BeatAPI Quick Guide

Quick Guide

BeatAPI uses one server-side API key across Workflow, Realtime, Video, Image, and Effect APIs. Start with the three steps below, then use the rest of this guide for 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:

$read -rsp "BeatAPI API key: " BEATAPI_API_KEY && echo
$export BEATAPI_API_KEY

All requests use the https://api.beatapi.io base URL and this header:

1Authorization: Bearer <BEATAPI_API_KEY>

2. Create a task

This minimal image request uses POST /v1/images/tasks:

$curl https://api.beatapi.io/v1/images/tasks \
> -X POST \
> -H "Authorization: Bearer $BEATAPI_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "nano-banana",
> "prompt": "Editorial product photograph on a warm stone pedestal."
> }'

A valid request returns 201 Created. Save the returned data.id.

3. Poll the result

$curl https://api.beatapi.io/v1/tasks/task_8K2qA \
> -H "Authorization: Bearer $BEATAPI_API_KEY"

Replace task_8K2qA with the data.id from step 2. Poll every 5–10 seconds with jitter. On succeeded, read data.output.media and stop polling. On failed, read data.error_code and data.error_message, then stop polling.

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.

Choose an API

APICreate operationInputResult
Workflow — Music VideoPOST /v1/music-video/tasksAudio and tier-specific visual referencesComplete Music Video and storyboard metadata
Workflow — EcommercePOST /v1/ecommerce-video/tasksProduct images, duration, creative briefComplete product video
RealtimePOST /v1/realtime/sessionsBrowser origin and fixed duration; then live MediaStreamLive generated WebRTC video
VideoPOST /v1/videos/tasksModel-specific prompt and media referencesOne hosted video
ImagePOST /v1/images/tasksModel-specific prompt and optional referencesOne hosted image
EffectPOST /v1/effects/tasksPublished Effect ID, images, supported optionsOne hosted image or video effect result

With the exception of Realtime, create operations return an asynchronous Task. Store data.id, then poll the shared task endpoint. The task endpoint allows up to 120 requests per minute per API key.

Get task status

GET /v1/tasks/{task_id}

ParameterLocationTypeRequiredRules
task_idPathstringYesUse data.id from a create response

Status values

StatusMeaningClient action
queuedAccepted and waitingContinue polling
processingGeneration is runningContinue polling
storyboard_readyMusic Video storyboard is availableAuto flow may continue; inspect if needed
requires_actionMusic Video manual review is waitingEdit or compose shots
editingMusic Video shot edit is runningContinue polling
composingMusic Video composition is runningContinue polling
succeededHosted output is readyRead data.output and stop polling
failedTask ended with an errorRead errors/refunds and stop polling

Normalized Task fields

FieldTypePresentMeaning
idstringAlwaysStable task ID
objectstringAlwaystask
task_kindstringAlwaysworkflow, effect, image, or video
capability_idstringAlwaysStable workflow, Effect, or generation model ID
capability_versioninteger or nullAlwaysImmutable version when versioned
workflowstringWorkflow tasksmusic-video or ecommerce-video
effect_idstringEffect tasksStable effect ID
effect_versionintegerEffect tasksImmutable selected effect version
media_typestringImage/video tasksimage or video
modelstringImage/video tasksStable model alias
statusstringAlwaysCurrent lifecycle status
stagestringAlwaysCurrent processing stage
storyboardobjectMusic VideoShot metadata when available
created_atintegerAlwaysUnix timestamp
updated_atintegerAlwaysUnix timestamp
completed_atinteger or nullAlwaysTerminal Unix timestamp
outputobject or nullAlwaysnull until success
usageobjectAlwaysCredits and billable duration
request_idstringAlwaysSupport/debug correlation ID
error_codestring or nullAlwaysMachine-readable task failure
error_messagestring or nullAlwaysHuman-readable task failure

Usage and output fields

