# Quick start: your first video via the API

> Test key, template, create, render, download – curl, JavaScript, Python.

Source: https://flow-marketing.org/en/help/api-quickstart · Question: How do I get my first video in five minutes?

Five steps to your first finished video: get a test key, pick a template, create a video with fields, render, download the file. With a test key this is free. The videos then carry a watermark and come as a 720p preview.

The examples run with curl, JavaScript (fetch, Node 18 or newer) and Python (requests). There are no official SDKs – the API is plain JSON over HTTPS.

## What you need {#voraussetzungen}

A Flow Marketing account and a test key. Create it in your account under “API” (/konto/api). A test key starts with `fm_test_`. You see it only once – copy it right away.

Store the key as an environment variable. All examples read it from `FLOW_API_KEY`. Never put it into code that runs in a browser or an app.

**Terminal**

```bash
export FLOW_API_KEY="fm_test_..."
```

> **Note:** Test mode: free, watermark, 720p preview, at most 25 test renders per 24 hours. Live keys (`fm_live_`) render without a watermark and are billed per second of video.

## Step 1: look at the templates {#vorlagen}

`GET /templates` returns all templates. Each has an `id`, a field schema (`fields_schema`) and a complete example (`example`). With `Accept-Language: de` names and descriptions come in German.

Here you take `produkt-launch`: a new product in 20 to 30 seconds.

**curl**

```bash
curl https://flow-marketing.org/api/turbo/v1/templates \
  -H "Authorization: Bearer $FLOW_API_KEY" \
  -H "Accept-Language: de"
```

**JavaScript**

```js
const res = await fetch('https://flow-marketing.org/api/turbo/v1/templates', {
  headers: { Authorization: 'Bearer ' + process.env.FLOW_API_KEY, 'Accept-Language': 'de' },
})
const { data } = await res.json()
for (const t of data) console.log(t.id, t.kind, t.name)
```

**Python**

```python
import os, requests

BASE = "https://flow-marketing.org/api/turbo/v1"
H = {"Authorization": "Bearer " + os.environ["FLOW_API_KEY"], "Accept-Language": "de"}

r = requests.get(BASE + "/templates", headers=H, timeout=30)
r.raise_for_status()
for t in r.json()["data"]:
    print(t["id"], t["kind"], t["name"])
```

## Step 2: create a video {#video-anlegen}

`POST /videos` with `template` and `fields`. The answer comes at once (201): a draft (`status: "draft"`) with a preview link (`preview_url`, valid 7 days), the quality traffic light (`quality`) and the price (`estimate`). Creating and previewing are free.

Send your own `Idempotency-Key` with every POST. If you repeat a request with the same key and the same body, you get the same answer – no second video is created.

**curl**

```bash
curl -X POST https://flow-marketing.org/api/turbo/v1/videos \
  -H "Authorization: Bearer $FLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "template": "produkt-launch",
    "language": "de",
    "formats": ["16x9"],
    "fields": {
      "produkt": "Musterwerk Plan",
      "hook": "Schichtplan per Zuruf?",
      "problem": "Jede Woche Zettel, Anrufe und Lücken im Plan.",
      "loesung": "Der Plan, der sich selbst füllt",
      "vorteile": ["Tauschen per Klick", "Urlaub sofort sichtbar"],
      "cta": "Jetzt kostenlos testen"
    }
  }'
```

**JavaScript**

```js
import { randomUUID } from 'node:crypto'

const res = await fetch('https://flow-marketing.org/api/turbo/v1/videos', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer ' + process.env.FLOW_API_KEY,
    'Content-Type': 'application/json',
    'Idempotency-Key': randomUUID(),
  },
  body: JSON.stringify({
    template: 'produkt-launch',
    language: 'de',
    formats: ['16x9'],
    fields: {
      produkt: 'Musterwerk Plan',
      hook: 'Schichtplan per Zuruf?',
      problem: 'Jede Woche Zettel, Anrufe und Lücken im Plan.',
      loesung: 'Der Plan, der sich selbst füllt',
      vorteile: ['Tauschen per Klick', 'Urlaub sofort sichtbar'],
      cta: 'Jetzt kostenlos testen',
    },
  }),
})
const video = await res.json()
if (!res.ok) throw new Error(video.code + ': ' + video.detail)
console.log(video.id, video.status, video.quality.overall, video.preview_url)
```

**Python**

