FreestyleDevelopers Open the app

Authentication

Freestyle is an OAuth 2.1 authorization server. The MCP endpoint and the Studio API v1 are its protected resources and accept the same user access tokens and scopes. MCP clients register themselves and obtain a user token with the authorization-code flow; enterprise partner apps are confidential clients that also mint organization tokens with client_credentials.

Discovery

EndpointPurpose
GET /.well-known/oauth-protected-resourceRFC 9728 protected-resource metadata: resource (the MCP URL), authorization_servers, scopes_supported, bearer_methods_supported: ["header"]. Also served at the path-suffixed /.well-known/oauth-protected-resource/api/mcp.
GET /.well-known/oauth-authorization-server
GET /.well-known/openid-configuration
RFC 8414 authorization-server metadata (below).
POST /api/oauth/registerDynamic client registration (RFC 7591).
GET /oauth/authorizeConsent page (browser).
POST /api/oauth/tokenauthorization_code, refresh_token, client_credentials (organization clients only).
POST /api/oauth/revokeToken revocation (RFC 7009).
GET /api/oauth/grants, POST /api/oauth/grants/{id}/revoke"Connected apps" for a signed-in app session (what the account page uses).
{
  "issuer": "https://freestyle.audio",
  "authorization_endpoint": "https://freestyle.audio/oauth/authorize",
  "token_endpoint": "https://freestyle.audio/api/oauth/token",
  "registration_endpoint": "https://freestyle.audio/api/oauth/register",
  "revocation_endpoint": "https://freestyle.audio/api/oauth/revoke",
  "response_types_supported": ["code"],
  "response_modes_supported": ["query"],
  "grant_types_supported": ["authorization_code", "refresh_token", "client_credentials"],
  "code_challenge_methods_supported": ["S256"],
  "token_endpoint_auth_methods_supported": ["none", "client_secret_basic", "client_secret_post"],
  "revocation_endpoint_auth_methods_supported": ["none", "client_secret_basic", "client_secret_post"],
  "scopes_supported": ["ai:use", "audio:listen", "daw:read", "daw:write", "exports:read", "media:upload",
                       "offline_access", "profile:read", "projects:list", "projects:read", "projects:write"]
}

The 401 challenge

An unauthenticated call to POST /api/mcp answers 401 with a challenge that points at the resource metadata and lists the scopes the server supports, so a client can bootstrap discovery without configuration:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://freestyle.audio/.well-known/oauth-protected-resource", scope="ai:use audio:listen daw:read daw:write exports:read media:upload offline_access profile:read projects:list projects:read projects:write"
Cache-Control: no-store

{"error": "Unauthorized"}

A tool call with a token that lacks the tool's scope is not a transport error: it returns a normal isError: true tool result whose _meta["mcp/www_authenticate"] carries a challenge with error="insufficient_scope" and the required scope.

Dynamic client registration

POST /api/oauth/register
Content-Type: application/json

