# Pathway Rules

> Manage pathway rules via the Jump EHR API. Create conditional overrides that customise how events route into episodes.

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

Pathway rules provide conditional overrides on top of base [pathway configs](https://docs.usejump.co.uk/api-reference/pathway-configs). Rules let you customise episode routing based on event properties — for example, routing VIP appointment bookings to a specific team, or silencing billing episodes for certain invoice types.

  * Override fields set to `null` inherit from the base pathway config. Only non-null fields take effect.
  * Each `(trigger_type, priority)` combination must be unique within your organisation. Attempting to create or update a rule with a duplicate priority returns `409 CONFLICT`.
  * Gaps in the priority sequence after deletion are fine — rules are evaluated by priority order, not contiguous numbering.
## List pathway rules

`GET /pathway-rules`

API-key scope: `read_pathways`

Sorted by trigger_type then priority (evaluation order).

### 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) |
| `trigger_type` | query | string | no |  |
| `enabled` | query | string | no |  |

### Responses

- `200` Paginated list

## Create a pathway rule

`POST /pathway-rules`

API-key scope: `write_pathways`

### 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 |
| --- | --- | --- | --- |
| `trigger_type` | string | yes |  |
| `rule_name` | string | yes |  |
| `priority` | integer | yes |  |
| `conditions` | object | no |  |
| `creation_mode` | string | null | no | One of: `create_episode`, `attach_or_create`, `attach_only`, `log_only`. |
| `inbox_visibility` | string | null | no | One of: `surface`, `silent`. |
| `journey_type` | string | null | no |  |
| `suggested_assignment` | string | null | no |  |
| `suggested_priority` | string | null | no | One of: `low`, `medium`, `high`, `urgent`. |
| `expected_next_actor` | string | null | no | One of: `practice`, `patient`. |
| `enabled` | boolean | null | no |  |

### Responses

- `201` Created
- `409` Priority conflict
- `422` Request body failed validation

## Retrieve a pathway rule

`GET /pathway-rules/{id}`

API-key scope: `read_pathways`

### Parameters

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

### Responses

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

## Update a pathway rule

`PATCH /pathway-rules/{id}`

API-key scope: `write_pathways`

### Parameters

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

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `rule_name` | string | no |  |
| `priority` | integer | no |  |
| `conditions` | object | no |  |
| `creation_mode` | string | null | no |  |
| `inbox_visibility` | string | null | no |  |
| `journey_type` | string | null | no |  |
| `suggested_assignment` | string | null | no |  |
| `suggested_priority` | string | null | no |  |
| `expected_next_actor` | string | null | no |  |
| `enabled` | boolean | null | no |  |

### Responses

- `200` Updated
- `404` Resource not found (or belongs to a different organisation)
- `409` Priority conflict

## Delete a pathway rule

`DELETE /pathway-rules/{id}`

API-key scope: `write_pathways`

### Parameters

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

### Responses

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