Skip to main content

Authentication

Send an API key as Authorization: Bearer YOUR_TOKEN to the origin that runs your Cocktail Manager app. The documentation site is not an API server. Use HTTPS for credentials outside local development.

CredentialUse it forWhat determines access
Workspace API key (WorkspaceApiKeyAuth)Background jobs, integrations and local scriptsOne workspace and the permissions granted to that key
App login session (SessionCookieAuth)Actions in the signed-in app, including session-only operationsThe signed-in user's identity, membership and role
Instance master key (InstanceApiKeyAuth)Privileged self-hosted instance administrationFull workspace access on routes that accept the master key; also certain master-only operations

Workspace API key​

A workspace API key is a signed JWT created by a workspace Admin or Owner in the app. It is not a login session, an OAuth access token from your identity provider, or a token you mint yourself. Treat it as an opaque credential: the server verifies its signature and expiry, reads current permissions from the database, and checks that the creator still holds an Admin or Owner role in that workspace. Merely decoding a JWT doesn't establish any of these facts.

The URL's {workspaceId} must be the key's workspace ID, not its display name or public guest-menu slug. IDs in the request body (for example an ingredient or cocktail in a write request) must also belong to the target workspace. An authenticated key used against another workspace or without the required scope gets 403. Valid scopes do not make a workspace key an Owner session.

GET /api/v1/me is an API-key-only check for both types of API key. It accepts a workspace key or the instance master key, but not an app session cookie. It returns { data: ... } with workspaceId, workspace ({ id, name } for a workspace key), permissions, apiKey (ID and name, not the token), and isMaster. It returns 401 if the API key is missing or rejected. See the quickstart for a test that doesn't mutate data.

App session and session-only operations​

The signed-in app uses a Better Auth session cookie. On workspace routes that accept both methods, requests without a valid API key can fall back to a valid session. Test an integration without cookies so an open browser session can't hide a broken key.

Creating or revoking API keys and leaving a workspace require a signed-in session; deleting the workspace requires an Owner session. Neither kind of API key substitutes for the session on these operations. Use the app UI for these actions; do not copy browser cookies into unattended scripts.

Instance master key (administration)​

An operator can configure INSTANCE_MASTER_API_KEY in the app server's environment. It is a separate server-configured secret, not a workspace JWT. On routes that accept it, it can target any workspace and bypasses ordinary workspace role and scope checks. It does not satisfy session-only operations, and operations that need a real user may impose additional requirements. With the master key, /api/v1/me returns isMaster: true and null for workspaceId and workspace.

Leave the master key unset if it's not needed. Never give it to a third-party integration or paste it into a browser API console. Use separate workspace keys instead. For server configuration, see Self-hosting.