Content-Type: application/json with every request that has a body.
Agents that sign in
ChatGPT, Claude and other agents can connect to the MCP server by signing in to Cleo instead of using a key. Their tokens work only on the MCP server: the REST API answers401 to them. See Connect your agent.
Key format
A key is an opaque string with four parts:
The key is not a JWT. It has no segments to decode and no expiry claim. Cleo stores only a hash of the secret, so the full key is shown once, when it is created. Cleo cannot show it again. If you lose it, create a new key and revoke the old one.
A key can have an expiry date. After that date, calls answer
401 key_expired. A revoked key answers 401 key_revoked.
Hosts
A key never works on the other host. The API tells you which host to use:
Business verification
A key works only after its business has finished identity verification. Until then every call answers403 business_not_verified, with two exceptions:
GET /v1/businessanswers, so you can show your user the setup stage.- On the MCP server,
get_business_statusanswers. Every other tool is hidden fromtools/list.
Scopes
Business admins create keys in the Cleo web app and choose their scopes. A key acts as a member of the business. Each scope grants Cleo permissions, and the key never gets more than that member: when the member is not an admin, a scope the member’s role does not allow grants nothing.
Some scopes share a permission inside Cleo, so routes also check the scope on the key itself. A
payments:read key cannot read bills, a balance-only key cannot send, cancel, retry or read payments, and a custom-fields key cannot read or submit bills.
A call outside the key’s scopes answers 403 forbidden_scope. On the MCP server, tools outside the key’s scopes are hidden from tools/list.
Routes that check the scope on the key check it before the member’s role, so the message says what to fix:
- The key lacks the scope. The message names it, for example
This API key needs the custom-fields:write scope. Add the scope to the key. - The key has the scope, but the member’s role does not allow the call. The message is
Your role does not have the permission to perform this action. Change the member’s role in the Cleo web app.
POST /v1/payables, answer the role message in both cases. Branch on code, not on message.
Rate limits
Each API key can make 100 requests per 60-second window. The window starts with the key’s first counted request and ends 60 seconds later. The next request after that starts a new window with a fresh count. This is a fixed window, not a rolling one.- What counts. Every REST request (
/v1/...) and every HTTP request to the MCP endpoint counts once. An MCP request counts once whatever it carries, including a JSON-RPC batch. Webhook hydration calls count like any other request. - One counter per key. All routes and all Cleo servers share the key’s counter. Two keys of one business have separate counters, and so do a
cleo_live_key and acleo_test_key. - What does not count. A request refused before the key is verified:
401(any key error),403 business_not_verified, and503 service_unavailable. These answers carry no rate limit headers.
The 101st request in a window, and every request after it until the window ends, answers
429 rate_limited. Retry-After and details.resetSeconds both equal RateLimit-Reset: the seconds until the window ends. The first request after that succeeds. Refused requests do not extend the window. On the MCP endpoint the 429 is the HTTP answer to the whole request, not a tool result.
RateLimit-Remaining and slow down before it reaches 0, rather than waiting for a 429.
The MCP endpoint is also limited per client IP address: 100 requests per minute, whatever the key or token. This limit is counted before the key is checked, so it also covers requests that end in 401. Every MCP response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset for this limit. A 401 carries only those, not the RateLimit-* headers. Past it, the MCP endpoint answers 429 rate_limited with a Retry-After header and no details.
The OAuth sign-in endpoints that agents use to connect have their own limits per IP address. See Rate limits on sign-in.
Service switch
Cleo can turn the partner API off. While it is off, every call answers503 service_unavailable. Retry later.
Errors on this page
The full list is in Errors.
Keep keys secret
- Store keys in a secret manager or environment variables, never in source control or client-side code.
- Give each integration its own key with only the scopes it needs.
- Rotate a key by creating a new one, switching to it, then revoking the old one.