Colossyan API Documentation
Dynamic variables
Dynamic variables
Dynamic variables allow you to customize template videos by substituting tokens with dynamic values. This is particularly useful for API integrations and batch video generations.
Dynamic variables can be embeded into an actor track
's text property. This way allowing you to create multiple
versions of the same video depending on your data.
The syntax
A dynamic variable is anything between curly brackets. The variable will be substituted with the value provided in the dynamic variables property with the same name as the content between the brackets.
For example {firstName}
is a dynamic variable that will be substituted with the value of firstName
.
An example
const job = { videoCreative: { settings: { videoSize: { height: 1080, width: 1920 } },
dynamicVariables: { city: "London" }
scenes: [ { name: "Dynamic variable example scene", tracks: [ { type: 'actor', position: { x: 200, y: 200 }, // From the top left in pixels size: { height: 680, width: 1520 }, // In pixels speakerId: "en-GB-RyanNeural", actor: "omar", text: "We are delighted to welcome our guests from {city}!", } ], }, ] }}
Edit this page on GitHubThis feature is extremely powerful in combination with our planned template video feature that will allow you to reference a video creative just by its ID. This will make it possible to create template videos in our web application, then use it through our API with only a reference and the dynamic variables.