# Client API: Container Apps: Rules

> The 4 Client API operations for rules.

Source: https://www.coritan.com/docs/api/reference/client/container-apps/servers-rules/

Part of [Container Apps](/docs/api/reference/client/container-apps/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/client/servers/{uuid}/rules`](#op-get-api-v1-client-servers-uuid-rules) | List rules for a server |
| POST | [`/api/v1/client/servers/{uuid}/rules`](#op-post-api-v1-client-servers-uuid-rules) | Create a new rule |
| PUT | [`/api/v1/client/servers/{uuid}/rules/{rule_uuid}`](#op-put-api-v1-client-servers-uuid-rules-rule-uuid) | Update a rule |
| DELETE | [`/api/v1/client/servers/{uuid}/rules/{rule_uuid}`](#op-delete-api-v1-client-servers-uuid-rules-rule-uuid) | Delete a rule |

### List rules for a server {#op-get-api-v1-client-servers-uuid-rules}

`GET /api/v1/client/servers/{uuid}/rules`

List rules for a server.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

A `200` response is a list; each item has these fields:

| Field | Type |
| --- | --- |
| `[].id` | integer |
| `[].uuid` | string |
| `[].server_id` | integer |
| `[].name` | string |
| `[].trigger_type` | string |
| `[].trigger_config` | Trigger Config |
| `[].conditions` | array of any or object or null |
| `[].actions` | array of any or object |
| `[].enabled` | boolean |
| `[].created_at` | string (date-time) |
| `[].updated_at` | string (date-time) or null |
| `[].last_triggered_at` | string (date-time) or null |

### Create a new rule {#op-post-api-v1-client-servers-uuid-rules}

`POST /api/v1/client/servers/{uuid}/rules`

Create a new rule.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `name` | string | yes |
| `trigger_type` | string | yes |
| `trigger_config` | Trigger Config | no |
| `conditions` | array of any or object or null | no |
| `actions` | array of any or object | yes |
| `enabled` | boolean | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

Fields of a `201` response:

| Field | Type |
| --- | --- |
| `id` | integer |
| `uuid` | string |
| `server_id` | integer |
| `name` | string |
| `trigger_type` | string |
| `trigger_config` | Trigger Config |
| `conditions` | array of any or object or null |
| `actions` | array of any or object |
| `enabled` | boolean |
| `created_at` | string (date-time) |
| `updated_at` | string (date-time) or null |
| `last_triggered_at` | string (date-time) or null |

### Update a rule {#op-put-api-v1-client-servers-uuid-rules-rule-uuid}

`PUT /api/v1/client/servers/{uuid}/rules/{rule_uuid}`

Update a rule.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `rule_uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `name` | string or null | no |
| `trigger_type` | string or null | no |
| `trigger_config` | object or null | no |
| `conditions` | array of any or object or null | no |
| `actions` | array of any or object or null | no |
| `enabled` | boolean or null | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

Fields of a `200` response:

| Field | Type |
| --- | --- |
| `id` | integer |
| `uuid` | string |
| `server_id` | integer |
| `name` | string |
| `trigger_type` | string |
| `trigger_config` | Trigger Config |
| `conditions` | array of any or object or null |
| `actions` | array of any or object |
| `enabled` | boolean |
| `created_at` | string (date-time) |
| `updated_at` | string (date-time) or null |
| `last_triggered_at` | string (date-time) or null |

### Delete a rule {#op-delete-api-v1-client-servers-uuid-rules-rule-uuid}

`DELETE /api/v1/client/servers/{uuid}/rules/{rule_uuid}`

Delete a rule.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `rule_uuid` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
