---
title: "Create and run a metric collection job"
method: POST
path: "/v1/metric/collection-jobs"
tags: ["Metric Collection Job"]
---

# Create and run a metric collection job

`POST /v1/metric/collection-jobs`

## Request

- Base URL: `https://api.roark.ai`
- URL: `https://api.roark.ai/v1/metric/collection-jobs`
- Auth: HTTP bearer

Creates a metric collection job for the specified calls or chats and metrics, then triggers processing. Provide exactly one of callIds or chatIds. Pass policyId to score with a metric policy’s settings (for example to re-score past calls after changing which properties Property Verification checks); metrics then defaults to every metric that policy collects.

## Request body

- CreateMetricCollectionJobInput: Input for creating and running a metric collection job. Limits: ≤500 conversations, ≤20 metrics, ≤5000 total items per request.
  - `callIds` string[]: Call IDs to collect metrics for. Mutually exclusive with chatIds. Max 500 per request.
  - `chatIds` string[]: Chat IDs to collect metrics for. Mutually exclusive with callIds. Max 500 per request.
  - `metrics` object[]: Metric definitions to collect. Max 20 per request. Required unless policyId is given; with policyId, defaults to every metric that policy collects, and each one listed must be in it.
    - `id` string, uuid, required
  - `policyId` string, uuid: Optional. A metric policy (collector) whose settings to score with: each metric runs at the version that policy runs it at, with its per-collector setting (such as the properties Property Verification checks), instead of the metric's default. A metric the policy runs at its default runs at its default here too. The policy's conditions are not applied: the listed conversations are scored as given. Use it to re-score past conversations after changing a policy's settings.

## Response `201`

The created metric collection job

- object
  - `data` MetricCollectionJobResponse, required: A metric collection job that processes metrics for calls or chats
    - `id` string, uuid, required: Unique identifier of the metric collection job
    - `status` 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'CANCELED', required: Current status of the job
    - `triggeredBy` 'USER_MANUAL' | 'USER_API' | 'METRIC_POLICY' | 'SIMULATION', required: What triggered this job
    - `totalItems` integer, required: Total number of call-metric pairs to process
    - `completedItems` integer, required: Number of items that finished without failing: a value was written, or the metric did not apply to the conversation
    - `failedItems` integer, required: Number of items that could not be computed, for example because an artifact the metric reads (such as diarization) failed to generate
    - `startedAt` string, nullable, required: When the job started processing
    - `completedAt` string, nullable, required: When the job completed
    - `errorMessage` string, nullable, required: Why the job failed or, on a COMPLETED job with failedItems above 0, why those items failed
    - `policyIds` string[], required: IDs of the metric policies that triggered this job
    - `createdAt` string, required: When the job was created
    - `updatedAt` string, required: When the job was last updated

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `402`: Payment Required
- `403`: Forbidden
- `404`: Not Found
- `429`: Too Many Requests
- `500`: Internal Server Error

## Changes

> 187 revisions in range; 1 not diffed.

- **2026-10-17** `2bb78f0ffcdc`: 3 info
  - added the new optional request property `policyId`
  - the request property `metrics` became optional
  - added the non-success response with the status `404`
- **2026-08-26** `b4a59c7057ca`: 1 info
  - added the non-success response with the status `402`
- **2026-08-17** `887b091b3d81`: 10 warning
  - added the new `conflict` enum value to the `type` response property for the response status `400`
  - added the new `conflict` enum value to the `type` response property for the response status `401`
  - added the new `conflict` enum value to the `type` response property for the response status `403`
  - added the new `conflict` enum value to the `type` response property for the response status `429`
  - …6 more

[Operation history](https://skmtc.dev/roarkhq/apis/roark-analytics-api/changes/v1/metric/collection-jobs/post.md)

---

[API](https://skmtc.dev/roarkhq/apis/roark-analytics-api.md) - [All operations](https://skmtc.dev/roarkhq/apis/roark-analytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/roarkhq/apis/roark-analytics-api/revisions/1a91a5c90e44?raw)
