> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/ai-in-umbraco/19.latest/testing-and-evaluation/api/run.md).

# Run

Execute a single test and get results with metrics.

Executes a test and returns the results with per-variation metrics. The framework runs the default configuration plus all configured variations under a single execution ID.

## Request

```http
POST /umbraco/ai/management/api/v1/tests/{idOrAlias}/run
```

### Path Parameters

| Parameter   | Type   | Description        |
| ----------- | ------ | ------------------ |
| `idOrAlias` | string | Test GUID or alias |

### Request Body

The request body is optional. Use it to override the profile, contexts, or guardrails for the execution.

{% code title="Request" %}

```json
{
    "profileIdOverride": "e401f2ff-7d65-5c12-a1f7-e812859a1962",
    "contextIdsOverride": ["f512a3aa-8e76-6d23-b2a8-f923960a2073"],
    "guardrailIdsOverride": ["a623a4aa-9f87-7e34-c3a9-a034071a3184"]
}
```

{% endcode %}

### Request Properties

| Property               | Type    | Required | Description                         |
| ---------------------- | ------- | -------- | ----------------------------------- |
| `profileIdOverride`    | guid    | No       | Override profile for all runs       |
| `contextIdsOverride`   | guid\[] | No       | Override context IDs for all runs   |
| `guardrailIdsOverride` | guid\[] | No       | Override guardrail IDs for all runs |

## Execution Flow

1. The default configuration runs `RunCount` times
2. Each variation runs with its settings (inherited or overridden `RunCount`)
3. Graders evaluate every run
4. The framework calculates metrics for the default config, each variation, and the aggregate

## Response

### Success

{% code title="200 OK" %}

```json
{
    "testId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "executionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "batchId": null,
    "defaultMetrics": {
        "testId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "totalRuns": 3,
        "passedRuns": 2,
        "passAtK": 0.67,
        "passToTheK": 0.0,
        "runIds": [
            "b2c3d4e5-f6a7-8901-bcde-f12345678901",
            "c3d4e5f6-a7b8-9012-cdef-123456789012",
            "d4e5f6a7-b8c9-0123-defa-234567890123"
        ]
    },
    "variationMetrics": [],
    "aggregateMetrics": {
        "testId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "totalRuns": 3,
        "passedRuns": 2,
        "passAtK": 0.67,
        "passToTheK": 0.0,
        "runIds": [
            "b2c3d4e5-f6a7-8901-bcde-f12345678901",
            "c3d4e5f6-a7b8-9012-cdef-123456789012",
            "d4e5f6a7-b8c9-0123-defa-234567890123"
        ]
    }
}
```

{% endcode %}

### Response Properties

| Property           | Type   | Description                                    |
| ------------------ | ------ | ---------------------------------------------- |
| `testId`           | guid   | The test that was executed                     |
| `executionId`      | guid   | Groups all runs from this execution            |
| `batchId`          | guid   | Batch ID (null for single runs)                |
| `defaultMetrics`   | object | Metrics from the default configuration runs    |
| `variationMetrics` | array  | Metrics for each variation                     |
| `aggregateMetrics` | object | Metrics across all runs (default + variations) |

### Metrics Object

| Property     | Type    | Description                                  |
| ------------ | ------- | -------------------------------------------- |
| `testId`     | guid    | The test ID                                  |
| `totalRuns`  | int     | Total runs executed                          |
| `passedRuns` | int     | Runs where all Error-severity graders passed |
| `passAtK`    | double  | `PassedRuns / TotalRuns`                     |
| `passToTheK` | double  | `1.0` if all passed, `0.0` otherwise         |
| `runIds`     | guid\[] | IDs of the runs (for detail retrieval)       |

### Not Found

{% code title="404 Not Found" %}

```json
{
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
    "title": "Not Found",
    "status": 404,
    "detail": "The requested test could not be found."
}
```

{% endcode %}

## Examples

### Run with Default Settings

{% code title="cURL" %}

```bash
curl -X POST "https://your-site.com/umbraco/ai/management/api/v1/tests/test-summarize-quality/run" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

{% endcode %}

### Run with Profile Override

{% code title="cURL" %}

```bash
curl -X POST "https://your-site.com/umbraco/ai/management/api/v1/tests/test-summarize-quality/run" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "profileIdOverride": "e401f2ff-7d65-5c12-a1f7-e812859a1962"
  }'
```

{% endcode %}

## Related

* [List Test Runs](/ai-in-umbraco/19.latest/testing-and-evaluation/api/runs.md) - Retrieve individual run details
* [Run Batch](/ai-in-umbraco/19.latest/testing-and-evaluation/api/run-batch.md) - Execute multiple tests
* [Compare Runs](/ai-in-umbraco/19.latest/testing-and-evaluation/api/compare.md) - Compare two runs


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/ai-in-umbraco/19.latest/testing-and-evaluation/api/run.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
