# Authentication and keys

> Bearer keys fm_test_ and fm_live_, scopes, monthly limit, headers, security.

Source: https://flow-marketing.org/en/help/api-authentication · Question: How do I authenticate with the API?

Every request carries an API key in the header “Authorization: Bearer …”. A test key (fm_test_) is free and renders with a watermark, a live key (fm_live_) is billed. The key decides account, mode and scopes.

This page covers what keys look like, which scopes exist, what live approval needs and which headers every answer carries.

## Send the key in the header {#bearer}

Send the key with every request in the header `Authorization: Bearer <key>`. Without a key, or with a wrong, revoked or expired key, the API always answers the same: 401 `invalid_api_key` with `WWW-Authenticate: Bearer realm="flow-api"`. That way it does not reveal whether a key existed.

A key has exactly this form: `fm_test_` or `fm_live_`, then 32 characters from A–Z, a–z and 0–9. Anything else is rejected before any lookup.

If the whole API account is locked, you get 403 `account_locked`.

**curl**

```bash
curl -i 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' },
})
console.log(res.status, res.headers.get('request-id'), res.headers.get('ratelimit-remaining'))
if (!res.ok) {
  const p = await res.json() // application/problem+json
  console.error(p.code, p.detail, p.request_id)
}
```

**Python**

```python
import os, requests

r = requests.get(
    "https://flow-marketing.org/api/turbo/v1/templates",
    headers={"Authorization": "Bearer " + os.environ["FLOW_API_KEY"], "Accept-Language": "de"},
    timeout=30,
)
print(r.status_code, r.headers.get("request-id"), r.headers.get("ratelimit-remaining"))
if not r.ok:
    p = r.json()  # application/problem+json
    print(p["code"], p["detail"], p["request_id"])
```

**Response 401**

```json
{
  "type": "https://flow-marketing.org/entwickler/doku/fehler#invalid_api_key",
  "title": "Invalid or missing API key.",
  "status": 401,
  "code": "invalid_api_key",
  "detail": "Invalid or missing API key.",
  "request_id": "req_4Fh8Kq2LmN0pQrS3",
  "doc_url": "https://flow-marketing.org/entwickler/doku/fehler#invalid_api_key"
}
```

## Creating a key {#schluessel-anlegen}

Only a hash (SHA-256) and the visible start of the key are stored (the first 12 characters, for example `fm_test_Ab3x`). Not even Flow Marketing can show a lost key again – create a new one.

Each API account has at most 25 active keys (409 `too_many_keys`). Keys you create through the MCP server never appear in the chat: you collect them through a one-time link in your account that is valid for 10 minutes. If nobody collects it, the key is revoked.

1. Open “API” in your account (/konto/api).
2. The first time, create the API account: billing details and agreement to the API terms.
3. “Create key”: name, mode (test or live) and, if needed, tick extra scopes.
4. Copy the full key right away. It is shown this one time only.

## Test and live {#test-und-live}

The mode is part of the key. Test and live are separate: videos, renders, webhooks and uploads of one mode are invisible to a key of the other mode (404 `not_found`).

Test mode: free, watermark, 720p preview, 25 test renders per 24 hours. Live: full quality, billed per second from the API account’s balance.

## Scopes {#scopes}

Each key carries a list of scopes. If one is missing, the API answers 403 `missing_scope` and names it. New keys from your account get the five default scopes; you tick the others one by one when creating the key.

Scopes are fixed on the key. If you need more later, create a new key.

| Scope | Default | Allows |
| --- | --- | --- |
| `templates:read` | yes | `GET /templates`, `GET /templates/{id}`, `GET /voices` (video voices) |
| `videos:read` | yes | `GET /videos`, `GET /videos/{id}`, `/plan`, `/report`, `POST /estimates`, `GET /renders`, `GET /renders/{id}`, `GET /uploads`, `GET /documents/{id}`, `GET /media` |
| `videos:write` | yes | create, change, delete, render and cancel videos; uploads and documents; `POST /videos/from-document`; `POST /media/estimate`, `POST /media` |
| `webhooks:manage` | yes | all endpoints under `/webhooks` |
| `usage:read` | yes | `GET /balance`, `GET /usage` |
| `voices:read` | no | `GET /models`, `GET /voices/{id}`, `GET /pronunciations`; library and your voices in `GET /voices` |
| `speech:write` | no | all endpoints under `/speech`, `PUT /pronunciations` |
| `voices:write` | no | `POST /voices/design`, `POST /voices`, `PATCH` and `DELETE /voices/{id}`, everything under `/voices/clones` |
| `avatars:write` | no | everything under `/avatars` |
| `live:read` | no | `GET /live/agents`, `GET /live/agents/{id}`, `POST /live/agents/{id}/estimate`, `GET /live/agents/{id}/calls`, `GET /live/connections` |
| `live:write` | no | `POST /live/agents`, `PATCH /live/agents/{id}`, `POST /live/agents/{id}/test`, `/phone_number` |

