---
title: "Generate test metrics"
method: POST
path: "/ai/tests/test_framework/v1/metrics/generate_metrics"
tags: ["AI Tests"]
---

# Generate test metrics

`POST /ai/tests/test_framework/v1/metrics/generate_metrics`

## Request

- Base URL: `https://api.telnyx.com/v2`
- URL: `https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/generate_metrics`
- Auth: HTTP bearer

Starts background generation of suggested metrics for a test agent. Returns a progress ID to poll with the get-test-metric-generation-progress endpoint.

## Request body

- GenerateTestMetricsRequest
  - `agent_id` integer, required: Test agent to suggest metrics for.
  - `num_metrics` integer, required: How many metrics to suggest.
  - `scenarios` integer[]: Scenario IDs to base the suggestions on.

## Response `200`

Metric generation initiated.

- ScenarioGenerationResponse
  - `progress_id` string, required: Identifier to poll generation progress with.

## Other responses

- `400`: Bad Request. The AI Tests service rejected the request.
- `401`: Unauthorized. Missing or invalid API key.
- `404`: Not Found. The requested resource does not exist or is not enabled for your account.
- `422`: Unprocessable Entity. A validation error occurred.
- `429`: Too Many Requests. The AI Tests service rate-limited the request.
- `503`: Service Unavailable. The AI Tests service is unavailable.

## Changes

> 152 revisions in range; 1 not diffed.

- **2026-10-22** `09b2e45a88da`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api-2/changes/ai/tests/test_framework/v1/metrics/generate_metrics/post.md)

---

[API](https://skmtc.dev/team-telnyx/apis/telnyx-api-2.md) - [All operations](https://skmtc.dev/team-telnyx/apis/telnyx-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/team-telnyx/apis/telnyx-api-2/revisions/f82938f53ff4?raw)
