# Intelligence

URL: https://docs.dixa.io/openapi/dixa-api/beta/intelligence

Get the metrics and records behind analytics in Dixa. Find a metric or record and the filters it accepts with List metrics or List records, and look up the ids to filter on with List filter values. Then send the query to the endpoint for its category: `conversations`, `agents` or `aiagents`. A metric returns values such as a count or an average, and a record returns a page of the events behind it. Read the [Intelligence API guide](https://docs.dixa.io/docs/intelligence-api-guide) for a walkthrough.

## List metrics

List the metrics you can query, with the filters and aggregates of each metric and the records it is based on. Use the metric `id` with Query conversation metric, Query agent metric or Query AI agent metric.

### GET /beta/intelligence/metrics

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/intelligence/metrics?pageLimit=50' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The list of metrics

Every metric:

```json
{
  "data": [
    {
      "id": "closedConversations",
      "name": "Closed conversations",
      "category": "conversations",
      "description": "The number of conversations closed in the selected period",
      "deprecated": false,
      "primaryFilters": [
        "period",
        "conversationIds"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        },
        {
          "attribute": "queue",
          "aliases": [
            "queueId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The queue the conversation was routed to"
        },
        {
          "attribute": "team",
          "aliases": [
            "teamId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The team the conversation was assigned to"
        },
        {
          "attribute": "tag",
          "aliases": [
            "tagId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne",
            "IsAll"
          ],
          "defaultOperator": "IsOne",
          "description": "A tag attached to the conversation"
        },
        {
          "attribute": "channel",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The channel the conversation came in on"
        },
        {
          "attribute": "initialDirection",
          "aliases": [
            "direction"
          ],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The initial direction of the conversation"
        },
        {
          "attribute": "contactPoint",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The contact point the conversation arrived through"
        }
      ],
      "aggregates": [
        {
          "name": "count",
          "type": "Integer",
          "defaultIncluded": true,
          "description": "The number of conversations closed in the period, including those closed by deactivated agents"
        }
      ],
      "relatedRecordIds": [
        "closedConversations"
      ]
    },
    {
      "id": "responseTime",
      "name": "Response time",
      "category": "conversations",
      "description": "The time conversations waited for a reply after an end user reached out",
      "definition": "Measures each completed interval as the milliseconds between an end user reaching out and the conversation being replied to. On asynchronous channels (e.g. Email, Contact form) an interval starts with an end user message and ends on the ensuing agent reply; when several end user messages arrive before a reply, the first of them starts the interval. On synchronous channels it starts when the end user reaches out and ends when they are connected to an agent (Phone) or receive the first outbound reply (e.g. Dixa Messenger). A conversation can contribute any number of intervals within the period.",
      "deprecated": false,
      "primaryFilters": [
        "period",
        "conversationIds"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        },
        {
          "attribute": "queue",
          "aliases": [
            "queueId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The queue the conversation was routed to"
        },
        {
          "attribute": "team",
          "aliases": [
            "teamId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The team the conversation was assigned to"
        },
        {
          "attribute": "tag",
          "aliases": [
            "tagId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne",
            "IsAll"
          ],
          "defaultOperator": "IsOne",
          "description": "A tag attached to the conversation"
        },
        {
          "attribute": "channel",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The channel the conversation came in on"
        },
        {
          "attribute": "initialDirection",
          "aliases": [
            "direction"
          ],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The initial direction of the conversation"
        },
        {
          "attribute": "contactPoint",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The contact point the conversation arrived through"
        }
      ],
      "aggregates": [
        {
          "name": "count",
          "type": "Integer",
          "defaultIncluded": true,
          "description": "The number of completed response-time intervals"
        },
        {
          "name": "min",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The lowest of the completed response-time intervals"
        },
        {
          "name": "max",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The highest of the completed response-time intervals"
        },
        {
          "name": "sum",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The total of the completed response-time intervals"
        },
        {
          "name": "average",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The mean of the completed response-time intervals"
        },
        {
          "name": "stdDev",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The standard deviation of the completed response-time intervals"
        }
      ],
      "relatedRecordIds": [
        "responseTime"
      ]
    }
  ]
}
```

Filtered by category:

```json
{
  "data": [
    {
      "id": "agentPresenceDuration",
      "name": "Agent presence duration",
      "category": "agents",
      "description": "How long agents spent working and away in the selected period",
      "definition": "Sums each agent's presence intervals, clipped to the selected period, grouped into working time (with per-media-type availability) and away time (broken down by custom away status). Durations are raw milliseconds.",
      "deprecated": false,
      "primaryFilters": [
        "period"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        }
      ],
      "aggregates": [
        {
          "name": "working",
          "type": "Object",
          "defaultIncluded": true,
          "description": "Total working duration in milliseconds and, under `availability`, the working duration per media type (email, chat, message, speak)"
        },
        {
          "name": "away",
          "type": "Object",
          "defaultIncluded": true,
          "description": "Total away duration in milliseconds and, under `byStatus`, the away duration per custom away status"
        }
      ],
      "relatedRecordIds": [
        "agentPresenceDuration"
      ]
    }
  ]
}
```

First page of two:

```json
{
  "data": [
    {
      "id": "closedConversations",
      "name": "Closed conversations",
      "category": "conversations",
      "description": "The number of conversations closed in the selected period",
      "deprecated": false,
      "primaryFilters": [
        "period",
        "conversationIds"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        },
        {
          "attribute": "queue",
          "aliases": [
            "queueId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The queue the conversation was routed to"
        },
        {
          "attribute": "team",
          "aliases": [
            "teamId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The team the conversation was assigned to"
        },
        {
          "attribute": "tag",
          "aliases": [
            "tagId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne",
            "IsAll"
          ],
          "defaultOperator": "IsOne",
          "description": "A tag attached to the conversation"
        },
        {
          "attribute": "channel",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The channel the conversation came in on"
        },
        {
          "attribute": "initialDirection",
          "aliases": [
            "direction"
          ],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The initial direction of the conversation"
        },
        {
          "attribute": "contactPoint",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The contact point the conversation arrived through"
        }
      ],
      "aggregates": [
        {
          "name": "count",
          "type": "Integer",
          "defaultIncluded": true,
          "description": "The number of conversations closed in the period, including those closed by deactivated agents"
        }
      ],
      "relatedRecordIds": [
        "closedConversations"
      ]
    },
    {
      "id": "responseTime",
      "name": "Response time",
      "category": "conversations",
      "description": "The time conversations waited for a reply after an end user reached out",
      "definition": "Measures each completed interval as the milliseconds between an end user reaching out and the conversation being replied to. On asynchronous channels (e.g. Email, Contact form) an interval starts with an end user message and ends on the ensuing agent reply; when several end user messages arrive before a reply, the first of them starts the interval. On synchronous channels it starts when the end user reaches out and ends when they are connected to an agent (Phone) or receive the first outbound reply (e.g. Dixa Messenger). A conversation can contribute any number of intervals within the period.",
      "deprecated": false,
      "primaryFilters": [
        "period",
        "conversationIds"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        },
        {
          "attribute": "queue",
          "aliases": [
            "queueId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The queue the conversation was routed to"
        },
        {
          "attribute": "team",
          "aliases": [
            "teamId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The team the conversation was assigned to"
        },
        {
          "attribute": "tag",
          "aliases": [
            "tagId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne",
            "IsAll"
          ],
          "defaultOperator": "IsOne",
          "description": "A tag attached to the conversation"
        },
        {
          "attribute": "channel",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The channel the conversation came in on"
        },
        {
          "attribute": "initialDirection",
          "aliases": [
            "direction"
          ],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The initial direction of the conversation"
        },
        {
          "attribute": "contactPoint",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The contact point the conversation arrived through"
        }
      ],
      "aggregates": [
        {
          "name": "count",
          "type": "Integer",
          "defaultIncluded": true,
          "description": "The number of completed response-time intervals"
        },
        {
          "name": "min",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The lowest of the completed response-time intervals"
        },
        {
          "name": "max",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The highest of the completed response-time intervals"
        },
        {
          "name": "sum",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The total of the completed response-time intervals"
        },
        {
          "name": "average",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The mean of the completed response-time intervals"
        },
        {
          "name": "stdDev",
          "type": "Number",
          "unit": "milliseconds",
          "defaultIncluded": true,
          "description": "The standard deviation of the completed response-time intervals"
        }
      ],
      "relatedRecordIds": [
        "responseTime"
      ]
    }
  ],
  "meta": {
    "next": "/beta/intelligence/metrics?pageKey=eyJvZmZzZXQiOjIsImxpbWl0IjoyfQ&pageLimit=2"
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## List records

List the records you can query, with the fields and filters of each record and the metrics based on it. Use the record `id` with Query conversation records, Query agent records or Query AI agent records.

### GET /beta/intelligence/records

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/intelligence/records?pageLimit=50' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The list of records

Every record:

```json
{
  "data": [
    {
      "id": "closedConversations",
      "name": "Closed conversations",
      "category": "conversations",
      "description": "The conversations closed in the selected period, one row each",
      "deprecated": false,
      "primaryFilters": [
        "period",
        "conversationIds"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        },
        {
          "attribute": "queue",
          "aliases": [
            "queueId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The queue the conversation was routed to"
        },
        {
          "attribute": "team",
          "aliases": [
            "teamId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The team the conversation was assigned to"
        },
        {
          "attribute": "tag",
          "aliases": [
            "tagId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne",
            "IsAll"
          ],
          "defaultOperator": "IsOne",
          "description": "A tag attached to the conversation"
        },
        {
          "attribute": "channel",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The channel the conversation came in on"
        },
        {
          "attribute": "initialDirection",
          "aliases": [
            "direction"
          ],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The initial direction of the conversation"
        },
        {
          "attribute": "contactPoint",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The contact point the conversation arrived through"
        }
      ],
      "fields": [
        {
          "name": "conversationId",
          "type": "Integer",
          "nullable": false,
          "description": "The conversation id"
        },
        {
          "name": "closedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the conversation was closed"
        },
        {
          "name": "agent",
          "type": "Entity",
          "nullable": true,
          "description": "The agent who closed the conversation",
          "idType": "Uuid"
        },
        {
          "name": "queue",
          "type": "Entity",
          "nullable": true,
          "description": "The queue the conversation was in when it was closed",
          "idType": "Uuid"
        },
        {
          "name": "closedBy",
          "type": "Entity",
          "nullable": false,
          "description": "Who closed the conversation — an agent, the end user, or unknown",
          "idType": "String"
        },
        {
          "name": "channel",
          "type": "Entity",
          "nullable": true,
          "description": "The channel the conversation came in on",
          "idType": "String"
        },
        {
          "name": "initialDirection",
          "type": "Entity",
          "nullable": true,
          "description": "The initial direction of the conversation",
          "idType": "String"
        },
        {
          "name": "contactPoint",
          "type": "Entity",
          "nullable": true,
          "description": "The contact point the conversation arrived through",
          "idType": "String"
        },
        {
          "name": "tags",
          "type": "List",
          "nullable": true,
          "description": "The tags attached to the conversation",
          "items": {
            "type": "Entity",
            "idType": "Uuid"
          }
        }
      ],
      "relatedMetricIds": [
        "closedConversations"
      ]
    },
    {
      "id": "agentPresenceDuration",
      "name": "Agent presence duration",
      "category": "agents",
      "description": "An agent's completed presence intervals in the selected period, one row each",
      "deprecated": false,
      "primaryFilters": [
        "period"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        }
      ],
      "fields": [
        {
          "name": "endedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the interval ended"
        },
        {
          "name": "agent",
          "type": "Entity",
          "nullable": false,
          "description": "The agent the interval belongs to",
          "idType": "Uuid"
        },
        {
          "name": "startedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the interval started"
        },
        {
          "name": "working",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was working (vs away) during the interval"
        },
        {
          "name": "availableOnEmail",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on email"
        },
        {
          "name": "availableOnChat",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on interactive chat"
        },
        {
          "name": "availableOnMessage",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on messaging"
        },
        {
          "name": "availableOnSpeak",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on voice"
        },
        {
          "name": "simultaneousRing",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether simultaneous ring was enabled"
        },
        {
          "name": "customAwayStatus",
          "type": "Entity",
          "nullable": true,
          "description": "The custom away status, when the agent was away on one",
          "idType": "Uuid"
        }
      ],
      "relatedMetricIds": [
        "agentPresenceDuration"
      ]
    }
  ]
}
```

Filtered by category:

```json
{
  "data": [
    {
      "id": "agentPresenceDuration",
      "name": "Agent presence duration",
      "category": "agents",
      "description": "An agent's completed presence intervals in the selected period, one row each",
      "deprecated": false,
      "primaryFilters": [
        "period"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        }
      ],
      "fields": [
        {
          "name": "endedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the interval ended"
        },
        {
          "name": "agent",
          "type": "Entity",
          "nullable": false,
          "description": "The agent the interval belongs to",
          "idType": "Uuid"
        },
        {
          "name": "startedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the interval started"
        },
        {
          "name": "working",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was working (vs away) during the interval"
        },
        {
          "name": "availableOnEmail",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on email"
        },
        {
          "name": "availableOnChat",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on interactive chat"
        },
        {
          "name": "availableOnMessage",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on messaging"
        },
        {
          "name": "availableOnSpeak",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on voice"
        },
        {
          "name": "simultaneousRing",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether simultaneous ring was enabled"
        },
        {
          "name": "customAwayStatus",
          "type": "Entity",
          "nullable": true,
          "description": "The custom away status, when the agent was away on one",
          "idType": "Uuid"
        }
      ],
      "relatedMetricIds": [
        "agentPresenceDuration"
      ]
    }
  ]
}
```

First page of two:

```json
{
  "data": [
    {
      "id": "closedConversations",
      "name": "Closed conversations",
      "category": "conversations",
      "description": "The conversations closed in the selected period, one row each",
      "deprecated": false,
      "primaryFilters": [
        "period",
        "conversationIds"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        },
        {
          "attribute": "queue",
          "aliases": [
            "queueId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The queue the conversation was routed to"
        },
        {
          "attribute": "team",
          "aliases": [
            "teamId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The team the conversation was assigned to"
        },
        {
          "attribute": "tag",
          "aliases": [
            "tagId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne",
            "IsAll"
          ],
          "defaultOperator": "IsOne",
          "description": "A tag attached to the conversation"
        },
        {
          "attribute": "channel",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The channel the conversation came in on"
        },
        {
          "attribute": "initialDirection",
          "aliases": [
            "direction"
          ],
          "type": "String",
          "operators": [
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The initial direction of the conversation"
        },
        {
          "attribute": "contactPoint",
          "aliases": [],
          "type": "String",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The contact point the conversation arrived through"
        }
      ],
      "fields": [
        {
          "name": "conversationId",
          "type": "Integer",
          "nullable": false,
          "description": "The conversation id"
        },
        {
          "name": "closedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the conversation was closed"
        },
        {
          "name": "agent",
          "type": "Entity",
          "nullable": true,
          "description": "The agent who closed the conversation",
          "idType": "Uuid"
        },
        {
          "name": "queue",
          "type": "Entity",
          "nullable": true,
          "description": "The queue the conversation was in when it was closed",
          "idType": "Uuid"
        },
        {
          "name": "closedBy",
          "type": "Entity",
          "nullable": false,
          "description": "Who closed the conversation — an agent, the end user, or unknown",
          "idType": "String"
        },
        {
          "name": "channel",
          "type": "Entity",
          "nullable": true,
          "description": "The channel the conversation came in on",
          "idType": "String"
        },
        {
          "name": "initialDirection",
          "type": "Entity",
          "nullable": true,
          "description": "The initial direction of the conversation",
          "idType": "String"
        },
        {
          "name": "contactPoint",
          "type": "Entity",
          "nullable": true,
          "description": "The contact point the conversation arrived through",
          "idType": "String"
        },
        {
          "name": "tags",
          "type": "List",
          "nullable": true,
          "description": "The tags attached to the conversation",
          "items": {
            "type": "Entity",
            "idType": "Uuid"
          }
        }
      ],
      "relatedMetricIds": [
        "closedConversations"
      ]
    },
    {
      "id": "agentPresenceDuration",
      "name": "Agent presence duration",
      "category": "agents",
      "description": "An agent's completed presence intervals in the selected period, one row each",
      "deprecated": false,
      "primaryFilters": [
        "period"
      ],
      "filters": [
        {
          "attribute": "agent",
          "aliases": [
            "agentId"
          ],
          "type": "Uuid",
          "operators": [
            "IsEmpty",
            "IsNotEmpty",
            "IsOne",
            "IsNotOne"
          ],
          "defaultOperator": "IsOne",
          "description": "The agent (AI or human) assigned to the conversation"
        }
      ],
      "fields": [
        {
          "name": "endedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the interval ended"
        },
        {
          "name": "agent",
          "type": "Entity",
          "nullable": false,
          "description": "The agent the interval belongs to",
          "idType": "Uuid"
        },
        {
          "name": "startedAt",
          "type": "Timestamp",
          "nullable": false,
          "description": "When the interval started"
        },
        {
          "name": "working",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was working (vs away) during the interval"
        },
        {
          "name": "availableOnEmail",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on email"
        },
        {
          "name": "availableOnChat",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on interactive chat"
        },
        {
          "name": "availableOnMessage",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on messaging"
        },
        {
          "name": "availableOnSpeak",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether the agent was available on voice"
        },
        {
          "name": "simultaneousRing",
          "type": "Boolean",
          "nullable": false,
          "description": "Whether simultaneous ring was enabled"
        },
        {
          "name": "customAwayStatus",
          "type": "Entity",
          "nullable": true,
          "description": "The custom away status, when the agent was away on one",
          "idType": "Uuid"
        }
      ],
      "relatedMetricIds": [
        "agentPresenceDuration"
      ]
    }
  ],
  "meta": {
    "next": "/beta/intelligence/records?pageKey=eyJvZmZzZXQiOjIsImxpbWl0IjoyfQ&pageLimit=2"
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Get metric

Get a metric by id.

### GET /beta/intelligence/metrics/{metricId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/intelligence/metrics/{metricId}' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The metric

Event count:

```json
{
  "data": {
    "id": "closedConversations",
    "name": "Closed conversations",
    "category": "conversations",
    "description": "The number of conversations closed in the selected period",
    "deprecated": false,
    "primaryFilters": [
      "period",
      "conversationIds"
    ],
    "filters": [
      {
        "attribute": "agent",
        "aliases": [
          "agentId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The agent (AI or human) assigned to the conversation"
      },
      {
        "attribute": "queue",
        "aliases": [
          "queueId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The queue the conversation was routed to"
      },
      {
        "attribute": "team",
        "aliases": [
          "teamId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The team the conversation was assigned to"
      },
      {
        "attribute": "tag",
        "aliases": [
          "tagId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne",
          "IsAll"
        ],
        "defaultOperator": "IsOne",
        "description": "A tag attached to the conversation"
      },
      {
        "attribute": "channel",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The channel the conversation came in on"
      },
      {
        "attribute": "initialDirection",
        "aliases": [
          "direction"
        ],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The initial direction of the conversation"
      },
      {
        "attribute": "contactPoint",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The contact point the conversation arrived through"
      }
    ],
    "aggregates": [
      {
        "name": "count",
        "type": "Integer",
        "defaultIncluded": true,
        "description": "The number of conversations closed in the period, including those closed by deactivated agents"
      }
    ],
    "relatedRecordIds": [
      "closedConversations"
    ]
  }
}
```

Duration statistics:

```json
{
  "data": {
    "id": "responseTime",
    "name": "Response time",
    "category": "conversations",
    "description": "The time conversations waited for a reply after an end user reached out",
    "definition": "Measures each completed interval as the milliseconds between an end user reaching out and the conversation being replied to. On asynchronous channels (e.g. Email, Contact form) an interval starts with an end user message and ends on the ensuing agent reply; when several end user messages arrive before a reply, the first of them starts the interval. On synchronous channels it starts when the end user reaches out and ends when they are connected to an agent (Phone) or receive the first outbound reply (e.g. Dixa Messenger). A conversation can contribute any number of intervals within the period.",
    "deprecated": false,
    "primaryFilters": [
      "period",
      "conversationIds"
    ],
    "filters": [
      {
        "attribute": "agent",
        "aliases": [
          "agentId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The agent (AI or human) assigned to the conversation"
      },
      {
        "attribute": "queue",
        "aliases": [
          "queueId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The queue the conversation was routed to"
      },
      {
        "attribute": "team",
        "aliases": [
          "teamId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The team the conversation was assigned to"
      },
      {
        "attribute": "tag",
        "aliases": [
          "tagId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne",
          "IsAll"
        ],
        "defaultOperator": "IsOne",
        "description": "A tag attached to the conversation"
      },
      {
        "attribute": "channel",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The channel the conversation came in on"
      },
      {
        "attribute": "initialDirection",
        "aliases": [
          "direction"
        ],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The initial direction of the conversation"
      },
      {
        "attribute": "contactPoint",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The contact point the conversation arrived through"
      }
    ],
    "aggregates": [
      {
        "name": "count",
        "type": "Integer",
        "defaultIncluded": true,
        "description": "The number of completed response-time intervals"
      },
      {
        "name": "min",
        "type": "Number",
        "unit": "milliseconds",
        "defaultIncluded": true,
        "description": "The lowest of the completed response-time intervals"
      },
      {
        "name": "max",
        "type": "Number",
        "unit": "milliseconds",
        "defaultIncluded": true,
        "description": "The highest of the completed response-time intervals"
      },
      {
        "name": "sum",
        "type": "Number",
        "unit": "milliseconds",
        "defaultIncluded": true,
        "description": "The total of the completed response-time intervals"
      },
      {
        "name": "average",
        "type": "Number",
        "unit": "milliseconds",
        "defaultIncluded": true,
        "description": "The mean of the completed response-time intervals"
      },
      {
        "name": "stdDev",
        "type": "Number",
        "unit": "milliseconds",
        "defaultIncluded": true,
        "description": "The standard deviation of the completed response-time intervals"
      }
    ],
    "relatedRecordIds": [
      "responseTime"
    ]
  }
}
```

Structured aggregates:

```json
{
  "data": {
    "id": "agentPresenceDuration",
    "name": "Agent presence duration",
    "category": "agents",
    "description": "How long agents spent working and away in the selected period",
    "definition": "Sums each agent's presence intervals, clipped to the selected period, grouped into working time (with per-media-type availability) and away time (broken down by custom away status). Durations are raw milliseconds.",
    "deprecated": false,
    "primaryFilters": [
      "period"
    ],
    "filters": [
      {
        "attribute": "agent",
        "aliases": [
          "agentId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The agent (AI or human) assigned to the conversation"
      }
    ],
    "aggregates": [
      {
        "name": "working",
        "type": "Object",
        "defaultIncluded": true,
        "description": "Total working duration in milliseconds and, under `availability`, the working duration per media type (email, chat, message, speak)"
      },
      {
        "name": "away",
        "type": "Object",
        "defaultIncluded": true,
        "description": "Total away duration in milliseconds and, under `byStatus`, the away duration per custom away status"
      }
    ],
    "relatedRecordIds": [
      "agentPresenceDuration"
    ]
  }
}
```

Conditional counts:

```json
{
  "data": {
    "id": "aiAgentFeedback",
    "name": "AI agent feedback",
    "category": "aiagents",
    "description": "The number of AI agent answers end users rated in the selected period, in total and per score",
    "definition": "Counts the thumbs ratings end users gave an AI agent's answer, split into thumbs up and thumbs down.",
    "deprecated": false,
    "primaryFilters": [
      "period"
    ],
    "filters": [
      {
        "attribute": "queue",
        "aliases": [
          "queueId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The queue the conversation was routed to"
      },
      {
        "attribute": "tag",
        "aliases": [
          "tagId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne",
          "IsAll"
        ],
        "defaultOperator": "IsOne",
        "description": "A tag attached to the conversation"
      },
      {
        "attribute": "channel",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The channel the conversation came in on"
      },
      {
        "attribute": "initialDirection",
        "aliases": [
          "direction"
        ],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The initial direction of the conversation"
      },
      {
        "attribute": "contactPoint",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The contact point the conversation arrived through"
      },
      {
        "attribute": "conversation",
        "aliases": [
          "conversationId",
          "csid"
        ],
        "type": "Integer",
        "operators": [
          "IsOne",
          "IsNotOne",
          "GreaterThan",
          "GreaterThanOrEqual",
          "LessThan",
          "LessThanOrEqual"
        ],
        "defaultOperator": "IsOne",
        "description": "The conversation"
      },
      {
        "attribute": "aiAgent",
        "aliases": [
          "aiAgentId"
        ],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The AI agent"
      }
    ],
    "aggregates": [
      {
        "name": "count",
        "type": "Integer",
        "defaultIncluded": true,
        "description": "The number of rated answers in the period"
      },
      {
        "name": "thumbsUp",
        "type": "Integer",
        "defaultIncluded": true,
        "description": "The number of answers rated thumbs up"
      },
      {
        "name": "thumbsDown",
        "type": "Integer",
        "defaultIncluded": true,
        "description": "The number of answers rated thumbs down"
      }
    ],
    "relatedRecordIds": [
      "aiAgentFeedback"
    ]
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Get record

Get a record by id.

### GET /beta/intelligence/records/{recordId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/intelligence/records/{recordId}' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The record

Conversation record:

```json
{
  "data": {
    "id": "closedConversations",
    "name": "Closed conversations",
    "category": "conversations",
    "description": "The conversations closed in the selected period, one row each",
    "deprecated": false,
    "primaryFilters": [
      "period",
      "conversationIds"
    ],
    "filters": [
      {
        "attribute": "agent",
        "aliases": [
          "agentId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The agent (AI or human) assigned to the conversation"
      },
      {
        "attribute": "queue",
        "aliases": [
          "queueId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The queue the conversation was routed to"
      },
      {
        "attribute": "team",
        "aliases": [
          "teamId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The team the conversation was assigned to"
      },
      {
        "attribute": "tag",
        "aliases": [
          "tagId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne",
          "IsAll"
        ],
        "defaultOperator": "IsOne",
        "description": "A tag attached to the conversation"
      },
      {
        "attribute": "channel",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The channel the conversation came in on"
      },
      {
        "attribute": "initialDirection",
        "aliases": [
          "direction"
        ],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The initial direction of the conversation"
      },
      {
        "attribute": "contactPoint",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The contact point the conversation arrived through"
      }
    ],
    "fields": [
      {
        "name": "conversationId",
        "type": "Integer",
        "nullable": false,
        "description": "The conversation id"
      },
      {
        "name": "closedAt",
        "type": "Timestamp",
        "nullable": false,
        "description": "When the conversation was closed"
      },
      {
        "name": "agent",
        "type": "Entity",
        "nullable": true,
        "description": "The agent who closed the conversation",
        "idType": "Uuid"
      },
      {
        "name": "queue",
        "type": "Entity",
        "nullable": true,
        "description": "The queue the conversation was in when it was closed",
        "idType": "Uuid"
      },
      {
        "name": "closedBy",
        "type": "Entity",
        "nullable": false,
        "description": "Who closed the conversation — an agent, the end user, or unknown",
        "idType": "String"
      },
      {
        "name": "channel",
        "type": "Entity",
        "nullable": true,
        "description": "The channel the conversation came in on",
        "idType": "String"
      },
      {
        "name": "initialDirection",
        "type": "Entity",
        "nullable": true,
        "description": "The initial direction of the conversation",
        "idType": "String"
      },
      {
        "name": "contactPoint",
        "type": "Entity",
        "nullable": true,
        "description": "The contact point the conversation arrived through",
        "idType": "String"
      },
      {
        "name": "tags",
        "type": "List",
        "nullable": true,
        "description": "The tags attached to the conversation",
        "items": {
          "type": "Entity",
          "idType": "Uuid"
        }
      }
    ],
    "relatedMetricIds": [
      "closedConversations"
    ]
  }
}
```

Agent record:

```json
{
  "data": {
    "id": "agentPresenceDuration",
    "name": "Agent presence duration",
    "category": "agents",
    "description": "An agent's completed presence intervals in the selected period, one row each",
    "deprecated": false,
    "primaryFilters": [
      "period"
    ],
    "filters": [
      {
        "attribute": "agent",
        "aliases": [
          "agentId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The agent (AI or human) assigned to the conversation"
      }
    ],
    "fields": [
      {
        "name": "endedAt",
        "type": "Timestamp",
        "nullable": false,
        "description": "When the interval ended"
      },
      {
        "name": "agent",
        "type": "Entity",
        "nullable": false,
        "description": "The agent the interval belongs to",
        "idType": "Uuid"
      },
      {
        "name": "startedAt",
        "type": "Timestamp",
        "nullable": false,
        "description": "When the interval started"
      },
      {
        "name": "working",
        "type": "Boolean",
        "nullable": false,
        "description": "Whether the agent was working (vs away) during the interval"
      },
      {
        "name": "availableOnEmail",
        "type": "Boolean",
        "nullable": false,
        "description": "Whether the agent was available on email"
      },
      {
        "name": "availableOnChat",
        "type": "Boolean",
        "nullable": false,
        "description": "Whether the agent was available on interactive chat"
      },
      {
        "name": "availableOnMessage",
        "type": "Boolean",
        "nullable": false,
        "description": "Whether the agent was available on messaging"
      },
      {
        "name": "availableOnSpeak",
        "type": "Boolean",
        "nullable": false,
        "description": "Whether the agent was available on voice"
      },
      {
        "name": "simultaneousRing",
        "type": "Boolean",
        "nullable": false,
        "description": "Whether simultaneous ring was enabled"
      },
      {
        "name": "customAwayStatus",
        "type": "Entity",
        "nullable": true,
        "description": "The custom away status, when the agent was away on one",
        "idType": "Uuid"
      }
    ],
    "relatedMetricIds": [
      "agentPresenceDuration"
    ]
  }
}
```

AI agent record:

```json
{
  "data": {
    "id": "aiAgentFeedback",
    "name": "AI agent feedback",
    "category": "aiagents",
    "description": "The AI agent answers end users rated in the selected period, one row per rating",
    "deprecated": false,
    "primaryFilters": [
      "period"
    ],
    "filters": [
      {
        "attribute": "queue",
        "aliases": [
          "queueId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The queue the conversation was routed to"
      },
      {
        "attribute": "tag",
        "aliases": [
          "tagId"
        ],
        "type": "Uuid",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne",
          "IsAll"
        ],
        "defaultOperator": "IsOne",
        "description": "A tag attached to the conversation"
      },
      {
        "attribute": "channel",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The channel the conversation came in on"
      },
      {
        "attribute": "initialDirection",
        "aliases": [
          "direction"
        ],
        "type": "String",
        "operators": [
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The initial direction of the conversation"
      },
      {
        "attribute": "contactPoint",
        "aliases": [],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The contact point the conversation arrived through"
      },
      {
        "attribute": "conversation",
        "aliases": [
          "conversationId",
          "csid"
        ],
        "type": "Integer",
        "operators": [
          "IsOne",
          "IsNotOne",
          "GreaterThan",
          "GreaterThanOrEqual",
          "LessThan",
          "LessThanOrEqual"
        ],
        "defaultOperator": "IsOne",
        "description": "The conversation"
      },
      {
        "attribute": "aiAgent",
        "aliases": [
          "aiAgentId"
        ],
        "type": "String",
        "operators": [
          "IsEmpty",
          "IsNotEmpty",
          "IsOne",
          "IsNotOne"
        ],
        "defaultOperator": "IsOne",
        "description": "The AI agent"
      }
    ],
    "fields": [
      {
        "name": "conversationId",
        "type": "Integer",
        "nullable": false,
        "description": "The conversation id"
      },
      {
        "name": "submittedAt",
        "type": "Timestamp",
        "nullable": false,
        "description": "When the feedback was submitted"
      },
      {
        "name": "aiAgent",
        "type": "Entity",
        "nullable": false,
        "description": "The AI agent whose answer was rated",
        "idType": "String"
      },
      {
        "name": "queue",
        "type": "Entity",
        "nullable": true,
        "description": "The most recent queue the conversation was in",
        "idType": "Uuid"
      },
      {
        "name": "feedbackType",
        "type": "Entity",
        "nullable": false,
        "description": "The kind of rating given",
        "idType": "String"
      },
      {
        "name": "score",
        "type": "Integer",
        "nullable": false,
        "description": "The score given: 1 for thumbs up, 0 for thumbs down"
      },
      {
        "name": "responseId",
        "type": "String",
        "nullable": false,
        "description": "The AI agent answer that was rated"
      },
      {
        "name": "channel",
        "type": "Entity",
        "nullable": true,
        "description": "The channel the conversation came in on",
        "idType": "String"
      },
      {
        "name": "initialDirection",
        "type": "Entity",
        "nullable": true,
        "description": "The initial direction of the conversation",
        "idType": "String"
      },
      {
        "name": "contactPoint",
        "type": "Entity",
        "nullable": true,
        "description": "The contact point the conversation arrived through",
        "idType": "String"
      },
      {
        "name": "tags",
        "type": "List",
        "nullable": true,
        "description": "The tags attached to the conversation",
        "items": {
          "type": "Entity",
          "idType": "Uuid"
        }
      }
    ],
    "relatedMetricIds": [
      "aiAgentFeedback"
    ]
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Query conversation metric

Get the value of a conversation metric for a period or a list of conversations. All aggregates of the metric are returned. If nothing matches, `count` is 0 and the other aggregates are null.

### POST /beta/intelligence/conversations/metrics/{metricId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

closedConversations · Interval · Queue and direction filters:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/closedConversations' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "queue",
      "values": [
        "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "initialDirection",
      "values": [
        "Inbound"
      ]
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

responseTime · Conversation ids · Duration statistics:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/responseTime' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "conversationIds": [
      8123456,
      8123481,
      8123502
    ]
  },
  "timezone": "Europe/Copenhagen"
}'
```

createdConversations · Preset · No filters:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/createdConversations' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "Last7Days"
    }
  },
  "timezone": "Europe/Copenhagen"
}'
```

responseTime · Interval · Included channels, excluded tag:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/responseTime' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "channel",
      "values": [
        "Email",
        "ContactForm"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "tag",
      "values": [
        "d41a7e90-5b2c-4f83-a6e1-0c9d3b8f2a57"
      ],
      "operator": "IsNotOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

queuedDuration · Interval · Untagged conversations, nothing matched:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/queuedDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "queue",
      "values": [
        "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "tag",
      "values": [],
      "operator": "IsEmpty"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

abandonedConversations · Preset · Phone calls to one number:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/abandonedConversations' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "Today"
    }
  },
  "filters": [
    {
      "attribute": "channel",
      "values": [
        "PstnPhone"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "contactPoint",
      "values": [
        "+18889100777"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

csat · Interval · One team:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/csat' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-06-30T23:59:59.999Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "team",
      "values": [
        "9d2f7b31-4c68-4e13-b590-8a3f1d7c6e29"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

fcr · Interval · One agent:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/fcr' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-04-01T00:00:00Z",
        "to": "2026-06-30T23:59:59.999Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

onHoldDuration · Interval · Assigned conversations only:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/metrics/onHoldDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [],
      "operator": "IsNotEmpty"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

#### Response examples

##### 200 The metric values, keyed by aggregate name

closedConversations · Interval · Queue and direction filters:

```json
{
  "data": {
    "count": 1284
  }
}
```

responseTime · Conversation ids · Duration statistics:

```json
{
  "data": {
    "count": 1284,
    "min": 12000,
    "max": 864321000,
    "average": 35725965.732087225,
    "stdDev": 61238905.11740288,
    "sum": 45872140000
  }
}
```

createdConversations · Preset · No filters:

```json
{
  "data": {
    "count": 412
  }
}
```

responseTime · Interval · Included channels, excluded tag:

```json
{
  "data": {
    "count": 936,
    "min": 9000,
    "max": 518400000,
    "average": 30058461.53846154,
    "stdDev": 47120655.88430212,
    "sum": 28134720000
  }
}
```

queuedDuration · Interval · Untagged conversations, nothing matched:

```json
{
  "data": {
    "count": 0
  }
}
```

abandonedConversations · Preset · Phone calls to one number:

```json
{
  "data": {
    "count": 17
  }
}
```

csat · Interval · One team:

```json
{
  "data": {
    "percentage": 87.23404255319149,
    "count": 235,
    "average": 4.391489361702128
  }
}
```

fcr · Interval · One agent:

```json
{
  "data": {
    "percentage": 71.42857142857143
  }
}
```

onHoldDuration · Interval · Assigned conversations only:

```json
{
  "data": {
    "count": 58,
    "min": 4000,
    "max": 612000,
    "average": 72586.20689655172,
    "stdDev": 98714.3310291778,
    "sum": 4210000
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Query agent metric

Get the value of an agent metric for a period. All aggregates of the metric are returned. If nothing matches, `count` is 0 and the other aggregates are null, except presence durations, which are 0. Deactivated agents are included.

### POST /beta/intelligence/agents/metrics/{metricId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

agentPresenceDuration · Interval · Whole organization:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/metrics/agentPresenceDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "timezone": "Europe/Copenhagen"
}'
```

agentPresenceDuration · Preset · One agent, no presence:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/metrics/agentPresenceDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "PreviousWeek"
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

agentAssignmentReasons · Interval · One queue and team, with a breakdown:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/metrics/agentAssignmentReasons' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "queue",
      "values": [
        "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "team",
      "values": [
        "9d2f7b31-4c68-4e13-b590-8a3f1d7c6e29"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

agentOffersTimedOut · Interval · One agent, phone only:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/metrics/agentOffersTimedOut' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "channel",
      "values": [
        "PstnPhone"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

agentClaims · Interval · Conversations from an id onward:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/metrics/agentClaims' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "conversation",
      "values": [
        "8123000"
      ],
      "operator": "GreaterThanOrEqual"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

#### Response examples

##### 200 The metric values, keyed by aggregate name

agentPresenceDuration · Interval · Whole organization:

```json
{
  "data": {
    "working": {
      "durationMs": 18420000,
      "availability": {
        "email": 18420000,
        "chat": 18420000,
        "message": 12300000,
        "speak": 0
      }
    },
    "away": {
      "durationMs": 5400000,
      "byStatus": [
        {
          "customAwayStatus": {
            "id": "3c6f2a18-8d47-4b93-a05e-2f7c9b1d6a38",
            "label": "Lunch"
          },
          "durationMs": 1800000
        },
        {
          "durationMs": 3600000
        }
      ]
    }
  }
}
```

agentPresenceDuration · Preset · One agent, no presence:

```json
{
  "data": {
    "working": {
      "durationMs": 0,
      "availability": {
        "email": 0,
        "chat": 0,
        "message": 0,
        "speak": 0
      }
    },
    "away": {
      "durationMs": 0,
      "byStatus": []
    }
  }
}
```

agentAssignmentReasons · Interval · One queue and team, with a breakdown:

```json
{
  "data": {
    "transferOffers": 9,
    "claims": 17,
    "count": 120,
    "queueOffers": 84,
    "bulkActions": 4,
    "outboundConversations": 6
  }
}
```

agentOffersTimedOut · Interval · One agent, phone only:

```json
{
  "data": {
    "count": 23
  }
}
```

agentClaims · Interval · Conversations from an id onward:

```json
{
  "data": {
    "count": 31
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Query AI agent metric

Get the value of an AI agent metric for a period. All aggregates of the metric are returned. If nothing matches, the counts are 0. Deleted AI agents are included.

### POST /beta/intelligence/aiagents/metrics/{metricId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

aiAgentFeedback · Interval · All AI agents:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/aiagents/metrics/aiAgentFeedback' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "timezone": "Europe/Copenhagen"
}'
```

aiAgentJoined · Preset · One AI agent:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/aiagents/metrics/aiAgentJoined' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "PreviousWeek"
    }
  },
  "filters": [
    {
      "attribute": "aiAgent",
      "values": [
        "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

aiAgentToolCalls · Interval · Chat only:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/aiagents/metrics/aiAgentToolCalls' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "channel",
      "values": [
        "Messenger"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

#### Response examples

##### 200 The metric values, keyed by aggregate name

aiAgentFeedback · Interval · All AI agents:

```json
{
  "data": {
    "count": 412,
    "thumbsUp": 351,
    "thumbsDown": 61
  }
}
```

aiAgentJoined · Preset · One AI agent:

```json
{
  "data": {
    "count": 268
  }
}
```

aiAgentToolCalls · Interval · Chat only:

```json
{
  "data": {
    "count": 1043
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Query conversation records

Get the rows of a conversation record for a period or a list of conversations. To get the next page, send the same query with `meta.next` as `pagination.pageKey`. Columns without a value are left out of the row.

### POST /beta/intelligence/conversations/records/{recordId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

closedConversations · Interval · Two channels, both tags:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/closedConversations' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "channel",
      "values": [
        "Email",
        "ContactForm"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "tag",
      "values": [
        "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
        "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72"
      ],
      "operator": "IsAll"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageLimit": 50
  },
  "includeLabels": true
}'
```

responseTime · Conversation ids · No labels:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/responseTime' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "conversationIds": [
      8123456,
      8123481,
      8123502
    ]
  },
  "timezone": "Europe/Copenhagen",
  "includeLabels": false
}'
```

interactions · Preset · Final page:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/interactions' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "PreviousWeek"
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04"
      ]
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageKey": "eyJ0aW1lc3RhbXAiOiIyMDI2LTA2LTIzVDA4OjQxOjU1LjYwMFoiLCJzZWNvbmRhcnlLZXkiOiI4MTIzNDcwIiwibGltaXQiOjUwLCJkaXJlY3Rpb24iOiJuZXh0In0",
    "pageLimit": 50
  }
}'
```

conversationRatingUpdated · Interval · Ratings for one queue, small pages:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/conversationRatingUpdated' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "queue",
      "values": [
        "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageLimit": 2
  }
}'
```

taggedConversations · Interval · Two tags, inbound only:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/taggedConversations' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "tag",
      "values": [
        "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
        "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "initialDirection",
      "values": [
        "Inbound"
      ]
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

conversationsTransferredToQueue · Interval · Phone transfers by two agents:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/conversationsTransferredToQueue' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "channel",
      "values": [
        "PstnPhone"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "agent",
      "values": [
        "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

conversationCustomAttributesUpdated · Interval · Contact form, spam excluded, no labels:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/conversationCustomAttributesUpdated' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "channel",
      "values": [
        "ContactForm"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "tag",
      "values": [
        "d41a7e90-5b2c-4f83-a6e1-0c9d3b8f2a57"
      ],
      "operator": "IsNotOne"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "includeLabels": false
}'
```

slaEvaluationUpdated · Interval · One SLA policy in one queue:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/slaEvaluationUpdated' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "slaPolicy",
      "values": [
        "412"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "queue",
      "values": [
        "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "includeLabels": true
}'
```

conversationMessages · Interval · Largest page, internal excluded, no labels:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/conversationMessages' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "initialDirection",
      "values": [
        "Internal"
      ],
      "operator": "IsNotOne"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageLimit": 200
  },
  "includeLabels": false
}'
```

conversationState · Interval · Two queues:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/conversations/records/conversationState' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "queue",
      "values": [
        "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

#### Response examples

##### 200 One page of rows, and the keys of the previous and next pages

closedConversations · Interval · Two channels, both tags:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        },
        {
          "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72",
          "label": "refund"
        }
      ],
      "closedBy": {
        "id": "Agent",
        "label": "Agent"
      },
      "closedAt": "2026-06-18T09:14:04.773+00:00",
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "ContactForm",
        "label": "Contact Form"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        },
        {
          "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72",
          "label": "refund"
        }
      ],
      "closedBy": {
        "id": "EndUser",
        "label": "End User"
      },
      "closedAt": "2026-06-18T11:03:27.48+00:00",
      "contactPoint": {
        "id": "+18889100777"
      },
      "conversationId": 8123481,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

responseTime · Conversation ids · No labels:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email"
      },
      "endedAt": "2026-06-18T09:15:32.483+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04"
        },
        {
          "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72"
        }
      ],
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "isFirstResponse": true,
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound"
      },
      "createdAt": "2026-06-18T09:14:04.773+00:00",
      "startedAt": "2026-06-18T09:14:04.773+00:00"
    },
    {
      "channel": {
        "id": "PstnPhone"
      },
      "endedAt": "2026-06-19T13:07:41.17+00:00",
      "queue": {
        "id": "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63"
      },
      "isFirstResponse": false,
      "conversationId": 8123481,
      "initialDirection": {
        "id": "Inbound"
      },
      "createdAt": "2026-06-19T12:58:03+00:00",
      "startedAt": "2026-06-19T13:02:18.9+00:00"
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

interactions · Preset · Final page:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        }
      ],
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "createdAt": "2026-06-24T14:19:44.62+00:00",
      "conversationId": 8123502,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      },
      "respondedAt": "2026-06-24T14:22:09.117+00:00",
      "isFirstResponse": true
    }
  ],
  "meta": {
    "previous": "eyJ0aW1lc3RhbXAiOiIyMDI2LTA2LTI0VDE0OjIyOjA5LjExN1oiLCJzZWNvbmRhcnlLZXkiOiI4MTIzNTAyIiwibGltaXQiOjUwLCJkaXJlY3Rpb24iOiJwcmV2aW91cyJ9",
    "pageLimit": 50
  }
}
```

conversationRatingUpdated · Interval · Ratings for one queue, small pages:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "submittedAt": "2026-06-18T09:42:10.281+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        }
      ],
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "comment": "Quick and friendly, thanks!",
      "ratingId": "b9f4e2c0-5a17-4d83-8e26-3c1a7f9d0b45",
      "ratingType": {
        "id": "Csat",
        "label": "Csat"
      },
      "score": 5,
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "ContactForm",
        "label": "Contact Form"
      },
      "submittedAt": "2026-06-18T11:20:03+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "ratingId": "0d5a8c71-e3b2-4f96-a148-7b2c9e6f1d30",
      "ratingType": {
        "id": "Csat",
        "label": "Csat"
      },
      "score": 2,
      "conversationId": 8123481,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "next": "eyJ0aW1lc3RhbXAiOiIyMDI2LTA2LTE4VDExOjIwOjAzWiIsInNlY29uZGFyeUtleSI6IjgxMjM0ODEiLCJhZGRpdGlvbmFsS2V5cyI6WyIxIl0sImxpbWl0IjoyLCJkaXJlY3Rpb24iOiJuZXh0In0",
    "pageLimit": 2
  }
}
```

taggedConversations · Interval · Two tags, inbound only:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "tag": {
        "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
        "label": "vip"
      },
      "taggedAt": "2026-06-18T09:20:41.5+00:00",
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "tag": {
        "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72",
        "label": "refund"
      },
      "taggedAt": "2026-06-18T09:20:41.5+00:00",
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

conversationsTransferredToQueue · Interval · Phone transfers by two agents:

```json
{
  "data": [
    {
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "transferredAt": "2026-06-12T13:48:07.332+00:00",
      "transferType": {
        "id": "Assisted",
        "label": "Assisted"
      },
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "transferOutcomeType": {
        "id": "Accepted",
        "label": "Accepted"
      },
      "toQueue": {
        "id": "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63",
        "label": "Billing"
      },
      "channel": {
        "id": "PstnPhone",
        "label": "Phone"
      },
      "conversationId": 8123502,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "transferredAt": "2026-06-15T08:02:55+00:00",
      "transferType": {
        "id": "Blind",
        "label": "Blind"
      },
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415",
        "label": "Amara Okafor"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "transferOutcomeType": {
        "id": "Timeout",
        "label": "Timeout"
      },
      "toQueue": {
        "id": "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63",
        "label": "Billing"
      },
      "channel": {
        "id": "PstnPhone",
        "label": "Phone"
      },
      "conversationId": 8123520,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

conversationCustomAttributesUpdated · Interval · Contact form, spam excluded, no labels:

```json
{
  "data": [
    {
      "contactPoint": {
        "id": "+18889100777"
      },
      "customAttributes": {
        "6c1e0a95-3d27-4b48-9f61-a2e8b5c74d10": "Gold",
        "9a42f7d3-8b15-4c06-a3e9-5d1b6f208c47": 3
      },
      "updatedAt": "2026-06-23T12:58:03+00:00",
      "channel": {
        "id": "ContactForm"
      },
      "conversationId": 8123481,
      "initialDirection": {
        "id": "Inbound"
      }
    },
    {
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "customAttributes": {},
      "updatedAt": "2026-06-23T13:11:40.72+00:00",
      "channel": {
        "id": "ContactForm"
      },
      "conversationId": 8123481,
      "initialDirection": {
        "id": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

slaEvaluationUpdated · Interval · One SLA policy in one queue:

```json
{
  "data": [
    {
      "breachDueAt": "2026-06-24T15:19:44.62+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        }
      ],
      "metric": "responseTime",
      "conversationId": 8123502,
      "evaluationStatus": {
        "id": "Breached",
        "label": "Breached"
      },
      "sla": {
        "id": "412",
        "label": "First reply within 1 hour"
      },
      "updatedAt": "2026-06-24T15:20:12.44+00:00",
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "createdAt": "2026-06-24T14:19:44.62+00:00",
      "startedAt": "2026-06-24T14:19:44.62+00:00"
    },
    {
      "breachDueAt": "2026-06-25T10:02:11.9+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "metric": "responseTime",
      "conversationId": 8123560,
      "evaluationStatus": {
        "id": "Complied",
        "label": "Achieved"
      },
      "sla": {
        "id": "412",
        "label": "First reply within 1 hour"
      },
      "updatedAt": "2026-06-25T09:31:50+00:00",
      "channel": {
        "id": "ContactForm",
        "label": "Contact Form"
      },
      "createdAt": "2026-06-25T09:02:11.9+00:00",
      "startedAt": "2026-06-25T09:02:11.9+00:00"
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

conversationMessages · Interval · Largest page, internal excluded, no labels:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04"
        }
      ],
      "direction": {
        "id": "Outbound"
      },
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "messageType": {
        "id": "Manual"
      },
      "messageCreatedAt": "2026-06-23T09:14:04.773+00:00",
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound"
      }
    },
    {
      "channel": {
        "id": "ContactForm"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      },
      "direction": {
        "id": "Outbound"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "messageType": {
        "id": "Auto"
      },
      "messageCreatedAt": "2026-06-23T14:19:45+00:00",
      "conversationId": 8123502,
      "initialDirection": {
        "id": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 200
  }
}
```

conversationState · Interval · Two queues:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "statusUpdatedAt": "2026-06-22T09:15:32.483+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        }
      ],
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "createdAt": "2026-06-22T09:14:04.773+00:00",
      "assignedAt": "2026-06-22T09:14:20+00:00",
      "outcome": {
        "id": "Answered",
        "label": "Answered"
      },
      "status": {
        "id": "Closed",
        "label": "Closed"
      },
      "queuedAt": "2026-06-22T09:14:05.1+00:00",
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "PstnPhone",
        "label": "Phone"
      },
      "statusUpdatedAt": "2026-06-23T16:41:09+00:00",
      "queue": {
        "id": "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63",
        "label": "Billing"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "createdAt": "2026-06-23T16:41:09+00:00",
      "status": {
        "id": "Open",
        "label": "Open"
      },
      "queuedAt": "2026-06-23T16:41:10.2+00:00",
      "conversationId": 8123578,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Query agent records

Get the rows of an agent record for a period. To get the next page, send the same query with `meta.next` as `pagination.pageKey`. Without filters, all agents are included, also deactivated ones.

### POST /beta/intelligence/agents/records/{recordId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

agentPresenceDuration · Interval · Two agents:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/records/agentPresenceDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageLimit": 50
  },
  "includeLabels": true
}'
```

agentPresenceDuration · Preset · Every agent, no labels:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/records/agentPresenceDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "PreviousWeek"
    }
  },
  "timezone": "Europe/Copenhagen",
  "includeLabels": false
}'
```

agentPresenceDuration · Interval · A deactivated agent, nothing in the period:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/records/agentPresenceDuration' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "e6b2a704-3f19-4d82-9c5b-4a8e1f2d7c36"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

agentOffers · Interval · Two agents, conversations up to an id:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/records/agentOffers' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "conversation",
      "values": [
        "8123500"
      ],
      "operator": "LessThanOrEqual"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageLimit": 2
  }
}'
```

agentAssignmentReasons · Interval · One agent in one queue:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/agents/records/agentAssignmentReasons' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "agent",
      "values": [
        "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "queue",
      "values": [
        "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

#### Response examples

##### 200 One page of rows, and the keys of the previous and next pages

agentPresenceDuration · Interval · Two agents:

```json
{
  "data": [
    {
      "working": true,
      "availableOnSpeak": false,
      "endedAt": "2026-06-18T12:30:00+00:00",
      "availableOnMessage": true,
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "simultaneousRing": false,
      "availableOnChat": true,
      "availableOnEmail": true,
      "startedAt": "2026-06-18T08:00:00+00:00"
    },
    {
      "working": false,
      "availableOnSpeak": false,
      "availableOnMessage": false,
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "simultaneousRing": false,
      "availableOnChat": false,
      "customAwayStatus": {
        "id": "3c6f2a18-8d47-4b93-a05e-2f7c9b1d6a38",
        "label": "Lunch"
      },
      "endedAt": "2026-06-18T13:00:00+00:00",
      "availableOnEmail": false,
      "startedAt": "2026-06-18T12:30:00+00:00"
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

agentPresenceDuration · Preset · Every agent, no labels:

```json
{
  "data": [
    {
      "working": true,
      "availableOnSpeak": false,
      "endedAt": "2026-06-16T16:00:00+00:00",
      "availableOnMessage": true,
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      },
      "simultaneousRing": false,
      "availableOnChat": false,
      "availableOnEmail": true,
      "startedAt": "2026-06-16T08:30:00+00:00"
    },
    {
      "working": false,
      "availableOnSpeak": false,
      "availableOnMessage": false,
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415"
      },
      "simultaneousRing": false,
      "availableOnChat": false,
      "customAwayStatus": {
        "id": "3c6f2a18-8d47-4b93-a05e-2f7c9b1d6a38"
      },
      "endedAt": "2026-06-16T16:45:00+00:00",
      "availableOnEmail": false,
      "startedAt": "2026-06-16T16:00:00+00:00"
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

agentPresenceDuration · Interval · A deactivated agent, nothing in the period:

```json
{
  "data": [],
  "meta": {
    "pageLimit": 50
  }
}
```

agentOffers · Interval · Two agents, conversations up to an id:

```json
{
  "data": [
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "offeredAt": "2026-06-18T09:14:05.2+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tags": [
        {
          "id": "5e7a9c13-2f84-4b60-9d31-6c8a5e2f7b04",
          "label": "vip"
        }
      ],
      "isPreferredAgent": false,
      "offerType": {
        "id": "Standard",
        "label": "Standard"
      },
      "agent": {
        "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
        "label": "Joe Bloggs"
      },
      "contactPoint": {
        "id": "support@example.com"
      },
      "isPersonalOffer": false,
      "conversationId": 8123456,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "PstnPhone",
        "label": "Phone"
      },
      "offeredAt": "2026-06-18T12:05:44.9+00:00",
      "queue": {
        "id": "7ac3e8f4-1b92-4d05-8637-9f2c4a8e1b63",
        "label": "Billing"
      },
      "isPreferredAgent": true,
      "offerType": {
        "id": "PreferredAgent",
        "label": "Preferred Agent"
      },
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415",
        "label": "Amara Okafor"
      },
      "contactPoint": {
        "id": "+18889100777"
      },
      "isPersonalOffer": true,
      "conversationId": 8123490,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "next": "eyJ0aW1lc3RhbXAiOiIyMDI2LTA2LTE4VDEyOjA1OjQ0LjkwMFoiLCJzZWNvbmRhcnlLZXkiOiI4MTIzNDkwIiwiYWRkaXRpb25hbEtleXMiOlsiNDUwMiJdLCJsaW1pdCI6MiwiZGlyZWN0aW9uIjoibmV4dCJ9",
    "pageLimit": 2
  }
}
```

agentAssignmentReasons · Interval · One agent in one queue:

```json
{
  "data": [
    {
      "channel": {
        "id": "PstnPhone",
        "label": "Phone"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "conversationCreatedAt": "2026-06-18T12:05:41.3+00:00",
      "assignedAt": "2026-06-18T12:06:02+00:00",
      "contactPoint": {
        "id": "+18889100777"
      },
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415",
        "label": "Amara Okafor"
      },
      "reason": {
        "id": "OfferAccepted",
        "label": "Queue offers"
      },
      "conversationId": 8123490,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "Email",
        "label": "Email"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "assignedAt": "2026-06-19T10:31:17.8+00:00",
      "contactPoint": {
        "id": "support@example.com"
      },
      "conversationCreatedAt": "2026-06-19T10:02:50+00:00",
      "tags": [
        {
          "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72",
          "label": "refund"
        }
      ],
      "agent": {
        "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415",
        "label": "Amara Okafor"
      },
      "reason": {
        "id": "ConversationClaimed",
        "label": "Claims"
      },
      "conversationId": 8123533,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Query AI agent records

Get the rows of an AI agent record for a period. To get the next page, send the same query with `meta.next` as `pagination.pageKey`. Without filters, all AI agents are included, also deleted ones.

### POST /beta/intelligence/aiagents/records/{recordId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

aiAgentFeedback · Interval · One AI agent:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/aiagents/records/aiAgentFeedback' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "aiAgent",
      "values": [
        "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen",
  "pagination": {
    "pageLimit": 50
  },
  "includeLabels": true
}'
```

aiAgentJoined · Preset · All AI agents, no labels:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/aiagents/records/aiAgentJoined' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "preset": "PreviousWeek"
    }
  },
  "timezone": "Europe/Copenhagen",
  "includeLabels": false
}'
```

aiAgentToolCalls · Interval · One AI agent, chat only:

```bash
curl -X POST 'https://dev.dixa.io/beta/intelligence/aiagents/records/aiAgentToolCalls' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "primaryFilter": {
    "period": {
      "interval": {
        "from": "2026-06-01T00:00:00Z",
        "to": "2026-07-01T00:00:00Z"
      }
    }
  },
  "filters": [
    {
      "attribute": "aiAgent",
      "values": [
        "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47"
      ],
      "operator": "IsOne"
    },
    {
      "attribute": "channel",
      "values": [
        "Messenger"
      ],
      "operator": "IsOne"
    }
  ],
  "timezone": "Europe/Copenhagen"
}'
```

#### Response examples

##### 200 One page of rows, and the keys of the previous and next pages

aiAgentFeedback · Interval · One AI agent:

```json
{
  "data": [
    {
      "channel": {
        "id": "Messenger",
        "label": "Messenger"
      },
      "aiAgent": {
        "id": "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47",
        "label": "Support assistant"
      },
      "submittedAt": "2026-06-20T10:42:13.208+00:00",
      "tags": [
        {
          "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72",
          "label": "refund"
        }
      ],
      "score": 1,
      "responseId": "f3c9a1e7-62b4-4d8f-a5c0-8e2b7d41f693",
      "feedbackType": {
        "id": "Thumbs",
        "label": "Thumbs"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "conversationId": 8123517,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    },
    {
      "channel": {
        "id": "Messenger",
        "label": "Messenger"
      },
      "aiAgent": {
        "id": "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47",
        "label": "Support assistant"
      },
      "submittedAt": "2026-06-20T11:05:47.9+00:00",
      "feedbackType": {
        "id": "Thumbs",
        "label": "Thumbs"
      },
      "score": 0,
      "responseId": "6a1d8e3b-07f2-4c95-b4e8-2d9f5a7c1e30",
      "conversationId": 8123529,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

aiAgentJoined · Preset · All AI agents, no labels:

```json
{
  "data": [
    {
      "channel": {
        "id": "Messenger"
      },
      "aiAgent": {
        "id": "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47"
      },
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90"
      },
      "joinedAt": "2026-06-20T10:41:02.5+00:00",
      "variant": {
        "id": "Support"
      },
      "chatbotType": {
        "id": "Mim"
      },
      "systemUser": {
        "id": "5f2a9d61-c3e8-4b07-91d4-7e6b2a0c8f15"
      },
      "conversationId": 8123517,
      "initialDirection": {
        "id": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

aiAgentToolCalls · Interval · One AI agent, chat only:

```json
{
  "data": [
    {
      "channel": {
        "id": "Messenger",
        "label": "Messenger"
      },
      "tags": [
        {
          "id": "b3c81f6d-7a95-4e28-8c40-1f6b9d3a5e72",
          "label": "refund"
        }
      ],
      "aiAgent": {
        "id": "0b7e4c2d-5a91-4f38-b6e2-9d1c3a8f5e47",
        "label": "Support assistant"
      },
      "calledAt": "2026-06-20T10:41:39.114+00:00",
      "queue": {
        "id": "2f9b6d51-38c4-4a72-9e15-7c8b3f6a2d90",
        "label": "Support"
      },
      "tool": {
        "id": "8d3f1b72-6e04-4a9c-b5d1-2c7e9f0a4b68",
        "label": "Look up order"
      },
      "conversationId": 8123517,
      "initialDirection": {
        "id": "Inbound",
        "label": "Inbound"
      }
    }
  ],
  "meta": {
    "pageLimit": 50
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## List filter values

List the values you can filter on for an attribute, such as all queues or all tags. Deactivated agents, queues and tags are included and marked with `deactivated: true`.

### GET /beta/intelligence/filters/{attribute}/values

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/intelligence/filters/{attribute}/values?pageLimit=50' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The values of the filter attribute

Entity values (agent):

```json
{
  "data": [
    {
      "id": "a4f1c0b2-6d38-4e91-8f27-1b5d9c3e7a04",
      "label": "Joe Bloggs",
      "deactivated": false
    },
    {
      "id": "c81d4e2a-95b7-4c60-a3f8-2e6a7d09b415",
      "label": "Amara Okafor",
      "deactivated": false
    },
    {
      "id": "e6b2a704-3f19-4d82-9c5b-4a8e1f2d7c36",
      "label": "Sam Petrov",
      "deactivated": true
    }
  ],
  "meta": {
    "next": "/beta/intelligence/filters/agent/values?pageKey=eyJvZmZzZXQiOjUwLCJsaW1pdCI6NTB9&pageLimit=50"
  }
}
```

Enum values (channel):

```json
{
  "data": [
    {
      "id": "ContactForm",
      "label": "Contact Form"
    },
    {
      "id": "Email",
      "label": "Email"
    },
    {
      "id": "PstnPhone",
      "label": "Phone"
    }
  ]
}
```

Last page:

```json
{
  "data": [
    {
      "id": "e6b2a704-3f19-4d82-9c5b-4a8e1f2d7c36",
      "label": "Sam Petrov",
      "deactivated": true
    }
  ],
  "meta": {
    "previous": "/beta/intelligence/filters/agent/values?pageKey=eyJvZmZzZXQiOjAsImxpbWl0Ijo1MH0&pageLimit=50"
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## OpenAPI definition

The operations and the schemas used, from the full spec at https://docs.dixa.io/openapi-specs/dixa-beta.yaml. Request and response examples are above.

```yaml
openapi: 3.0.3
info:
  title: Dixa API
  version: beta
servers:
  - url: https://dev.dixa.io
security:
  - ApiKeyAuth: []
paths:
  /beta/intelligence/metrics:
    get:
      tags:
        - Intelligence
      summary: List metrics
      description: List the metrics you can query, with the filters and aggregates of
        each metric and the records it is based on. Use the metric `id` with
        Query conversation metric, Query agent metric or Query AI agent metric.
      operationId: getIntelligenceMetrics
      parameters:
        - name: category
          in: query
          description: Only list metrics in this category. If not provided, all metrics
            are listed.
          required: false
          schema:
            type: string
            enum:
              - conversations
              - agents
              - aiagents
        - name: pageKey
          in: query
          description: The key of the page to fetch. To page through the results, call the
            link in `meta.next` or `meta.previous` of the previous response,
            which already carries this key.
          required: false
          schema:
            type: string
        - name: pageLimit
          in: query
          description: The number of entries per page, up to 1000. Defaults to 50, or to
            the page size of `pageKey` when one is given.
          required: false
          schema:
            default: 50
            type: integer
            format: int32
      responses:
        "200":
          description: The list of metrics
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceMetricCatalogue"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/records:
    get:
      tags:
        - Intelligence
      summary: List records
      description: List the records you can query, with the fields and filters of each
        record and the metrics based on it. Use the record `id` with Query
        conversation records, Query agent records or Query AI agent records.
      operationId: getIntelligenceRecords
      parameters:
        - name: category
          in: query
          description: Only list records in this category. If not provided, all records
            are listed.
          required: false
          schema:
            type: string
            enum:
              - conversations
              - agents
              - aiagents
        - name: pageKey
          in: query
          description: The key of the page to fetch. To page through the results, call the
            link in `meta.next` or `meta.previous` of the previous response,
            which already carries this key.
          required: false
          schema:
            type: string
        - name: pageLimit
          in: query
          description: The number of entries per page, up to 1000. Defaults to 50, or to
            the page size of `pageKey` when one is given.
          required: false
          schema:
            default: 50
            type: integer
            format: int32
      responses:
        "200":
          description: The list of records
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceRecordCatalogue"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/metrics/{metricId}:
    get:
      tags:
        - Intelligence
      summary: Get metric
      description: Get a metric by id.
      operationId: getIntelligenceMetricsMetricid
      parameters:
        - name: metricId
          in: path
          description: The metric id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The metric
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceMetric"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/records/{recordId}:
    get:
      tags:
        - Intelligence
      summary: Get record
      description: Get a record by id.
      operationId: getIntelligenceRecordsRecordid
      parameters:
        - name: recordId
          in: path
          description: The record id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The record
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceRecord"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/conversations/metrics/{metricId}:
    post:
      tags:
        - Intelligence
      summary: Query conversation metric
      description: Get the value of a conversation metric for a period or a list of
        conversations. All aggregates of the metric are returned. If nothing
        matches, `count` is 0 and the other aggregates are null.
      operationId: postIntelligenceConversationsMetricsMetricid
      parameters:
        - name: metricId
          in: path
          description: The id of a conversation metric
          required: true
          schema:
            type: string
          examples:
            closedConversations · Interval · Queue and direction filters:
              value: closedConversations
            responseTime · Conversation ids · Duration statistics:
              value: responseTime
            createdConversations · Preset · No filters:
              value: createdConversations
            responseTime · Interval · Included channels, excluded tag:
              value: responseTime
            queuedDuration · Interval · Untagged conversations, nothing matched:
              value: queuedDuration
            abandonedConversations · Preset · Phone calls to one number:
              value: abandonedConversations
            csat · Interval · One team:
              value: csat
            fcr · Interval · One agent:
              value: fcr
            onHoldDuration · Interval · Assigned conversations only:
              value: onHoldDuration
      requestBody:
        description: The query
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConversationMetricDataRequest"
        required: true
      responses:
        "200":
          description: The metric values, keyed by aggregate name
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceMetricValues"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/agents/metrics/{metricId}:
    post:
      tags:
        - Intelligence
      summary: Query agent metric
      description: Get the value of an agent metric for a period. All aggregates of
        the metric are returned. If nothing matches, `count` is 0 and the other
        aggregates are null, except presence durations, which are 0. Deactivated
        agents are included.
      operationId: postIntelligenceAgentsMetricsMetricid
      parameters:
        - name: metricId
          in: path
          description: The id of an agent metric
          required: true
          schema:
            type: string
          examples:
            agentPresenceDuration · Interval · Whole organization:
              value: agentPresenceDuration
            agentPresenceDuration · Preset · One agent, no presence:
              value: agentPresenceDuration
            agentAssignmentReasons · Interval · One queue and team, with a breakdown:
              value: agentAssignmentReasons
            agentOffersTimedOut · Interval · One agent, phone only:
              value: agentOffersTimedOut
            agentClaims · Interval · Conversations from an id onward:
              value: agentClaims
      requestBody:
        description: The query
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AgentMetricDataRequest"
        required: true
      responses:
        "200":
          description: The metric values, keyed by aggregate name
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceMetricValues"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/aiagents/metrics/{metricId}:
    post:
      tags:
        - Intelligence
      summary: Query AI agent metric
      description: Get the value of an AI agent metric for a period. All aggregates of
        the metric are returned. If nothing matches, the counts are 0. Deleted
        AI agents are included.
      operationId: postIntelligenceAiagentsMetricsMetricid
      parameters:
        - name: metricId
          in: path
          description: The id of an AI agent metric
          required: true
          schema:
            type: string
          examples:
            aiAgentFeedback · Interval · All AI agents:
              value: aiAgentFeedback
            aiAgentJoined · Preset · One AI agent:
              value: aiAgentJoined
            aiAgentToolCalls · Interval · Chat only:
              value: aiAgentToolCalls
      requestBody:
        description: The query
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AiAgentMetricDataRequest"
        required: true
      responses:
        "200":
          description: The metric values, keyed by aggregate name
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceMetricValues"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/conversations/records/{recordId}:
    post:
      tags:
        - Intelligence
      summary: Query conversation records
      description: Get the rows of a conversation record for a period or a list of
        conversations. To get the next page, send the same query with
        `meta.next` as `pagination.pageKey`. Columns without a value are left
        out of the row.
      operationId: postIntelligenceConversationsRecordsRecordid
      parameters:
        - name: recordId
          in: path
          description: The id of a conversation record
          required: true
          schema:
            type: string
          examples:
            closedConversations · Interval · Two channels, both tags:
              value: closedConversations
            responseTime · Conversation ids · No labels:
              value: responseTime
            interactions · Preset · Final page:
              value: interactions
            conversationRatingUpdated · Interval · Ratings for one queue, small pages:
              value: conversationRatingUpdated
            taggedConversations · Interval · Two tags, inbound only:
              value: taggedConversations
            conversationsTransferredToQueue · Interval · Phone transfers by two agents:
              value: conversationsTransferredToQueue
            conversationCustomAttributesUpdated · Interval · Contact form, spam excluded, no labels:
              value: conversationCustomAttributesUpdated
            slaEvaluationUpdated · Interval · One SLA policy in one queue:
              value: slaEvaluationUpdated
            conversationMessages · Interval · Largest page, internal excluded, no labels:
              value: conversationMessages
            conversationState · Interval · Two queues:
              value: conversationState
      requestBody:
        description: The query
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConversationRecordDataRequest"
        required: true
      responses:
        "200":
          description: One page of rows, and the keys of the previous and next pages
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceRecordPage"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/agents/records/{recordId}:
    post:
      tags:
        - Intelligence
      summary: Query agent records
      description: Get the rows of an agent record for a period. To get the next page,
        send the same query with `meta.next` as `pagination.pageKey`. Without
        filters, all agents are included, also deactivated ones.
      operationId: postIntelligenceAgentsRecordsRecordid
      parameters:
        - name: recordId
          in: path
          description: The id of an agent record
          required: true
          schema:
            type: string
          examples:
            agentPresenceDuration · Interval · Two agents:
              value: agentPresenceDuration
            agentPresenceDuration · Preset · Every agent, no labels:
              value: agentPresenceDuration
            agentPresenceDuration · Interval · A deactivated agent, nothing in the period:
              value: agentPresenceDuration
            agentOffers · Interval · Two agents, conversations up to an id:
              value: agentOffers
            agentAssignmentReasons · Interval · One agent in one queue:
              value: agentAssignmentReasons
      requestBody:
        description: The query
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AgentRecordDataRequest"
        required: true
      responses:
        "200":
          description: One page of rows, and the keys of the previous and next pages
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceRecordPage"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/aiagents/records/{recordId}:
    post:
      tags:
        - Intelligence
      summary: Query AI agent records
      description: Get the rows of an AI agent record for a period. To get the next
        page, send the same query with `meta.next` as `pagination.pageKey`.
        Without filters, all AI agents are included, also deleted ones.
      operationId: postIntelligenceAiagentsRecordsRecordid
      parameters:
        - name: recordId
          in: path
          description: The id of an AI agent record
          required: true
          schema:
            type: string
          examples:
            aiAgentFeedback · Interval · One AI agent:
              value: aiAgentFeedback
            aiAgentJoined · Preset · All AI agents, no labels:
              value: aiAgentJoined
            aiAgentToolCalls · Interval · One AI agent, chat only:
              value: aiAgentToolCalls
      requestBody:
        description: The query
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AiAgentRecordDataRequest"
        required: true
      responses:
        "200":
          description: One page of rows, and the keys of the previous and next pages
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceRecordPage"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/intelligence/filters/{attribute}/values:
    get:
      tags:
        - Intelligence
      summary: List filter values
      description: "List the values you can filter on for an attribute, such as all
        queues or all tags. Deactivated agents, queues and tags are included and
        marked with `deactivated: true`."
      operationId: getIntelligenceFiltersAttributeValues
      parameters:
        - name: attribute
          in: path
          description: A filter `attribute` from List metrics or List records
          required: true
          schema:
            type: string
        - name: pageKey
          in: query
          description: The key of the page to fetch. To page through the results, call the
            link in `meta.next` or `meta.previous` of the previous response,
            which already carries this key.
          required: false
          schema:
            type: string
        - name: pageLimit
          in: query
          description: The number of entries per page, up to 1000. Defaults to 50, or to
            the page size of `pageKey` when one is given.
          required: false
          schema:
            default: 50
            type: integer
            format: int32
      responses:
        "200":
          description: The values of the filter attribute
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntelligenceFilterValuePage"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    IntelligenceMetricCatalogue:
      title: IntelligenceMetricCatalogue
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MetricCatalogueEntry"
        meta:
          $ref: "#/components/schemas/PaginationLinks"
    MetricCatalogueEntry:
      title: MetricCatalogueEntry
      description: A metric and how to query it
      type: object
      required:
        - id
        - name
        - category
        - description
        - deprecated
      properties:
        id:
          description: The metric id, used in the URL when you query the metric
          type: string
        name:
          description: The display name
          type: string
        category:
          description: "`conversations`, `agents` or `aiagents`. Decides which endpoint
            you query the metric with"
          type: string
        description:
          description: A short description of the metric
          type: string
        definition:
          description: How the metric is calculated, if documented
          type: string
        deprecated:
          description: Whether the metric will be removed. A deprecated metric can still
            be queried
          type: boolean
        primaryFilters:
          description: "The keys the `primaryFilter` of a query supports: `period`,
            `conversationIds` or both"
          type: array
          items:
            type: string
        filters:
          description: The filters the metric supports
          type: array
          items:
            $ref: "#/components/schemas/FilterDescriptor"
        aggregates:
          description: The values the metric returns
          type: array
          items:
            $ref: "#/components/schemas/MetricAggregate"
        relatedRecordIds:
          description: The records the metric is based on
          type: array
          items:
            type: string
    FilterDescriptor:
      title: FilterDescriptor
      description: A filter the metric or record supports
      type: object
      required:
        - attribute
        - type
        - defaultOperator
        - description
      properties:
        attribute:
          description: The value to use as a filter's `attribute`
          type: string
        aliases:
          description: Other names you can use for the attribute. Responses always use
            `attribute`
          type: array
          items:
            type: string
        type:
          description: The type of the filter values
          type: string
          enum:
            - String
            - Integer
            - Number
            - Boolean
            - Uuid
            - Timestamp
            - Entity
            - List
            - Object
        operators:
          description: The operators the attribute supports
          type: array
          items:
            type: string
            enum:
              - IsEmpty
              - IsNotEmpty
              - IsOne
              - IsNotOne
              - IsAll
              - GreaterThan
              - GreaterThanOrEqual
              - LessThan
              - LessThanOrEqual
        defaultOperator:
          description: The operator used when a filter has no `operator`
          type: string
          enum:
            - IsEmpty
            - IsNotEmpty
            - IsOne
            - IsNotOne
            - IsAll
            - GreaterThan
            - GreaterThanOrEqual
            - LessThan
            - LessThanOrEqual
        description:
          description: A description of the filter
          type: string
    MetricAggregate:
      title: MetricAggregate
      description: A value the metric returns
      type: object
      required:
        - name
        - type
        - defaultIncluded
        - description
      properties:
        name:
          description: The key of the value in the response
          type: string
        type:
          description: The type of the value
          type: string
          enum:
            - String
            - Integer
            - Number
            - Boolean
            - Uuid
            - Timestamp
            - Entity
            - List
            - Object
        unit:
          description: The unit of the value, such as milliseconds. Not set when the value
            has no unit
          type: string
        defaultIncluded:
          description: Whether the value is returned by default. All values are currently
            returned
          type: boolean
        description:
          description: A description of the value
          type: string
    PaginationLinks:
      title: PaginationLinks
      type: object
      properties:
        previous:
          description: url
          type: string
        next:
          description: url
          type: string
    BadRequest:
      title: BadRequest
      type: object
      required:
        - message
      properties:
        message:
          type: string
    NotFound:
      title: NotFound
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ServerError:
      title: ServerError
      type: object
      required:
        - message
      properties:
        message:
          type: string
    IntelligenceRecordCatalogue:
      title: IntelligenceRecordCatalogue
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/RecordCatalogueEntry"
        meta:
          $ref: "#/components/schemas/PaginationLinks"
    RecordCatalogueEntry:
      title: RecordCatalogueEntry
      description: A record and how to query it
      type: object
      required:
        - id
        - name
        - category
        - description
        - deprecated
      properties:
        id:
          description: The record id, used in the URL when you query the record
          type: string
        name:
          description: The display name
          type: string
        category:
          description: "`conversations`, `agents` or `aiagents`. Decides which endpoint
            you query the record with"
          type: string
        description:
          description: A short description of the record
          type: string
        deprecated:
          description: Whether the record will be removed. A deprecated record can still
            be queried
          type: boolean
        primaryFilters:
          description: "The keys the `primaryFilter` of a query supports: `period`,
            `conversationIds` or both"
          type: array
          items:
            type: string
        filters:
          description: The filters the record supports
          type: array
          items:
            $ref: "#/components/schemas/FilterDescriptor"
        fields:
          description: The columns a row can contain. A nullable column can be left out of
            a row
          type: array
          items:
            $ref: "#/components/schemas/RecordField"
        relatedMetricIds:
          description: The metrics based on the record
          type: array
          items:
            type: string
    RecordField:
      title: RecordField
      description: A column of a record row
      type: object
      required:
        - name
        - type
        - nullable
        - description
      properties:
        name:
          description: The key of the column in a row
          type: string
        type:
          description: The type of the column value
          type: string
          enum:
            - String
            - Integer
            - Number
            - Boolean
            - Uuid
            - Timestamp
            - Entity
            - List
            - Object
        nullable:
          description: Whether the column can be left out of a row
          type: boolean
        description:
          description: A description of the column
          type: string
        unit:
          description: The unit of the value, such as milliseconds. Not set when the value
            has no unit
          type: string
        idType:
          description: The id type. Only set when the column is a reference
          type: string
          enum:
            - Uuid
            - String
            - Integer
        items:
          $ref: "#/components/schemas/RecordFieldItems"
    RecordFieldItems:
      title: RecordFieldItems
      description: The type of the list items. Only set for list fields
      type: object
      required:
        - type
      properties:
        type:
          description: The item type
          type: string
          enum:
            - String
            - Integer
            - Number
            - Boolean
            - Uuid
            - Timestamp
            - Entity
            - List
            - Object
        idType:
          description: The id type. Only set when the items are references
          type: string
          enum:
            - Uuid
            - String
            - Integer
    IntelligenceMetric:
      title: IntelligenceMetric
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/MetricCatalogueEntry"
    IntelligenceRecord:
      title: IntelligenceRecord
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/RecordCatalogueEntry"
    ConversationMetricDataRequest:
      title: ConversationMetricDataRequest
      description: A conversation metric query
      type: object
      required:
        - primaryFilter
        - timezone
      properties:
        primaryFilter:
          $ref: "#/components/schemas/ConversationPrimaryFilter"
        filters:
          description: The filters to apply. All filters must match
          type: array
          items:
            $ref: "#/components/schemas/SecondaryFilter"
        timezone:
          description: The timezone presets and days are evaluated in, such as
            `Europe/Copenhagen`
          type: string
    ConversationPrimaryFilter:
      title: ConversationPrimaryFilter
      description: 'The period or conversations to query, given as either `{"period":
        {...}}` or `{"conversationIds": [8123456, 8123481]}`'
      oneOf:
        - $ref: "#/components/schemas/ConversationIdsPrimaryFilter"
        - $ref: "#/components/schemas/ConversationPeriodPrimaryFilter"
    ConversationIdsPrimaryFilter:
      title: ConversationIdsPrimaryFilter
      description: Query specific conversations, regardless of when they happened
      type: object
      properties:
        conversationIds:
          description: The conversation ids
          type: array
          items:
            type: integer
            format: int64
    ConversationPeriodPrimaryFilter:
      title: ConversationPeriodPrimaryFilter
      description: Query a period
      type: object
      required:
        - period
      properties:
        period:
          $ref: "#/components/schemas/Period"
    Period:
      title: Period
      description: 'A period, given as either a preset, `{"preset": "Last7Days"}`, or
        an interval, `{"interval": {"from": "2026-06-01T00:00:00Z", "to":
        "2026-06-30T23:59:59.999Z"}}`'
      oneOf:
        - $ref: "#/components/schemas/IntervalPeriod"
        - $ref: "#/components/schemas/PresetPeriod"
    IntervalPeriod:
      title: IntervalPeriod
      description: A period between two points in time
      type: object
      required:
        - interval
      properties:
        interval:
          $ref: "#/components/schemas/IntelligenceInterval"
    IntelligenceInterval:
      title: IntelligenceInterval
      description: A time range. Both ends are ISO 8601 timestamps that must end in
        `Z` or a UTC offset, such as `2026-06-01T00:00:00Z` or
        `2026-06-01T00:00:00+02:00`
      type: object
      required:
        - from
        - to
      properties:
        from:
          description: The start of the range, inclusive. Must be before `to`
          type: string
          format: date-time
        to:
          description: The end of the range, inclusive
          type: string
          format: date-time
    PresetPeriod:
      title: PresetPeriod
      description: A preset period, evaluated in the timezone of the query
      type: object
      required:
        - preset
      properties:
        preset:
          description: >-
            The preset. The available presets are:


            - `Today` and `Yesterday`

            - `Last{Unit}` or `Previous{Unit}`: the previous full unit, e.g.
            `PreviousWeek`

            - `Last{N}{Unit}s`: for N of 2 or more, the last N units, including
            the current one, e.g. `Last7Days`. With N of 1 it is the same as
            `Previous{Unit}`

            - `This{Unit}`: the current unit so far, for `Week`, `Month`,
            `Quarter` or `Year`, e.g. `ThisMonth`


            The units are `Hour`, `Day`, `Week`, `Month`, `Quarter` and `Year`
          type: string
    SecondaryFilter:
      title: SecondaryFilter
      description: A filter on an attribute
      type: object
      required:
        - attribute
      properties:
        attribute:
          description: The attribute to filter on, from the `filters` of the metric or
            record. Any other attribute is rejected
          type: string
        values:
          description: The values to filter on, as returned by List filter values. Send an
            empty list for `IsEmpty` and `IsNotEmpty`
          type: array
          items:
            type: string
        operator:
          description: The operator. Defaults to the `defaultOperator` of the attribute.
            An operator the attribute does not support is rejected
          type: string
          enum:
            - IsEmpty
            - IsNotEmpty
            - IsOne
            - IsNotOne
            - IsAll
            - GreaterThan
            - GreaterThanOrEqual
            - LessThan
            - LessThanOrEqual
    IntelligenceMetricValues:
      title: IntelligenceMetricValues
      type: object
      required:
        - data
      properties:
        data:
          description: The metric values, keyed by the `name` of each of the metric's
            `aggregates`. All aggregates are included. If nothing matches,
            `count` is 0, `min`, `max`, `sum`, `average`, `stdDev` and
            `percentage` are null, and an object value is filled with zeros
          type: object
          additionalProperties: {}
    AgentMetricDataRequest:
      title: AgentMetricDataRequest
      description: An agent metric query
      type: object
      required:
        - primaryFilter
        - timezone
      properties:
        primaryFilter:
          $ref: "#/components/schemas/AgentPrimaryFilter"
        filters:
          description: The filters to apply. All filters must match
          type: array
          items:
            $ref: "#/components/schemas/SecondaryFilter"
        timezone:
          description: The timezone presets and days are evaluated in, such as
            `Europe/Copenhagen`
          type: string
    AgentPrimaryFilter:
      title: AgentPrimaryFilter
      description: The period to query
      type: object
      required:
        - period
      properties:
        period:
          $ref: "#/components/schemas/Period"
    AiAgentMetricDataRequest:
      title: AiAgentMetricDataRequest
      description: An AI agent metric query
      type: object
      required:
        - primaryFilter
        - timezone
      properties:
        primaryFilter:
          $ref: "#/components/schemas/AiAgentPrimaryFilter"
        filters:
          description: The filters to apply. All filters must match
          type: array
          items:
            $ref: "#/components/schemas/SecondaryFilter"
        timezone:
          description: The timezone presets and days are evaluated in, such as
            `Europe/Copenhagen`
          type: string
    AiAgentPrimaryFilter:
      title: AiAgentPrimaryFilter
      description: The period to query
      type: object
      required:
        - period
      properties:
        period:
          $ref: "#/components/schemas/Period"
    ConversationRecordDataRequest:
      title: ConversationRecordDataRequest
      description: A conversation record query
      type: object
      required:
        - primaryFilter
        - timezone
      properties:
        primaryFilter:
          $ref: "#/components/schemas/ConversationPrimaryFilter"
        filters:
          description: The filters to apply. All filters must match
          type: array
          items:
            $ref: "#/components/schemas/SecondaryFilter"
        timezone:
          description: The timezone presets and days are evaluated in, such as
            `Europe/Copenhagen`
          type: string
        pagination:
          $ref: "#/components/schemas/PageRequest"
        includeLabels:
          description: Whether references include a `label`. Defaults to true
          type: boolean
    PageRequest:
      title: PageRequest
      description: The page to fetch. If not provided, the first page is returned
      type: object
      properties:
        pageKey:
          description: The key of the page to fetch, taken from `meta.next` or
            `meta.previous` in a previous response
          type: string
        pageLimit:
          description: The number of rows per page, up to 200
          default: 50
          type: integer
          format: int32
          minimum: 1
          maximum: 200
    IntelligenceRecordPage:
      title: IntelligenceRecordPage
      type: object
      required:
        - meta
      properties:
        data:
          description: The rows of the page. The columns a row can contain are listed
            under `fields` in the record's catalogue entry
          type: array
          items:
            description: A row, keyed by the `name` of each of the record's `fields`.
              Columns without a value are left out, so rows can have different
              keys
            type: object
            additionalProperties: {}
        meta:
          $ref: "#/components/schemas/PageResponse"
    PageResponse:
      title: PageResponse
      description: The keys of the previous and next pages, and the page size
      type: object
      required:
        - pageLimit
      properties:
        previous:
          description: The key of the previous page. Not set on the first page
          type: string
        next:
          description: The key of the next page. Not set on the last page
          type: string
        pageLimit:
          description: The page size used
          type: integer
          format: int32
    AgentRecordDataRequest:
      title: AgentRecordDataRequest
      description: An agent record query
      type: object
      required:
        - primaryFilter
        - timezone
      properties:
        primaryFilter:
          $ref: "#/components/schemas/AgentPrimaryFilter"
        filters:
          description: The filters to apply. All filters must match
          type: array
          items:
            $ref: "#/components/schemas/SecondaryFilter"
        timezone:
          description: The timezone presets and days are evaluated in, such as
            `Europe/Copenhagen`
          type: string
        pagination:
          $ref: "#/components/schemas/PageRequest"
        includeLabels:
          description: Whether references include a `label`. Defaults to true
          type: boolean
    AiAgentRecordDataRequest:
      title: AiAgentRecordDataRequest
      description: An AI agent record query
      type: object
      required:
        - primaryFilter
        - timezone
      properties:
        primaryFilter:
          $ref: "#/components/schemas/AiAgentPrimaryFilter"
        filters:
          description: The filters to apply. All filters must match
          type: array
          items:
            $ref: "#/components/schemas/SecondaryFilter"
        timezone:
          description: The timezone presets and days are evaluated in, such as
            `Europe/Copenhagen`
          type: string
        pagination:
          $ref: "#/components/schemas/PageRequest"
        includeLabels:
          description: Whether references include a `label`. Defaults to true
          type: boolean
    IntelligenceFilterValuePage:
      title: IntelligenceFilterValuePage
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/IntelligenceFilterValue"
        meta:
          $ref: "#/components/schemas/PaginationLinks"
    IntelligenceFilterValue:
      title: IntelligenceFilterValue
      description: A value of a filter attribute
      type: object
      required:
        - id
      properties:
        id:
          description: The value to use in a filter's `values`
          type: string
        label:
          description: The display name
          type: string
        deactivated:
          description: Whether the agent, queue, tag or SLA policy is deactivated. Not set
            for other attributes
          type: boolean
```
