Skip to main content
POST
/
v1
/
metric
/
collection-jobs
JavaScript
import Roark from '@roarkanalytics/sdk';

const client = new Roark({
  bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});

const metricCollectionJob = await client.metricCollectionJob.create({
  metrics: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }],
});

console.log(metricCollectionJob.data);
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "status": "PENDING",
    "triggeredBy": "USER_MANUAL",
    "totalItems": 123,
    "completedItems": 123,
    "failedItems": 123,
    "startedAt": "<string>",
    "completedAt": "<string>",
    "errorMessage": "<string>",
    "policyIds": [
      "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    ],
    "createdAt": "<string>",
    "updatedAt": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.roark.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Input for creating and running a metric collection job. Limits: ≤500 conversations, ≤20 metrics, ≤5000 total items per request.

metrics
object[]
required

Metric definitions to collect. Max 20 per request.

Required array length: 1 - 20 elements
callIds
string<uuid>[]

Call IDs to collect metrics for. Mutually exclusive with chatIds. Max 500 per request.

Required array length: 1 - 500 elements
chatIds
string<uuid>[]

Chat IDs to collect metrics for. Mutually exclusive with callIds. Max 500 per request.

Required array length: 1 - 500 elements

Response

The created metric collection job

data
object
required

A metric collection job that processes metrics for calls or chats