Developer docs menu
Authentication
API keys, scopes, daily credit limits, and OAuth sign-in for AI apps.
API keys
Keys start with cpk_. Make them in CRMCoPilot under Settings → API Tokens. The full key is shown once when you create it; afterwards Settings shows only its start and end.
- Send it in the header on every request:
Authorization: Bearer cpk_…. A key in the URL, or a query parameter likeapi_keyortoken, is refused with400. - Expiry: 30, 90 or 365 days, or never. An expired key returns
401 key_expired. - Turn off or delete a key in Settings at any time. It stops working on the next request.
- Limit: 25 working keys per account. Apps connected by OAuth don't count.
- One key per app is a good habit: you can see when each was last used and turn one off without affecting the others.
Requestexport CRMCOPILOT_KEY="cpk_…"
curl "https://production.crmcopilot.ai/api/agent/v1/me" -H "Authorization: Bearer $CRMCOPILOT_KEY"
Key options and scopes
The options you tick when you create a key decide its scopes:
| Option in Settings | Preset | What the key can do |
|---|---|---|
| Let AI assistants read this account through MCP | read | Read everything listed below and search for people (free). It can't spend credits or change anything. |
| …and Also allow it to take actions | spend | Everything above, plus spend credits (unlocking emails, company search, decision makers) up to the daily credit limit you set, make changes such as pausing an AutoPilot or creating a sequence, and propose actions for approval. |
| Key for AEO | suggest | Read the account summary and suggest business-profile additions. For AEO and research tools. |
| None ticked | — | Not usable with the Agent API (403 scope_missing). |
| Scope | Allows | In preset |
|---|---|---|
account:read | Plan, credits, and checking proposals | read, spend, suggest |
autopilots:read | AutoPilots, their runs and previews | read, spend |
crm:read | Which CRMs are connected | read, spend |
analytics:read | Outreach results, goals and hot leads | read, spend |
replies:read | Replies to your emails | read, spend |
sequences:read | Sequences and how they're doing | read, spend |
leads:search | People search, saved and signal searches | read, spend |
agents:read | Prospecting agents, findings and buying signals | read, spend |
exports:read | Leads sent to your CRM with their buying signal | read, spend |
leads:unlock | Spending credits: email unlocks, company search, decision makers | spend |
workspace:write | Changes (dismiss findings, pause AutoPilots, create sequences and signal searches) and proposing actions | spend |
profile:suggest | Suggesting business-profile changes | suggest |
A call without the scope it needs returns 403 scope_missing with the missing scope in details.scope. Company search and decision makers also need a key that may spend, because they cost credits.
Daily credit limit
Every key that may spend has a daily credit limit, 25 by default and up to 1,000, counted from 00:00 UTC. A call that would go over it returns 402 credits_insufficient with details.reason = "key_daily_limit". Credits for actions the user approves come from the account balance like any action in the app; they don't count toward the key's limit.
OAuth sign-in (for AI apps)
AI apps such as claude.ai and ChatGPT connect by signing the user in instead of using a pasted key. CRMCoPilot is its own OAuth 2.1 authorization server, with discovery, dynamic client registration and PKCE, so any MCP client that follows the MCP authorization spec can connect.
| Endpoint | Purpose |
|---|---|
GET https://production.crmcopilot.ai/.well-known/oauth-protected-resource/api/agent/v1/mcp | Protected resource metadata (RFC 9728). Also served without the path suffix. |
GET https://production.crmcopilot.ai/.well-known/oauth-authorization-server | Authorization server metadata (RFC 8414). |
POST https://production.crmcopilot.ai/oauth/register | Dynamic client registration (RFC 7591). 1–5 redirect_uris, https only (http allowed for localhost). Returns a client_id, plus a secret if you ask for client_secret_post or client_secret_basic. |
GET https://production.crmcopilot.ai/oauth/authorize | The user signs in and approves. response_type=code, PKCE with S256 required. An optional resource must be the MCP server URL. |
POST https://production.crmcopilot.ai/oauth/token | Exchange a code (with code_verifier) or a refresh token. |
POST https://production.crmcopilot.ai/oauth/revoke | Revoke a token (RFC 7009). Disconnects the app. |
Token response{
"access_token": "cpk_…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "cpr_…",
"scope": "copilot.read copilot.act"
}
- Scopes:
copilot.read(read and search) andcopilot.act(also take actions within a daily credit limit). The user decides on the consent screen; thescopeyou request only pre-ticks the box. The token response tells you what was granted. - Access tokens are ordinary CRMCoPilot keys that last 1 hour. They work on the REST API too, with the same rules as any key.
- Refreshing issues a new access token and a new refresh token; the old ones stop working at once.
- Plan check: sign-in and refresh fail with
403 access_deniedif the account's plan doesn't include agent access. - Connected apps are listed in Settings → API Tokens, where the user can disconnect them.
- Errors from OAuth endpoints use the standard OAuth shape:
{"error": "…", "error_description": "…"}.
Every 401 from the API and MCP server includes WWW-Authenticate: Bearer realm='CRM CoPilot', resource_metadata='…/.well-known/oauth-protected-resource/api/agent/v1/mcp', which is how MCP clients discover where to sign in.
Keeping keys safe
- Keep keys on servers or in your AI app's secret settings, never in browser code or a public repo.
- Use read-only keys where you can, and a low daily credit limit on keys that may spend.
- If a key leaks, turn it off in Settings and make a new one.
Last checked against the live code on 5 December 2026.