Studio API v1
The Studio API v1 is the versioned REST API for apps, backends and other DAW user interfaces. It is the primary way to integrate with Freestyle from code. It uses the same OAuth tokens and scopes as the MCP server, enforces the same project roles and runs the same service code, so a change made through the API is the change the Studio would make. It has 406 operations in 31 resource groups.
Studio API or MCP? Use the Studio API when your code decides what to call (buttons, timeline gestures, sync jobs). Use MCP when an AI model decides (ChatGPT, Claude and other assistants). Both accept the same user token. See which one to use.
Getting started
- Get an OAuth client. Use the same authorization server as MCP. A public app (a desktop or single-page DAW, a script) registers itself with dynamic client registration and gets a
fst_dcr_…client id. An organization's app is a partner app: its admin creates it in the console at/org/appsor with the MCP toolcreate_partner_app(scopeorganization:manage). Set itsredirect_uris, its scope ceiling (allowed_scopes) and the browser origins that may open realtime sockets (allowed_origins). Thefst_sec_…secret is shown once. - Sign the user in. Run the authorization-code flow with PKCE and ask for the scopes your interface needs, for example
projects:list projects:read projects:write daw:read daw:write media:upload exports:read audio:listen offline_access. Omitresourceor send the MCP URL; one access token is valid on both/api/mcpand/api/v1. The user must have Pro access. - Call the API with
Authorization: Bearer fst_at_…. Access tokens last an hour; refresh them with the rotating refresh token.
Base URL
https://freestyle.audio/api/v1Every path in the API reference is relative to this base. The OpenAPI 3.1 document is public: GET https://freestyle.audio/api/v1/openapi.json live from the server, and /docs/openapi.json as published with these docs. Generate a client from either.
A first request
export FREESTYLE_TOKEN=fst_at_…
curl -s https://freestyle.audio/api/v1/projects?limit=5 \
-H "Authorization: Bearer $FREESTYLE_TOKEN"HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: rq…
X-RateLimit-Limit: 600
X-RateLimit-Remaining: 599
{"data": [{"id": "…", "title": "Night drive", "artist": "…", "bpm": 92, "role": "owner",
"shared": false, "visibility": "link", "liveRoom": null, "updated_at": "…"}],
"pagination": {"limit": 5, "hasMore": true, "nextCursor": "…"}}shared means shared with you: true when your role is editor or viewer, the same rule as the "Shared with you" marker in Freestyle's library. A project you own is shared: false even when its visibility (its share setting: private, link or public) lets others in. liveRoom is the project's DAW sync room ({"code", "members"}) or null.
Then read one project, including its lanes, clips and tempo, and keep its ETag for later edits:
curl -si https://freestyle.audio/api/v1/projects/<project_id> \
-H "Authorization: Bearer $FREESTYLE_TOKEN"bpm in that reply is the tempo the project runs at and is never null; bpmSource says where it comes from: "set" (an explicit tempo), "backing" (nothing set, the backing's detected tempo) or "default" (nothing set or detected: 120 BPM, the engine's tempo for a new project). Pass bpm to createProject to start at another tempo, or change it later with setProjectTempo. The bpm in listProjects rows is only the stored explicit tempo (null = none set).
New projects stay put while you set them up. An account keeps at most 50 active and 10 empty projects; past that, each create quietly closes one least-recently-used project (empty ones first) instead of failing, and that project then answers 404. A project created, written, opened or attached to an engine session in the last 30 minutes is never the one closed, so a new draft stays readable while your UI opens it, even if the same account creates more projects meanwhile.
Next: the DAW UI guide walks through a whole editing session.
Scopes and roles
Every operation requires exactly one scope, the same scope as its MCP tool (the full list is on the Authentication page). Project operations also check the caller's role on the project, as the app does: viewers read, editors change, and only the owner deletes or shares. The reference lists the scope and role of each operation.
- A project you cannot see answers
404 not_found, so ids cannot be probed. - A role that is too low answers
403 editor_requiredor403 owner_required. - A token without the scope answers
403 insufficient_scopewithdetails.requiredScopeand an RFC 6750WWW-Authenticatechallenge. Ask the user to authorize again with that scope. - An account without Pro access answers
403 pro_mode_required. - An account that fails the entitlement check (the surface is disabled for it, or the account is quarantined) answers
403 chatgpt_app_access_required, for OAuth tokens and Studio sessions alike. If the entitlement authority cannot be reached the API fails closed with503 auth_unavailable. - A Studio session for an account that has not chosen a username answers
428 username_required.
Conventions
- Requests and responses are JSON. Send
Content-Type: application/jsonwith a body; a body that is not a JSON object is400 invalid_json. - Paths use resource nouns. Actions that are not plain CRUD use a colon:
POST /projects/{project_id}/clips:batch,POST /projects/{project_id}/lanes:reorder,POST /projects/{project_id}/timing-map:undo. - Response fields keep the casing of the shared service (so they match MCP). v1 adds fields such as
timelineRevisionbut never renames or removes them. - Identifiers are opaque. Use ids the API returned; never build one.
- Many engine operations accept an optional
track_id: the take, clip or lane whose live engine session to use. Leave it out to use the project's default session. - Time units. Clip timing is wall-clock time on the project timeline, never musical time:
start_ms(clip cards:startMs) is an integer number of milliseconds from the start of the project (bar 1, beat 1 = 0) to where the clip's audible region starts;duration_sec(durationSec) is the audible length in seconds (float), after trimming;audio_offset_sec(audioOffsetSec) is how many seconds into the source file the audible region begins (a left trim). So a clip plays source seconds[audio_offset_sec, audio_offset_sec + duration_sec)at timeline seconds[start_ms/1000, start_ms/1000 + duration_sec). Clip reads also carrysourceDurationSec, the full length in seconds of the clip's source audio file (nullwhen unknown): a slip toward later audio or a right-edge un-trim stays withinaudio_offset_sec + duration_sec <= sourceDurationSec. A few older clips already end slightly past their file (the tail plays as silence); do not extend those further. Fields named*_frame/*_framesare sample frames at the engine's sample rate (unless asample_ratesays otherwise),tickfields are 96 PPQ through the project's tempo map, and*_measure/ bars are 1-based. A tempo change never moves a clip'sstart_ms; convert withconvertMusicalTime.
Errors
Every failure uses one envelope, including 401, unknown routes, 429 and 500:
HTTP/1.1 400 Bad Request
X-Request-Id: rq…
{"error": {"code": "invalid_op",
"message": "ops[1]: op must be update|insert|remove|restore.",
"stage": "validation",
"details": {"opIndex": 1},
"requestId": "rq…"}}| Field | Meaning |
|---|---|
code | Stable, machine-readable reason. Branch on this. The codes are the ones MCP returns for the same failure. |
message | A sentence for people. Do not parse it. |
stage | Where it failed: auth, validation (nothing ran), precondition (a revision or If-Match did not match), rate_limit, engine_dispatch (the call to the engine did not complete), engine (the engine answered and refused) or internal. |
details | Extra fields for this failure, for example opIndex, currentRevision, requiredScope, retryAfterSec, bucket, requiresConfirmation, skipped_lanes. |
engineStatus | The Mozart engine's HTTP status, when known. |
requestId | Same as the X-Request-Id header. Quote it when you report a problem. |
Codes and HTTP statuses
The status follows the code. Revision conflicts are always 412. A failure inside the engine is 502 (or 504 engine_timeout). Services can return codes that are not listed here (for example track_limit or invalid_url); they keep the service's status.
| HTTP | Codes |
|---|---|
| 400 | action_mutates audio_invalid confirmation_required duplicate_mix_change engine_invalid_arguments guardrail_refused idempotency_key_required invalid_argument invalid_count_in invalid_cursor invalid_edits invalid_expected_mix_revision invalid_expected_value_norm invalid_idempotency_key invalid_json invalid_launch invalid_mix_change invalid_op invalid_request invalid_slot invalid_timing_map invalid_track_kind invalid_url lane_not_audio project_empty project_import_invalid project_metadata_contains_file query_is_link region_too_long replace_import_unsupported restore_state_invalid song_preset_invalid unsupported_mix_field username_mismatch youtube_import_too_long |
| 401 | unauthorized |
| 403 | chatgpt_app_access_required editor_required forbidden insufficient_scope oauth_grant_revoked owner_required peer_delegation_write_required plugin_not_in_plan pro_mode_required project_write_forbidden recording_delegation_required recording_take_owner_mismatch |
| 404 | backing_not_found beat_not_found export_job_not_found import_job_not_found job_not_found mix_target_not_found no_backing_track no_custom_lyrics no_track no_waveform not_found recording_take_not_found session_not_found stem_job_not_found track_not_found waveform_unavailable |
| 405 | method_not_allowed |
| 409 | automation_exists clip_changed clip_not_found count_in_cancelled count_in_refused edit_in_progress editor_not_available editor_not_open engine_conflict engine_unavailable engine_update_required export_in_progress id_exists idempotency_in_progress idempotency_key_used in_place_unsupported_source lane_has_no_live_chain loop_region_required lyrics_retrying master_effects_not_supported mix_apply_partial mix_persist_unavailable no_audio_loaded no_source_lane not_armed nothing_to_undo plugin_instance_mismatch plugin_instance_not_found preset_not_supported project_track_limit recording_in_progress recording_take_pending session_loading source_encrypted_unsupported source_not_durable stale_preview_request state_conflict stem_job_running studio_busy_on_other_project target_not_found target_not_loaded tempo_map_not_constant tempo_stretch_in_progress timing_map_nothing_to_undo too_many_previews track_limit transport_rolling would_clip |
| 411 | content_length_required |
| 412 | conflict markers_revision_conflict mix_revision_conflict plugin_parameter_conflict precondition_failed revision_conflict timeline_revision_conflict timing_map_revision_conflict timing_map_revision_mismatch |
| 413 | file_too_large payload_too_large source_too_long_for_in_place upload_too_large |
| 415 | unsupported_media_type |
| 422 | db_curve_gain_only idempotency_key_reused invalid_automation recording_take_rejected recording_take_silent target_not_on_lane |
| 428 | expected_revision_required username_required |
| 429 | rate_limited upload_concurrency upload_quota |
| 451 | mozart_region_restricted region_restricted |
| 500 | internal_error lyrics_save_failed play_not_recorded |
| 502 | action_failed audio_add_failed audio_import_error backing_attach_failed download_failed engine_error engine_forbidden engine_rejected engine_route_not_found engine_unreachable project_import_failed |
| 503 | auth_unavailable editor_frame_unavailable engine_restarting engine_session_contended engine_session_not_found enterprise_unavailable overloaded rate_limit_unavailable revision_unavailable service_unavailable stem_extraction_disabled storage_ledger_not_activated |
| 504 | engine_timeout |
A few statuses deserve a note:
405 method_not_allowed: the path exists but not with this method. TheAllowheader lists the methods it supports (andOPTIONSanswers with the same list).428 expected_revision_required: the operation needs a revision (If-Matchorexpected_revision) and none was sent. Read the resource and send itsETag.428 username_required: see above.503 revision_unavailable: the server could not read the current revision to check yourIf-Match, so it applied nothing (it fails closed rather than risk overwriting). Retry shortly.- A failure without a specific code gets a stable code for its status, for example
409 state_conflict,411 content_length_requiredor413 payload_too_large.
Other statuses you can see: 413 file_too_large, 429 upload_quota / upload_concurrency and 503 overloaded / storage_ledger_not_activated on uploads (see limits).
Request ids
Every response, successful or not, carries X-Request-Id. Error bodies repeat it as error.requestId. Log it with your own request so a failure can be traced end to end.
Idempotency-Key
Every mutation that can be retried safely accepts an Idempotency-Key header. Send a new random key (8 to 128 characters of [A-Za-z0-9._:-], for example a UUID) for each logical action, and the same key when you retry it.
- The key is scoped to your user, your app, the operation and the path.
- Only deterministic outcomes are stored (for 24 hours):
2xx, and400,403,404and422. Any other outcome (409,412,428,429,5xx) releases the key, so a retry with the same key really runs again, for example after a fresh read or afterRetry-After. - A retry of the same request (same JSON body, query string and
If-Match) with the same key replays the stored response withIdempotent-Replayed: true. Nothing runs a second time. - A replayed body never contains signed or credentialed URLs: such
…Urlfields arenulland the body hassignedUrlsOmitted: true. Read the resource again (for examplegetExportStatus) for a current link. - The same key with a different request is
422 idempotency_key_reused. A retry while the first request is still running is409 idempotency_in_progresswithRetry-After. A request still marked in progress after 600 s is treated as abandoned (for example after a server crash), and a retry then runs. - Some operations require a key and refuse a request without one with
400: uploads (uploadAudio, codeidempotency_key_required) and sample edits (editClipSamples,undoClipSampleEdit, which need 16 to 128 characters). For range edits the key also seeds the new clip ids, so a retry produces the same ids.
curl -X POST https://freestyle.audio/api/v1/projects/<project_id>/exports \
-H "Authorization: Bearer $FREESTYLE_TOKEN" \
-H "Idempotency-Key: 7f6c2a52-6d0e-4c1e-9a55-2b0f0f6e0c11" \
-H "Content-Type: application/json" -d '{}'Revisions: ETag, If-Match and 412
State that several editors can change has a revision, returned as an ETag. Send it back as If-Match on the next write. If someone else changed the state in between, nothing is applied and the answer is 412 with the current revision, so you can reload and try again instead of overwriting their work.
| Revision | Read from | Guards | Conflict code |
|---|---|---|---|
| Timeline revision (lanes, clips, patterns, placements) | ETag of getProject, listLanes, listClips; the timelineRevision field and ETag of every timeline mutation | applyClipBatch, editTimeRange and other timeline writes | timeline_revision_conflict (details.currentRevision) |
| Clip source revision | ETag of getClipWaveform | editClipSamples, undoClipSampleEdit (required) | revision_conflict (details.current_revision) |
| Timing-map revision | ETag of getTimingMap | setTimingMap, undoTimingMap, setProjectTempo, tick-based seek and setLoop | timing_map_revision_conflict; from the engine on tick-based seek / setLoop, timing_map_revision_mismatch (details.current_revision) |
| Mix revision (lane gain / pan / mute / solo / routing, master gain, bus gain / mute / solo) | ETag: "mix-<n>" and mixRevision of getEngineMix, waitEngineMix and every mix write | Mixer, bus and routing writes, mix:apply, typed engine actions (header only). See Mixing safely. | mix_revision_conflict (details.currentMixRevision) |
| Plug-in parameter value | valueNorm from listLanePluginParameters / getLanePluginState | expected_value_norm on setLanePluginParameter | plugin_parameter_conflict (details.currentValueNorm) |
| Per-op expectations | The clip fields you read | An op's expected object in applyClipBatch | conflict |
If-Match: *means "no precondition". Weak (W/) and quoted forms are accepted.- On reads, send the last
ETagasIf-None-Match; an unchanged resource answers304with no body. Poll cheaply this way. - Where a revision is mandatory (sample edits, for example) and you send none, the answer is
428 expected_revision_required. If the server cannot read the current revision, it answers503 revision_unavailableand applies nothing. - Engine conflicts keep the engine's status in
engineStatus; the current revision is indetails.current_revision. - Where the service has its own field (
expected_revision,timing_map_revision), you can send that in the body instead of the header.
Pagination
List operations return a page and a cursor:
{"data": [ … ],
"pagination": {"limit": 50, "hasMore": true, "nextCursor": "eyJ…"}}limitdefaults to 50, maximum 200.- Pass
nextCursorback ascursorwith the same filters until it isnull. A cursor is bound to the operation and its filters: changing a filter, or sending a cursor from another list, is400 invalid_cursor. - Cursors are opaque. Do not decode or build them.
Destructive operations: the DELETE / confirm rule
- An ordinary
DELETEis the confirmation. Deleting a bus, lane, pattern, automation envelope or collaborator needs no extra flag. Ask the user in your interface before you send it. - A few operations also need
confirm=true, because they are irreversible or reach the whole project:deleteProject,restoreProjectSave,resetProjectShareLink,engine_clear_track_plugins,engine_delete_bus,engine_delete_bus_plugin,engine_delete_clip,engine_delete_lane_plugin,engine_delete_pattern,engine_delete_pattern_placement,engine_delete_track,engine_finalize_recording,engine_load_bus_plugin,engine_load_track_plugin,engine_remove_track,engine_render_live_window,engine_render_share,engine_unload_lane,finalizeRecording. Sendconfirm=truein the query string or the JSON body after the user agreed. Without it the answer is400 confirmation_requiredwithdetails.requiresConfirmation, and nothing runs. - Every mutation in the OpenAPI document carries
x-freestyle-confirmation:DELETE,confirm=trueornone.
Rate limits
The Studio API has its own budget, separate from every MCP budget:
| Class | Budget | Used by |
|---|---|---|
interactive | 600 requests per minute per user, and for OAuth apps also 600 per minute per (app, user), so one user of your app can never use up the app for everyone else. First-party Studio sessions pay no app bucket. | Almost every operation: reads, edits, transport, mixer, exports, uploads, polling. Not counted as Mozart AI usage. |
wait | 120 requests per minute per user (and 120 per (app, user) for OAuth apps) instead of the interactive budget, plus at most 2 waits in flight per user and 32 per server (429 with Retry-After beyond) | Long-polls that hold the request until something changes: waitEngineMix. |
ai | The interactive budgets plus the Mozart AI per-minute and daily quota | Only operations that invoke a model, or that MCP meters the same way: applyRegionEffect, previewRegionEffect, mozartAiCommand, engine_add_808, engine_add_drum_hits, engine_add_groove, engine_add_hat_rolls, engine_add_instrument_track, engine_adjust_volume, engine_align_to_beat, engine_analyze_harmony, engine_analyze_song_sections, engine_audit_arrangement, engine_audition_patch, engine_compose_song, engine_detect_tempo, engine_find_sounds, engine_find_splice_sounds, engine_listen, engine_listen_back, engine_mix_check, engine_read_skill, engine_refine_song, engine_remove_track, engine_replace_stem_part, engine_restore_original, engine_search_patches, engine_separate_stems, engine_set_instrument_patch, engine_set_patch, engine_set_pattern_steps, engine_song_brief, engine_stem_status, engine_swap_sound, engine_write_pattern_notes. Undo and job polling stay interactive. |
There is no app-wide hard limit: app-wide volume above 6000 requests per minute only alerts Freestyle and never refuses a request.
Expensive server work has dedicated per-user budgets on top of the interactive one. They apply to every account:
| Budget | Default | Operations |
|---|---|---|
Fetches (details.bucket fetch) | 30 per hour per user | addAudioFromUrl, and createProject with a YouTube or URL source |
Exports and renders (details.bucket export) | 60 per hour per user | exportMix, and the render_share and render_live_window engine actions |
Splice searches (details.bucket external_search) | 120 per minute per user | searchCatalogSpliceSounds, previewCatalogSpliceSound |
Sound previews (rate_limited, with Retry-After) | 120 preview requests per minute and 900 distinct sounds per hour per user, shared with Studio playback (previewing the same sound again within the hour is free) | previewCatalogSound |
| Stem splits | 1 per 5 minutes, 2 per hour and 10 per day per user, shared with the Studio | splitClipStems (refunded when no GPU job was queued) |
| Listening renders | 60 per hour per user, shared with MCP | listenToProject |
Responses carry X-RateLimit-Limit and X-RateLimit-Remaining for the per-user bucket. An exhausted budget answers 429 rate_limited with Retry-After (seconds) and details.bucket (user, app_user, fetch, export or ai). Wait at least that long. Uploads and sample edits have their own quotas; all budgets are on Rate limits & errors.
Engine actions and live state
Every live-engine action of the Pro catalog is available as typed REST, for anything the dedicated resource groups do not cover.
- Catalog.
GET /engine/actionslists each action with its typed argument schema, family, risk, whether it mutates, the scope and project role it needs, its rate class and the operation that runs it. Filter withfamilyormutates. - Typed operations. Each action has its own operation,
POST /projects/{project_id}/engine/actions/<action>, with the operationIdengine_<action>and the action's argument schema as the request body. A generated client therefore gets one typed method per action. The genericPOST …/engine:executetakes{action, arguments}and runs any action by name with the same rules. Unknown argument keys are rejected with400, as the typed schemas declare. - Rules. Only an explicit list of pure reads (transport, clock, session and history status, track, bus and plug-in reads, waveforms, patterns and the timing map) need just
daw:readand the viewer role; the catalog marks them. Every other action needsdaw:writeand the editor role and takes anIdempotency-Key. That includes analysis tools that render audio, call a model or write project notes (such aslisten,mix_checkandsong_brief). Destructive actions needconfirm=true. Actions are interactive and never counted as Mozart AI usage, with two exceptions: the generativecomposefamily, stems included, pays the AI quota as on MCP (for a deterministic split use the typed, interactivesplitClipStemsinstead;stem_statusis a pure read), and offline renders (render_share,render_live_window) pay the export budget, likeexportMix. The engine's own error codes and HTTP status come back in the envelope (error.code,error.engineStatus). - Live state.
GET …/engine/statereturns session, transport, tracks, live clips with their ids, buses, history status, patterns and the mix in one read.GET …/engine/tracksandGET …/engine/mixread just the tracks or just the mix; the mix carries its revision (see Mixing safely). A typed engine action that writes the mix accepts the mixIf-Matchtoo. - MIDI audition.
POST …/engine/midiplays notes now: one note, orevents(1 to 64) withnote0 to 127,actionnote_onornote_off,velocity0 to 1 andchannel1 to 16. Malformed input is rejected before the engine.…/engine/midi:allNotesOffsilences an instrument. - Recording.
POST …/recording:start,GET …/recordingandPOST …/recording:finalize(needsconfirm=true). The take's audio never travels through this API: the client streams its microphone to the engine on its own WebRTC uplink (POST …/live-ingest/offer) and marks the take withtake_start/take_stopon the uplink's data channel; finalize saves it bytake_id. The take is recorded as you, and scanned and promoted to a clip exactly like a take recorded in the Studio. A count-in (count_in_beats) returns at its boundary. To add an existing audio file instead, useuploadAudiooraddAudioFromUrl. - Engine history.
GET …/history,POST …/history:undoandPOST …/history:redoexpose the Studio's undo log.- It holds only edits the Studio recorded. Edits made through this API are not in it, so
history:undonever reverts them. history:undoandhistory:redoonly move the log's cursor and return theentry. Your client must apply that entry's before or after state, as the Studio does.- To undo your own API edits, use the undo objects they return:
undofrom clip moves,undo.inverse_opsfrom time-range edits and region effects (post them toclips:batch), sample-edit undo, timing-map undo,undo.beforeandundo.restoreTokenfrom pattern-placement deletes (post both to:restore, which brings back the same placement id with its automation; the token is signed, bound to that deletion and your account, and valid for 24 hours) andai:undo. Channel Rack writes (addPatternChannel,updatePatternChannel,deletePatternChannel) answerundo: {method, path, body, timelineRevision}: sendbodytopath(relative to/api/v1) withmethod, exactly as it is, withIf-Match: timelineRevision. The olderopfields are still there, and posting the whole undo object as a body is accepted (op,method,path,bodyandtimelineRevisionare ignored).assignPatternChannelToNewTrackanswersundo.steps: two such requests, run in order. An audio import (uploadAudio/addAudioFromUrl, which make a lane) is undone withdeleteLane: the lane also leaves the running engine session at once (liveEngine.applied), so it stops sounding and drops out ofgetEngineState/listEngineTracks;:restorebrings it back and reloads its clips into the session. - Send an
Idempotency-Keyso a retry never steps twice.
- It holds only edits the Studio recorded. Edits made through this API are not in it, so
Mixing safely
A Studio user mixes directly on the live engine, so an agent's write can land on a fader a person just moved. The engine keeps one mix revision that every mix change bumps, whoever made it (the Studio's direct fader, pan, mute, solo and routing moves, other agents, the WebRTC control channel, a session reload; lanes and buses added or removed). Automation playback and meters never bump it. Use it as a compare-and-set:
- Read
GET …/engine/mix: master gain, every lane's gain, pan, mute, solo and bus, every live bus's gain, mute and solo,mixRevision, andETag: "mix-<n>". - Write with
If-Matchset to that ETag (or sendexpected_mix_revisionin the body) onsetLaneGain,setLanePan,setLaneMute,setLaneSolo,setLaneRouting,setMasterGain,setMasterPan,setBusGain,setBusPan,setBusMute,setBusSoloand the mix fields (volume,pan,muted,soloed) ofupdateLane(there,If-Match: "mix-<n>"is the mix precondition and any otherIf-Matchis the timeline revision). The engine compares and applies under one lock, so if anyone changed the mix since your read, nothing is applied and the answer is412 mix_revision_conflictwithdetails.currentMixRevision. A successful write answers the newmixRevisionandETag, ready for your next write. - Move several controls at once with
POST …/engine/mix:apply:{"changes": [...]}with up to 64 of{"target": "lane", "lane_id", "gain"?, "pan"?, "muted"?, "soloed"?, "bus_id"?},{"target": "master", "gain"?, "pan"?}and{"target": "bus", "bus_id", "gain"?, "pan"?, "muted"?, "soloed"?}(bus_pan/master_panare accepted as aliases ofpanon bus / master changes). Every change is validated before any applies (one value per control; gain 0 to 4, pan -1 to 1), and the whole move is one revision step.response.undo_changesis the inverse batch: send it back tomix:applywith the new ETag to undo the move as one step. The Studio's native history is client-logged, so the move is not added to it. - Wait for changes instead of polling:
GET …/engine/mix:wait?if_none_match=<n>&wait_ms=10000returns the new mix as soon as the revision differs, or304afterwait_ms(at most 10 s; at most 2 waits in flight per user and 32 per server,429+Retry-Afterbeyond). It has its ownwaitrate class and holds no database connection while waiting.getEngineMixwithIf-None-Matchanswers304while nothing changed. - Plug-in parameters: send
expected_value_norm(thevalueNormyou read) withsetLanePluginParameter, plusexpected_plugin_instance_idto pin the slot. If the parameter moved by more than 1e-4, the write is refused with412 plugin_parameter_conflict(details.currentValueNorm). Hosted plug-ins are compared on the engine in the same step as the write; native effects under the engine's parameter-write lock.
What is saved. Lane faders are saved with the project like the Studio's (setLaneGain and mix:apply lane gains write the lane's volume, which get_project shows and a reload restores; the beat writes backing_gain), unless you pass persist: false while sweeping. Lane pan and master gain are saved the same way; lane mute and solo write the same lane and clip rows as the Studio's M/S buttons. Bus pan and master pan (equal-power balance after the bus or master fader, smoothed) are live session state: a reopened project starts centered.
Pattern lanes. setLaneMute / setLaneSolo on a pattern lane mute its placements exactly like the timeline row's M/S (so the Studio's button lights) and the lane's own mixer track in the engine, so getEngineMix shows it and mix:wait wakes. When a Studio user clicks the row's M/S instead, the lane row and its mixer track follow the placements, so the two never disagree: unmuting from either side unmutes both. mix:apply takes pattern-lane mute/solo too (a lane with trackType: "pattern"), with the same effects: the mixer track flag, the placements' mute/solo rows and the engine's realtime placement filter change in the same mix revision as the rest of the batch. Soloing a pattern lane also unmutes it (as the button does) unless the same change names muted, so response.results may carry an extra muted row and undo_changes restores both. The reply's patternRuntimeMuted lists the lanes and placements written; sameRevision: false means an older engine applied the placement filter as one extra revision step (the reply's mixRevision / ETag is already the latest). A legacy rack lane with placements but no mixer track is still 400 unsupported_mix_field: use setLaneMute / setLaneSolo there.
db_persisted in mix:apply results. Each response.results[] row says whether that control was saved with the project: true for a lane gain (unless persist: false), lane pan, routing, master gain and lane mute/solo; false for live-only controls (bus gain/mute/solo, bus and master pan, persist: false sweeps) and for a change that failed.
Older engines. A live engine that predates mix revisions reports mixRevision: null and no ETag. A write that carries If-Match, expected_mix_revision or expected_value_norm is then refused with 409 engine_update_required and nothing is applied: the API never drops a precondition and writes anyway. The same writes without a precondition keep working. The Studio itself never sends a precondition, so it is unaffected.
Catalog, plug-ins and instruments
Three resource groups let an interface browse what it can use and add it to a project without MCP. They follow every convention above; the notes below are what is specific to them.
Plug-in catalog
listPluginCataloglists every plug-in a lane or bus can host by catalog id, with itskind(effectorinstrument),format(vst3ornative), category and preset catalog. Filter withkind,formatandq. Withproject_id(editor role) instrument availability is checked on that project's engine host; native effects are always available, and hosted effects reportinstalled: nullbecause the engine has no probe for them.include_presets=trueinlines the named presets of plug-ins that have a preset catalog (Nectar, AutoTune);getCatalogPluginreads one entry.addLanePluginappends a plug-in to a lane by catalog id, exactly as the Studio's add-plug-in menu does (the plug-in gets an instance id and survives a reload). It answers201withpluginIndexandinstanceId.position(aliasplugin_index, 0-based) inserts it at that slot in the same request instead of appending; the plug-ins from that slot on move down one, live and in the saved chain. Instruments are refused here (400 invalid_track_kind; create an instrument lane instead), and so are vocal suites on instrument lanes.addBusPlugindoes the same for a bus, the master bus included (hosted effects only; see Master effects). Limitation: the engine has no add-by-catalog-id for buses, so the plug-in must be installed at its catalog location on the project's engine host. Otherwise the answer is409 plugin_not_installed_on_host, and host paths are never echoed.- Host file paths are never accepted. A body with
path,plugin_pathor a similar field, or aplugin_idthat looks like a path or a bundle name, is400 invalid_argumentwithdetails.refusedFields, and nothing reaches the engine. Responses never contain host paths either. deleteLanePluginremoves the plug-in in one slot. The server reads the slot's instance id in the same request and removes that instance, so a stale index never removes another plug-in. Sendexpected_plugin_typeto also pin the catalog id; a mismatch is412 precondition_failedwithdetails.currentPluginType. As with every ordinaryDELETE, noconfirmis needed. The remaining plug-ins move up one slot, and the saved chain is renumbered the same way, so positions never collide.- Undoing a plug-in delete.
deleteLanePluginanddeleteLanePluginInstanceanswerremoved.restore(PluginRestoreState): the plug-in'stypeId,name,bypassed, thepositionit held and itsstate, an opaque base64 blob (a hosted plug-in's saved chunk, read from the running plug-in just before the delete; for a native effect, its parameters and EQ curve).removed.restore.addLanePluginis the ready-made body: post it toaddLanePlugin(plugin_id,state,bypassed,position,instance_id) and the plug-in comes back in the same slot, under the same instance id, with exactly its settings, restored the way a saved chain is restored on load.stateis at most 4 MiB (413 payload_too_large; a larger state is returned asnullwithstateOmitted: "too_large"), and aninstance_idthe lane already has is409 plugin_instance_exists. listLanePluginParametersandlistBusPluginParametersdiscover a slot's parameters: a host-stableid(index:Nwhen the host has none),name,unit,range(normalized 0 to 1, the unitsetLanePluginParametertakes; native slots addrawMin/rawMax),stepswhen the host reports it,defaultand the currentvalue. They are paginated; the slot summary (name, catalog id, instance id, current program) is inplugin. Use theindexfor writes and theidas the durable identity.
- Slot preconditions. A slot index is a position, not an identity.
setLanePluginParameter,setLanePluginBypassed,applyLanePluginPresetandsetLanePluginProgramacceptexpected_plugin_instance_idandexpected_plugin_type(theinstance_id/type_idfromlistLanePlugins). If the slot now holds another plug-in, the answer is409 plugin_instance_mismatchwithdetails.currentInstanceIdanddetails.currentPluginType, and nothing is written. The engine write is pinned to the instance the server just checked, so a plug-in swapped in during the request is refused too. - Editor windows. After
openPluginEditor, pollgetPluginEditorFramefor the window as a JPEG (editor role; at most 2 frame requests in flight per user, more get429). Send the lastX-Editor-Revisionasif_revisionwithwait_msto get304until the frame changes; the engine answers as soon as an input event has reached the editor and it repainted, so request the next frame as soon as one arrives. For frames pushed without a round trip per frame, subscribe on your monitoring WebRTC peer (Live plug-in editor frames). Drive it withsendPluginEditorPointer(down, move, up with onegesture_id, coordinates normalized 0 to 1),sendPluginEditorScrollandsendPluginEditorKeys(editor role). A pointer up, a scroll and keys are confirmed by their effect: a plug-in parameter or the editor's pixels changed. Otherwise the answer isok: falsewithcode: input_unconfirmed; an event that was only handed to a window is never reported as delivered.code: not_hit_testable(delivery: "rejected") means nothing was sent: the engine host could not make the slot's editor the window under the pointer (another window covers it, it is off-screen or minimized, or the host's display is locked). Re-open the editor withopenPluginEditorand retry; repeating the same event does not help.no_editor_viewmeans the point hit no view inside the editor (outside its content), anddispatch_failedmeans the host refused the event. None of these is retried by the server. The frame always comes from the slot's own editor window (X-Editor-Window-Id,X-Editor-Plugin-Instance-Id).X-Editor-Frame-Stale: 1means the parameters moved but the editor did not repaint. No open editor is always409 editor_not_open. These use their own rate class. Close withreleasePluginEditor. Built-in (native) effects have no editor window: their rows carryhasEditor: falseand editor requests answer409 editor_not_available(final; uselistLanePluginParametersinstead).plugin_indexon every editor route is the indexlistLanePluginsreports; on an instrument lane, index 0 is the instrument itself, so…/plugins/0/editor:openopens the instrument's editor.
curl -X POST https://freestyle.audio/api/v1/projects/<project_id>/lanes/<lane_id>/plugins \
-H "Authorization: Bearer $FREESTYLE_TOKEN" \
-H "Idempotency-Key: 0b8f7a1e-2c55-4c0e-8d1f-7e7c1f3a9d42" \
-H "Content-Type: application/json" -d '{"plugin_id": "native-reverb"}'Master effects
The master bus has a real insert chain. Address it as bus_id master on the bus plug-in routes, exactly like any other bus. It processes the final mix (every lane, every bus and the beat) before the master fader and pan and before the output limiter, both in live playback and in exports (the engine render behind render_share; stems and pattern bounces are not master-processed).
- Add with
addBusPlugin(hosted effects by catalog id, the same ones a bus takes;positioninserts at a slot,bypassedcreates it bypassed). The answer carriespluginIndex,instanceIdandpersisted. - List the live chain with
listBusPlugins(index, name,type_id,instance_id,bypassed,hasEditor,chainLatencySamples) and the saved one withgetBusPluginStateorlistBuses(the master entry'spluginChain). - Change it with
moveBusPlugin,setBusPluginBypassed,listBusPluginParameters/setBusPluginParameter. - Remove and undo.
deleteBusPluginanswersremoved(BusPluginRestoreState: instance id, catalog id, bypass, slot and the plug-in's saved chunk with itsstateSignature, read from the running plug-in just before the delete) andundo, theaddBusPluginrequest that puts it back in the same slot under the same instance id with the same settings. Only a state a bus delete issued is accepted back (400 restore_state_invalid); a state over 4 MiB is omitted (stateOmitted: "too_large"). This works on every bus. - Editors. Hosted master inserts have the full editor contract under
…/buses/master/plugins/{plugin_index}/editor:openBusPluginEditor,getBusPluginEditorFrame,sendBusPluginEditorPointer,sendBusPluginEditorScroll,sendBusPluginEditorKeys,getBusPluginEditorStatus,closeBusPluginEditor,releaseBusPluginEditor, with the same semantics as the lane editor routes above. Other buses have no editor routes (409 editor_not_available,details.reason: "bus_editor_not_supported"); a built-in master processor has no editor (409 editor_not_available). - Saved automatically. The engine saves the master chain itself (order, bypass and the plug-in state, which is captured about 1.5 s after the last parameter or state edit) and restores it on every session load; project copies and project saves carry it.
saveBusPluginStateonmasteronly refines a saved insert (its fields merge); an unknownplugin_keyis404 not_found. - Latency. A master insert that reports latency delays the whole output equally, so nothing in the mix drifts against anything else. It counts as output latency:
getTransportClockproducer_latency_secondsincludes it (draw the playhead with it, see Realtime), and exports compensate it, so the file stays sample-aligned with the timeline. - Older engine hosts. A project whose engine host predates master effects answers master plug-in requests with
409 master_effects_not_supported(details.reason: "engine_outdated"); retry after the host is upgraded.
curl -X POST https://freestyle.audio/api/v1/projects/<project_id>/buses/master/plugins \
-H "Authorization: Bearer $FREESTYLE_TOKEN" \
-H "Idempotency-Key: 6f1d2c3b-4a5e-4f60-8172-93a4b5c6d7e8" \
-H "Content-Type: application/json" -d '{"plugin_id": "tdr_kotelnikov"}'Instruments
listInstrumentCataloglists instrument generators by catalog id with their captured patch catalog (LABS, Omnisphere, Splice INSTRUMENT, Xpand!2),creatable, and, withproject_id, host availability.createInstrumentLanecreates an instrument lane with a catalog instrument loaded, the same flow the Studio uses.presetnames a patch from its catalog;roleandarticulationpick one by role. It runs no audition renders and writes no notes: add musical content afterwards. Like other lane writes it honoursIf-Match(timeline revision) and returns the new revision asETagandtimelineRevision.replaceLaneInstrument(PUT …/lanes/{lane_id}/instrument) swaps the instrument of an existing instrument lane in place, like the Studio's Sound Library replace: the new instrument is loaded and saved first, then the old one is removed, so a failed load leaves the lane as it was. The lane keeps its id, name, row, patterns, notes, pattern clips, effects, sends and mix; its pattern channels keep playing it.instrument_idis a creatable catalog id andpresetoptionally names a patch from the new instrument's catalog. The answer namespreviousInstrumentand carriesundo({method, path, body}): sendbodytopathwithmethodandIf-Matchto put the previous instrument back with its exact saved sound (body.restore_stateis signed and only accepted for that instrument). The new instrument sits at plug-in index 0 (pluginIndex). The same instrument with no preset isreplaced: falseand changes nothing. It honoursIf-Matchand returns the new revision.
Catalog search
The catalog group is read-only search over the libraries the user can reach, one operation per kind of item, each with the scope of the matching MCP tool: sounds (browseCatalogSounds, auditioned without touching a project through previewCatalogSound, which returns a short-lived credential-free previewUrl served straight from media storage), Splice (searchCatalogSpliceSounds, previewCatalogSpliceSound), effect presets (listCatalogEffectPresets), vocal chain presets (listCatalogVocalChainPresets, getCatalogVocalChainPreset), plug-in presets (listCatalogPluginPresets, getCatalogNectarPreset, listCatalogPresetPackItems), drum kits (listCatalogDrumKits), beats (searchCatalogBeats) and the marketplace (browseCatalogMarketplace, listCatalogMarketplaceFeed).
- Results hold only what the user may see. A
project_idorsong_project_idfilter checks the project role first, so another user's project is404 not_found. - Every list uses the cursor pagination above. Beats, the marketplace feed and preset pack items page through the source's own pages (their
limitmaximum is lower: 25, 50 and 100), and the page size is part of the cursor. The other lists return one bounded window of results that you page with the cursor; narrow the query to see past it. - The marketplace feed order is fixed by
seed(default0), so pages never repeat or skip; another seed reshuffles. - Preview and cover URLs can be short-lived. These operations are all
GETs, so a response is never stored for anIdempotency-Keyreplay; read again for a fresh link.
Versioning
- The major version is in the path:
/api/v1. Within v1, changes are additive only: new operations, new optional parameters, new response fields and new error codes. Ignore fields you do not know, and handle an unknowncodeby its HTTP status. - Fields are never renamed or removed, and types are never changed, within v1. Such a change needs a new major version path.
info.versionin the OpenAPI document tracks the published contract. The document is generated from the server's registry and checked against a committed snapshot on every change, and the reference is rendered from the same snapshot, so the docs cannot drift from the server.
Where to go next
- Build a DAW UI: an end-to-end editing session.
- Realtime: sessions & audio: the interactive session WebSocket and WebRTC monitoring.
- Studio API reference: every operation.