Skip to main content

Your First Request

Let's create your first OG image step by step.

The Request

Every OG image generation request needs:

  1. Template - The design template to use
  2. 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

FieldDescription
urlDirect URL to the generated image
widthImage width in pixels
heightImage height in pixels
expiresAtWhen 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

OptionTypeDefaultDescription
widthnumber1200Image width (max: 2048)
heightnumber630Image height (max: 2048)
formatstring"png"Output format: png, jpeg, webp
qualitynumber90Compression 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