# Create a new attribute for a ticket type

`POST /ticket_types/{ticket_type_id}/attributes`

> This is a subset of the full specification, limited to the `POST /ticket_types/{ticket_type_id}/attributes` operation.
>
> 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 `POST /ticket_types/{ticket_type_id}/attributes` 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: Ticket Type Attributes
    description: Everything about your ticket type attributes
paths:
  /ticket_types/{ticket_type_id}/attributes:
    post:
      summary: Create a new attribute for a ticket type
      parameters:
        - name: Intercom-Version
          in: header
          schema:
            $ref: '#/components/schemas/intercom_version'
        - name: ticket_type_id
          in: path
          required: true
          description: The unique identifier for the ticket type which is given by Intercom.
          schema:
            type: string
      tags:
        - Ticket Type Attributes
      description: You can create a new attribute for a ticket type.
      operationId: createTicketTypeAttribute
      responses:
        '200':
          description: Ticket Type Attribute created
          content:
            application/json:
              examples:
                Ticket Type Attribute created:
                  value:
                    type: ticket_type_attribute
                    id: '157'
                    workspace_id: this_is_an_id640_that_should_be_at_least_
                    name: Attribute Title
                    description: Attribute Description
                    data_type: string
                    input_options:
                      multiline: false
                    order: 2
                    required_to_create: false
                    required_to_create_for_contacts: false
                    visible_on_create: true
                    visible_to_contacts: true
                    default: false
                    ticket_type_id: 63
                    archived: false
                    created_at: 1734537862
                    updated_at: 1734537862
              schema:
                $ref: '#/components/schemas/ticket_type_attribute'
        '400':
          description: Bad request
          content:
            application/json:
              examples:
                Missing name:
                  value:
                    type: error.list
                    request_id: 5e2e5891-1673-417d-a27b-c0ffeecaf367
                    errors:
                      - code: parameter_invalid
                        message: Invalid name parameter - Missing name
                Missing data_type:
                  value:
                    type: error.list
                    request_id: 5e2e7780-1680-4180-a280-c0ffeecc8c80
                    errors:
                      - code: parameter_invalid
                        message: Invalid data_type parameter - Missing data type
                Invalid data_type:
                  value:
                    type: error.list
                    request_id: 5e2e966f-168d-4183-a285-c0ffeece2599
                    errors:
                      - code: parameter_invalid
                        message: 'Invalid data_type parameter - Allowed options: string list integer decimal boolean datetime files'
                Duplicate name:
                  value:
                    type: error.list
                    request_id: 5e2eb55e-169a-4186-a28a-c0ffeecfbeb2
                    errors:
                      - code: parameter_invalid
                        message: Ticket type attribute name 'Severity' already exists on this ticket type
                List without enough options:
                  value:
                    type: error.list
                    request_id: 5e2ed44d-16a7-4189-a28f-c0ffeed157cb
                    errors:
                      - code: parameter_invalid
                        message: options requires a minimum of 2 items for list type attributes
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: 6c9836ed-8485-4f1d-929d-b9d7e153daed
                    errors:
                      - code: unauthorized
                        message: Access Token Invalid
              schema:
                $ref: '#/components/schemas/error'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_ticket_type_attribute_request'
            examples:
              ticket_type_attribute_created:
                summary: Ticket Type Attribute created
                value:
                  name: Attribute Title
                  description: Attribute Description
                  data_type: string
                  required_to_create: false
components:
  schemas:
    create_ticket_type_attribute_request:
      description: You can create a Ticket Type Attribute
      type: object
      title: Create Ticket Type Attribute Request Payload
      properties:
        name:
          type: string
          description: The name of the ticket type attribute
          example: Bug Priority
        description:
          type: string
          description: The description of the attribute presented to the teammate or contact
          example: Priority level of the bug
        data_type:
          type: string
          description: The data type of the attribute
          enum:
            - string
            - list
            - integer
            - decimal
            - boolean
            - datetime
            - files
          example: string
        required_to_create:
          type: boolean
          description: Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox.
          default: false
          example: false
        required_to_create_for_contacts:
          type: boolean
          description: Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger.
          default: false
          example: false
        visible_on_create:
          type: boolean
          description: Whether the attribute is visible to teammates when creating a ticket in Inbox.
          default: true
          example: true
        visible_to_contacts:
          type: boolean
          description: Whether the attribute is visible to contacts when creating a ticket in Messenger.
          default: true
          example: true
        multiline:
          type: boolean
          description: Whether the attribute allows multiple lines of text (only applicable to string attributes)
          example: false
        list_items:
          type: string
          description: A comma delimited list of items for the attribute value (only applicable to list attributes)
          example: Low Priority,Medium Priority,High Priority
        allow_multiple_values:
          type: boolean
          description: Whether the attribute allows multiple files to be attached to it (only applicable to file attributes)
          example: false
      required:
        - name
        - data_type
    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
              data:
                type: object
                nullable: true
                additionalProperties: true
                description: Optional. Extra detail about the error, for example `required_permissions` on a 403 `action_forbidden` error.
                example:
                  required_permissions:
                    - read_conversations
            required:
              - code
      required:
        - type
        - errors
    intercom_version:
      description: Intercom API version.</br>If you omit the header, the API uses the version set in your app package, and 1.0 if none is set.
      type: string
      example: '2.18'
      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'
        - '2.13'
        - '2.14'
        - '2.15'
        - '2.16'
        - '2.17'
        - '2.18'
    ticket_type_attribute:
      title: Ticket Type Attribute
      type: object
      description: Ticket type attribute, used to define each data field to be captured in a ticket.
      nullable: true
      properties:
        type:
          type: string
          description: String representing the object's type. Always has the value `ticket_type_attribute`.
          example: ticket_type_attribute
        id:
          type: string
          description: The id representing the ticket type attribute.
          example: '1'
        workspace_id:
          type: string
          description: The id of the workspace that the ticket type attribute belongs to.
          example: ecahpwf5
        name:
          type: string
          description: The name of the ticket type attribute
          example: Title
        description:
          type: string
          description: The description of the ticket type attribute
          example: Bug title.
        data_type:
          type: string
          description: 'The type of the data attribute (allowed values: "string list integer decimal boolean datetime files")'
          example: string
        input_options:
          type: object
          nullable: true
          description: Input options for the attribute. For a string attribute this holds `multiline` when it was set; for a list attribute it holds the list's options. When the attribute has no input options, this is `null`, or left out of the create and update ticket type attribute responses.
          example:
            multiline: true
        order:
          type: integer
          description: The order of the attribute against other attributes
          example: 1
        required_to_create:
          type: boolean
          description: Whether the attribute is required or not for teammates.
          default: false
          example: false
        required_to_create_for_contacts:
          type: boolean
          description: Whether the attribute is required or not for contacts.
          default: false
          example: false
        visible_on_create:
          type: boolean
          description: Whether the attribute is visible or not to teammates.
          default: true
          example: false
        visible_to_contacts:
          type: boolean
          description: Whether the attribute is visible or not to contacts.
          default: true
          example: false
        default:
          type: boolean
          description: Whether the attribute is built in or not.
          example: true
        ticket_type_id:
          type: integer
          description: The id of the ticket type that the attribute belongs to.
          example: 42
        archived:
          type: boolean
          description: Whether the ticket type attribute is archived or not.
          example: false
        created_at:
          type: integer
          format: timestamp
          description: The date and time the ticket type attribute was created.
        updated_at:
          type: integer
          format: timestamp
          description: The date and time the ticket type attribute was last updated.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
