---
title: "Add script evals"
method: POST
path: "/api/scripts/{handle}/{host}/{slug}/evals"
---

# Add script evals

`POST /api/scripts/{handle}/{host}/{slug}/evals`

## Request

- Base URL: `https://reduck.ai`
- URL: `https://reduck.ai/api/scripts/{handle}/{host}/{slug}/evals`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Add evals to a script: frozen args on a browser setup, with an optional check of the output. An eval that exists is answered as it is, active again.

## Path parameters

- `handle` string, required: The owner a resource is addressed under: "@username" for a personal scope, or a bare slug for a project.
- `host` string, required: The site the script automates, as a hostname.
- `slug` string, required: The script's unique identifier within its host, unique per owner.

## Request body

- object
  - `evals` object[], required
    - `browser` 'extension' | 'managed': Where the eval runs: `extension` (a paired device, the default) or `managed` (a Reduck managed browser).
    - `region` string: Managed datacenter. Managed only; omit for the default region.
    - `country` string: Managed egress country, ISO-3166 alpha-2. Managed only; omit for datacenter egress.
    - `args` object: The frozen arguments the eval runs the script with.
    - `validation_code` string, nullable: Optional JavaScript function body run against the output as `result`; a falsy return or a throw fails the eval. Runs in a Deno sandbox with no browser and no network, for 2 s at most.
    - `note` string, nullable: What the eval covers and why it exists, for whoever reads its verdict.

## Response `200`

OK

- object
  - `data` object[], required: One entry per input, in order. `created` false: the eval existed, and is active again.
    - `created` boolean, required
    - `id` string, required
    - `args` Recordstringunknown, required
    - `browser` 'extension' | 'managed', required
    - `region` string, required
    - `country` string, required
    - `validation_code` string, nullable, required
    - `note` string, nullable, required
    - `active` boolean, required: An inactive eval is kept but not run, and does not gate a promote.
    - `created_at` string, required
    - `latest` EvalVerdict, required
      - `run_id` string, required
      - `version_id` string, nullable, required: The version the run executed; null once that version was deleted.
      - `status` union, required
        - 'infra' | 'pass' | 'script' | 'validation'
        - 'pending'
      - `detail` string, nullable, required: Why the status is not `pass`.
      - `created_at` string, required
    - `args_error` string, nullable: Only when the list was asked for a `version_id` of this script: why the input schema of that version refuses the args of this eval, or null when it takes them. A version is not promoted while an active eval has one.

## Other responses

- `400`: Invalid request
- `401`: Not authenticated
- `403`: You may not edit this script.
- `404`: Not found

---

[API](https://skmtc.dev/reduck/apis/reduck-api.md) · [All operations](https://skmtc.dev/reduck/apis/reduck-api/llms.txt) · [OpenAPI document](https://skmtc.dev/reduck/apis/reduck-api/revisions/a573b91206d6?raw)
