API authentication
Choose a credential for the Bobsled AI API, send it with a request, act as an Account member, and fix authentication errors.
This page explains how to authenticate requests to the Bobsled AI API. It's for developers who write scripts, services, and clients. To create and govern these credentials in the app, see Developer access.
Choose an authentication method
Send exactly one credential with each request. Bobsled AI rejects a request that carries more than one credential family. Each operation in the API reference lists the credentials that it accepts.
The following table compares the methods:
Before you begin
The curl examples on this page read the following shell variables:
$BOBSLED_ORIGIN: your Bobsled AI URL, such ashttps://customer.dogsled.it.$BOBSLED_PROJECT_ID: the ID of the Project that you call.$BOBSLED_ACCOUNT_ID: the ID of your Account.
Each section lists the credential variables that its examples add. Store credentials in a local or hosted secret manager, never in a checked-in .env file.
Authenticate with a personal API key
A personal API key represents the user who owns it. Bobsled AI authorizes each request with the owner's current Account role, the owner's Project grants, and the Project on the request.
To create a key, in the user menu, select Personal API Keys, and then click Create API key. Choose api:read, api:write, or both, and an expiry of 7, 30, 60, or 90 days. Bobsled AI shows the key once. The /api/v1/me/personal-api-keys routes also create keys and accept an expiresInDays value from 1 to 90. For the complete steps, see Create a personal API key.
Send the key in the X-Dogsled-API-Key header. Don't also send a session cookie or a bearer token. The following command lists recent runs from one Project:
curl --fail-with-body --silent --show-error \
--header "X-Dogsled-API-Key: $BOBSLED_API_KEY" \
"$BOBSLED_ORIGIN/api/v1/projects/$BOBSLED_PROJECT_ID/pipeline-runs?limit=20"Set $BOBSLED_API_KEY to your personal API key.
To check whether an operation accepts a personal API key, and whether it needs api:read or api:write, see the API reference.
Authenticate with a service principal
A service principal represents software that the Account owns. An Account Admin creates it on the Machine credentials page. The Admin gives it selected Project grants or Whole organization access, and dogsled:api:read, dogsled:api:write, or both. For setup, see Create a service principal.
To call the API, exchange the client ID and client secret for a short-lived access token. Then send the token with each request.
Get an access token
Request a token from /api/auth/oauth2/token with the OAuth 2.0 client credentials flow. Send your Bobsled AI API resource, $BOBSLED_ORIGIN/api/v1, as the resource value. The following command requests a read-only token:
curl --fail-with-body --silent --show-error \
--user "$BOBSLED_CLIENT_ID:$BOBSLED_CLIENT_SECRET" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "resource=$BOBSLED_ORIGIN/api/v1" \
--data-urlencode "scope=dogsled:api:read" \
"$BOBSLED_ORIGIN/api/auth/oauth2/token"Set the following variables:
$BOBSLED_CLIENT_ID: the service principal's client ID.$BOBSLED_CLIENT_SECRET: the service principal's client secret.
The output is similar to the following:
{
"access_token": "ACCESS_TOKEN",
"token_type": "Bearer",
"expires_in": 300,
"expires_at": 1796083500,
"scope": "dogsled:api:read"
}The scope parameter works as follows:
- Request only the scopes that the integration needs. For both, send the space-delimited value
dogsled:api:read dogsled:api:write. - If you omit
scope, the token receives every scope that the service principal holds. - A scope that the service principal doesn't hold fails with
invalid_scope.
Each token lasts 5 minutes, and the response has no refresh token. Cache a token only for its lifetime, and request a new one before it expires. Never store a token as though it were the long-lived client secret. Requests from a disabled or revoked service principal fail closed.
Send the access token
Copy access_token into a secret variable, and send it in the Authorization header. The following command lists recent Project runs:
curl --fail-with-body --silent --show-error \
--header "Authorization: Bearer $BOBSLED_ACCESS_TOKEN" \
"$BOBSLED_ORIGIN/api/v1/projects/$BOBSLED_PROJECT_ID/pipeline-runs?limit=20"Set $BOBSLED_ACCESS_TOKEN to the access_token value from the token response.
Act as an Account member
A service principal with User impersonation turned on can send a request as one member of its own Account. Send the member's user ID in the x-dogsled-impersonate-user-id header with the bearer token. Get the user ID from the Account members list.
The following command lists chats as the selected member:
curl --fail-with-body --silent --show-error \
--header "Authorization: Bearer $BOBSLED_ACCESS_TOKEN" \
--header "x-dogsled-impersonate-user-id: $BOBSLED_USER_ID" \
"$BOBSLED_ORIGIN/api/v1/accounts/$BOBSLED_ACCOUNT_ID/chats"Set $BOBSLED_USER_ID to the user ID of the Account member.
Bobsled AI authorizes the request with that member's current Account role and Project grants. Chats and other user-owned records belong to that member. Logs record both the member and the service principal.
The header works only on /api/v1 routes. Bobsled AI rejects the request with 403 forbidden, and doesn't fall back to the service principal, in the following cases:
- The credential isn't a service-principal bearer token.
- The service principal has User impersonation turned off.
- The user isn't a current member of the service principal's Account.
- The route manages service principals or requires Whole organization access.
- The header value isn't a valid user ID.
A disabled service principal fails authentication with 401, with or without the header.
Authenticate an MCP client
An MCP client uses the OAuth flow that the Bobsled AI MCP server advertises. The consent page names the client and the requested access. The resulting MCP session is the only source of the actor for delegated tool calls, and tool arguments can't replace that verified identity. To connect a client, see MCP server.
Use a browser session
The Bobsled AI app uses a session cookie and sends it to the same origin. A session-authenticated mutation enforces the same-origin policy that its route declares. Don't copy session cookies into scripts or external services.
How Bobsled AI authorizes a request
Authentication proves the principal. Authorization then evaluates the Account, the Project, the credential's permission, the route policy, and the resource. Each principal gets Project access as follows:
- A service principal with selected Project grants needs the exact Project grant.
- A service principal with Whole organization access can reach every live Project in its organization.
- A personal API key inherits the user's current access.
After Bobsled AI authorizes a request, a provider operation can still fail at the external system. For the permissions that each role holds, see Permissions.
Rotate and revoke credentials
To rotate a personal API key, do the following:
- Create a replacement key.
- Update the consumer to use the replacement.
- Confirm that the consumer works with the replacement.
- Revoke the old key.
To rotate a service-principal credential, do the following:
- On the Machine credentials page, create or rotate the credential.
- Update the consumers.
- Request a token, and send an authorized request with it.
- Revoke the old secret.
Revoke a credential immediately after a suspected exposure. Keep a named owner and an expiration or review date for every credential.
Troubleshoot authentication
The following table lists common authentication errors:
When you diagnose a request, record the credential type, safe principal ID, scope, Project ID, route, status, timestamp, and correlation ID. Never record full key material, client secrets, bearer tokens, cookies, authorization headers, or secret-backed provider configuration.
What's next
- Call the Bobsled AI API to page through results, retry safely, and handle errors.
- Connect an MCP client to work from a coding agent with OAuth.
- Manage developer access to create, review, and revoke credentials as an Admin.
Bobsled AI API
Learn how the Bobsled AI REST API is organized and authorized, and complete common tasks such as paging, retries, Project grants, and connection tests.
MCP server
Connect an OAuth-capable MCP client, such as Claude, Codex, ChatGPT, or Cursor, to the Bobsled AI MCP server and verify the connection.