# Cases API

> Customer questions and problems: open, close, reopen. Every route, its parameters and fields.

Customer questions and problems: open, close, reopen. 8 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/cases` | List cases |
| `POST /v1/cases` | Create a case |
| `GET /v1/cases/{id}` | Get a case |
| `PATCH /v1/cases/{id}` | Update a case |
| `DELETE /v1/cases/{id}` | Delete a case (soft delete) |
| `POST /v1/cases/{id}/restore` | Restore a deleted case |
| `POST /v1/cases/{id}/close` | Close a case |
| `POST /v1/cases/{id}/reopen` | Reopen a closed case |

## List cases

`GET https://staging-api.naruskacrm.com/v1/cases`

Declared filters only (an unknown one is refused); `q` searches the name (accent- and case-insensitive); `sort` takes a declared field, `-` for descending. Pass `next_cursor` back as `cursor`. Custom fields: `custom.<api_key>` for picklists (options by key or label, comma-separated: any of them), multi-picklists (contains any) and booleans (`false` also matches empty); `custom.<api_key>_from` / `_to` for numbers and dates. The applied custom filters come back with their labels in `custom_filters`.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | next_cursor of the previous page. 1–400 characters |
| `owner` | query | `me` or string (uuid) |  |  |
| `status` | query | string |  | Case status api_key or id. At most 63 characters |
| `category` | query | `open`, `waiting`, `closed` |  |  |
| `priority` | query | `low`, `normal`, `high`, `urgent` |  |  |
| `contact_id` | query | string (uuid) |  |  |
| `account_id` | query | string (uuid) |  |  |
| `opportunity_id` | query | string (uuid) |  |  |
| `open` | query | `true`, `false` |  | true: cases that are not closed; false: closed cases |
| `tag` | query | string |  | at most 100 characters |
| `q` | query | string |  | Title, or the case number (C-1042 or 1042). 1–200 characters |
| `resolved_from` | query | string (date) or string (date-time) |  | Closed (resolved_at) on or after |
| `resolved_to` | query | string (date) or string (date-time) |  | Closed (resolved_at) on or before |
| `created_from` | query | string (date) or string (date-time) |  |  |
| `created_to` | query | string (date) or string (date-time) |  |  |
| `sort` | query | `case_number`, `-case_number`, `title`, `-title`, `status_order`, `-status_order`, `priority_order`, `-priority_order`, `owner_name`, `-owner_name`, `created_at`, `-created_at`, `resolved_at`, `-resolved_at`, `updated_at`, `-updated_at` |  | Sort by case_number, title, status_order, priority_order, owner_name, created_at, resolved_at, updated_at; prefix "-" for descending. |
| `updated_since` | query | string (date-time) |  |  |
| `include_deleted` | query | `true`, `false` |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Case](/api/reference/objects.md#case) | yes |  |
| `next_cursor` | string or null | yes |  |
| `custom_filters` | array of [CustomFilter](/api/reference/objects.md#customfilter) |  |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Create a case

`POST https://staging-api.naruskacrm.com/v1/cases`

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `title` | string | yes | 1–200 characters |
| `description` | string or null |  | at most 100000 characters |
| `contact_id` | string (uuid) | yes |  |
| `account_id` | string (uuid) or null |  |  |
| `opportunity_id` | string (uuid) or null |  |  |
| `owner_user_id` | string (uuid) or null |  |  |
| `owner_team_id` | string (uuid) or null |  |  |
| `priority` | `low`, `normal`, `high`, `urgent` |  |  |
| `status_id` | string (uuid) |  |  |
| `status` | string |  | at most 63 characters |
| `channel` | `phone`, `email`, `web_form`, `chat`, `in_person`, `other` or null |  |  |
| `resolution` | string or null |  | at most 100000 characters |
| `root_cause` | string or null |  | at most 100000 characters |
| `custom` | object |  |  |
| `source_system` | string or null |  | 1–100 characters |
| `source_id` | string or null |  | 1–500 characters |

### Response 201

Returns: [Case](/api/reference/objects.md#case).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Get a case

`GET https://staging-api.naruskacrm.com/v1/cases/{id}`

`include` adds `children` (emails, phones, addresses, affiliations, deal contacts, attendees), `tags` and `related` (the first 10 of each related list), so a record page loads in one request.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `include` | query | string |  | at most 100 characters |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `id` | string (uuid) | yes |  |
| `company_id` | string (uuid) | yes |  |
| `created_at` | string (date-time) | yes |  |
| `updated_at` | string (date-time) | yes |  |
| `created_by` | string (uuid) or null | yes |  |
| `updated_by` | string (uuid) or null | yes |  |
| `deleted_at` | string (date-time) or null | yes |  |
| `deleted_by` | string (uuid) or null | yes |  |
| `case_number` | number | yes |  |
| `display_number` | string |  |  |
| `title` | string | yes |  |
| `description` | string or null | yes |  |
| `contact_id` | string (uuid) or null | yes |  |
| `contact_name` | string or null |  |  |
| `account_id` | string (uuid) or null | yes |  |
| `account_name` | string or null |  |  |
| `opportunity_id` | string (uuid) or null | yes |  |
| `opportunity_name` | string or null |  |  |
| `owner_user_id` | string (uuid) or null | yes |  |
| `owner_user_name` | string or null |  |  |
| `owner_team_id` | string (uuid) or null | yes |  |
| `owner_team_name` | string or null |  |  |
| `owner_name` | string or null |  |  |
| `status_id` | string (uuid) | yes |  |
| `status_api_key` | string |  |  |
| `status_name` | string |  |  |
| `status_category` | `open`, `waiting`, `closed` |  |  |
| `status_order` | number |  |  |
| `priority` | `low`, `normal`, `high`, `urgent` | yes |  |
| `priority_order` | number |  |  |
| `channel` | `phone`, `email`, `web_form`, `chat`, `in_person`, `other` or null | yes |  |
| `resolved_at` | string (date-time) or null | yes |  |
| `resolution` | string or null | yes |  |
| `root_cause` | string or null | yes |  |
| `age_days` | number |  |  |
| `resolution_hours` | number or null |  |  |
| `custom` | object | yes |  |
| `custom_labels` | [CustomLabels](/api/reference/objects.md#customlabels) |  |  |
| `source_system` | string or null | yes |  |
| `source_id` | string or null | yes |  |
| `children` | object |  |  |
| `tags` | array of [Tag](/api/reference/objects.md#tag) |  |  |
| `related` | object |  |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Update a case

`PATCH https://staging-api.naruskacrm.com/v1/cases/{id}`

JSON merge patch: send only the fields to change. custom is merged per key; a null value removes a key.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `title` | string |  | 1–200 characters |
| `description` | string or null |  | at most 100000 characters |
| `contact_id` | string (uuid) |  |  |
| `account_id` | string (uuid) or null |  |  |
| `opportunity_id` | string (uuid) or null |  |  |
| `owner_user_id` | string (uuid) or null |  |  |
| `owner_team_id` | string (uuid) or null |  |  |
| `priority` | `low`, `normal`, `high`, `urgent` |  |  |
| `status_id` | string (uuid) |  |  |
| `status` | string |  | at most 63 characters |
| `channel` | `phone`, `email`, `web_form`, `chat`, `in_person`, `other` or null |  |  |
| `resolution` | string or null |  | at most 100000 characters |
| `root_cause` | string or null |  | at most 100000 characters |
| `custom` | object |  |  |
| `source_system` | string or null |  | 1–100 characters |
| `source_id` | string or null |  | 1–500 characters |

### Response 200

Returns: [Case](/api/reference/objects.md#case).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Delete a case (soft delete)

`DELETE https://staging-api.naruskacrm.com/v1/cases/{id}`

Soft delete (admins only). The record and its children are kept for 30 days and can be restored.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Restore a deleted case

`POST https://staging-api.naruskacrm.com/v1/cases/{id}/restore`

Admins only. Children and links deleted with the record come back with it.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

Returns: [Case](/api/reference/objects.md#case).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Close a case

`POST https://staging-api.naruskacrm.com/v1/cases/{id}/close`

Moves the case to a closed status: the one named (status_id or status api_key), else the live closed status with the lowest sort order. resolution and root_cause are optional; resolved_at is set now. Closing a closed case again changes only the fields sent.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `status_id` | string (uuid) |  |  |
| `status` | string |  | at most 63 characters |
| `resolution` | string or null |  | at most 100000 characters |
| `root_cause` | string or null |  | at most 100000 characters |

### Response 200

Returns: [Case](/api/reference/objects.md#case).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Reopen a closed case

`POST https://staging-api.naruskacrm.com/v1/cases/{id}/reopen`

Moves a closed case back to an open or waiting status: the one named, else the default case status (or the first open one). resolved_at is cleared; resolution and root_cause stay. An open case comes back unchanged.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `status_id` | string (uuid) |  |  |
| `status` | string |  | at most 63 characters |

### Response 200

Returns: [Case](/api/reference/objects.md#case).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

