OG Image Generation
The core endpoint for generating Open Graph images.
POST /og/generate
Generate an OG image from a template.
Request
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": "My Amazing Blog Post",
"description": "A deep dive into something interesting",
"author": "Jane Doe"
},
"options": {
"format": "png",
"width": 1200,
"height": 630
}
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
template | string | Yes | Template name |
data | object | Yes | Template-specific data |
options | object | No | Output options |
Template Options
Blog Template
{
"template": "blog",
"data": {
"title": "string (required)",
"description": "string",
"author": "string",
"date": "string",
"readTime": "string",
"category": "string"
}
}
Product Template
{
"template": "product",
"data": {
"name": "string (required)",
"tagline": "string",
"price": "string",
"badge": "string",
"image": "string (URL)"
}
}
Event Template
{
"template": "event",
"data": {
"title": "string (required)",
"date": "string (required)",
"time": "string",
"location": "string",
"host": "string"
}
}
Output Options
| Option | Type | Default | Description |
|---|---|---|---|
width | integer | 1200 | Image width (200-2048) |
height | integer | 630 | Image height (200-2048) |
format | string | "png" | png, jpeg, webp |
quality | integer | 90 | 1-100, for jpeg/webp |
cache | boolean | true | Enable caching |
Response
{
"success": true,
"data": {
"url": "https://ssiat.dev/og/abc123.png",
"width": 1200,
"height": 630,
"format": "png",
"size": 45678,
"expiresAt": "2024-01-16T00:00:00Z"
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
url | string | Direct URL to the image |
width | integer | Actual image width |
height | integer | Actual image height |
format | string | Image format |
size | integer | File size in bytes |
expiresAt | string | Cache expiration (ISO 8601) |
GET /og/templates
List all available templates.
Request
curl https://ssiat.dev/api/v1/og/templates \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": {
"templates": [
{
"id": "blog",
"name": "Blog Post",
"description": "Perfect for articles and blog posts",
"fields": ["title", "description", "author", "date"]
},
{
"id": "product",
"name": "Product",
"description": "Showcase products",
"fields": ["name", "tagline", "price", "image"]
}
]
}
}