Rendering the final video
The final video is rendered through the API, not in the browser. Your server sends one request and gets the file back as the user saw it in the preview; the preview and the renderer are the same engine.
Rendering in the browser is possible in principle: there are projects that embed an MP4 encoder in a web page. In our experience it works on a capable machine but not predictably on whatever device a user has, and the page has to stay open until the encoding is done. When your product relies on paying users, a render that succeeds nine times out of ten isn't good enough; it has to succeed every time. For that reason, the final MP4 is rendered on Creatomate's infrastructure instead, which accepts almost any input format and has the processing power and resources to finish every video.
Which request to send
How you changed the video in the preview decides what the request contains. When users changed only the content of a template through setModifications, the template and the changes are still separate. The request then names the template and sends the same modifications object; your server never needs the video's JSON:
curl -X POST https://api.creatomate.com/v2/renders \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-d '{
"template_id": "YOUR_TEMPLATE_ID_HERE",
"modifications": {
"Title": "Summer sale",
"Photo": "https://example.com/photo.jpg"
}
}'When the video itself was changed, through applyModifications or setSource, the video no longer matches the template. Send what getSource() returns as the source of the request instead; that is the whole video as RenderScript, rendered by the API as it is. The RenderScript quick start shows that request.
Send either request from your server, where your API key stays. The public token in the browser can't render; that is what makes it safe to publish. And because the API fetches every file the video uses from its URL, all uploads have to be finished before you render.
What comes back
The response describes the render: its ID, its status, and the URL where the file will be once it's done. A render takes anywhere from a few seconds to a few minutes. To find out when it's done, add a webhook URL to the request, and Creatomate calls it when the render has finished, successfully or not. Checking the render's status yourself works too. Each render uses credits.
That closes the loop: a template or a video, a preview the user changes, and a file rendered from the same changes. The reference lists every method and event in one place.