How to Create Videos using an API?

Creating video programmatically by API is commonly used to make dynamic video for social media marketing, video personalization, or AI-driven video generation. To generate video using an API, there are several ways. The first approach is to render video based on a template. Another way is to create video entirely with code using JSON. Here's how:

API Request
curl -s -X POST \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary @- << EOF
  "template_id": "58c1163e-f250-49df-b98d-e8c4aad01a2d",

  "modifications": {
    "Text": "Your Text And Video Here",
    "Video": ""
Output Video

How it works: Creatomate is a video API for programmatically creating videos using a code or no-code workflow. The API runs completely in the cloud, making it suitable for rendering thousands of videos without worrying about server infrastructure.

The example above shows how a video can be rendered based on a template and dynamic data. Here we are using cURL to call the API. However, you can use any programming language (JavaScript, PHP, Python, etc.) or no-code tool (Zapier, Make, Pabbly, etc.) to integrate the API into your application.

A video template is created using the online video editor. Each template has a unique ID, which you can reference in the API request. Using the "modifications" parameter, you can insert dynamic data into the template to create unique videos on each run. The API then returns a URL where the created MP4 can be retrieved.

Another way to render a video programmatically is by using JSON instead of a template. This involves sending a list of video operations to the API in a JSON-like format. This is the most flexible way to create video via API, typically used for stitching, merging, cropping, and overlaying text to videos. You can learn more about this format by looking at the related examples below.

To get started, follow this quick tutorial or check out the API documentation.

Edit this Code Example in the Video Editor

Easily design your own video templates using the online editor. Then, export your templates as JSON and integrate them into your application to create any kind of video – completely through code.

Related API Video Editing Questions

Start automating today

Start with a full-featured trial with 50 credits, no credit card required.
Get started for free