API authentication, scopes and limits
Every call goes to https://api.click2reply.com/v1/… with JSON in and out and an
Authorization: Bearer <token> header. The organization comes from the token, never from the
path or the body. POST /v1/oauth/token, /v1/oauth/revoke and /v1/oauth/introspect
are the exception: they follow RFC 6749, take form bodies too, and answer errors as
{ "error", "error_description" }.
Tokens
Section titled “Tokens”| Token | Starts with | For |
|---|---|---|
| Personal access token | c2r_pat_ | Your own scripts, acting as you. Created in Settings > API and webhooks. |
| Bot token | c2r_bot_ | A script that acts as a bot agent rather than a person. |
| OAuth access token | c2r_oat_ | An app another organization installed; valid for 60 minutes. |
| OAuth refresh token | c2r_ort_ | Trades for a new access token; valid for 60 days. |
The quickstart walks through getting each. To see what a token can
do, call GET /v1/oauth/info with it. To end one, revoke it in the settings, or for OAuth tokens
call POST /v1/oauth/revoke.
Scopes
Section titled “Scopes”A token holds the scopes it was granted that its agent’s role still allows, so a token never does more than the person or bot it acts as. Grant only what the code needs.
| Scope | Allows |
|---|---|
chats.access | Read and answer the chats of the groups the agent belongs to. |
chats.all | Read and answer every chat, in every group. |
archives.read | Search and read archived chats. |
archives.write | Change archived chats. |
customers.read | Read customer profiles. |
customers.write | Update customer profiles. |
customers.ban | Ban customers. |
traffic.read | See live website traffic. |
campaigns.manage | Manage greetings, campaigns and goals. |
canned.manage | Manage canned responses. |
tags.manage | Manage tags. |
reports.read | Read reports. |
team.read | Read agents, bots, groups and their status. |
team.manage | Invite, change and suspend agents; manage groups. |
settings.manage | Change routing, widget and chat settings. |
channels.manage | Connect and change messaging channels. |
ai.manage | Change the AI model settings. |
developers.manage | Manage webhooks, apps and bot tokens. |
data.export | Export chats, customers and reports. |
Billing, roles, your own tokens, OAuth app registration and the organization itself are changed only from a signed-in session, never with an API token.
Rate limits
Section titled “Rate limits”Calls are never metered or charged. Limits only keep one client from starving the rest:
600 requests a minute per token, and
3000 per organization
(120 on the free plan). Past a limit the API answers
429 with a retry-after header in seconds; every answer carries
ratelimit-policy.
Errors
Section titled “Errors”Every error has one shape, and the HTTP status follows from code:
{ "error": { "code": "validation", "message": "event.text: Too small", "details": {} } }| code | Status |
|---|---|
validation | 400 |
authentication | 401 |
authorization | 403 |
not_found | 404 |
conflict | 409 |
chat_inactive | 409 |
agent_unavailable | 409 |
entity_too_large | 413 |
idempotency_key_reused | 422 |
unsupported_version | 426 |
too_many_requests | 429 |
plan_limit | 402 |
internal | 500 |
not_implemented | 501 |
service_unavailable | 503 |
message is English for developers and may change; branch on code. Every answer carries an
X-Request-Id header: quote it when you ask us about a call.
A list takes ?limit= (default 25, at most 100) and answers
{ "items": [...], "next_page_token": "..." }. Pass ?page_token= to read the next page; the
token carries the first call’s filters, so send it alone. A null next_page_token is the last page.
Retrying safely
Section titled “Retrying safely”Every write (POST, PUT, PATCH, DELETE) takes an Idempotency-Key header: your own unique value,
such as a UUID, of 1 to 255 printable ASCII characters. Send the same request again with the same key,
after a timeout for instance, and for 24 hours you get the first answer back,
marked Idempotent-Replayed: true, instead of a second write.
- The same key with a different body or on another route is refused with
422 idempotency_key_reused. - While the first request with a key is still running, a second one is answered
409 conflictwithdetails.reasonidempotency_in_flight: retry it a moment later. - Only a successful (
2xx) answer is kept, so a request that failed runs again when you retry it. - An answer that hands out a credential (a token, a secret, recovery codes, a signed link) is never
kept, so retrying one, such as
POST /v1/tokens, runs it again. - A request without a token, such as signing in, and one with a body over 1 MB, such as an upload, ignore the key.
- Keys are per credential: the same key sent with another token, session, agent or customer is a key of its own.
A chat event’s custom_id does the same for that event, with no time limit.
The API reference lists the routes with the scope each needs.