Quick Guide

BeatAPI provides one server-side API key for Workflow, Realtime, Video, Image, and Effect APIs. This guide covers authentication, file upload, the shared async Task contract, usage, and production error handling.

Base URL and authentication

https://api.beatapi.io

Create a key in Dashboard → API Keys, then keep it on a trusted server.

$read -rsp "BeatAPI API key: " BEATAPI_API_KEY && echo
$export BEATAPI_API_KEY
1Authorization: Bearer <BEATAPI_API_KEY>

The silent prompt keeps the key out of shell history. Never place a permanent key 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.

First async request

$curl https://api.beatapi.io/v1/music-video/tasks \
> -X POST \
> -H "Authorization: Bearer $BEATAPI_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "images": ["https://media.beatapi.io/samples/neon-singer.png"],
> "audio_url": "https://media.beatapi.io/samples/neon-singer-preview.mp3",
> "prompt": "Neon rooftop performance with cinematic light trails.",
> "resolution": "720p"
> }'

A valid request returns 201 Created. Save data.id before continuing.

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

Poll every 5–10 seconds with jitter. 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}
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.