Bulk actions
Run one action on a list of up to 100 conversations: assignees, tags, pause, finish or archive. Each conversation is handled on its own, with the same rules as the single action, and gets its own result. One that fails does not stop or undo the others.
Take the IDs from List conversations or Search conversations, review them, and send them here. A search or a filter is never turned into a write by itself.
Example
curl -X POST https://api.platic.ai/v2/conversations/bulk \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"action": "tags",
"conversationIds": ["8Yc2kQ1mZ0rTq4Lp7WvX", "Q3m9Zt2Lw8Rk1Vb6Hc0P", "Jd4Xn7Kp2Ys9Ta5Fq1Ue"],
"input": { "mode": "patch", "add": ["vip"] }
}' const { data, meta } = await platic.conversations.bulk({
action: "tags",
conversationIds: ["8Yc2kQ1mZ0rTq4Lp7WvX", "Q3m9Zt2Lw8Rk1Vb6Hc0P", "Jd4Xn7Kp2Ys9Ta5Fq1Ue"],
input: { mode: "patch", add: ["vip"] },
});
for (const result of data.results) {
if (!result.ok) console.warn(result.id, result.error.code);
} The SDK sends an Idempotency-Key on every call and reuses it when it retries, so a retry never acts twice on any conversation.
Archive every finished conversation from last week that has no open case. Show me the list before you do it.
Your assistant finds the IDs with search_conversations_v2 and uses bulk_conversation_action_v2.
Send an Idempotency-Key. Without it, a retry after a lost answer runs the action again on every conversation.
Actions
action | What it does to each conversation | input |
|---|---|---|
tags | Like Tag a conversation | mode: "replace" with tags, or mode: "patch" with add and remove |
assignees | Like Assign a conversation, including the notification to the members added | mode: "replace" with assigneeIds and optional assignedToTeam, or mode: "patch" with add, remove and optional assignedToTeam |
pause | Like Pause the agent | None |
finish | Like Finish a conversation | None |
archive | Like Archive a conversation | None |
Webhooks and notifications go out for each conversation that changes, as with the single action. Resume, reopen, spam, the agent and the topic are not available in bulk.
Headers
| Header | Description | Required |
|---|---|---|
Idempotency-Key | Makes the whole call safe to retry: a repeat with the same key and body returns the same results (meta.replayed: true) without acting again on any conversation. 1 to 255 visible ASCII characters; a UUID works. See Retries | — |
Bulk calls do not take If-Resource-Version: sending it returns 400 INVALID_REQUEST.
Query parameters
| Parameter | Type | Description |
|---|---|---|
workspace | string | The workspace, for an API key that covers several. Other credentials always act on their own workspace |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | ✓ | assignees, tags, pause, finish or archive |
conversationIds | string[] | ✓ | 1 to 100 conversation IDs, without repeats |
input | object | — | What the action takes. Required for tags and assignees; leave it out (or send {}) for pause, finish and archive |
input for tags
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | ✓ | replace: each conversation ends with exactly tags. patch: add and remove |
tags | string[] | With replace | The tags each conversation ends with, up to 20 |
add | string[] | — | With patch: tags to add, up to 20 |
remove | string[] | — | With patch: tags to remove, up to 20 |
input for assignees
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | ✓ | replace: each conversation ends with exactly assigneeIds. patch: add and remove |
assigneeIds | string[] | With replace | The members each conversation ends with, by member ID or email, up to 50 |
add | string[] | — | With patch: members to assign, by member ID or email, up to 50 |
remove | string[] | — | With patch: members to unassign, by member ID or email, up to 50 |
assignedToTeam | boolean | — | true assigns the whole team; false unassigns it. Left out, it does not change |
Emails are checked once for the whole call: an email that is not a member of the workspace returns 422 INVALID_ASSIGNEE and nothing runs.
{
"action": "assignees",
"conversationIds": ["8Yc2kQ1mZ0rTq4Lp7WvX", "Q3m9Zt2Lw8Rk1Vb6Hc0P"],
"input": { "mode": "patch", "add": ["luis@acme.com"] }
} {
"action": "archive",
"conversationIds": ["8Yc2kQ1mZ0rTq4Lp7WvX", "Q3m9Zt2Lw8Rk1Vb6Hc0P"]
} Response
The answer is 200 with one result per ID, in the order you sent them, even when some failed. It does not return the conversations: read them with Get a conversation if you need them.
{
"status": "success",
"data": {
"results": [
{
"id": "8Yc2kQ1mZ0rTq4Lp7WvX",
"ok": true,
"changed": true,
"effects": { "interrupted": false, "reusable": false, "memoryCycleClosed": true }
},
{
"id": "Q3m9Zt2Lw8Rk1Vb6Hc0P",
"ok": false,
"error": {
"code": "CASE_OPEN",
"message": "The conversation has an open case. Close or decline it before archiving the conversation."
}
}
]
},
"meta": {
"requestId": "req_7f3d",
"action": "archive",
"replayed": false
}
} | Field | Description |
|---|---|
data.results[].id | The conversation ID, as you sent it |
data.results[].ok | true if the action worked on this conversation |
data.results[].changed | With ok: true. false when the conversation already had that result: nothing was written and no one was notified |
data.results[].effects | With ok: true. What else happened, with the same keys as the single action |
data.results[].error.code | With ok: false. The same codes as the single action, for example CONVERSATION_NOT_FOUND, FORBIDDEN, CASE_OPEN, CONVERSATION_ARCHIVED, STATUS_TRANSITION_NOT_ALLOWED, UNKNOWN_TAG, TOO_MANY_TAGS, INVALID_ASSIGNEE or TOO_MANY_ASSIGNEES. ACTION_FAILED when that conversation failed for another reason: retry it |
data.results[].error.message | What happened, in words |
meta.action | The action you sent |
meta.replayed | true when this is the stored outcome of an earlier call with the same Idempotency-Key. Nothing ran again |
meta.requestId | ID of the request, for support |
To retry only the conversations that failed, send a new call with their IDs and a new Idempotency-Key.
Retries
One Idempotency-Key covers the whole call.
- Same key, same body: you get the same results with
meta.replayed: true. No conversation is changed again and no one is notified again. - Same key, different body (another action, other IDs or another
input):409 IDEMPOTENCY_KEY_REUSED. - First call still running:
409 IDEMPOTENCY_IN_PROGRESS. Retry in a few seconds with the same key. - Lifetime: keys are kept for one day.
Your access is checked again on every retry. More in Idempotency.
Errors
These errors refuse the whole call. Errors for one conversation come inside its result, with 200.
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | The body is not valid: an unknown action, no IDs, more than 100 IDs, repeated IDs, an input that does not fit the action, or If-Resource-Version. details.issues says which |
400 | INVALID_REQUEST | The workspace in ?workspace= is not covered by the credential. details.available lists the ones it covers |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential cannot change conversations |
403 | INSUFFICIENT_SCOPE | An OAuth token without the platica:write scope. details.requiredScope says which one is missing |
409 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was already used with a different body |
409 | IDEMPOTENCY_IN_PROGRESS | The first call with this Idempotency-Key is still running. Retry shortly with the same key |
422 | INVALID_ASSIGNEE | With assignees: an email is not a member of the workspace. details.invalidAssigneeIds lists them. Nothing ran |
503 | ACTION_FAILED | The outcome could not be confirmed (details.retryable: true). Repeat with the same Idempotency-Key: a conversation that already changed answers changed: false and is not changed twice |
The general error format is in Errors.