```python
import os, uuid, requests

BASE = "https://flow-marketing.org/api/turbo/v1"
H = {"Authorization": "Bearer " + os.environ["FLOW_API_KEY"]}

r = requests.post(
    BASE + "/videos",
    headers={**H, "Idempotency-Key": str(uuid.uuid4())},
    json={
        "template": "produkt-launch",
        "language": "de",
        "formats": ["16x9"],
        "fields": {
            "produkt": "Musterwerk Plan",
            "hook": "Schichtplan per Zuruf?",
            "problem": "Jede Woche Zettel, Anrufe und Lücken im Plan.",
            "loesung": "Der Plan, der sich selbst füllt",
            "vorteile": ["Tauschen per Klick", "Urlaub sofort sichtbar"],
            "cta": "Jetzt kostenlos testen",
        },
    },
    timeout=60,
)
video = r.json()
if not r.ok:
    raise SystemExit(video["code"] + ": " + video["detail"])
print(video["id"], video["status"], video["quality"]["overall"], video["preview_url"])
```

**Response 201 (shortened)**

```json
{
  "id": "vid_7Hq2LmN0pQrS3tUv4WxY",
  "object": "video",
  "mode": "test",
  "status": "draft",
  "revision": 1,
  "template": "produkt-launch",
  "template_version": "1.0.0",
  "style": "s08",
  "language": "de",
  "formats": ["16x9"],
  "voice": "klar-w",
  "duration_s": 24.6,
  "fields": { "produkt": "Musterwerk Plan", "hook": "Schichtplan per Zuruf?" },
  "filled_by": "you",
  "narration": { "hook": "Schichtplan per Zuruf?" },
  "brand": null,
  "metadata": {},
  "preview_url": "https://flow-marketing.org/v/eyJ6Ijoi...",
  "quality": {
    "overall": "green",
    "checks": [
      { "id": "reading_time", "status": "green", "value": 2.1, "limit": 3, "unit": "words_per_s", "message": "..." }
    ]
  },
  "estimate": {
    "object": "estimate",
    "price_cents": 0,
    "price_gross_cents": 0,
    "currency": "eur",
    "billable_seconds": 25,
    "duration_s": 24.6,
    "unit_price_eur_per_second": "0",
    "pricing_available": true,
    "pricing_beta": true,
    "binding": true,
    "ready_in_s": [70, 180]
  },
  "latest_render": null,
  "corrections_left": null,
  "free_rebuild_available": false,
  "error": null,
  "links": {
    "self": "https://flow-marketing.org/api/turbo/v1/videos/vid_7Hq2LmN0pQrS3tUv4WxY",
    "plan": "https://flow-marketing.org/api/turbo/v1/videos/vid_7Hq2LmN0pQrS3tUv4WxY/plan",
    "report": "https://flow-marketing.org/api/turbo/v1/videos/vid_7Hq2LmN0pQrS3tUv4WxY/report",
    "render": "https://flow-marketing.org/api/turbo/v1/videos/vid_7Hq2LmN0pQrS3tUv4WxY/render"
  },
  "created_at": "2026-11-22T09:00:00.000Z",
  "updated_at": "2026-11-22T09:00:00.000Z"
}
```

## Reading the quality traffic light {#pruef-ampel}

`quality.overall` is `green`, `yellow` or `red`. `quality.checks` tells you per check what was measured, with value (`value`), limit (`limit`) and unit (`unit`) – for example reading time (`reading_time`), font size, contrast or text overflowing.

Green and yellow can be rendered. On red the API refuses the render with `pre_render_check_red`. Then shorten the flagged fields with `PATCH /videos/{id}` and you get a new preview at once.

## Step 3: render {#rendern}

`POST /videos/{id}/render` starts the render. The answer (202) is a render job with its own id (`rnd_…`) and `status: "queued"`.

With `max_price_cents` you set a ceiling in cents: if the price is higher, nothing starts (402 `price_above_max`). In test mode the price is 0. You can also render right when creating: `"render": true` in the body of `POST /videos`.

**curl**

```bash
curl -X POST https://flow-marketing.org/api/turbo/v1/videos/vid_7Hq2LmN0pQrS3tUv4WxY/render \
  -H "Authorization: Bearer $FLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"max_price_cents": 500}'
```

**JavaScript**

