# Get record

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

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

## 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/{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"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    IntelligenceRecord:
      title: IntelligenceRecord
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/RecordCatalogueEntry"
    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
    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
```
