# Update an exam

`PATCH https://api.cademi.com.br/api/v3/products/{product_id}/exams/{exam_id}`

Operation ID: `exams.update` · API v3

Updates an exam. `settings` is applied partially: omitted keys keep their current values, and `null` in a numeric setting removes the limit.

To avoid overwriting a newer version, send the `ETag` from the retrieve operation in the `If-Match` header.

Required permissions: `exams.update`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |
| `exam_id` | path | string | yes |  |
| `If-Match` | header | string | no |  |

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `deleted` | boolean, one of `false` | no | Only false is accepted. Restores the exam from the trash. |
| `description` | string or null | no |  |
| `settings` | object | no |  |
| `title` | string | no |  |

## Responses

### 200

Returns the updated exam.

Body: `data`: Exam.

Fields of Exam:

| Field | Type | Required | Description |
|---|---|---|---|
| `attempts_count` | integer | yes | Number of attempts recorded for the exam. |
| `created_at` | string (date-time) | yes |  |
| `deleted` | boolean | yes |  |
| `description` | string | yes |  |
| `id` | string | yes | Public ID of the exam, prefixed with exm_. |
| `lesson_ids` | array of string | yes | Public IDs of the lessons that display this exam, prefixed with les_. |
| `object` | string, one of `exam` | yes |  |
| `product_id` | string | yes | Public ID of the product, prefixed with prd_. |
| `questions_count` | integer | yes | Number of active (non-deleted) questions in the exam. |
| `revision` | string | yes |  |
| `settings` | object | yes | Exam settings, with a fixed set of keys. Numeric settings are null when no limit applies. |
| `title` | string | yes |  |
| `updated_at` | string (date-time) | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The exam was not found in the specified product or is not accessible with the current credentials.

Body: Error.

### 412

The exam has changed since the supplied revision was retrieved.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
