---
docId: doc_ca1f0311c34d4b7381ce83f98c26f935
title: Cases
description: Every time an agent escalates a conversation, a case is opened with a case number, owners and an event log. Open, take, annotate and close them through the API.
---

<script>
  import { Ways, Collapsible } from '$lib/components';
</script>

# Cases

Handle conversations that need your team’s help. [Find a case](/api-reference/cases/list), [take it](/api-reference/cases/take) to handle it and [close it](/api-reference/cases/close) when finished.

Each case is opened from an [escalation](/api-reference/escalations). It includes a case number, priority, assignees, collected data and a log of what happens. The API uses `clients` for contacts.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
# 1. Open a case (201 if it opens; 200 for duplicate_open, missing_fields or manual_not_allowed)
curl -X POST https://api.platic.ai/v1/cases \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"escalationId": "'"$ESCALATION_ID"'", "conversationId": "'"$CONVERSATION_ID"'", "fields": {"invoice": "A-1043"}}'

# 2. Take the case
curl -X POST https://api.platic.ai/v1/cases/$CASE_ID/accept \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userId": "ana@example.com"}'

# 3. Close it and give the conversation back to the agent
curl -X POST https://api.platic.ai/v1/cases/$CASE_ID/close \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason": "resolved", "returnToAgent": true}'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
// 1. Open a case in a conversation
const opened = await platic.cases.create({
  escalationId,
  conversationId,
  fields: { invoice: "A-1043" },
});

if (opened.result === "opened") {
  // 2. Take it (the conversation becomes supervised) and add a note
  await platic.cases.accept(opened.case.id, { userId: "ana@example.com" });
  await platic.cases.addNote(opened.case.id, { text: "The charge was verified." });

  // 3. Close it and give the conversation back to the agent
  await platic.cases.close(opened.case.id, { reason: "resolved", returnToAgent: true });
}
```

</Ways.Way>
</Ways>

## What you need to know

- **Lifecycle (`open` -> `closed`):** a contact has at most one open case per escalation. A closed case is not reopened. If nobody takes it within `untakenDiscardHours` (72 h by default), it is discarded on its own after a notice halfway through the period; it can also close as `expired` because of `maxOpenDays` or inactivity.
- **People by ID or email:** in `assigneeIds`, `userId` and `?assigneeId=` you can send the user ID or the email of any member of the workspace. With an API key, `accept` requires `userId`.
- **Webhooks:** subscribe to `case.created`, `case.updated`, `case.assigned`, `case.note.created` and `case.closed` ([Payloads](/api-reference/webhooks/payloads#cases)).

## What happens to the conversation

<span id="the-conversation-object"></span>

- **When you [open](/api-reference/cases/open):** the owners are added to `owners`. If the escalation has `keepReplying: false`, the conversation moves to `assistance` (agent paused). While a case is open, the conversation does not expire.
- **When you [take](/api-reference/cases/take):** whoever takes it joins `owners` and the conversation moves to `supervised` (handled by a person).
- **When you [close](/api-reference/cases/close) the last open one:** if it was in `assistance`, it goes back to `automatic`; if it was in `supervised`, it goes back to `automatic` with `returnToAgent: true`. When you decline (`discarded`) a direct message that goes back to `automatic`, the agent picks up right then.

Opening, taking and closing return `conversation` (`conversationId`, `threadId`, `openCount`, `operationBefore`, `operation`, `operationChanged`, `ownersAdded`, `ownersAddedEmails` and `post` on comments) so you know how it ended up without rereading it.

## Endpoints

| Method | Endpoint | What it does |
|--------|----------|--------------|
| `GET` | [`/v1/cases`](/api-reference/cases/list) | List cases with filters |
| `POST` | [`/v1/cases`](/api-reference/cases/open) | Open a case |
| `GET` | [`/v1/cases/{caseId}`](/api-reference/cases/get) | Get a case with its log |
| `PATCH` | [`/v1/cases/{caseId}`](/api-reference/cases/update) | Change priority, owners, data or summary |
| `POST` | [`/v1/cases/{caseId}/accept`](/api-reference/cases/take) | Take a case |
| `POST` | [`/v1/cases/{caseId}/close`](/api-reference/cases/close) | Close or decline a case |
| `POST` | [`/v1/cases/{caseId}/notes`](/api-reference/cases/add-note) | Add a note to the log |
| `GET` | [`/v1/cases/{caseId}/events`](/api-reference/cases/history) | Read only the log |

<span id="common-errors"></span>

Requires the **Conversations** permission. All the error codes (`CASE_NOT_FOUND`, `CASE_CLOSED`, `ESCALATION_ARCHIVED`, `CONFLICT`) are in [Errors](/api-reference/errors#cases-and-escalations) and the AI tools are in [Cases MCP](/mcp/tools#cases).

## The `cases` summary

<Collapsible summary="Cases in conversations, posts and threads">

Conversations, posts and threads include a `cases` object with `open`, `openCount`, `openIds`, `topPriority`, `oldestOpenAt`, `releasedAt`, `untakenCount` and `attention`. To search conversations by cases, use `escalationId` and `caseStatus` in [list conversations (V1)](/api-reference/conversations/v1/list).

</Collapsible>
