# Create eval

```http
POST /projects/{project_reference}/evals
```

Create an eval source file in the project source or a preview branch to test an agent against a dataset and metrics; returns the eval source document. Requires project.evals.write.

## Parameters

| Name                 | In    | Required | Description                                                     |
| -------------------- | ----- | -------- | --------------------------------------------------------------- |
| `project_reference`  | path  | Yes      | Project slug, UUID, or domain that identifies the project.      |
| `source_target_kind` | query |          | Source to use: project or preview\_branch. Defaults to project. |
| `target_branch_id`   | query |          | Preview branch to use when the target kind is preview\_branch.  |

## Request body

| Field         | Type    | Required | Description                                                    |
| ------------- | ------- | -------- | -------------------------------------------------------------- |
| `name`        | string  | Yes      | Human-readable eval name; the eval id is derived from it.      |
| `description` | string  |          | Optional short description of what the eval checks.            |
| `target`      | string  | Yes      | Identifier of the agent the eval runs against.                 |
| `dataset`     | object  | Yes      | The examples the eval runs: inline examples or a dataset file. |
| `metrics`     | array   |          | The metrics that score each example. Defaults to none.         |
| `repetitions` | integer |          | How often each example runs. Defaults to 1.                    |
| `tags`        | array   |          | Labels for the eval. Defaults to none.                         |
| `metadata`    | object  |          | Free-form JSON object stored with the eval. Defaults to empty. |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 201    | Created a structured evaluation source document in the selected source target.                              |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Forbidden                                                                                                   |
| 409    | Conflict                                                                                                    |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
