Your First Request
Let's create your first OG image step by step.
The Request
Every OG image generation request needs:
- Template - The design template to use
- Data - The content to display in the image
curl -X POST https://ssiat.dev/api/v1/og/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "blog",
"data": {
"title": "Welcome to My Blog",
"description": "Thoughts on technology and life",
"author": "Jane Smith",
"date": "2024-01-15"
}
}'
Understanding the Response
A successful response looks like this:
{
"success": true,
"data": {
"url": "https://ssiat.dev/og/abc123.png",
"width": 1200,
"height": 630,
"expiresAt": "2024-02-15T00:00:00Z"
}
}
Response Fields
| Field | Description |
|---|---|
url | Direct URL to the generated image |
width | Image width in pixels |
height | Image height in pixels |
expiresAt | When the cached image expires |
Adding Options
Customize the output format and size:
{
"template": "blog",
"data": {
"title": "My Post"
},
"options": {
"width": 1200,
"height": 630,
"format": "png",
"quality": 90
}
}
Available Options
| Option | Type | Default | Description |
|---|---|---|---|
width | number | 1200 | Image width (max: 2048) |
height | number | 630 | Image height (max: 2048) |
format | string | "png" | Output format: png, jpeg, webp |
quality | number | 90 | Compression quality (1-100) |
Error Handling
If something goes wrong, you'll receive an error response:
{
"success": false,
"error": {
"code": "INVALID_TEMPLATE",
"message": "Template 'unknown' does not exist"
}
}
Always check the success field before using the response.
Next Steps
- Explore all Templates
- Learn about Customization
- See the full API Reference