Skip to main content
To securely access and interact with Sourcebot’s API, authentication is required. Users must generate an API Key, which will be used to authenticate requests.
If anonymous access is enabled, some endpoints will be accessible without a API key.

Creating an API key

Navigate to Settings → API Keys and click Create API Key. Copy the value - it is only shown once.
API Keys page in Sourcebot Settings

Using an API key

Pass your API key as a Bearer token in the Authorization header on every request.
For example, to call the /api/search endpoint:

Using a scoped access token

Scoped access tokens are short-lived bearer credentials intended for clients that should only access a specific set of repositories. Create one with a Sourcebot API key by calling POST /api/ee/scoped_access_token with repository names:
The response contains an opaque token beginning with sbst_. It expires exactly one hour after issuance, cannot be refreshed, and is returned only once. Use it as a Bearer token with public API endpoints or the Sourcebot MCP server:
Repository scope is bound internally to repository IDs and is also intersected with the creating user’s current repository permissions. Creating and revoking scoped access tokens requires an API key; a scoped access token cannot mint or revoke tokens.