---
docId: doc_95c3e832f8b04c8dbb19fd94206656c4
title: Close a case
description: Close a case with its reason. If it was the last one open, the conversation can go back to the agent.
api:
  group: casos
  auth: bearer
  operations:
    - operationId: closeCase
      method: POST
      path: '/v1/cases/{caseId}/close'
      postmanName: Close a Case
---

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

# Close a case

Finish a case by sending `reason`: `resolved`, `discarded` or `unresolved`. Include a `note` if you discard it or could not resolve it. A closed case cannot be reopened; if the problem returns, open another case.

## Example

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

```bash
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
await platic.cases.close("case_123", { reason: "resolved", returnToAgent: true });
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `caseId` | string | Case id | ✓ |

## Request body

```json
{
  "reason": "resolved",
  "note": "The invoice was reissued with the correct tax ID.",
  "returnToAgent": true
}
```

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `reason` | string | ✓ | `resolved` (it was resolved), `discarded` (it did not apply: this is **declining it**, as in the app) or `unresolved` (it could not be resolved). `expired` is only set by Platica when the case expires |
| `note` | string | - | How it ended, up to 4,000 characters. Required with `discarded` and `unresolved` |
| `returnToAgent` | boolean | - | If it was the last one open and a person was handling the conversation (`supervised`), `true` gives it back to the agent: it answers again from the contact's next message. Default, `false` |

## Response

`200 OK`. `result` is `closed`, or `already_closed` if it was already closed; in that case nothing changes.

```json
{
  "status": "success",
  "data": {
    "result": "closed",
    "case": {
      "id": "Es4kP9wLx2QmZ7bN1cVd",
      "workspaceId": "Wk5rT8yUi2OpAs4d",
      "number": 143,
      "folio": "INV-0143",
      "escalationId": "Et7hQ2mVx9LpRk3s",
      "escalationSnapshot": {
        "name": "Invoice error",
        "prefix": "INV",
        "color": "#2563EB",
        "keepReplying": false,
        "canClose": false,
        "waitMessage": null,
        "inactivityCloseHours": null,
        "untakenDiscardHours": 72,
        "allowManual": true
      },
      "status": "closed",
      "priority": "normal",
      "summary": "Asks to fix the tax ID on the invoice for order 48213.",
      "fields": {"order_number": "48213", "tax_id": "ACME010101AB1"},
      "contactId": "Ct3fG5hJ7kL9mN1p",
      "conversationId": "Cv8hN2lP4qR6sT0u",
      "channelId": "Ch2wE4rT6yU8iO0p",
      "platform": "whatsapp",
      "relatedConversationIds": [],
      "postId": null,
      "threadId": null,
      "agentId": "Ag6bV8nM1qW3eR5t",
      "openedBy": {"kind": "agent", "id": "Ag6bV8nM1qW3eR5t"},
      "assigneeIds": ["Us9fG3hJ6kL2mN8b", "Us2qW4eR6tY8uI0o"],
      "acceptedBy": "Us2qW4eR6tY8uI0o",
      "acceptedAt": "2026-11-12T15:12:00.000Z",
      "lastActivityAt": "2026-11-12T15:12:00.000Z",
      "maxOpenAt": "2026-11-26T15:04:00.000Z",
      "autoCloseAt": null,
      "discardAt": null,
      "discardWarnAt": null,
      "discardWarnedAt": null,
      "closedAt": "2026-11-12T16:40:00.000Z",
      "closedBy": {"kind": "api", "id": "Ak7Pz2Lm9Qx4Wc6e"},
      "closeReason": "resolved",
      "closeNote": "The invoice was reissued with the correct tax ID.",
      "createdAt": "2026-11-12T15:04:00.000Z",
      "updatedAt": "2026-11-12T16:40:00.000Z",
      "assigneeEmails": ["billing@acme.com", "support@acme.com"],
      "acceptedByEmail": "support@acme.com"
    },
    "conversation": {
      "conversationId": "Cv8hN2lP4qR6sT0u",
      "threadId": null,
      "openCount": 0,
      "operationBefore": "supervised",
      "operation": "automatic",
      "operationChanged": true,
      "ownersAdded": [],
      "ownersAddedEmails": [],
      "post": null
    }
  }
}
```

| Field | Type | Description |
|-------|------|-------------|
| `result` | string | `closed` or `already_closed` |
| `case` | object | The case as it ended up, with the fields in [get a case](/api-reference/cases/get#the-case) |
| `conversation` | object | How the conversation ended up. `openCount: 0` means none are left open. See [the `conversation` object](/api-reference/cases#the-conversation-object) |

<Note type="tip">

While the conversation has other open cases, closing one does not give it back to the agent, even if you send `returnToAgent: true`.

</Note>

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | `reason` is missing or not valid (`expired` is not accepted either), or `note` is missing with `discarded` or `unresolved` (`Closing as discarded needs a note`) |
| `404` | `CASE_NOT_FOUND` | The case does not exist in this workspace |

The errors that come up on any operation are in the [introduction](/api-reference/cases#common-errors).

## Notes

- **Declining** is closing with `discarded` and a `note` explaining why it did not apply. If it was the last open case on a direct message and the conversation goes back to `automatic`, Platica asks the agent to continue the conversation right then (the same as declining from the inbox).
- When you close as `resolved` or `unresolved` with `returnToAgent: true`, the agent does not answer on the spot: it picks up from the contact's next message. If you want to tell them it is handling them again, send a message with [send a message](/api-reference/messages/send).
- If the agent was paused by the case (`assistance`) and it was the last one open, the conversation goes back to the agent without needing `returnToAgent`.
- The `case.closed` webhook arrives. If the conversation changed, `conversation.operation.updated` also arrives with `source` `api.case.closed`.
- From an AI agent, the tool is [`close_case`](/mcp/tools#cases).
