BeatAPI Quick Guide
BeatAPI uses one server-side API key across Text, Workflow, Realtime, Video, Image, and Effect APIs. Start with the three steps below, then use the rest of this guide for synchronous text responses, shared task fields, uploads, limits, and production errors.
First task in three steps
1. Create an API key
Create a key in Dashboard → API Keys, then load it into your shell without placing it in command history:
Send this header with every request. Image, video, effect, workflow and capability requests go to https://api.beatapi.io. Text requests go to https://direct.beatapi.io (see Text API). The key is the same:
2. Create a task
A new account starts on free credit: a small starter balance (the amount depends on the sign-up region, and some regions start at zero) that can call only the models on the free-tier list. nano-banana-2 is on it. Any model not on the list answers 403 forbidden until the account’s first top-up, and a top-up unlocks every model. GET https://api.beatapi.io/v1/free-tier returns the current list without a key. Each model also carries requires_topup in GET /v1/media/models and in Inspect and Search results: true means the model is refused until the first top-up, and false means at least one tier is open, not that every call will pass. In a region that starts at zero, the first call answers 402 insufficient_credits until you top up. See Free models.
This minimal image request uses POST /v1/images/tasks:
A valid request returns 201 Created. Save the returned data.id.
Enum values are case-insensitive, and older spellings (1080P, 4k, Fast, Quality) are still accepted. The documentation writes only the canonical spelling.
3. Poll the result
Replace task_8K2qA with the data.id from step 2. Wait data.poll_after_seconds seconds between polls. Use the value in the response rather than a constant of your own: it is present while the task runs, and today it is 5 for images, 8 for video and effects, and 10 for data and workflows. On succeeded, read data.output.media and stop polling. On failed, read data.error_code, data.error_message and data.retryable, then stop polling.
Polling GET /v1/tasks/{task_id} is not subject to the request-rate limit, so following poll_after_seconds never earns a 429 from BeatAPI. A 429, 500 or 503 on a poll is transient and says nothing about the task: wait and ask again.
Keep permanent API keys on trusted servers. Never place them in browser code, mobile code, scripts, logs, or screenshots. Realtime browsers receive only a short-lived client_secret created by your server.
Submit, poll and download (Python)
A complete script that submits an image task, waits with a total timeout, handles failed and retryable, and downloads the result:
- Total timeout. The script gives up after 1800 seconds (30 minutes). The slowest models typically finish in about 400 seconds, so this leaves room for queueing without hanging forever. Giving up is your decision, not the task’s: BeatAPI itself stops a task only after its processing window.
- A create error is retried only when it says so.
create_taskretries when the error hasretryable: true, waitsretry_after_secondson a429, and sends the sameIdempotency-Keyeach time: only2xxanswers are stored, so a retry cannot create a second task. failedis a normal answer. The HTTP status is200; the credits reserved for the task are refunded. Retry only whenretryableistrue.- One key per logical request. Reusing the key of a failed task returns that stored task, not a new one.
Get results by webhook
Instead of polling you can register an HTTPS endpoint with POST /v1/webhooks. BeatAPI then posts task.succeeded or task.failed to it when a task finishes, with the same task object that GET /v1/tasks/{task_id} returns. Verify the signature, deduplicate by event ID, and keep a slow reconciliation poll as the fallback. The payloads, headers, retries and verification code are on the Webhooks page.
To have one task’s result delivered to one address instead, add callback_url to an image or video task request; it must be on the host of one of your webhook endpoints. See the One-off callback section of the Webhooks page.
Choose an API
Text calls go to https://direct.beatapi.io and return synchronously or as a server-sent event stream. Realtime creates a short-lived Session. Workflow, Video, Image, and Effect create operations return an asynchronous Task: store data.id, then poll the shared task endpoint. Polling GET /v1/tasks/{task_id} is not rate limited; wait poll_after_seconds between polls.
For GPT model selection, request formats, and streaming examples, see the GPT guide.
Get task status
GET /v1/tasks/{task_id}
Status values
Image and video tasks only use queued, processing, succeeded and failed. The other statuses belong to Music Video.
Status names in other APIs
If you are porting a client written for another API, map its statuses like this. BeatAPI has no cancelled status and no endpoint to cancel a task: once accepted, a task runs to succeeded or failed, and a failed task is refunded.
Normalized Task fields
Usage and output fields
Public response names such as credits_reserved are retained for API compatibility. All credit and balance values are decimal USD ledger amounts: 1 Credit = ` symbol.
How long things are kept
On a failed task, usage.credits_reserved is the amount held at create, usage.credits_charged and usage.credits_settled are 0, and usage.credits_refunded is the amount returned. An accepted task fails with one of six codes: content_policy_violation and bad_request (not retryable), and processing_unavailable, processing_timeout, processing_failed and result_transfer_failed (retryable). See Errors.
List tasks
GET /v1/tasks
Lists your account’s tasks, newest first. Each item is the task object GET /v1/tasks/{task_id} returns, so one parser reads both.
An unknown parameter is 400 bad_request. The answer is {"data": {"object": "list", "data": [task, …], "has_more": true, "next_cursor": "…"}}; the last page has no next_cursor.
- The cursor is opaque. Pass
next_cursorback ascursorand do not build or edit one. It works only for the account that read that page; any other value is400 bad_request. - Status filters follow the lifecycle.
statusfilters byqueued,processing,succeededandfailed.processingalso matches a Music Video task that is at a stage such asstoryboard_ready. - Synchronous calls are not listed. Social data, web and SEO calls answer in the response; they are not tasks, so they never appear here and
GET /v1/tasks/{task_id}answers404for them. - A filtered page can be short, even empty. With
modelorapi_key_id, one page reads at most the 2,000 most recent tasks after the cursor and returns the matches among them, so it can hold fewer thanlimititems or none whilehas_moreistrue. Keep followingnext_cursoruntilhas_moreisfalse; a short or empty page is not the end of the list. - Rate limit.
GET /v1/tasksallows 60 requests per minute for the account, however many API keys it has; past that it answers429 rate_limit_exceededwithRetry-After. To follow one task, pollGET /v1/tasks/{task_id}, which has no such limit.
Upload an input file
POST /v1/files
Use file upload when an input is local instead of already available at a public HTTPS URL.
Every upload must include an exact Content-Length; normal curl, browser, and SDK uploads set it automatically. Chunked uploads without a declared length are rejected before the body is buffered.
Multipart fields
You may also send the raw file body with its asset Content-Type.
Some common aliases are accepted and stored under the canonical type, for example image/jpg as image/jpeg, audio/mp3 as audio/mpeg, and text/plain (with a .srt filename) as application/x-subrip. PDF, generic text, octet-stream, unsupported video containers, and ZIP uploads are refused with 400 bad_request. The gateway trusts the declared Content-Type; when the filename has an extension, it must agree with that type. It does not inspect the file contents and does not read duration or dimensions. A file accepted by the upload can still be refused by the model or workflow that uses it, for example for duration or size rules, when you create the task. Workflow input URLs cannot be localhost, private-network, or data URLs.
Upload refusals are 400 bad_request with one of these messages:
If the file cannot be stored, the upload answers 503 with processing_unavailable (“File storage is temporarily unavailable. Retry later; nothing was stored.”) or result_transfer_failed (“The file could not be stored on our side. Retry; nothing was stored.”). Retry with backoff.
File response
Use data.url in the model or workflow request. The model or workflow checks its own limits when you create the task; for example, Standard Music Video accepts 10–180 seconds of audio and Premium accepts 10–300.
Check usage and limits
GET /v1/usage
Send an API key or your account’s personal access token; both return the same account-wide summary.
The one optional query parameter, period, sets the window the counts and breakdowns cover, ending now: 24h, 7d, 30d or all (the default, the whole account history). credit_balance and concurrency are always current. Any other parameter, or another period value, is refused with 400.
Breakdown item fields:
Music Video tasks paused at storyboard_ready or requires_action can have settled credits without counting as active processing work.
To see what each task or text request cost, read the per-request usage records with your account’s personal access token.
Errors and retry policy
Every error carries code, an English message that states the cause, and request_id (also sent in the X-BeatAPI-Request-Id response header; quote it when you contact support); only a 429 rate_limit_exceeded also carries retry_after_seconds and the Retry-After header; a 503 has no known wait, so retry it with backoff. retryable is present for every code in the table below. Branch on it: false means the same call will fail again until you change it.
Public error codes
BeatAPI exposes only the stable public codes below. BeatAPI never names the supplier behind a model and does not pass on raw upstream bodies. Errors lists which code each failure produces at create and on an accepted task, and how the text endpoints fail before the model is called (this envelope) and during the call (the SDK’s native error shape, with BeatAPI codes for our own refusals and rewritten codes for failures on the model’s side). These values appear in response error.code. Terminal asynchronous failures may also return the applicable value in task error_code.
BeatAPI does not answer 502 or 504; one you still see came from the network edge, has no JSON body, and is retried like a 503.
Idempotency:
- Send the key in the
Idempotency-Keyrequest header. Workflow, Image, Video, and Effect task creation accept an optional key, and so doesPOST /v1/capabilities/run. Realtime Session create requires it (up to 255 characters). - A key is remembered for 24 hours. A key longer than 255 characters is
400 bad_request. - The same key with a different body or path is
409 idempotency_conflict. So is the same key while the first request is still running. - Repeating the identical request returns the stored response with the header
Idempotent-Replayed: true. - Only
2xxresponses are stored, so after a400or402you can retry with the same key.
Production checklist
- Use the exact origin:
https://api.beatapi.iofor image, video, effect, workflow and capability calls,https://direct.beatapi.iofor text calls. - Keep permanent API keys on trusted servers.
- Validate required/optional fields, enums, limits, and conditional rules from the selected API page.
- Store task/Session IDs and
request_idbefore starting background work. - Poll every
poll_after_secondsand stop at the documented terminal or action state. - Download and store the results you need to keep within 72 hours of completion.
- Honor status codes,
Retry-After, andretry_after_seconds. - Verify webhook signatures against raw bytes before JSON parsing. Webhooks send only
task.succeededandtask.failed, with 3 attempts (retries after 1 minute and 5 minutes). A task that times out sendstask.failedtoo, but keep a slow poll as the source of truth. - Record credit reservations, settlements, refunds, errors, and final output URLs.
- Review the Privacy Policy and Terms of Service before processing cameras, faces, voices, or reference assets.

