Skip to main content

Templates API

The Templates API lets you programmatically render OG image templates. Use it to generate dynamic social images from your templates and include them in posts or use them externally.

Render a Template

Render an OG image template with the provided configuration and return the generated image URL.
This endpoint is also available at the alias:
Both paths are functionally identical.

Authentication

This endpoint uses API key authentication. Include your API key in the soku-api-key header. An active Soku subscription (trialing or active) is required.

Headers

Rate Limit

20 requests per 60 seconds, in addition to the global tier limit. See Rate Limits.

Request Body

Config Object

The config object varies by template. Each template defines its own set of configurable fields. Common fields for the built-in tweetImage template are shown below as an example:
The fields available in the config object depend entirely on the template you are rendering. Check your template configuration in the Soku dashboard under Templates for the exact fields and their expected values.

Response


Examples

Render a tweet image template

Response:

Render with a custom aspect ratio

Using the alias endpoint

The same request can be made using the /v1/media/render-og alias:

Render and publish in one workflow

Generate an OG image and include it in a post:

Error Responses

Example error response:

Next Steps