> 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/run-by-tags.md).

# Run by Tags

Executes all tests that have ALL specified tags. All matching tests share the same batch ID.

## Request

```http
POST /umbraco/ai/management/api/v1/tests/run-by-tags
```

### Request Body

{% code title="Request" %}

```json
{
    "tags": ["quality", "summarization"],
    "profileIdOverride": null,
    "contextIdsOverride": null,
    "guardrailIdsOverride": null
}
```

{% endcode %}

### Request Properties

| Property               | Type      | Required | Description                             |
| ---------------------- | --------- | -------- | --------------------------------------- |
| `tags`                 | string\[] | Yes      | Tags to filter by (all must match)      |
| `profileIdOverride`    | guid      | No       | Override profile for all matching tests |
| `contextIdsOverride`   | guid\[]   | No       | Override context IDs for all tests      |
| `guardrailIdsOverride` | guid\[]   | No       | Override guardrail IDs for all tests    |

{% hint style="info" %}
Tests must have ALL specified tags to be included. A test with tags `["quality"]` does not match a request for `["quality", "summarization"]`.
{% endhint %}

## Response

### Success

The response follows the same structure as [Run Test Batch](/ai-in-umbraco/17.latest/testing-and-evaluation/api/run-batch.md) -- a dictionary mapping test IDs to execution results.

{% code title="200 OK" %}

```json
{
    "results": {
        "3fa85f64-5717-4562-b3fc-2c963f66afa6": {
            "testId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "executionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
            "batchId": "f1e2d3c4-b5a6-9870-fedc-ba0987654321",
            "defaultMetrics": {
                "testId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
                "totalRuns": 3,
                "passedRuns": 3,
                "passAtK": 1.0,
                "passToTheK": 1.0,
                "runIds": ["run-1", "run-2", "run-3"]
            },
            "variationMetrics": [],
            "aggregateMetrics": {
                "testId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
                "totalRuns": 3,
                "passedRuns": 3,
                "passAtK": 1.0,
                "passToTheK": 1.0,
                "runIds": ["run-1", "run-2", "run-3"]
            }
        }
    }
}
```

{% endcode %}

### Validation Error

{% code title="400 Bad Request" %}

```json
{
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "Invalid request",
    "status": 400,
    "detail": "At least one tag must be provided."
}
```

{% endcode %}

## Examples

### Run All Quality Tests

{% code title="cURL" %}

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

{% endcode %}

### Run SEO Tests with Profile Override

{% code title="cURL" %}

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

{% endcode %}

## Related

* [Run Single Test](/ai-in-umbraco/17.latest/testing-and-evaluation/api/run.md) - Execute one test
* [Run Batch](/ai-in-umbraco/17.latest/testing-and-evaluation/api/run-batch.md) - Execute tests by ID
* [List Test Runs](/ai-in-umbraco/17.latest/testing-and-evaluation/api/runs.md) - Query runs by batch ID


---

# 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/run-by-tags.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.
