# Create an exam

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

Operation ID: `exams.create` · API v3

Creates an exam in the product.

A new exam is not attached to any lesson. To display it to users, set its ID in the `exam_id` field of a lesson using the lesson update operation.

Required permissions: `exams.create`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |
| `Idempotency-Key` | header | string | yes |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `description` | string or null | no |  |
| `settings` | object | no |  |
| `title` | string | yes |  |

## Responses

### 201

Returns the newly created 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 product was not found or is not accessible with the current credentials.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

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