# Reopen an exam attempt

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

Operation ID: `exams.attempts.update` · API v3

Reopens an exam attempt by setting `status` to `open`. A `reason` is required and no other fields can be changed.

Reopening discards this attempt and any earlier attempts by the same user on this exam, marks the lesson that displays the exam as not completed, reverses the points awarded, and records the adjustment with its reason and author. Certificates that were already issued are not revoked.

Attempts that are already open or already discarded cannot be reopened.

Required permissions: `exams.attempts.reopen`.

## Parameters

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

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `reason` | string | yes |  |
| `status` | string, one of `open` | yes |  |

## Responses

### 200

Returns the attempt after reopening, now in the discarded state.

Body: `data`: ExamAttempt.

Fields of ExamAttempt:

| Field | Type | Required | Description |
|---|---|---|---|
| `correct_count` | integer | yes |  |
| `exam_id` | string | yes | Public ID of the exam, prefixed with exm_. |
| `finished_at` | string or null (date-time) | yes |  |
| `id` | string | yes | Public ID of the exam attempt, prefixed with exa_. |
| `lesson_id` | string or null | yes | Public ID of the lesson in which the exam was taken. |
| `min_score` | number or null | yes |  |
| `object` | string, one of `exam_attempt` | yes |  |
| `passed` | boolean or null | yes | Whether the attempt reached the passing score. null when the exam has no passing score or the attempt is not finished. |
| `product_id` | string | yes | Public ID of the product, prefixed with prd_. |
| `revision` | string | yes |  |
| `score` | number or null | yes |  |
| `started_at` | string (date-time) | yes |  |
| `status` | string, one of `open`, `completed`, `discarded`, `timed_out` | yes |  |
| `user` | object | yes | The user who made the attempt. The email address is never included. |
| `wrong_count` | integer | 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 attempt was not found for the specified exam or is not accessible with the current credentials.

Body: Error.

### 409

The attempt is already open or has already been discarded.

Body: Error.

### 412

The attempt 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
