Developer API
Build on CerebroChain with OAuth 2.1.
Give your app or agent scoped, per-user access to CerebroChain's metered bot API through a standard OAuth 2.1 authorization-code + PKCE flow — consent screen, granular scopes, refresh-token rotation, and revocation. Calls draw from prepaid credits (1 credit = $0.001).
Two ways to authenticate
- OAuth 2.1 (per-user). Best for apps acting on behalf of a CerebroChain user. The user signs in and consents; your app receives a scoped, revocable Bearer token. Covered below.
- API key (machine-to-machine). For your own backend
agents, issue a key in
the
console and send it as the
X-API-Keyheader. Both paths bill the same tenant credit pool.
Register an OAuth app
Sign in to the console and open
Settings → OAuth apps. Give the app a name, one or more redirect URIs
(https, or http loopback for local development), and the
scopes it may request. You'll receive a
client_id and, for confidential apps, a
client_secret shown once — store it
securely; you can rotate it later but it is never shown again.
Programmatic clients may instead self-register via Dynamic Client Registration (RFC 7591).
Public vs confidential clients
- Public (
token_endpoint_auth_method: none) — SPAs, mobile, and CLI tools that can't hold a secret. Security comes from PKCE (S256) and exact redirect-URI matching. - Confidential (
client_secret_basicorclient_secret_post) — server-side apps. They additionally present aclient_secretat the token endpoint. Only a hash of the secret is ever stored.
The authorization-code + PKCE flow
-
Generate a PKCE
code_verifierand itscode_challenge(S256, required). -
Redirect the user to
/api/oauth/authorizewithclient_id,redirect_uri,response_type=code,code_challenge,code_challenge_method=S256, your requestedscope, and astate. -
The user signs in on
cerebrochain.comand approves the listed scopes. Your password and credentials never touch the app. -
We redirect back to your
redirect_uriwith a single-usecode(and yourstate). -
Exchange the code at
/api/oauth/token(grant_type=authorization_code) with thecode_verifier— and, for confidential clients, theclient_secret(HTTP Basic or in the body). You receive anaccess_tokenand arefresh_token.
Scopes
Request only what you need — every requested scope must be one the app is registered to hold (downscoping only). The consent screen lists each grant in plain English.
| Scope | Grants |
|---|---|
bot:read | Read priced market & supply-chain data feeds |
bot:invoke | Run priced compute, AI inference, intelligence, and route optimization |
credits:read | View developer-API credit balance and usage |
keys:manage | Issue and revoke developer API keys and OAuth apps |
wms:read | Read warehouse-management data (inventory, orders) |
wms:write | Change warehouse data in your workspace (items, stock, orders, warehouses) |
logistics:read | Read logistics & fleet data |
logistics:write | Prepare and buy shipping labels from your prepaid credits |
executive:read | Read executive analytics (financial metrics, KPIs) |
discovery | Read public platform capability and market reference data — no workspace, account, or customer data; issued without sign-in |
mcp | Full connector scope (what claude.ai requests); expands to bot:read, bot:invoke, the three reads (wms, logistics, executive) and the two writes (wms:write, logistics:write) |
Calling the API
Send the access token as a Bearer credential to a priced
/api/bot/* endpoint:
curl https://cerebrochain.com/api/bot/data/market/forex \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Each priced call deducts credits from the tenant's pool and requires
the route's scope. A token missing the required scope gets
403 insufficient_scope; an invalid or expired token gets
401 with a WWW-Authenticate challenge. Top up
credits in
the console.
Prices
A call to a priced /api/bot/* endpoint paid from your
prepaid credits (1 credit = $0.001) costs the price below. Calls
your credits can't cover are free, up to 100 a day per IP
address, except enterprise analytics: it answers about your own
account, so it needs an API key or OAuth token and is paid from
credits only. Calls through the Claude connector are priced on
the connector page.
| Endpoint | Price per call |
|---|---|
GET /api/bot/data/market/forex | $0.001 |
GET /api/bot/data/market/freight | $0.005 |
GET /api/bot/data/commodity/prices | $0.003 |
GET /api/bot/data/port/congestion | $0.005 |
GET /api/bot/data/shipping/lanes | $0.008 |
GET /api/bot/data/logistics/rates | $0.01 |
GET /api/bot/data/logistics/optimize | $0.05 |
GET /api/bot/data/logistics/arbitrage | $0.10 |
GET /api/bot/data/supplychain/disruptions | $0.02 |
POST /api/bot/compute/inference | $0.05 |
POST /api/bot/route/optimize | $0.05 |
POST /api/bot/agent/mcp/execute | $0.50 |
POST /api/bot/agent/orchestrate | $0.25 |
GET /api/bot/enterprise/analytics | $5.00 |
Token lifetime, refresh & revocation
- Access tokens expire after 1 hour. Use the
refresh_tokengrant at/api/oauth/tokento get a new pair; refresh tokens rotate on every use. - Reuse detection. If a rotated (already-used) refresh token is replayed, the entire token family is revoked — so a stolen refresh token can't outlive detection.
- Revocation. Revoke any token at
/api/oauth/revoke(RFC 7009). Tenants can also review and revoke connected apps from Settings → OAuth apps.
Endpoints & discovery
Issuer: https://cerebrochain.com. Metadata is published per RFC 8414 / RFC 9728:
| Endpoint | Purpose |
|---|---|
GET /.well-known/oauth-authorization-server | AS metadata (endpoints, scopes, auth methods) |
GET /.well-known/oauth-protected-resource | Protected-resource metadata |
POST /api/oauth/register | Dynamic Client Registration (RFC 7591) |
GET /api/oauth/authorize | Start the flow (PKCE S256 required) |
POST /api/oauth/token | Code exchange + refresh rotation |
POST /api/oauth/revoke | Token revocation (RFC 7009) |
Support
Questions or a bug? Email [email protected], call 775-719-9177, or use the contact form. Connecting an AI assistant instead? See the MCP connector guide.