Mark as spam
Mark a conversation as spam (spam: true) or unmark it (spam: false). When you mark it, you must say with blockContact whether the contact is blocked too. Unmarking never unblocks the contact.
Example
curl -X PUT "https://api.platic.ai/v2/conversations/$CONVERSATION_ID/spam?fields=id,status" \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{ "spam": true, "blockContact": true }' const { meta } = await platic.conversations.setSpam("8Yc2kQ1mZ0rTq4Lp7WvX", { spam: true, blockContact: true });
console.log(meta.effects.contact); // { id: "cl_3h7Jt9Q2", blocked: true, changed: true } The SDK sends an Idempotency-Key on every action and reuses it when it retries.
Mark this conversation as spam and block the contact.
Your assistant uses set_conversation_spam_v2.
What happens
Marking (spam: true):
statusbecomesspam. If the agent was writing a reply, it stops.blockContactis required. Withtrue, the contact is blocked too, as with Moderate a contact, with the reasonconversation_spam. Withfalse, the contact is not touched.- Blocking needs write access to contacts. Without it, the answer is
403 FORBIDDENand nothing changes. - If the contact was already blocked, it stays blocked and
meta.effects.contact.changedisfalse.
Unmarking (spam: false):
- The conversation gets back the status it had before. An archived conversation stays archived.
blockContactis not allowed. The contact is never unblocked here: they may be blocked for another reason. Unblock them with Moderate a contact.
If nothing changes (the conversation already has that spam state and the contact needs no block), the answer has meta.changed: false: nothing is written and no webhook is sent.
A spam conversation cannot be finished, reopened, resumed or handed back to the agent until you unmark it.
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
conversationId | string | The conversation's id. See How IDs work | ✓ |
Headers
| Header | Description | Required |
|---|---|---|
Idempotency-Key | Makes the call safe to retry. 1 to 255 visible ASCII characters; a UUID works. See Retries | — |
This action does not take If-Resource-Version: sending it returns 400 INVALID_REQUEST.
Query parameters
| Parameter | Type | Description |
|---|---|---|
fields | string | Fields of the conversation to return, comma-separated. Replaces the defaults; id is always returned. The fields are the same as in Get a conversation |
include | string | Relations to resolve in included: agents, channels, assignees |
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 |
|---|---|---|---|
spam | boolean | ✓ | true marks the conversation as spam; false unmarks it |
blockContact | boolean | With spam: true | Whether the contact is blocked too. Required with spam: true; not allowed with spam: false |
{
"spam": true,
"blockContact": true
} To unmark:
{
"spam": false
} Any other field returns 400 INVALID_REQUEST.
Response
The answer is the conversation after the change, read with fields and include as in Get a conversation, and a meta that says what the action did. This example used ?fields=id,status.
{
"status": "success",
"data": {
"id": "8Yc2kQ1mZ0rTq4Lp7WvX",
"status": "spam"
},
"meta": {
"fields": ["id", "status"],
"include": [],
"requestId": "req_7f3c",
"resourceVersion": "MTc2NDYxMjAwMC4xMjM0NTY3ODk",
"action": "spam",
"changed": true,
"effects": {
"contact": {
"id": "cl_3h7Jt9Q2",
"blocked": true,
"changed": true
}
},
"replayed": false
}
} | Field | Description |
|---|---|
data | The conversation as it is now, with the selected fields |
included | Related records, only when you sent include |
meta.action | Always spam |
meta.changed | false when neither the conversation nor the contact changed |
meta.effects.contact | What happened to the contact. null when you did not ask to block it |
meta.effects.contact.id | The contact's ID (clients in the API), or null if the conversation has no contact to block |
meta.effects.contact.blocked | Whether the contact is blocked after the call |
meta.effects.contact.changed | true when this call blocked the contact; false if it was already blocked |
meta.resourceVersion | The conversation's version after the change |
meta.replayed | true when this is the stored outcome of an earlier call with the same Idempotency-Key. Nothing ran again; data and resourceVersion show the conversation as it is now |
meta.fields · meta.include | Fields and relations applied |
meta.requestId | ID of the request, for support |
meta.warnings | Only when there is something to report. CONVERSATION_NOT_READABLE: the action was applied, but your credential can no longer read the conversation, so data has only id |
Retries
Send an Idempotency-Key so a retry after a lost answer is safe. A key belongs to one credential, one action and one conversation.
- Same key, same body: you get the first outcome with
meta.replayed: true. Nothing runs again.fieldsandincludemay change: they only choose what the answer shows. - Same key, different body:
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. A call that fails does not keep its key, so retrying it runs the action again.
Your access is checked again on every retry. More in Idempotency.
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | The body, a query parameter or a header is not valid: blockContact missing with spam: true, blockContact sent with spam: false, another field, 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 |
400 | INVALID_FIELD | A name in fields does not exist. details.allowed lists the accepted ones |
400 | INVALID_INCLUDE | A name in include does not exist. details.allowed lists the accepted ones |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential cannot change conversations, your role can read this conversation but not change it, or you asked to block the contact without write access to contacts |
403 | INSUFFICIENT_SCOPE | An OAuth token without the platica:write scope. details.requiredScope says which one is missing |
404 | CONVERSATION_NOT_FOUND | No conversation has that id in the workspace, or it is out of your credential's reach |
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 |
503 | ACTION_FAILED | The outcome could not be confirmed (details.retryable: true). Repeat with the same Idempotency-Key: an action that already ran is not run again |
The general error format is in Errors.
Notes
A call that changes the conversation sends conversation.status.updated. A call that blocks the contact also sends client.updated. Both have source: "api.conversation.v2", or "mcp.conversation.v2" when your assistant did it.