# Custom Attributes

> This is a subset of the full specification, limited to the `custom_attributes` schema.
>
> You can find the full specification here: /_bundle/docs/references/@2.18/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.18'
  description: This is a subset of the full specification, limited to the `custom_attributes` schema.
  contact:
    name: Intercom Developer Hub
    url: https://developers.intercom.com
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
servers:
  - url: https://api.intercom.io
    description: The production API server
  - url: https://api.eu.intercom.io
    description: The european API server
  - url: https://api.au.intercom.io
    description: The australian API server
security:
  - bearerAuth: []
paths: {}
components:
  schemas:
    datetime:
      oneOf:
        - title: string
          type: string
          format: date-time
          description: A date and time following the ISO8601 notation.
        - title: integer
          type: integer
          description: A date and time as UNIX timestamp notation.
    ai_topic_subtopic:
      title: AI Topic and Subtopic
      type: object
      description: A single AI-generated topic and subtopic classification for a conversation. Surfaced inside `custom_attributes` under the "AI Topic and Subtopic" key as an array of these objects. Requires the AI add-on; the key is omitted when the conversation has no classification.
      properties:
        topic_name:
          type: string
          description: The name of the AI-generated topic.
          example: Billing
        subtopic_name:
          type: string
          nullable: true
          description: The name of the AI-generated subtopic, if any.
          example: Payment Issues
        id:
          type: integer
          nullable: true
          description: The id of the subtopic.
          example: 42
    custom_attributes:
      title: Custom Attributes
      type: object
      description: An object containing the custom attributes on a conversation as key-value pairs. For relationship attributes the value is a list of custom object instance models. System-defined attributes such as "AI Topic and Subtopic", "CX Score rating", "CX Score explanation" and "CX Score reasons" may also be included.
      properties:
        AI Topic and Subtopic:
          type: array
          readOnly: true
          description: Read-only AI Insights classification of the conversation. Present only with the AI add-on; omitted when the conversation has no classification.
          example:
            - topic_name: Billing
              subtopic_name: Payment Issues
              id: 42
          items:
            $ref: '#/components/schemas/ai_topic_subtopic'
        CX Score reasons:
          type: array
          readOnly: true
          description: Read-only reasons behind the conversation's CX Score. Intercom generates this attribute, so it cannot be set. Omitted when the conversation has no CX Score reasons.
          example:
            - name: Resolution speed
              value: Fast
          items:
            $ref: '#/components/schemas/cx_score_reason'
      additionalProperties:
        anyOf:
          - type: string
          - type: integer
          - type: number
          - type: boolean
          - $ref: '#/components/schemas/datetime'
          - $ref: '#/components/schemas/custom_object_instance_list'
      example:
        paid_subscriber: true
        monthly_spend: 155.5
        team_mates: 9
        start_date_iso8601: '2023-03-04T09:46:14Z'
        end_date_timestamp: 1677923174
        CX Score rating: 4
        CX Score explanation: The conversation was resolved quickly and the customer expressed satisfaction with the outcome.
        AI Topic and Subtopic:
          - topic_name: Billing
            subtopic_name: Payment Issues
            id: 42
        CX Score reasons:
          - name: Resolution speed
            value: Fast
    cx_score_reason:
      title: CX Score reason
      type: object
      description: A single reason behind a conversation's CX Score. Surfaced inside `custom_attributes` under the "CX Score reasons" key as an array of these objects.
      properties:
        name:
          type: string
          description: The name of the reason.
          example: Resolution speed
        value:
          type: string
          description: The value recorded for the reason.
          example: Fast
    custom_object_instance:
      title: Custom Object Instance
      type: object
      x-tags:
        - Custom Object Instances
      nullable: true
      description: A Custom Object Instance represents an instance of a custom object type. This allows you to create and set custom attributes to store data about your customers that is not already captured by Intercom. The parent object includes recommended default attributes and you can add your own custom attributes.
      properties:
        id:
          type: string
          description: The Intercom defined id representing the custom object instance.
          example: 16032025
        external_id:
          type: string
          description: The id you have defined for the custom object instance.
          example: 0001d1c1e65a7a19e9f59ae2
        external_created_at:
          type: integer
          format: date-time
          nullable: true
          description: The time when the Custom Object instance was created in the external system it originated from.
          example: 1571672154
        external_updated_at:
          type: integer
          format: date-time
          nullable: true
          description: The time when the Custom Object instance was last updated in the external system it originated from.
          example: 1571672154
        created_at:
          type: integer
          format: date-time
          description: The time the attribute was created as a UTC Unix timestamp
          example: 1671028894
        updated_at:
          type: integer
          format: date-time
          description: The time the attribute was last updated as a UTC Unix timestamp
          example: 1671028894
        type:
          type: string
          description: The identifier of the custom object type that defines the structure of the custom object instance.
          example: Order
        custom_attributes:
          type: object
          description: |-
            The custom attributes you have set on the custom object instance.

            Each value is returned with the type of the attribute it is set on: a string, integer, number or boolean, or `null` when the attribute is unset. A list attribute returns the label of the selected option. A reference attribute returns an object holding the referenced records, under `contacts` for a contact reference, `conversations` for a conversation reference, or `instances` for a reference to another custom object type.
          additionalProperties:
            anyOf:
              - type: string
                nullable: true
              - type: integer
              - type: number
              - type: boolean
              - type: object
          example:
            order_number: ORDER-12345
            total_amount: 99.99
    custom_object_instance_list:
      title: Custom Object Instances
      type: object
      description: The list of associated custom object instances for a given reference attribute on the parent object.
      properties:
        type:
          type: string
          example: order.list
        instances:
          type: array
          description: The list of associated custom object instances for a given reference attribute on the parent object.
          items:
            $ref: '#/components/schemas/custom_object_instance'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
