Skip to main content
An OAuth client lets your server request an access token from Bland and use that token to call the API. The token lasts one hour. The client’s credentials stay on your server and go only to the token endpoint, never with an API request. Use OAuth clients when your security policy asks for short-lived tokens, or when you want a long-lived secret to stay out of every request. Use an API key when you don’t need that. A token reaches the same routes as a restricted API key with the same permissions.

Before you start

  • You must be an owner or admin of your organization.
  • You need access to OAuth clients. If you don’t see OAuth clients on Settings > API keys, contact Bland support.
  • You create and manage clients in the dashboard only. API keys and access tokens can’t create or manage them.
  • OAuth clients are in the V2 dashboard, at the addresses in the table below. Create the client in the dashboard for your organization’s region, and use that region’s API host. A client works only in the region where you created it.
The examples below use the EU host. Replace it with yours.

Create a client

1

Open the page

Go to Settings > API keys and find OAuth clients. Select Create OAuth client.
2

Name the client and pick permissions

Enter a name of up to 64 characters. Under Permissions, pick at least one. A token can never reach more than the client’s permissions. See Permissions.
3

Choose how the client signs in

Pick Client secret or Private key JWT.With Client secret, Bland generates a secret and shows it once. With Private key JWT, you sign each token request with your own private key, and you paste the matching public keys as a JWK Set. Each key needs a kid. Use RSA keys of at least 2048 bits, or EC keys on P-256, P-384, or P-521, with no private parameters.
4

Save the credentials

Select Create OAuth client. Copy the client ID and, for a client secret, the secret. Bland shows the secret only once. If you lose it, rotate the secret to get a new one.
You can’t change a client’s permissions or keys in the dashboard. To change them, create a new client, switch your integration to it, and delete the old one.

Get an access token

Send a POST request to your region’s token endpoint with grant_type=client_credentials. The endpoint accepts form-encoded bodies. Authenticate the request in one of two ways, matching how you created the client. A client can use only the method it was created with.

Client secret

Send the client ID and secret in the HTTP Authorization header, using Basic authentication. Don’t put the secret in the request body.
The response looks like this. There is no refresh token.

Private key JWT

Sign a short-lived JWT (a client assertion) with your private key, and send it instead of a secret. The assertion needs these claims: Build a new assertion for each token request. Send these fields, and don’t send an Authorization header:
  • grant_type=client_credentials
  • client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer
  • client_assertion=<your signed JWT>
  • scope, if you want fewer than all of the client’s permissions
To make a key pair and a JWK Set to paste into the dashboard, run this once. It writes the private key to private-key.pem and prints the public JWK Set.

Call the API

Send the access token in the Authorization header as a bearer token.
Don’t send the x-bland-org-id header. The token already names your organization, and a request with that header is refused with a 400.

Token lifetime

A token lasts 1 hour (expires_in is in seconds), and there are no refresh tokens. Cache the token and request a new one a few minutes before it expires. Don’t request a token for every API call: the token endpoint allows 60 requests a minute from one IP address. If an API call returns 401, request a new token and retry once. If the token request fails with invalid_client, the client was disabled or deleted, or its secret was rotated.

Permissions

A client’s permissions are scopes in the form resource:action, the same scopes a restricted API key uses. In the dashboard, a resource and an action together make a scope. For example, Calls and Read is calls:read, and Evals and Manage is evals:run. Use the scope names in the scope parameter. A scope can include others. If you pick agents:write, the client also holds agents:read, and you can request either. A token reaches only the routes its scopes allow. A route outside them returns 403 with the error INSUFFICIENT_SCOPE. When some scope opens the route, the response’s required_scope names the scopes the token is missing, separated by spaces. For the endpoints each scope opens, and what stays closed to every scope, see Restricted keys.
Some permissions let a token use credentials stored in your organization. A token with agents:write, calls:create, or dispositions:write can use stored secrets and connected credentials, the same as a restricted API key with those permissions. Pick these permissions only for a client you trust with those credentials.

Rotate, disable, and delete

A client belongs to your organization, not to the person who created it. It keeps working if that person leaves. An owner or admin disables or deletes it. Open the menu on the client’s row in Settings > API keys > OAuth clients.
  • Rotate secret. Available for Client secret clients. The old secret stops working at once. Tokens you already received keep working until they expire, up to 1 hour. Private key JWT clients have no secret to rotate. To replace a key, create a new client with the new key set and delete the old one.
  • Disable client. New token requests fail with invalid_client right away, and tokens the client already holds stop working on their next request. Select Enable client to turn it back on.
  • Delete client. The same effect as disabling, and it can’t be undone.
The Last used column shows when the client last received a token. It doesn’t show API calls made with a token you already hold.

Limits

  • A token lasts 1 hour, and there are no refresh tokens.
  • The token endpoint allows 60 requests a minute from one IP address, shared by every client behind it.
  • A client assertion can’t expire more than 5 minutes in the future.
  • A client name has 1 to 64 characters.

Errors

The token endpoint returns JSON with an error code and an error_description. A token request over the rate limit returns 429 in the standard Bland error format, with the error TOO_MANY_REQUESTS in the errors array. Wait a minute, and cache your token. The API returns these errors when you use a token:
Docs for agents: llms.txt