```js
import { randomUUID } from 'node:crypto'

const res = await fetch('https://flow-marketing.org/api/turbo/v1/videos/' + videoId + '/render', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer ' + process.env.FLOW_API_KEY,
    'Content-Type': 'application/json',
    'Idempotency-Key': randomUUID(),
  },
  body: JSON.stringify({ max_price_cents: 500 }),
})
const render = await res.json() // 202: { id: 'rnd_...', status: 'queued', ... }
if (!res.ok) throw new Error(render.code + ': ' + render.detail)
```

**Python**

```python
import os, uuid, requests

BASE = "https://flow-marketing.org/api/turbo/v1"
H = {"Authorization": "Bearer " + os.environ["FLOW_API_KEY"]}

r = requests.post(
    BASE + "/videos/" + video_id + "/render",
    headers={**H, "Idempotency-Key": str(uuid.uuid4())},
    json={"max_price_cents": 500},
    timeout=30,
)
render = r.json()  # 202: {"id": "rnd_...", "status": "queued", ...}
if not r.ok:
    raise SystemExit(render["code"] + ": " + render["detail"])
```

## Step 4: wait for the result {#status}

A render usually takes one to three minutes (`estimate.ready_in_s`). Ask with `GET /renders/{id}?wait=30`: the answer comes as soon as the status changes, at the latest after 30 seconds.

The render is done at `succeeded`. On `failed` or `canceled` the reason is in `error`. Instead of asking, you can create a webhook and wait for `video.ready`.

**curl**

```bash
# waits up to 30 s for a status change
curl -s "https://flow-marketing.org/api/turbo/v1/renders/rnd_9KpQ2wErT5yU7iO1aS3d?wait=30" \
  -H "Authorization: Bearer $FLOW_API_KEY"
```

**JavaScript**

```js
const H = { Authorization: 'Bearer ' + process.env.FLOW_API_KEY }
let r
do {
  const res = await fetch('https://flow-marketing.org/api/turbo/v1/renders/' + renderId + '?wait=30', { headers: H })
  r = await res.json()
} while (['queued', 'rendering', 'checking'].includes(r.status))
console.log(r.status, r.files, r.error)
```

**Python**

```python
import os, requests

BASE = "https://flow-marketing.org/api/turbo/v1"
H = {"Authorization": "Bearer " + os.environ["FLOW_API_KEY"]}

while True:
    r = requests.get(BASE + "/renders/" + render_id, params={"wait": 30}, headers=H, timeout=40).json()
    if r["status"] not in ("queued", "rendering", "checking"):
        break
print(r["status"], r["files"], r["error"])
```

## Step 5: download the file {#datei-laden}

A finished render has `files`: one file per chosen format (`master_16x9`, `master_9x16`, `master_1x1`), plus, depending on the video, captions (`captions_de`, `captions_en`), a thumbnail (`thumbnail`) and the quality report as PDF (`report_pdf`).

Each file has a signed `url` valid for 24 hours (`expires_at`). If you need a new link later, call `GET /renders/{id}` again.

**curl**

```bash
# FILE_URL = files.master_16x9.url from the render (valid for 24 h)
curl -L -o video.mp4 "$FILE_URL"
```

**JavaScript**

```js
import { writeFile } from 'node:fs/promises'

const file = render.files.master_16x9 // { url, expires_at, content_type }
const res = await fetch(file.url)
await writeFile('video.mp4', Buffer.from(await res.arrayBuffer()))
```

**Python**

```python
import requests

url = render["files"]["master_16x9"]["url"]
with requests.get(url, stream=True, timeout=120) as r:
    r.raise_for_status()
    with open("video.mp4", "wb") as f:
        for teil in r.iter_content(chunk_size=1 << 20):
            f.write(teil)
```

## Everything in one script {#ganzes-skript}

The same as one script to copy. It stops with code, text and request id when something goes wrong.

**JavaScript**

