# Create a render

This is the endpoint to create a render.

It responds with `200 OK` and returns the render data including the render URL.

By default, renders are generated synchronously and take around 2 seconds to complete (videos may take longer depending on duration and complexity).

Once generated, the image/PDF/video file is immediately available at the returned URL.

## Sample Request

Here’s a sample request to create a render:

```
POST /v1/render;
```

```
fetch('https://api.templated.io/v1/render', {

method: 'POST',

body: JSON.stringify(

{

"template" : TEMPLATE_ID,

"layers" : {

"text-1" : {

"text" : "This is my text to be rendered",

"color" : "#FF0000",

"background" : "#0000FF"

},

"image-1": {

"image_url" : "https://picsum.photos/200/300.jpg"

}

}

}

),

headers: {

'Content-Type' : 'application/json',

'Authorization' : `Bearer ${API_KEY}`

}
})
```

### Parameters

template `string` `REQUIRED`

The template id that you want to render.

templates `array`

This is only used for batch rendering from a list of templates.

If it’s provided, the template parameter will be ignored and will not be required.

Example: "templates": ["template-id-1", "template-id-2"]

format `string`

Render format (`jpg`, `png`, `webp`, `pdf`, or `mp4`). Default is `jpg`.

transparent `boolean`

Make the background transparent when the render format is `png`. Default is `false`.

duration `number`

Duration of the video in milliseconds when the render format is `mp4`.

Maximum is 90000 (90 seconds). Default is 5000 (5 seconds).

fps `number`

Frames per second when the render format is `mp4`.

Minimum is `1`. Maximum is `60`. Default is `30`.

## Response

The API returns a JSON object with the render details.

```
{

"id": "ce424057-6b54-41bb-afec-adc35a2b9175",

"url": "https://templated-assets.s3.amazonaws.com/renders/ce424057-6b54-41bb-afec-adc35a2b9175.jpg",

"width": 1920,

"height": 1080,

"format": "jpg",

"templateId": "1f1231-dasd123-fsdf12312-fds4123-asdas23",

"templateName": "Sample Template",

"createdAt": "2025-04-22 08:30:58",

"externalId": null
}
```

## Video Rendering

Templated supports rendering templates as MP4 videos. This is ideal for templates with animations, video layers, or when you want to create dynamic video content from your designs.

### Sample Video Request

```
fetch('https://api.templated.io/v1/render', {

method: 'POST',

body: JSON.stringify({

"template": TEMPLATE_ID,

"format": "mp4",

"duration": 10000,  // 10 seconds

"fps": 30,

"layers": {

"title": { "text": "Welcome to my video!" },

"background-video": { "video_url": "https://example.com/video.mp4" }

}

}),

headers: {

'Content-Type': 'application/json',

'Authorization': `Bearer ${API_KEY}`

}
})
```

### Layer Animations

You can add entrance, looping, and exit animations to any layer via the `animation` property. Animations only apply to video (MP4) renders.

```json
{

"template": "TEMPLATE_ID",

"format": "mp4",

"duration": 6000,

"layers": {

"title": {

"text": "Breaking News",

"animation": {

"in": { "type": "slide", "direction": "left", "duration": 500 },

"loop": { "type": "pulse", "duration": 1000 },

"out": { "type": "fade", "duration": 500 },

"start": 1000,

"end": 5000

}

}

}
}
```