FieldTypeMeaning
usage.credits_reservedintegerCredits reserved for the operation
usage.credits_chargedintegerCredits charged when accepted
usage.billable_duration_secondsinteger, optionalDuration used for credit calculation
usage.credits_settledintegerCredits finalized after successful work
usage.credits_refundedintegerCredits returned after an eligible failure
output.mediaobject[]Hosted result files
output.media[].typestringimage or video
output.media[].urlstringHosted result URL
output.media[].mime_typestringResult MIME type
output.r2_urlstringPrimary hosted result URL

Upload an input file

POST /v1/files

Use file upload when an input is local instead of already available at a public HTTPS URL.

Multipart fields

FieldTypeRequiredDefaultRules
filebinaryYesOne supported file up to 50 MB
purposestringNoinputOnly input is supported
$curl https://api.beatapi.io/v1/files \
> -X POST \
> -H "Authorization: Bearer $BEATAPI_API_KEY" \
> -F "file=@./song.mp3" \
> -F "purpose=input"

You may also send the raw file body with its asset Content-Type.

AssetAccepted extensionsAccepted MIME typesAdditional rule
ImagePNG, JPG/JPEG, WebPimage/png, image/jpeg, image/webpMaximum 50 MB
AudioMP3, WAV, AAC, M4Aaudio/mpeg, audio/wav, audio/aac, audio/mp4Maximum 50 MB; 10–300 seconds
SubtitleSRTapplication/x-subrip; text/plain only with .srt filenameMaximum 50 MB

PDF, generic text, octet-stream, video, and ZIP uploads are not supported. Workflow input URLs cannot be localhost, private-network, or data URLs.

File response

1{
2 "data": {
3 "id": "file_3xYz9",
4 "object": "file",
5 "url": "https://media.beatapi.io/inputs/file_3xYz9.mp3",
6 "key": "inputs/file_3xYz9.mp3",
7 "mime_type": "audio/mpeg",
8 "size_bytes": 1048576,
9 "purpose": "input",
10 "audio_duration_seconds": 64.02,
11 "audio_duration_source": "mp3_frame_scan",
12 "created_at": 1782210000
13 }
14}
FieldTypePresentMeaning
idstringAlwaysFile ID
objectstringAlwaysfile
urlstringAlwaysLong-lived HTTPS input URL
keystringAlwaysStorage key
mime_typestringAlwaysDetected/accepted MIME type
size_bytesintegerAlwaysUploaded byte size
audio_duration_secondsnumberAudio onlyDetected audio duration
audio_duration_sourcestringAudio onlyDuration detection method
purposestringAlwaysinput
created_atintegerAlwaysUnix timestamp

Use data.url in the model or workflow request. Audio task limits still apply: Standard Music Video accepts 10–180 seconds; Premium accepts 10–300.

Check usage and limits

GET /v1/usage

This authenticated endpoint has no parameters.

$curl https://api.beatapi.io/v1/usage \
> -H "Authorization: Bearer $BEATAPI_API_KEY"
FieldTypeMeaning
objectstringusage
credit_balanceintegerCurrent credit balance; it may be negative
total_tasksintegerAccount task count
credits_settledintegerSettled task credits
credits_refundedintegerRefunded task credits
concurrencyobjectProcessing-task capacity summary
concurrency.limitintegerAccount processing-task limit
concurrency.activeintegerTasks currently consuming processing capacity
realtimeobject, optionalRealtime Session usage summary
realtime.sessionsintegerTotal Realtime Sessions
realtime.creditsintegerRealtime settled credits
realtime.activeintegerSessions in ready, connecting, or active
by_workflow[]object[]Workflow compatibility breakdown
by_capability[]object[]All task kinds by stable capability
by_model[]object[]Image/video tasks by model alias
by_api_key[]object[]Task/credit totals by API key

Breakdown item fields:

ArrayRequired item fields
by_workflowworkflow, tasks, credits_settled
by_capabilitytask_kind, capability_id, tasks, credits_settled
by_modelmedia_type, model, tasks, credits_settled
by_api_keyapi_key_id, title, key_prefix, tasks, credits_settled