```js
// node erstes-video.mjs  (Node 18+, FLOW_API_KEY = test key)
import { writeFile } from 'node:fs/promises'
import { randomUUID } from 'node:crypto'

const BASE = 'https://flow-marketing.org/api/turbo/v1'
const H = { Authorization: 'Bearer ' + process.env.FLOW_API_KEY }

async function api(method, path, body) {
  const res = await fetch(BASE + path, {
    method,
    headers: body ? { ...H, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() } : H,
    body: body ? JSON.stringify(body) : undefined,
  })
  const data = await res.json()
  if (!res.ok) throw new Error(data.code + ': ' + data.detail + ' (' + data.request_id + ')')
  return data
}

// 1. create the video: preview and quality traffic light come back at once
const video = await api('POST', '/videos', {
  template: 'produkt-launch',
  language: 'de',
  formats: ['16x9'],
  fields: {
    produkt: 'Musterwerk Plan',
    hook: 'Schichtplan per Zuruf?',
    problem: 'Jede Woche Zettel, Anrufe und Lücken im Plan.',
    loesung: 'Der Plan, der sich selbst füllt',
    vorteile: ['Tauschen per Klick', 'Urlaub sofort sichtbar'],
    cta: 'Jetzt kostenlos testen',
  },
})
console.log(video.id, video.quality.overall, video.preview_url)
if (video.quality.overall === 'red') throw new Error('quality red: shorten the flagged fields (PATCH)')

// 2. render
let render = await api('POST', '/videos/' + video.id + '/render', {})

// 3. wait (long poll, up to 30 s per call)
while (['queued', 'rendering', 'checking'].includes(render.status)) {
  render = await api('GET', '/renders/' + render.id + '?wait=30')
}
if (render.status !== 'succeeded') throw new Error(render.error ? render.error.code : render.status)

// 4. download (link valid for 24 h)
const mp4 = await fetch(render.files.master_16x9.url)
await writeFile('video.mp4', Buffer.from(await mp4.arrayBuffer()))
console.log('done: video.mp4')
```

**Python**

```python
# python erstes_video.py  (pip install requests, FLOW_API_KEY = test key)
import os, uuid, requests

BASE = "https://flow-marketing.org/api/turbo/v1"
H = {"Authorization": "Bearer " + os.environ["FLOW_API_KEY"]}


def api(method, path, body=None, **kw):
    headers = dict(H)
    if body is not None:
        headers["Idempotency-Key"] = str(uuid.uuid4())
    r = requests.request(method, BASE + path, headers=headers, json=body, timeout=kw.get("timeout", 60), params=kw.get("params"))
    data = r.json()
    if not r.ok:
        raise SystemExit(data["code"] + ": " + data["detail"] + " (" + data["request_id"] + ")")
    return data


# 1. create the video: preview and quality traffic light come back at once
video = api("POST", "/videos", {
    "template": "produkt-launch",
    "language": "de",
    "formats": ["16x9"],
    "fields": {
        "produkt": "Musterwerk Plan",
        "hook": "Schichtplan per Zuruf?",
        "problem": "Jede Woche Zettel, Anrufe und Lücken im Plan.",
        "loesung": "Der Plan, der sich selbst füllt",
        "vorteile": ["Tauschen per Klick", "Urlaub sofort sichtbar"],
        "cta": "Jetzt kostenlos testen",
    },
})
print(video["id"], video["quality"]["overall"], video["preview_url"])
if video["quality"]["overall"] == "red":
    raise SystemExit("quality red: shorten the flagged fields (PATCH)")

# 2. render
render = api("POST", "/videos/" + video["id"] + "/render", {})

# 3. wait (long poll, up to 30 s per call)
while render["status"] in ("queued", "rendering", "checking"):
    render = api("GET", "/renders/" + render["id"], params={"wait": 30}, timeout=40)
if render["status"] != "succeeded":
    raise SystemExit((render["error"] or {}).get("code", render["status"]))

# 4. download (link valid for 24 h)
with requests.get(render["files"]["master_16x9"]["url"], stream=True, timeout=120) as r:
    r.raise_for_status()
    with open("video.mp4", "wb") as f:
        for teil in r.iter_content(chunk_size=1 << 20):
            f.write(teil)
print("done: video.mp4")
```

## Where to go next {#naechste-schritte}

- Webhooks instead of polling: events like `video.ready` signed to your server.
- Your brand: `brand` with name, colours and a logo upload (`POST /uploads`).
- Going live: create a live key, check the price first with `POST /estimates`, set a monthly limit in your account.
- Understanding errors: every answer from 400 up has a fixed `code`, a sentence in `detail` and a `request_id`.

## See also

- [First steps with the API (short)](https://flow-marketing.org/en/help/api)
- [Webhooks reference](https://flow-marketing.org/en/help/api-webhooks-reference)
- [Videos](https://flow-marketing.org/en/help/api-videos)
- [Authentication](https://flow-marketing.org/en/help/api-authentication)
- [Test mode](https://flow-marketing.org/en/help/api-test-mode)
- [Error codes](https://flow-marketing.org/en/help/api-error-codes)
