Change the status of many leads
POST/v1/agents/:agentId/leads/change-status
x-scope: "leads:write"
x-rate-limit-per-minute: 10
Changes every lead that matches the filters to new_status. There is no undo. The
filters are listLeads' own and combine the same way, so listLeads with the same query
lists the leads this takes (those already in new_status are left alone and not
counted). status is required, so a call always names the statuses it takes leads from
(422 invalid_request_body without it); limit and cursor aren't taken
(422 invalid_request_body). Each lead that changes gets a status-change note on its
contact's timeline, as updateLead writes, and a new last_activity_at; nobody is
assigned, and the agent's status flow is not applied.
dry_run is required: send dry_run: true first, which returns how many leads would
change and changes nothing. A changed of 0 means there is nothing to change: don't send
the real call. Otherwise send the same query with dry_run: false and that number as
max_changes: if more would change by then, nothing changes (409 too_many_leads); send
a dry run again and confirm the new number. Leads change in batches of 1,000, so if a call
fails part way, the leads already changed stay changed: send a dry run again to see how
many are left, then the call with that number. Admin rank on the agent, as in the
dashboard.
Request
Responses
- 200
- 401
- 403
- 404
- 409
- 413
- 422
- 429
- 500
- 503
How many leads changed, or would change on a dry run.
Response Headers
Correlation id for this request — paste into support tickets.
Authentication failed. Single code (invalid_api_key) covers every
sub-case: missing header, wrong scheme, malformed, unknown, revoked or
expired key. The message field disambiguates for humans debugging.
One exception: when the key could not be checked because of a server-side
fault, the status is still 401 but type is internal_error and code
is internal_server_error; retry with backoff.
Response Headers
Correlation id for this request — paste into support tickets.
Authenticated, but not allowed: insufficient_scope (the key lacks the scope in this
operation's x-scope) or agent_not_authorized (the key is limited to other agents).
Response Headers
Correlation id for this request — paste into support tickets.
agent_not_found when the agent is not one of your company's agents (the API never confirms
whether another company's agent exists); endpoint_not_found for a path or method no
endpoint serves, including an id that is not a UUID.
Response Headers
Correlation id for this request — paste into support tickets.
too_many_leads: more leads would change than max_changes, so nothing changed. The
filters may differ from the dry run's, or leads arrived or went quiet since. Don't retry
as is, and don't raise max_changes on your own: send a dry run again, confirm the new
number, then the call with it.
Response Headers
Correlation id for this request — paste into support tickets.
The request body is larger than 1 MB.
Response Headers
Correlation id for this request — paste into support tickets.
invalid_request_body when the body isn't valid JSON, a field has the wrong type or
format, a query parameter doesn't parse, status is missing, or limit or cursor is
sent; param names it. invalid_request for a new_status the agent doesn't have; the
message lists the agent's statuses.
Response Headers
Correlation id for this request — paste into support tickets.
Per-key rate limit hit. Default is 60/min/key; an endpoint with an
x-rate-limit-per-minute of its own counts in a budget of its own
(today the WhatsApp template endpoints, sendBroadcast, retryBroadcast, inviteMember,
resendInvitation, uploadAttachmentMedia, importAttachmentMedia, createUpload and
importSavedReplyMedia, which share one that allows 10/min/key,
sendConversationMessage, which allows 20/min/key; putUploadContent takes no key and
allows the default 60/min per IP address), and its 429
reports that limit in X-RateLimit-Limit. Retry-After tells you when to retry;
X-RateLimit-Reset is the Unix timestamp of the next window.
Per-success-response
X-RateLimit-*headers are a known gap; on 2xx responses these headers are NOT currently emitted. Customers should rely on 429 +Retry-Afterfor backoff signals.
Response Headers
Correlation id for this request — paste into support tickets.
Seconds to wait before retrying.
The per-minute request limit of the endpoint called. Every key has the same limits today.
Remaining requests in the current window. 0 on rejection.
Unix timestamp at which the current window resets.
Unexpected server-side failure. Retry with exponential backoff. If
the failure persists, send us the correlation_id.
Response Headers
Correlation id for this request — paste into support tickets.
Mojeeb couldn't check access because of a temporary fault: the key's,
or on assignLead and assignConversation the teammate's. Nothing was
changed. Retry with backoff.
Response Headers
Correlation id for this request — paste into support tickets.