Archived docs Get your API Key
Documentation
🤖 AI Assistant

N8N

JSON2Video can be easily integrated with n8n, a free and open-source workflow automation tool. This allows you to automate video creation as part of larger workflows involving various other applications and services.

This section provides a guide to using JSON2Video within n8n.

Creating a JSON2Video node

To use JSON2Video in n8n, you will need to create an HTTP Request node configured to interact with the JSON2Video API.

Here's a step-by-step guide:

  1. Add an HTTP Request node: In your n8n workflow, add a new "HTTP Request" node.

  2. Configure the HTTP Request node:

    • Method: Set the method to POST to create a new movie.
    • URL: Set the URL to https://api.json2video.com/v2/movies.
    • Headers: Add the following headers:
      • Content-Type: application/json
      • x-api-key: YOUR_API_KEY (Replace YOUR_API_KEY with your actual JSON2Video API key. See the Getting Started section for how to obtain your API key).
    • Body: Set the body to JSON.
  3. Construct the JSON payload: You will need to create a JSON payload according to the JSON Syntax. This payload defines the movie object, including the scenes and elements required for video creation. You can use n8n's expression editor to dynamically generate this JSON based on data from previous nodes in your workflow.

    • Example JSON Payload:
    {
      "comment": "My n8n generated video",
      "resolution": "full-hd",
      "scenes": [
        {
          "elements": [
            {
              "type": "text",
              "text": "Hello from n8n!",
              "duration": 5
            }
          ]
        }
      ]
    }
    
  4. Execute the node: Execute the HTTP Request node. If successful, it will return a JSON response containing the project ID.

  5. Check Movie Status (Optional): To check the status of the movie rendering, you'll need a second HTTP Request Node. Configure this node as follows:

    • Method: GET
    • URL: Construct the URL using n8n's expression editor to include the project query parameter: https://api.json2video.com/v2/movies?project={{$node["YOUR_FIRST_HTTP_REQUEST_NODE_NAME"].json.project}} (Replace YOUR_FIRST_HTTP_REQUEST_NODE_NAME with the name of the first node).
    • Headers: Same as the first HTTP Request node.

You can then parse the response from the second HTTP Request Node to determine the status of the video and retrieve the final video URL. The Movie object in the response will contain the URL.

Remember to consult the API Reference for details on all possible parameters and configurations.

You will likely need to experiment with the exact settings and expressions within n8n to achieve your desired video automation workflow.