Templates
Model properties
- Name
id
- Type
- string
- Description
Unique identifier for the template.
- Name
name
- Type
- string
- Description
Name of the template.
- Name
created_at
- Type
- date
- Description
Date the template was created.
- Name
parsed_config
- Type
- object
- Description
An object containing video configuration data that is parsed from the template's default values and config.
List all templates
This endpoint allows you to retrieve a paginated list of all your templates. By default, a maximum of 15 templates are shown per page.
Request parameters
- Name
page
- Type
- integer
- Description
Specify the page number to retrieve. Default is 1.
- Name
per_page
- Type
- integer
- Description
Limit the number of templatess returned per page. Default is 15.
Request
curl --location 'https://api.editframe.com/v2/templates' \
--header 'Authorization: Bearer {token}'
Response
{
"data": [
{
"id": "d3Gqx972JN",
"name": "My second template",
"created_at": "2023-07-25T09:19:55.000000Z",
"parsed_config": {}
}
],
"meta": {
"current_page": 1,
"last_page": 1,
"per_page": 15,
"total": 2,
"from": 1,
"to": 10
}
}
Create a new template
This endpoint allows you to create a new template.
Request parameters
- Name
name
- Type
- string
- required
- Description
Name of the template.
- Name
config
- Type
- JSON
- required
- Description
An object containing video configuration data. You can use the Editframe SDK to generate this data.
We are using the Shopify Liquid for inputs values
- Name
inputs
- Type
- JSON
- required
- Description
An object containing the input fields for the template.
- Name
default_values
- Type
- JSON
- required
- Description
An object containing the default values for the template. These values will be used to generate the template's preview config
parsed_config
.
Request
curl --location 'https://api.editframe.com/v2/templates' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"name": "My first template",
"default_values": {
"video_url": "https:\/\/cdn.coverr.co\/videos\/coverr-man-doing-an-arm-workout-2882\/1080p.mp4"
},
"inputs": {
"video_url": "required|active_url"
},
"config": {
"layers": [
{
"id": "82db8f",
"source": "{{ video_url }}",
"size": {
"scale": 1,
"width": 1920,
"format": "fit",
"height": 1080
},
"trim": {
"start": 0
},
"type": "video",
"audio": {
"volume": 1
},
"position": {
"x": "center",
"y": "center",
"z": 0,
"angle": 0,
"angleX": 0,
"angleY": 0,
"origin": "center",
"isRelative": false
},
"timeline": {
"start": 0
},
"transitions": []
}
],
"duration": 5,
"extension": "mp4",
"dimensions": {
"width": 1920,
"height": 1080
},
"backgroundColor": "#000000FF"
}
}'
Response
{
"data": {
"id": "d3Gqx972JN",
"name": "My first template",
"created_at": "2023-07-25T09:19:55.000000Z",
"parsed_config": {}
}
}
Retrieve a template
This endpoint allows you to retrieve an individual template by providing the template id. Refer to the model properties to see which properties are included with template objects.
Request
curl https://api.editframe.com/v2/templates/d3Gqx972JN\
-H "Authorization: Bearer {token}"
Response
{
"data": {
"id": "d3Gqx972JN",
"name": "My second template",
"created_at": "2023-07-25T09:19:55.000000Z",
"parsed_config": {}
}
}
Render a video using a template
This endpoint allows you to render a video using a template. The template must have been created with the Create a new template endpoint. Refer to the model properties to see which properties are included with template objects.
Request parameters
- Name
data
- Type
- JSON
- required
- Description
An object containing data for the inputs you defined in the template creation process.
In the API response, the video
object will contain the id
of the video that is being rendered. You can use this id
to check the status of the video render job. using the Retrieve a video endpoint. And you can listen for the video.ready
event to get notified when the video is ready. More info about the events here.
Request
curl --location 'https://api.editframe.com/v2/templates/M1xQy5rQwl/render' \
--header 'Authorization: Bearer {token}' \
--data '{
"data": {
"video_url": "https://cdn.coverr.co/videos/coverr-a-croft-with-mature-vegetables-4297/1080p.mp4"
}
}'
Response
{
"data": {
"template": {
"id": "M1xQy5rQwl",
"name": "My first template",
"created_at": "2023-07-24T13:34:53.000000Z",
"parsed_config": {
"layers": [
{
"id": "82db8f",
"file": "https://cdn.coverr.co/videos/coverr-a-croft-with-mature-vegetables-4297/1080p.mp4",
"size": {
"scale": 1,
"width": 1920,
"format": "fit",
"height": 1080
},
"trim": {
"start": 0
},
"type": "video",
"audio": {
"volume": 1
},
"position": {
"x": "center",
"y": "center",
"z": 0,
"angle": 0,
"angleX": 0,
"angleY": 0,
"origin": "center",
"isRelative": false
},
"timeline": {
"start": 0
},
"transitions": []
}
],
"duration": 5,
"extension": "mp4",
"dimensions": {
"width": 1920,
"height": 1080
},
"backgroundColor": "#000000FF",
"shouldWatermark": true
}
},
"video": {
"id": "yj32EyW2LK",
"is_failed": false,
"is_ready": false,
"metadata": {}
}
}
}
Delete a template
This endpoint allows you to delete a template.
Request
curl -X DELETE https://api.editframe.com/v2/templates/d3Gqx972JN \
-H "Authorization: Bearer {token}"