Archived docs Get your API Key
Get started
Tutorials
Guides
Reference
Help for AI agents
🤖 AI Assistant

n8n end-to-end

n8n is a free and open-source workflow automation tool. It is the most common self-hostable alternative to Make.com / Zapier and pairs well with JSON2Video for production-grade pipelines you want to run on your own infrastructure.

n8n does not have a dedicated JSON2Video node. You use the built-in HTTP Request node to call the JSON2Video REST API directly. This guide walks through the full pattern: submit, poll, react.

TODO: capture screenshot of an n8n workflow with the two HTTP Request nodes connected.

1. Prerequisites

  • An n8n instance (self-hosted, n8n.cloud, or local).
  • A JSON2Video account with an API key. Get one at json2video.com/dashboard/apikeys.
  • Familiarity with n8n's expression editor ({{ }} syntax) and credentials.

2. Store the API key as an n8n credential

Rather than pasting the API key into every HTTP node, store it once:

  1. In n8n, open Credentials → New.
  2. Choose Header Auth.
  3. Name it JSON2Video API key.
  4. Set:
    • Name = x-api-key
    • Value = your secondary API key from the dashboard
  5. Save.

Now every HTTP Request node in your workflow can reference this credential.

3. Submit a render

Add an HTTP Request node and configure it as follows:

Field Value
Method POST
URL https://api.json2video.com/v2/movies
Authentication Generic Credential Type → Header Auth → JSON2Video API key
Send Body enabled, Body Content Type: JSON, Specify Body: Using JSON
Body the movie JSON (see below)

A minimal body that produces a 5-second video:

{
  "comment": "Generated by n8n",
  "resolution": "full-hd",
  "scenes": [
    {
      "elements": [
        { "type": "text", "text": "Hello from n8n!", "duration": 5, "style": "002" }
      ]
    }
  ]
}

For dynamic content from upstream nodes, switch to the expression editor and use {{ $json.fieldName }} to interpolate values:

{
  "resolution": "full-hd",
  "scenes": [
    {
      "elements": [
        { "type": "text", "text": "Hello {{ $json.name }}!", "duration": 5 }
      ]
    }
  ]
}

When the node executes, the response looks like:

{
  "success": true,
  "project": "WAEE8PohgVwv2teP",
  "timestamp": "2025-05-28T14:57:34.393Z"
}

Note the project ID — you'll use it in the next step.

4. Wait for the render

A render typically takes 10-90 seconds. You have two options:

Option A: Poll with a loop

  1. Add a Wait node (e.g. 5 seconds).
  2. Add a second HTTP Request node:
    • Method: GET
    • URL: https://api.json2video.com/v2/movies?project={{ $node["Create movie"].json.project }}
    • Authentication: same credential as before
  3. Add an IF node that checks {{ $json.movie.status }}:
    • done → branch to the downstream nodes.
    • error or timeout → branch to an error handler.
    • anything else (pending, running) → loop back to the Wait node.

This pattern is simple and works for any workflow. Cap the maximum number of loop iterations to avoid infinite loops if a render gets stuck.

Option B: Webhook callback

  1. Add a JSON2Video webhook destination to your movie JSON:

    {
      "resolution": "full-hd",
      "scenes": [ /* ... */ ],
      "exports": [{
        "destinations": [{
          "type": "webhook",
          "endpoint": "https://your-n8n.example.com/webhook/json2video-done"
        }]
      }]
    }
    
  2. In n8n, create a second workflow that starts with a Webhook trigger node at the path /webhook/json2video-done. n8n shows you the public URL.

  3. The webhook trigger fires with the full movie object as the body when the render finishes.

Webhook-based flows scale better and don't burn n8n executions on polling.

5. Use the rendered video

After the done branch, you have access to:

  • {{ $json.movie.url }} — direct MP4 URL on the JSON2Video CDN.
  • {{ $json.movie.thumbnail }} — auto-generated thumbnail URL.
  • {{ $json.movie.duration }} — duration in seconds.
  • {{ $json.movie.size }} — file size in bytes.

Connect downstream nodes:

  • YouTube → upload the rendered MP4.
  • Slack / Discord → notify a channel with the URL.
  • HTTP Request → send the URL to your own backend.
  • Postgres / MySQL → store the URL in your database.

6. Error handling

In production, wire up an error branch:

  • The first POST /v2/movies response may have success: false — surface message and abort.
  • The polling status may transition to error or timeout — surface the movie.message.
  • Network failures on either node should retry with exponential backoff (n8n has a built-in Retry on Fail option).

See Error handling for the full pattern.

See also