API & Integration -> Quick Start

Create a video by RenderScript

If templates are too limiting to your automation needs, you can use RenderScript to generate a video or image completely from JSON.

Step 1
Send an API request

RenderScript lets you render directly from JSON-based instructions. Just send an API request and get a video or image in response.
curl -X POST https://api.creatomate.com/v2/renders \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY_HERE" \
     -d '{
  "output_format": "mp4",
  "width": 1280,
  "height": 720,
  "duration": 3,
  "elements": [
    {
      "type": "text",
      "text": "My first video generated with RenderScript!",
      "fill_color": "#ff0000",
      "width": "50%",
      "height": "25%"
    }
  ]
}'

Step 2
Try a more advanced example

Everything in Creatomate runs on RenderScript. You can see how that works by looking at the RenderScript of any template you create in the editor. But you can also skip the template editor and generate your own RenderScript. This gives you lots of flexibility when creating dynamic images and videos.Here is a more complex example built with RenderScript. In reality, there's no need to write this JSON by hand – just use the template editor. Once your design is ready, you can integrate the RenderScript into your app or automation process.
curl -X POST https://api.creatomate.com/v2/renders \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY_HERE" \
     -d '{
  "output_format": "mp4",
  "width": 1280,
  "height": 720,
  "elements": [
    {
      "type": "audio",
      "track": 1,
      "time": 0,
      "duration": null,
      "source": "https://cdn.creatomate.com/demo/music3.mp3",
      "loop": true,
      "audio_fade_out": 2
    },
    {
      "type": "composition",
      "track": 2,
      "time": 0,
      "elements": [
        {
          "name": "Videos",
          "type": "composition",
          "track": 1,
          "time": 0,
          "elements": [
            {
              "name": "Video-1",
              "type": "video",
              "track": 1,
              "source": "https://cdn.creatomate.com/demo/house1.mp4"
            },
            {
              "name": "Video-2",
              "type": "video",
              "track": 1,
              "source": "https://cdn.creatomate.com/demo/house2.mp4",
              "animations": [
                {
                  "time": 0,
                  "duration": 1,
                  "transition": true,
                  "type": "fade",
                  "enable": "second-only"
                }
              ]
            },
            {
              "name": "Video-3",
              "type": "video",
              "track": 1,
              "source": "https://cdn.creatomate.com/demo/house3.mp4",
              "animations": [
                {
                  "time": 0,
                  "duration": 1,
                  "transition": true,
                  "type": "fade",
                  "enable": "second-only"
                }
              ]
            }
          ]
        },
        {
          "name": "Description",
          "type": "text",
          "track": 2,
          "time": 0,
          "x": "3.743%",
          "y": "93.5601%",
          "width": "88.031%",
          "height": "18.9311%",
          "x_anchor": "0%",
          "y_anchor": "100%",
          "x_alignment": "50%",
          "y_alignment": "50%",
          "fill_color": "rgba(0,0,0,1)",
          "text": "Los Angeles, CA 90045\nCall (123) 555-1234 to arrange a viewing today",
          "font_family": "Montserrat",
          "font_weight": "800",
          "line_height": "234%",
          "background_color": "rgba(255,255,255,1)",
          "background_x_padding": "73%",
          "background_y_padding": "35%",
          "background_align_threshold": "0%",
          "animations": [
            {
              "time": 0,
              "duration": 0.8,
              "easing": "quadratic-out",
              "type": "text-slide",
              "scope": "split-clip",
              "split": "line",
              "overlap": "100%",
              "direction": "up",
              "background_effect": "scaling-clip"
            }
          ]
        }
      ]
    },
    {
      "name": "Outro",
      "type": "composition",
      "track": 2,
      "duration": 4,
      "fill_color": "rgba(255,255,255,1)",
      "animations": [
        {
          "time": 0,
          "duration": 1,
          "transition": true,
          "type": "fade"
        }
      ],
      "elements": [
        {
          "type": "text",
          "track": 1,
          "time": 0,
          "x": "24.3774%",
          "y": "60.795%",
          "width": "51.2453%",
          "height": "6.9826%",
          "x_anchor": "0%",
          "y_anchor": "100%",
          "y_alignment": "100%",
          "fill_color": "rgba(0,0,0,1)",
          "text": "My Brand Realtors",
          "font_family": "Inter",
          "background_border_radius": "39%",
          "animations": [
            {
              "time": 0,
              "duration": 1.24,
              "easing": "quadratic-out",
              "type": "text-slide",
              "scope": "split-clip",
              "split": "line",
              "background_effect": "scaling-clip"
            }
          ]
        },
        {
          "name": "Contact-Name",
          "type": "text",
          "track": 2,
          "time": 0,
          "x": "24.3774%",
          "y": "52.7013%",
          "width": "51.2453%",
          "height": "13.4963%",
          "x_anchor": "0%",
          "y_anchor": "100%",
          "y_alignment": "100%",
          "fill_color": "rgba(0,0,0,1)",
          "text": "Elisabeth Parker",
          "font_family": "Inter",
          "font_weight": "800",
          "background_border_radius": "39%",
          "animations": [
            {
              "time": 0,
              "duration": 1.24,
              "easing": "quadratic-out",
              "type": "text-slide",
              "scope": "split-clip",
              "split": "line",
              "background_effect": "scaling-clip"
            }
          ]
        }
      ]
    }
  ]
}'

Step 3
Combine RenderScript with a template

It is also possible to insert RenderScript into a template, providing a hybrid approach for programmatically generating parts of a video while keeping the ability to edit the template in the editor.This example uses the
add
operator to insert a text element into the template's
elements
property. See also this example for more information.
curl -X POST https://api.creatomate.com/v2/renders \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY_HERE" \
     -d '{
  "output_format": "mp4",
  "template_id": "YOUR_TEMPLATE_ID_HERE",
  "modifications": {
    "elements.add": [
      {
        "type": "text",
        "text": "This text element is inserted to an existing template using RenderScript.",
        "y": "28%",
        "width": "88%",
        "fill_color": "#ffffff",
        "stroke_color": "#000000",
        "stroke_width": "1.05 vmin",
        "font_family": "Montserrat",
        "font_weight": "600",
        "font_size": "6.2 vmin"
      }
    ]
  }
}'