Choose a creative template
Creative Templates decide structure and visual design of your videos. You can either choose one from Shakr Template Library or one of After Effects projects uploaded by your team's designer.
This document will introduce you to choosing a template from Shakr Template Library.
Template, TemplateStyle, TemplateStyleVersion
When using Shakr API, there are three resources that comprise a template.
- Template: A group of
TemplateStyle
that share similar visual design and structure. - TemplateStyle: Unique unit of video used in Shakr. One
Template
can include manyTemplateStyle
s with various display ratio(i.e. 4:5, 1:1, 9:16, etc) and various lengths(i.e. 15s, 30sec, etc). - TemplateStyleVersion: Individual version of
TemplateStyle
that comes with different languages.
info
To learn more about terminology and Shakr API's resource model, refer to Terminology.
Find Template and TemplateStyle ID
Template Library
Choose a template that you want from Shakr Template Library and copy its URL. You can obtain Template ID and TemplateStyle ID from it.
Structure of Template URL
https://studio.shakr.com/t/sound-on-stories-poll/xe91cv/bEe1C8/en
The template URL shown above contains the following information.
TemplateStyle Name | Template ID | TemplateStyle ID | TemplateStyleVersion Language |
---|---|---|---|
sound-on-stories-poll | xe91cv | bEe1C8 | en |
For the next step, you'll need TemplateStyle ID and TemplateStyleVersion Language.
Get TemplateStyleVersion ID
There can be various versions inside TemplateStyle
, one version per each language. You need an ID of a version when you make an API call to create a video. This Template Style Version ID can be acquired by calling GET /v2/templates/:template_id/styles
API endpoint and referring to version_ids key.
version_ids is comprised in key-value structure, and key and value represent language and TemplateStyleVersion ID of the said language, respectively.
- cURL
- Node.js
- Elixir
curl 'https://api.shakr.com/v2/templates/TEMPLATE_ID/styles',
-H 'Content-Type: application/json'
-H 'Authorization: Bearer SERVER_ACCESS_TOKEN'
{
"styles": [
{
"id": "bEe1C8", // TemplateStyle ID
"name": {
"en": "Stories Poll"
},
"version_ids": {
"en": "6bzvun" // TemplateStyleVersion ID
},
...
},
...
]
}
const fetch = require('node-fetch');
fetch(
'https://api.shakr.com/v2/templates/TEMPLATE_ID/styles',
{
method: 'GET',
headers: {
'Authorization': 'Bearer SERVER_ACCESS_TOKEN'
}
}
)
.then(res => res.json())
.then(({ styles }) => {
console.log(styles[0].id); // TemplateStyle ID
console.log(styles[0].version_ids.en); // TemplateStyleVersion ID
});
request = %HTTPoison.Request{
url: "https://api.shakr.com/v2/templates/TEMPLATE_ID/styles",
method: :get,
headers: [
{"Authorization", "Bearer SERVER_ACCESS_TOKEN"}
]
}
with {:ok, %{status_code: 200} = response} <- HTTPoison.request(request),
{:ok, decoded_json} <- Jason.decode(response.body) do
template_style = Enum.at(decoded_json["styles"], 0)
# TemplateStyle ID
IO.puts(template_style["id"])
# TemplateStyleVersion ID
IO.puts(template_style["version_ids"]["en"])
end
Choose video creation method
If you chose a template and have TemplateStyleVersion ID handy, then it's time to make a video! There are two methods to create a video.
With Shakr API, you can bypass the editor and create videos automatically by providing text and media assets directly to the API.
3-2. Create videos with Video Editor SDK
With Shakr Video Editor SDK, you can embed Shakr Editor to your web services, enabling your customers to enter text and media assets to create videos on their own.