# Episodes

> Manage clinical episodes (inbox items) with the Jump EHR API. Create, update, close, reopen, and assign workflow episodes.

Source: https://docs.usejump.co.uk/api-reference/episodes

Episodes are the core clinical workflow unit in Jump EHR — they represent items in the practice inbox. Each episode tracks a clinical workflow for a patient, from initial trigger (appointment booking, lab result, questionnaire submission) through to resolution.

  * Status, priority, and assignment changes must use action endpoints — they cannot be changed via PATCH. This ensures audit trails are maintained.
  * Consistency rules are enforced on create: `status: "pending_patient"` requires `responsibility: "patient"`, and `responsibility: "none"` is only valid for closed episodes.
  * You cannot set `responsibility: "practice"` with `assigned_to: null`. Either provide an assignee or set responsibility to `patient`.
## List episodes

`GET /episodes`

API-key scope: `read_episodes`

Sorted by updated_at descending (most recently active first).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | Maximum number of records to return (1–100, default 20) |
| `offset` | query | integer | no | Number of records to skip (default 0) |
| `search` | query | string | no |  |
| `patient_id` | query | string (uuid) | no |  |
| `status` | query | string | no | One of: `open`, `pending_patient`, `awaiting_review`, `closed`. |
| `status_in` | query | string | no | Comma-separated |
| `responsibility` | query | string | no | One of: `practice`, `patient`, `none`. |
| `assigned_to` | query | string (uuid) | no |  |
| `priority` | query | string | no | One of: `low`, `medium`, `high`, `urgent`. |
| `journey_type` | query | string | no |  |
| `inbox_visibility` | query | string | no | One of: `surface`, `silent`. |

### Responses

- `200` Paginated list

## Create an episode

`POST /episodes`

API-key scope: `write_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string (uuid) | no | Optional UUID for request deduplication. Same key + same body returns the cached response. Same key + different body returns 409 CONFLICT. Keys are scoped to your organisation and endpoint, and expire after 24 hours. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `patient_id` | string (uuid) | yes |  |
| `title` | string | yes |  |
| `description` | string | no |  |
| `status` | string | no | One of: `open`, `pending_patient`, `awaiting_review`. |
| `responsibility` | string | no | One of: `practice`, `patient`, `none`. |
| `assigned_to` | string (uuid) | no |  |
| `priority` | string | no | One of: `low`, `medium`, `high`, `urgent`. |
| `journey_type` | string | no |  |
| `source_type` | string | no |  |
| `source_id` | string (uuid) | no |  |
| `problem_ids` | string (uuid)[] | no |  |
| `tags` | string[] | no |  |
| `due_date` | string (date-time) | no |  |
| `programme_id` | string (uuid) | no |  |
| `inbox_visibility` | string | no | One of: `surface`, `silent`. |

### Responses

- `201` Created
- `409` Idempotency key reused with different request body
- `422` Request body failed validation

## Retrieve an episode

`GET /episodes/{id}`

API-key scope: `read_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Responses

- `200` Episode detail
- `404` Resource not found (or belongs to a different organisation)

## Update an episode

`PATCH /episodes/{id}`

API-key scope: `write_episodes`

Status, priority, and assignment changes must use action endpoints.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | no |  |
| `description` | string | no |  |
| `due_date` | string | null (date-time) | no |  |
| `problem_ids` | string (uuid)[] | no |  |
| `tags` | string[] | no |  |
| `journey_type` | string | no |  |
| `source_type` | string | no |  |
| `source_id` | string (uuid) | no |  |
| `programme_id` | string | null (uuid) | no |  |
| `inbox_visibility` | string | no | One of: `surface`, `silent`. |

### Responses

- `200` Updated
- `404` Resource not found (or belongs to a different organisation)
- `422` Request body failed validation

## Close an episode

`POST /episodes/{id}/close`

API-key scope: `write_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | string | no | One of: `resolved`, `duplicate`, `patient_declined`, `admin_closed`. |
| `note` | string | no |  |

### Responses

- `200` Closed
- `422` Invalid state transition

## Reopen a closed episode

`POST /episodes/{id}/reopen`

API-key scope: `write_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | string | no | One of: `open`, `pending_patient`, `awaiting_review`. |
| `responsibility` | string | no | One of: `practice`, `patient`. |
| `reason` | string | no |  |

### Responses

- `200` Reopened

## Assign an episode

`POST /episodes/{id}/assign`

API-key scope: `write_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `assigned_to` | string | null (uuid) | yes | User UUID or null to unassign |
| `responsibility` | string | no | One of: `practice`, `patient`. |

### Responses

- `200` Assigned

## Change episode priority

`POST /episodes/{id}/change-priority`

API-key scope: `write_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `priority` | string | yes | One of: `low`, `medium`, `high`, `urgent`. |
| `reason` | string | no |  |

### Responses

- `200` Priority changed

## List events for an episode

`GET /episodes/{id}/events`

API-key scope: `read_episodes`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer | no | Maximum number of records to return (1–100, default 20) |
| `offset` | query | integer | no | Number of records to skip (default 0) |
| `event_type` | query | string | no |  |
| `event_type_in` | query | string | no |  |
| `created_by_type` | query | string | no | One of: `user`, `system`, `patient`. |

### Responses

- `200` Paginated list
- `404` Resource not found (or belongs to a different organisation)

## Create an event on an episode

`POST /episodes/{id}/events`

API-key scope: `write_episodes`

Append-only timeline event on an episode.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `Idempotency-Key` | header | string (uuid) | no | Optional UUID for request deduplication. Same key + same body returns the cached response. Same key + different body returns 409 CONFLICT. Keys are scoped to your organisation and endpoint, and expire after 24 hours. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `event_type` | string | yes | One of: `note`, `questionnaire`, `communication`, `system`, `status_change`, `questionnaire_response`, `assignment`, `priority_change`, `appointment`, `invoice`, `lab_result`, `identity_verification`, `automation`, `notification`, `prescription`. |
| `description` | string | yes |  |
| `title` | string | no |  |
| `created_by` | string (uuid) | no |  |
| `created_by_type` | string | no | One of: `user`, `system`, `patient`. |
| `mentioned_users` | string (uuid)[] | no |  |
| `extracted_tags` | string[] | no |  |
| `related_object_type` | string | no |  |
| `related_object_id` | string (uuid) | no |  |

### Responses

- `201` Created
- `404` Resource not found (or belongs to a different organisation)
- `409` Idempotency key reused with different request body
- `422` Request body failed validation
