> 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/17.latest/testing-and-evaluation/api.md).

# API

The Test API provides endpoints for creating, managing, and executing AI tests, as well as querying and comparing test runs.

## Test Endpoints

| Method | Endpoint                                                                                   | Description               |
| ------ | ------------------------------------------------------------------------------------------ | ------------------------- |
| GET    | [`/tests`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/list.md)                    | List all tests            |
| GET    | [`/tests/{idOrAlias}`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/get.md)         | Get a test by ID or alias |
| POST   | [`/tests`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/create.md)                  | Create a new test         |
| PUT    | [`/tests/{idOrAlias}`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/update.md)      | Update an existing test   |
| DELETE | [`/tests/{idOrAlias}`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/delete.md)      | Delete a test             |
| POST   | [`/tests/{idOrAlias}/run`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/run.md)     | Execute a single test     |
| POST   | [`/tests/run-batch`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/run-batch.md)     | Execute multiple tests    |
| POST   | [`/tests/run-by-tags`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/run-by-tags.md) | Execute tests by tags     |

## Test Run Endpoints

| Method | Endpoint                                                                                          | Description                                      |
| ------ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| GET    | [`/test-runs`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/runs.md)                       | List test runs (filtered)                        |
| GET    | `/test-runs/{id}`                                                                                 | Get a test run by ID                             |
| GET    | `/test-runs/{id}/transcript`                                                                      | Get the transcript for a run                     |
| GET    | `/test-runs/latest/{testId}`                                                                      | Get the most recent run for a test               |
| GET    | `/test-runs/executions/{executionId}`                                                             | Get execution summary with per-variation metrics |
| DELETE | `/test-runs/{id}`                                                                                 | Delete a test run                                |
| POST   | `/test-runs/baseline/{testId}/{testRunId}`                                                        | Set a run as the test baseline                   |
| POST   | [`/test-runs/compare`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/compare.md)            | Compare two test runs                            |
| POST   | [`/test-runs/compare-variations`](/ai-in-umbraco/17.latest/testing-and-evaluation/api/compare.md) | Compare two variation groups                     |

## Base URL

```
/umbraco/ai/management/api/v1
```

## Test Object

{% code title="Test" %}

```json
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "alias": "test-summarize-quality",
    "name": "Summarization Quality",
    "description": "Validates summarization output quality and format",
    "testFeatureId": "prompt",
    "testTargetId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "profileId": "e401f2ff-7d65-5c12-a1f7-e812859a1962",
    "contextIds": [],
    "testFeatureConfig": {
        "variables": {
            "content": "Sample article text for testing..."
        }
    },
    "graders": [
        {
            "id": "a1b2c3d4-0000-0000-0000-000000000001",
            "graderTypeId": "contains",
            "name": "Has bullet points",
            "config": { "searchPattern": "- ", "ignoreCase": true },
            "negate": false,
            "severity": "Error",
            "weight": 1.0
        }
    ],
    "variations": [],
    "runCount": 3,
    "tags": ["quality", "summarization"],
    "baselineRunId": null,
    "version": 1,
    "dateCreated": "2024-06-15T10:30:00Z",
    "dateModified": "2024-06-15T10:30:00Z"
}
```

{% endcode %}

## Properties

| Property            | Type      | Description                              |
| ------------------- | --------- | ---------------------------------------- |
| `id`                | guid      | Unique identifier                        |
| `alias`             | string    | Unique alias for code references         |
| `name`              | string    | Display name                             |
| `description`       | string    | Optional description                     |
| `testFeatureId`     | string    | Test feature harness (`prompt`, `agent`) |
| `testTargetId`      | guid      | ID of the target entity                  |
| `profileId`         | guid      | Default AI profile (optional)            |
| `contextIds`        | guid\[]   | Default AI contexts                      |
| `testFeatureConfig` | object    | Feature-specific configuration (JSON)    |
| `graders`           | array     | Success criteria                         |
| `variations`        | array     | A/B testing overrides                    |
| `runCount`          | int       | Number of runs per execution             |
| `tags`              | string\[] | Organization tags                        |
| `baselineRunId`     | guid      | Baseline run for regression detection    |
| `dateCreated`       | date      | When the test was created (UTC)          |
| `dateModified`      | date      | When the test was last modified (UTC)    |
| `version`           | int       | Current version number                   |

## Related

* [Test Concepts](/ai-in-umbraco/17.latest/testing-and-evaluation/concepts.md)
* [Graders](/ai-in-umbraco/17.latest/testing-and-evaluation/graders.md)
* [Variations](/ai-in-umbraco/17.latest/testing-and-evaluation/variations.md)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
