Generate an image
curl --request POST \
--url https://api.pictify.io/image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"html": "<string>",
"url": "<string>",
"template": "<string>",
"variables": {},
"width": 1200,
"height": 630,
"selector": "<string>",
"fileExtension": "png"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
html: '<string>',
url: '<string>',
template: '<string>',
variables: {},
width: 1200,
height: 630,
selector: '<string>',
fileExtension: 'png'
})
};
fetch('https://api.pictify.io/image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pictify.io/image"
payload = {
"html": "<string>",
"url": "<string>",
"template": "<string>",
"variables": {},
"width": 1200,
"height": 630,
"selector": "<string>",
"fileExtension": "png"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pictify.io/image"
payload := strings.NewReader("{\n \"html\": \"<string>\",\n \"url\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {},\n \"width\": 1200,\n \"height\": 630,\n \"selector\": \"<string>\",\n \"fileExtension\": \"png\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.pictify.io/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"html\": \"<string>\",\n \"url\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {},\n \"width\": 1200,\n \"height\": 630,\n \"selector\": \"<string>\",\n \"fileExtension\": \"png\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://cdn.pictify.io/renders/abc123.png",
"userStorageUrl": "<string>",
"id": "img_abc123",
"createdAt": "2023-11-07T05:31:56Z"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}Images
HTML to Image API
Convert HTML to PNG, JPG, or WebP images via REST API — from raw HTML, a URL screenshot, or a saved template
POST
/
image
Generate an image
curl --request POST \
--url https://api.pictify.io/image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"html": "<string>",
"url": "<string>",
"template": "<string>",
"variables": {},
"width": 1200,
"height": 630,
"selector": "<string>",
"fileExtension": "png"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
html: '<string>',
url: '<string>',
template: '<string>',
variables: {},
width: 1200,
height: 630,
selector: '<string>',
fileExtension: 'png'
})
};
fetch('https://api.pictify.io/image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pictify.io/image"
payload = {
"html": "<string>",
"url": "<string>",
"template": "<string>",
"variables": {},
"width": 1200,
"height": 630,
"selector": "<string>",
"fileExtension": "png"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pictify.io/image"
payload := strings.NewReader("{\n \"html\": \"<string>\",\n \"url\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {},\n \"width\": 1200,\n \"height\": 630,\n \"selector\": \"<string>\",\n \"fileExtension\": \"png\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.pictify.io/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"html\": \"<string>\",\n \"url\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {},\n \"width\": 1200,\n \"height\": 630,\n \"selector\": \"<string>\",\n \"fileExtension\": \"png\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://cdn.pictify.io/renders/abc123.png",
"userStorageUrl": "<string>",
"id": "img_abc123",
"createdAt": "2023-11-07T05:31:56Z"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}Image Generation
Generate PNG, JPEG, or WebP images from HTML content, URLs, or saved templates. You can also render FabricJS canvas data directly.One of
html, url, or template is required. See each endpoint page for full request/response details.Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /image | Generate image from HTML, URL, or template |
GET | /image | List images |
GET | /image/{uid} | Get image |
POST | /image/canvas | Canvas render from FabricJS data |
Input Sources
| Source | Parameter | Description |
|---|---|---|
| HTML | html | Render raw HTML/CSS content |
| URL | url | Screenshot a publicly accessible URL |
| Template | template | Render a saved template with variables |
| Canvas | fabricJSData | Render FabricJS canvas JSON export |
Output Formats
| Format | Extension | Best For |
|---|---|---|
| PNG | png | Default, lossless, supports transparency |
| JPEG | jpg / jpeg | Smaller file size, photos |
| WebP | webp | Modern format, best compression |
fileExtension parameter to change the output format.
Key Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
width | integer | 1200 | Output width in pixels (1-4000) |
height | integer | 630 | Output height in pixels (1-4000) |
selector | string | - | CSS selector to capture a specific element |
fileExtension | string | png | Output format |
The
userStorageUrl response field is only included if you have configured custom storage in your account settings.Body
application/json
Response
Image generated successfully