Skip to content
API reference / Authentication
Open app

Authentication

Use caseRecommended method
Server-to-server automationService account
User-driven CLI or tool loginMagic code or CLI browser login
AI client with user consentMCP OAuth

Choose the auth flow based on who is acting:

  • a backend service should use a service account
  • a human operator in a tool or CLI should use a user login flow
  • an MCP client acting on behalf of a signed-in user should use OAuth

Service-account flow

Service accounts are created at the workspace level and exchange clientId plus clientSecret for bearer tokens.

Terminal window
curl -X POST "$COLABRA_API_URL/v1/auth/service-account/token" \
-H "Content-Type: application/json" \
-d '{
"clientId": "'"$CLIENT_ID"'",
"clientSecret": "'"$CLIENT_SECRET"'"
}'

The response returns:

  • access_token
  • refresh_token
  • expires_in_seconds
  • service-account metadata

Use the returned bearer token on /v1 requests.

This is the default for scheduled jobs, internal automations, and system-to-system integrations where no person is present at runtime.

Refresh and logout

MethodPathPurpose
POST/v1/auth/refreshRotate a refresh token into a new access-token pair
POST/v1/auth/logoutRevoke the active bearer token and optional refresh token

/v1/auth/refresh requires both refreshToken and clientId.

User login flows

Magic-code login

MethodPathPurpose
POST/v1/auth/login/startStart login by email, optionally with a CLI redirect URI
POST/v1/auth/magic-code/startSend a magic code directly
POST/v1/auth/magic-code/verifyExchange email and code for tokens

Use this flow for operator-facing tooling where a human can receive and enter a code.

CLI browser login

The CLI/browser flow is designed for tools that want to hand off login to the browser and then poll until completion.

MethodPathPurpose
POST/v1/auth/cli/startStarts a browser-based CLI login flow
GET/v1/auth/cli/browser-completeBrowser completion endpoint
GET/v1/auth/cli/pollPolls for pending, complete, or error state
GET/v1/auth/cli/callbackSSO callback for CLI flows

Identity and workspace context

MethodPathPurpose
GET/v1/meReturn the authenticated principal and visible workspaces
GET/v1/workspacesList workspaces the principal can access

Service-account management

These endpoints require a user principal with workspace integration permissions.

MethodPathPurpose
GET/v1/service-accountsList service accounts for a workspace
POST/v1/service-accountsCreate a new service account
POST/v1/service-accounts/{serviceAccountId}/rotateRotate credentials
POST/v1/service-accounts/{serviceAccountId}/revokeRevoke the service account

When a service account is created, Colabra also generates a webhook signing secret.

MCP OAuth

The MCP server uses OAuth endpoints rather than service-account bearer exchange.

MethodPathPurpose
GET/.well-known/oauth-authorization-serverOAuth server metadata
GET/.well-known/oauth-protected-resource/mcpProtected resource metadata
GET/mcp/oauth/authorizeAuthorization step
POST/mcp/oauth/authorize/decisionConsent decision
POST/mcp/oauth/registerDynamic client registration
POST/mcp/oauth/tokenToken exchange

The MCP scope currently exposed is mcp:tools.

Use MCP OAuth only for MCP clients. It is not a general replacement for bearer-token auth on /v1.