Render API - Convert HTML to Image
The render API converts your html
or svg
string to a PNG image.
Auth
Follow the auth guide to add the required headers and your API key with requests.
Usage
Key | Value | Help |
---|---|---|
Endpoint | api.urlmeta.org/render | Should always be accessed over https |
Method | POST | |
Body | html or svg string |
Query Parameters
Key | Value | Help |
---|---|---|
format | Format of the body you're passing. Optional but recommended. | optional Either html or svg |
Content-type
Important: Always set the Content-Type
header to application/xml
when making a request to the Render API.
Example
To render an HTML string to an image, you can use the following example.
curl -X POST "https://api.urlmeta.org/render" \
-H "Content-Type: application/xml" \
-H "Authorization: Basic YOUR_AUTH_KEY" \
-d '<h1>Hello, World!</h1>'
Response
The API will always return JSON response. Here's the response schema returned by the Screenshot API.
{
"result": {
"status": "OK"
},
"rendered": {
"file": "... URL of the rendered file ..."
}
}
ℹ️
The rendered.file
will only be valid for 5 minutes. After that, you'll
have to request a new render. Make sure you store/download it before it
expires.