# List records

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

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

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