# Query conversation metric

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

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"
}
```

## OpenAPI definition

The operation 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/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"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    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: {}
    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
```
