# Update a data attribute

`PUT /data_attributes/{id}`

> This is a subset of the full specification, limited to the `PUT /data_attributes/{id}` operation.
>
> You can find the full specification here: /_bundle/docs/references/@2.12/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.12'
  description: This is a subset of the full specification, limited to the `PUT /data_attributes/{id}` operation.
  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: []
tags:
  - name: Data Attributes
    description: Everything about your Data Attributes
paths:
  /data_attributes/{id}:
    put:
      summary: Update a data attribute
      parameters:
        - name: Intercom-Version
          in: header
          schema:
            $ref: '#/components/schemas/intercom_version'
        - name: id
          in: path
          required: true
          description: The data attribute id
          example: 1
          schema:
            type: integer
      tags:
        - Data Attributes
      operationId: updateDataAttribute
      description: |

        You can update a data attribute.

        > 🚧 Updating the data type is not possible
        >
        > It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead.
      responses:
        '200':
          description: Successful
          content:
            application/json:
              examples:
                Successful:
                  value:
                    id: 12
                    type: data_attribute
                    name: The One Ring
                    full_name: custom_attributes.The One Ring
                    label: The One Ring
                    description: Just a plain old ring
                    data_type: string
                    options:
                      - 1-10
                      - 11-20
                    api_writable: true
                    ui_writable: false
                    messenger_writable: true
                    custom: true
                    archived: false
                    admin_id: '991266546'
                    created_at: 1736201813
                    updated_at: 1736201813
                    model: company
              schema:
                $ref: '#/components/schemas/data_attribute'
        '400':
          description: Too few options in list
          content:
            application/json:
              examples:
                Too few options in list:
                  value:
                    type: error.list
                    request_id: 91a693a1-586f-40f7-92dc-005544836389
                    errors:
                      - code: parameter_invalid
                        message: Options isn't an array
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: ec5d090e-cb85-4d98-90eb-86a9af57215d
                    errors:
                      - code: unauthorized
                        message: Access Token Invalid
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: Attribute Not Found
          content:
            application/json:
              examples:
                Attribute Not Found:
                  value:
                    type: error.list
                    request_id: 252401cb-0b72-4887-827f-24014f040bc2
                    errors:
                      - code: field_not_found
                        message: We couldn't find that data attribute to update
              schema:
                $ref: '#/components/schemas/error'
        '422':
          description: Has Dependant Object
          content:
            application/json:
              examples:
                Has Dependant Object:
                  value:
                    type: error.list
                    request_id: c050f493-1cc3-4af8-9b3d-8a6be4dade62
                    errors:
                      - code: data_invalid
                        message: The Data Attribute you are trying to archive has a dependant object
              schema:
                $ref: '#/components/schemas/error'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_data_attribute_request'
            examples:
              successful:
                summary: Successful
                value:
                  description: Just a plain old ring
                  options:
                    - value: 1-10
                    - value: 11-20
                  archived: false
              too_few_options_in_list:
                summary: Too few options in list
                value:
                  description: Too few options
                  options:
                    value: 1-10
                  archived: false
              attribute_not_found:
                summary: Attribute Not Found
                value:
                  description: Just a plain old ring
                  options:
                    - value: 1-10
                    - value: 11-20
                  archived: false
              has_dependant_object:
                summary: Has Dependant Object
                value:
                  description: Trying to archieve
                  archived: true
components:
  schemas:
    data_attribute:
      title: Data Attribute
      type: object
      x-tags:
        - Data Attributes
      description: Data Attributes are metadata used to describe your contact, company and conversation models. These include standard and custom attributes. By using the data attributes endpoint, you can get the global list of attributes for your workspace, as well as create and archive custom attributes.
      properties:
        type:
          type: string
          description: Value is `data_attribute`.
          enum:
            - data_attribute
          example: data_attribute
        id:
          type: integer
          description: The unique identifier for the data attribute which is given by Intercom. Only available for custom attributes.
          example: 12878
        model:
          type: string
          description: Value is `contact` for user/lead attributes and `company` for company attributes.
          enum:
            - contact
            - company
          example: contact
        name:
          type: string
          description: Name of the attribute.
          example: paid_subscriber
        full_name:
          type: string
          description: Full name of the attribute. Should match the name unless it's a nested attribute. We can split full_name on `.` to access nested user object values.
          example: custom_attributes.paid_subscriber
        label:
          type: string
          description: Readable name of the attribute (i.e. name you see in the UI)
          example: Paid Subscriber
        description:
          type: string
          description: Readable description of the attribute.
          example: Whether the user is a paid subscriber.
        data_type:
          type: string
          description: The data type of the attribute.
          enum:
            - string
            - integer
            - float
            - boolean
            - date
          example: boolean
        options:
          type: array
          description: List of predefined options for attribute value.
          items:
            type: string
          example:
            - 'true'
            - 'false'
        api_writable:
          type: boolean
          description: Can this attribute be updated through API
          example: true
        messenger_writable:
          type: boolean
          description: Can this attribute be updated by the Messenger
          example: false
        ui_writable:
          type: boolean
          description: Can this attribute be updated in the UI
          example: true
        custom:
          type: boolean
          description: Set to true if this is a CDA
          example: true
        archived:
          type: boolean
          description: Is this attribute archived. (Only applicable to CDAs)
          example: false
        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
        admin_id:
          type: string
          description: Teammate who created the attribute. Only applicable to CDAs
          example: '5712945'
    error:
      type: object
      title: Error
      description: The API will return an Error List for a failed request, which will contain one or more Error objects.
      properties:
        type:
          type: string
          description: The type is error.list
          example: error.list
        request_id:
          type: string
          nullable: true
          format: uuid
          description: ''
          example: f93ecfa8-d08a-4325-8694-89aeb89c8f85
        errors:
          type: array
          description: An array of one or more error objects
          items:
            properties:
              code:
                type: string
                description: A string indicating the kind of error, used to further qualify the HTTP response code
                example: unauthorized
              message:
                type: string
                nullable: true
                description: Optional. Human readable description of the error.
                example: Access Token Invalid
              field:
                type: string
                nullable: true
                description: Optional. Used to identify a particular field or query parameter that was in error.
                example: email
            required:
              - code
      required:
        - type
        - errors
    intercom_version:
      description: Intercom API version.</br>By default, it's equal to the version set in the app package.
      type: string
      example: '2.12'
      default: '2.12'
      enum:
        - '1.0'
        - '1.1'
        - '1.2'
        - '1.3'
        - '1.4'
        - '2.0'
        - '2.1'
        - '2.2'
        - '2.3'
        - '2.4'
        - '2.5'
        - '2.6'
        - '2.7'
        - '2.8'
        - '2.9'
        - '2.10'
        - '2.11'
        - '2.12'
        - Preview
    update_data_attribute_request:
      description: ''
      type: object
      title: Update Data Attribute Request
      properties:
        archived:
          type: boolean
          description: Whether the attribute is to be archived or not.
          example: false
        description:
          type: string
          description: The readable description you see in the UI for the attribute.
          example: My Data Attribute Description
        messenger_writable:
          type: boolean
          description: Can this attribute be updated by the Messenger
          example: false
      oneOf:
        - properties:
            options:
              type: array
              description: Array of objects representing the options of the list, with `value` as the key and the option as the value. At least two options are required.
              items:
                type: object
                properties:
                  value:
                    type: string
              example:
                - value: 1-10
                - value: 11-50
          required:
            - options
          title: list attribute
        - title: other type
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