Music Video tasks paused at storyboard_ready or requires_action can have settled credits without counting as active processing work.

Errors and retry policy

1{
2 "error": {
3 "code": "rate_limit_exceeded",
4 "message": "Too many requests.",
5 "request_id": "req_abc123",
6 "retry_after_seconds": 12
7 }
8}

Public error codes

BeatAPI exposes only the stable public codes below. Internal provider errors are normalized and are never part of the customer contract. These values appear in response error.code. Terminal asynchronous failures may also return the applicable value in task error_code.

CodeMeaningClient action
bad_requestRequest fields, combinations, formats, URLs, or limits are invalidCorrect the request before retrying
unauthorizedThe API key is missing, invalid, revoked, or inactiveCheck the active Bearer key
forbiddenThe authenticated account cannot perform the operationCheck account permission and requested resource
not_foundThe requested resource does not exist or is not owned by this API keyCheck the ID and API-key ownership
insufficient_creditsThe account does not have enough BeatAPI creditsAdd credits before creating another paid operation
idempotency_conflictThe idempotency key was already used with a different request bodyReuse the key only for the same logical request, or use a new key
user_concurrency_exceededThe account already has the maximum number of active tasksWait for an active task to finish or increase account concurrency
rate_limit_exceededThe API key exceeded a request-rate limitHonor Retry-After or retry_after_seconds
content_policy_violationThe prompt or input media violates the content policyRevise the prompt or media before submitting a new request
processing_unavailableProcessing capacity is temporarily unavailableWait for the indicated delay; continue polling an already accepted task
processing_failedThe accepted task ended without a usable resultStop polling, inspect error_message and refund fields, then retry only when appropriate
processing_timeoutThe accepted task exceeded the processing windowStop polling, inspect refund fields, and submit a new request if needed
result_transfer_failedBeatAPI could not persist the generated result to first-party storageStop polling, inspect refund fields, and retry the operation if needed
invalid_signatureA webhook signature or timestamp could not be verifiedVerify the signing secret, raw request body, timestamp, and signature headers
realtime_disabledRealtime API is not enabled for the accountEnable Realtime access before creating another Session
realtime_capacity_unavailableRealtime capacity is temporarily unavailableWait for the indicated delay before creating another Session
realtime_session_expiredThe Realtime Session can no longer be usedCreate a new Session and client secret
origin_not_allowedThe browser origin is not allowed for the Realtime SessionUse an exact configured HTTPS origin
invalid_client_secretThe Realtime client secret is invalid or no longer usableCreate a new Session and use its new client secret
transport_not_allowedThe requested Realtime transport is not allowedUse a transport documented by the Realtime API
internal_errorBeatAPI encountered an unexpected internal errorRetain request_id; retry only when safe or contact BeatAPI support
HTTPCommon codeClient action
400bad_requestCorrect fields, combinations, formats, URLs, or limits
401unauthorizedCheck the active Bearer key
402insufficient_creditsAdd credits before a new paid operation
403forbidden or Realtime origin errorCheck permission or exact browser origin
404not_foundCheck the ID and API-key ownership
409idempotency_conflictReuse a key only with the same logical request body
429Rate or concurrency codeHonor Retry-After or wait for capacity
500–503Processing, transfer, internal, or capacity errorPreserve request_id; poll known tasks and retry only when documented safe

Idempotency differs by endpoint:

  • Realtime Session create requires Idempotency-Key (1–128 characters).
  • Workflow, Image, Video, and Effect task creation accept an optional key. Reuse a key only with the exact same logical request body.
  • Image, Video, and Effect keys are documented with a maximum of 255 characters. Workflow keys should be kept concise for cross-database compatibility.

Production checklist

  • Use the exact https://api.beatapi.io origin.
  • 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_id before starting background work.
  • Poll with jitter and stop at the documented terminal or action state.
  • Honor status codes, Retry-After, and retry_after_seconds.
  • Verify webhook signatures against raw bytes before JSON parsing.
  • 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.