{
  "client_name": "My assistant",
  "redirect_uris": ["http://localhost:8765/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none",
  "scope": "profile:read projects:list projects:read projects:write daw:read daw:write ai:use audio:listen offline_access"
}
HTTP/1.1 201 Created

{
  "client_id": "fst_dcr_…",
  "client_id_issued_at": 1767225600,
  "client_name": "My assistant",
  "redirect_uris": ["http://localhost:8765/callback"],
  "response_types": ["code"],
  "grant_types": ["authorization_code", "refresh_token"],
  "token_endpoint_auth_method": "none",
  "scope": "ai:use audio:listen daw:read daw:write offline_access profile:read projects:list projects:read projects:write"
}
  • client_name is required (up to 128 printable characters). logo_uri, if given, must be https.
  • redirect_uris: one to ten exact URIs, no duplicates.
  • Only the authorization-code flow can be registered: response_types must be ["code"], grant_types must include authorization_code and may include refresh_token. The server always stores both — every grant receives a rotating refresh token. client_credentials cannot be registered dynamically; it is reserved for organization clients created by an admin.
  • token_endpoint_auth_method: none (public client, the default), client_secret_basic or client_secret_post. A confidential registration returns client_secret exactly once (client_secret_expires_at: 0); only its SHA-256 hash is stored.
  • scope narrows the client's ceiling (see Scopes). Omit it to allow every user scope.
  • Registration is rate limited per IP (300 per hour; 3000 per hour in a separate bucket when every redirect URI is a Claude or ChatGPT callback); the body is capped at 16 KB.

Accepted redirect URIs

Redirect URIAccepted?
RFC 8252 loopback: http://localhost…, http://127.0.0.1…, http://[::1]… (any path, any port)Yes. The port may differ between registration and authorization.
https://claude.ai/api/mcp/auth_callback, https://claude.com/api/mcp/auth_callbackYes (exact).
ChatGPT connector callbacks on https://chatgpt.com/…Yes (the documented callback paths only).
Any other https:// URLYes, as long as it has no userinfo and no fragment.
Custom schemes (myapp://, cursor://), plain http:// on a non-loopback host, URLs with credentials or a #fragmentNo — 400 invalid_client_metadata / invalid_redirect_uri.

Authorization code with PKCE

Send the user's browser to the consent page. PKCE with S256 is mandatory; plain is not accepted.

GET /oauth/authorize
  ?response_type=code
  &client_id=fst_dcr_…
  &redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Fcallback
  &scope=profile%3Aread%20projects%3Alist%20projects%3Aread%20daw%3Aread%20offline_access
  &state=opaque-state
  &code_challenge=…
  &code_challenge_method=S256
  &resource=https://freestyle.audio%2Fapi%2Fmcp
  • redirect_uri must match a registered URI exactly (loopback: scheme, host, path and query must match; the port may change).
  • scope is a space-separated subset of the client's ceiling. Anything outside it, or an unknown scope, is refused with invalid_scope before the user sees anything. Omit scope to request the whole ceiling.
  • resource (RFC 8707) is optional and defaults to the MCP URL. If present it must be exactly that URL (invalid_target otherwise). The value is bound through the code to the token and checked on every call.
  • state is returned untouched (up to a sane size).

The consent screen

The user must be signed in to Freestyle (the page offers sign-in; the authorize URL is remembered across the sign-in round trip, including email-link sign-in) and must have Pro access. The screen shows the client's name, its kind (AI assistant or organization app), the organization for partner apps, the host it will return to, and one row per requested scope with a short description and a writes badge on scopes that can change the user's projects. A summary line counts how many of the permissions can write. Approve redirects to redirect_uri?code=fst_ac_…&state=…; Deny redirects with error=access_denied. Codes live 10 minutes and are single use.

Token endpoint

POST /api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=fst_ac_…
&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Fcallback
&client_id=fst_dcr_…
&code_verifier=…
&resource=https://freestyle.audio%2Fapi%2Fmcp
{
  "access_token": "fst_at_…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "fst_rt_…",
  "scope": "daw:read offline_access profile:read projects:list projects:read"
}
  • Public clients identify themselves with client_id in the body. Confidential clients authenticate with client_secret_basic (HTTP Basic client_id:client_secret, preferred) or client_secret_post (client_secret in the body). Sending a different client_id in the Basic header and the body is rejected as ambiguous. A wrong or missing secret answers 401 invalid_client with WWW-Authenticate: Basic realm="freestyle-oauth".
  • code_verifier must hash (S256) to the challenge sent at authorization; redirect_uri and resource must match the authorization request.
  • A used, expired or mismatched code answers 400 invalid_grant.

Token lifetimes

TokenLifetimeNotes
Authorization code fst_ac_10 minutesSingle use.
Access token fst_at_3600 seconds (1 hour)Issuing a new pair revokes the grant's previous access token.
Refresh token fst_rt_7776000 seconds (90 days)Rotates on every use.
Partner token fst_pat_28800 seconds (8 hours)client_credentials only; see Enterprise.

Codes and tokens are stored only as SHA-256 hashes; Freestyle cannot show a token again after issuing it.

Refreshing

POST /api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&refresh_token=fst_rt_…&client_id=fst_dcr_…
  • Every refresh returns a new access token and a new refresh token; the old refresh token is revoked.
  • Reuse detection: presenting a refresh token that was already rotated revokes the whole grant (400 invalid_grant, "Refresh token reuse revoked this connected app"). The user has to authorize again.
  • scope may narrow the grant on refresh (never widen it); resource, if sent, must equal the grant's resource.
  • A refresh also fails with invalid_grant when the grant was disconnected, the client was disabled, the user lost access, or the account's sessions were invalidated.

Scopes

Every tool and endpoint names exactly one required scope. A client's ceiling — set at registration through scope (default: all user scopes) or by an organization admin for partner apps — is a hard limit: a request for a scope outside it is refused at authorization time, not merely at use time. Scopes marked writes are the ones an admin leaves off for read-only partners.

User scopes

Granted by a signed-in person on the consent screen to an MCP client or to a partner app acting for that person.

ScopeGrantsAccess
profile:readSee your Freestyle profile (name, username, avatar).read
projects:listList the Freestyle projects available to your account.read
projects:readRead project contents: lanes, takes, backing track, key and tempo.read
projects:writeCreate, rename, duplicate, share and delete your projects.writes
media:uploadAdd audio files and YouTube backing tracks to your projects.writes
daw:readRead live studio state: transport, tracks, mixer, plugins and history.read
daw:writeChange your projects through Mozart's reviewed DAW actions.writes
ai:useRun Mozart AI commands on your projects.writes
audio:listenRender and listen to short excerpts of your projects.read
exports:readList and download your rendered exports.read
social:readBrowse Discover, posts, comments, profiles, people and your notifications.read
social:writePost your projects, like, comment, follow people, manage friends and blocks.writes
messages:readRead your direct message conversations.read
messages:writeSend direct messages and start conversations.writes
profile:writeEdit your profile, username, avatar, settings and account (including deletion).writes
live:readSee your live sessions, rooms, members and queues.read
live:writeCreate, join, manage and end live sessions and their queues.writes
library:readBrowse presets, sound packs, drum kits, templates and the marketplace.read
library:writeSave, publish and manage your presets, drum kits and marketplace assets.writes
organization:manageManage your organization as an admin: members, invites and partner apps.writes
offline_accessStay connected with a refresh token (no re-login for 90 days).read

Organization scopes

Carried only by partner tokens minted with client_credentials. They are never shown on a consent screen and a partner token can never hold a user scope.

ScopeGrantsAccess
org:readRead the organization profile and settings.read
org:members:readList organization members and their link to the partner's user ids.read
org:members:writeAdd, update or remove organization members.writes
org:launchMint signed 'Open in Freestyle' launch links for the partner's users.writes
org:projects:readRead projects that members have shared with the organization.read
org:projects:writeCreate projects and import files for consenting members.writes
org:usage:readRead organization usage and rate-limit statistics.read

Confidential clients and client_credentials

Enterprise partner apps are confidential clients created in the organization console (client id fst_org_…, secret fst_sec_…). They use the same token endpoint:

curl -s https://freestyle.audio/api/oauth/token \
  -u "fst_org_EXAMPLE0000000000000000000000:fst_sec_EXAMPLE…" \
  -d grant_type=client_credentials \
  -d "scope=org:read org:members:read org:launch"

The grant is accepted only for an enabled organization client with a secret; any other client answers unauthorized_client. Details, errors and limits are on the Enterprise page. A partner app can additionally run the authorization-code flow above to act for an individual member (its registered redirect_uris apply), which is how a member's consent grant is created outside a launch link.

Using a token

Authorization: Bearer fst_at_…

On /api/mcp the token must be an access token issued for that resource; the server also re-checks, on every call, that the grant is not revoked, the client is enabled, the account still has Pro access and the account's sessions were not invalidated after the grant was created. Partner tokens (fst_pat_) are accepted only by /api/enterprise/v1/*, never by the MCP endpoint or the Studio API.

The Studio API v1 (/api/v1) accepts exactly the access tokens /api/mcp accepts, with the same checks, so one authorization serves both. Request tokens with resource omitted or set to the MCP URL. An invalid, expired or revoked token on /api/v1 answers 401 unauthorized in the Studio API error envelope with a WWW-Authenticate challenge, and a token without an operation's scope answers 403 insufficient_scope.

Revocation

POST /api/oauth/revoke
Content-Type: application/x-www-form-urlencoded

token=fst_rt_…&client_id=fst_dcr_…

Answers 200 with an empty body. Revoking a refresh token revokes its grant and every token of that grant; a confidential client must authenticate to revoke. Users revoke from Account → Connected apps (Disconnect), which takes effect immediately. Organization admins can disable a partner app or rotate its secret, which revokes its partner tokens — and, for disabling, every member consent to that app.

Token and registration errors

The token, registration and revocation endpoints use the standard OAuth error body {"error": "…", "error_description": "…"}:

StatuserrorWhen
400invalid_grantUnknown, used, expired or mismatched code; invalid or rotated refresh token.
400invalid_scopeUnknown scope, scope outside the ceiling, or a user scope requested on client_credentials.
400invalid_targetresource is not the MCP URL.
400invalid_client_metadata, invalid_redirect_uriRegistration rejected (see above).
400unsupported_grant_typeAnything but the three supported grants.
400 / 403unauthorized_clientclient_credentials from a public or disabled client, or a suspended organization.
401invalid_clientWrong or missing client secret (plus WWW-Authenticate: Basic).
429 / 503slow_down, temporarily_unavailableToken-endpoint or registration budget exhausted; see Retry-After.
404—The OAuth surface is not enabled on this environment.

Freestyle developer documentation. Base URL https://freestyle.audio. Generated from the server's own registry and configuration.