**Response 403**

```json
{
  "type": "https://flow-marketing.org/entwickler/doku/fehler#missing_scope",
  "title": "This key lacks the scope \"webhooks:manage\".",
  "status": 403,
  "code": "missing_scope",
  "detail": "This key lacks the scope \"webhooks:manage\". Nothing was charged.",
  "request_id": "req_9TzX1cV3bN5mQ7wE",
  "doc_url": "https://flow-marketing.org/entwickler/doku/fehler#missing_scope"
}
```

## Monthly limit and limits {#monatslimit}

The API account has a monthly spending limit. You set it in your account under “Budget” (net, in euros). If a render would exceed the limit, it does not start: 402 `spending_limit_reached`, nothing is reserved. At 80 % and 100 % the webhooks `spending_limit.warning` and `spending_limit.reached` fire, and an e-mail if you want one.

The server already knows a separate limit per key. In your account you currently set only the limit for the whole API account.

Requests per minute are limited per account and mode (read, write, expensive calls). The numbers are on “Rate limits”.

## IP allow list {#ip-liste}

An allow list of IP addresses per key does not exist yet. So protect the key carefully (see “Security”).

> **Note:** The OpenAPI description mentions an IP allow list. It is planned but not built yet.

## Revoking and replacing {#sperren-wechseln}

Revoking works at once: choose “Revoke” next to the key in your account. After that the API answers 401.

Replacing a key without downtime: create a new key with the same scopes, swap it in your software, then revoke the old one. Automatic rotation with an overlap period is not in the account yet. Keys from the account do not expire by themselves.

If a key leaked, for example in a public repository: revoke it at once and check under “Logs” in your account which requests used it.

## Live approval {#live-freigabe}

Test keys always work. For a live key Flow Marketing checks two things:

- Complete billing address: street, postcode, city and country (two-letter country code).
- A valid tax case: Germany works. Companies in other EU countries need a verified VAT ID. Outside the EU the API cannot be booked at the moment.

> **Note:** If something is missing, creating the key returns 403 `business_check_required` with the reason in the text. You maintain address and VAT ID in your account.

## Language of answers {#sprache}

Send `Accept-Language: de` and `title`, `detail`, field messages and template names come in German. Any other value, or no header, gives English.

Codes, status values and field names are always English and never change. Build your logic on `code` only, never on the text.

## Headers {#kopfzeilen}

Always include the `Request-Id` when you contact support. Your account shows the requests of the last 30 days under “Logs” – without bodies and without keys.

| Header | Direction | Meaning |
| --- | --- | --- |
| `Authorization` | request | `Bearer fm_test_…` or `Bearer fm_live_…` |
| `Content-Type` | request | `application/json` for POST, PATCH and PUT. A Content-Type other than JSON returns 415 `unsupported_media_type`. Body at most 64 KB (413 `payload_too_large`). |
| `Idempotency-Key` | request | for POST and PATCH, up to 200 characters, kept for 24 hours |
| `Accept-Language` | request | `de` for German texts, otherwise English |
| `Request-Id` | response | id of the request (`req_…`), also as `request_id` in error bodies |
| `Flow-Version` | response | date version of the API, today `2026-11-20` |
| `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` | response | limit per minute, remaining, seconds until the next window |
| `Retry-After` | response | on 429 and some 503: seconds until the next attempt |
| `Idempotent-Replayed` | response | `true` when the answer comes from the idempotency store |
| `WWW-Authenticate` | response | on 401 |
| `Cache-Control` | response | always `no-store` |

> **Note:** A `Flow-Version` header in the request is not evaluated today. The version only appears in the response.

## Security {#sicherheit}

- Never in a browser, an app or public code: the key belongs on your server.
- Keep it in an environment variable or a secret store, never in the repository.
- One key per program or environment, with only the scopes it needs. That way you can revoke precisely.
- Set a monthly limit and cap every render with `max_price_cents`.
- The API sets no cookies and does not check the origin – server to server over HTTPS.
- Always verify webhook signatures before you trust an event.

## See also

- [Go to keys](https://flow-marketing.org/konto/api)
- [Test mode](https://flow-marketing.org/en/help/api-test-mode)
- [Rate limits](https://flow-marketing.org/en/help/api-rate-limits)
- [Idempotency](https://flow-marketing.org/en/help/api-idempotency)
- [Costs and balance](https://flow-marketing.org/en/help/api-costs-and-balance)
