Skip to Content
Create Image from Template

Create Image from Template

Send a POST request to this endpoint to create a new image using a predefined template.

ℹ️

You will need to authenticate to use this API. See authentication.

ℹ️

This endpoint consumes 1 credit per successful image generation.

Request

POST https://api.ojo.so/v1/image/template

Request Body

ParameterTypeDescription
templateIdstringThe ID of the template to use
modifyobject(Optional) An object containing variables to modify in the template
viewportHeightnumber(Optional) Height of the viewport in pixels (default: 800)
viewportWidthnumber(Optional) Width of the viewport in pixels (default: 1280)
transparentBackgroundboolean(Optional) When set to true, generates the image with a transparent background. Defaults to false if not specified.
curl --request POST \ --url https://api.ojo.so/v1/image/template \ --header 'Authorization: Bearer <API Key>' \ --header 'Content-Type: application/json' \ --data '{ "templateId": "your-template-id", "modify": { "title": "Custom Title" }, "viewportHeight": 1000, "viewportWidth": 1500 }'

Response

Everything went as planned and your image is generated.

{ "id": "image-id", "imageUrl": "https://example.com/path/to/image.png", "createdAt": "2023-08-29T12:34:56Z" }