# 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.11/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.11'
  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: '210'
                    workspace_id: this_is_an_id600_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: 81
                    archived: false
                    created_at: 1719493013
                    updated_at: 1719493013
              schema:
                $ref: '#/components/schemas/ticket_type_attribute'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: 3bc672fa-e051-4ede-b6e9-79f518231ba9
                    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
        - description
        - 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
              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.11'
      default: '2.11'
      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'
        - Preview
    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.
      properties:
        type:
          type: string
          description: String representing the object's type. Always has the value `ticket_type_attribute`.
          example: ticket_type_attribute
          enum:
            - 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
          description: Input options for the attribute
          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.
      required:
        - type
        - id
        - workspace_id
        - name
        - description
        - data_type
        - input_options
        - order
        - required_to_create
        - required_to_create_for_contacts
        - visible_on_create
        - visible_to_contacts
        - default
        - ticket_type_id
        - archived
        - created_at
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
