> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thena.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a custom field



## OpenAPI

````yaml post /v1/custom-field
openapi: 3.0.0
info:
  title: Thena Platform
  description: The Thena Platform API description
  version: 1.0.0
  contact: {}
servers:
  - url: https://platform.thena.ai
    description: Platform
  - url: http://localhost:8000
    description: Local
security:
  - ApiKey: []
tags: []
paths:
  /v1/custom-field:
    post:
      tags:
        - Custom fields
      description: >-
        This endpoint is only available for standard and enterprise tier
        organizations.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomFieldDto'
      responses:
        '201':
          description: Operation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldResponseDto'
        '400':
          description: Bad Request - Validation error from service
          content:
            application/json:
              example:
                message: >-
                  Custom field with name 'Priority Level' already exists in your
                  organization
                statusCode: 400
                timestamp: '2024-01-15T10:30:00Z'
        '401':
          description: User is not authenticated!
        '403':
          description: User does not have access to this resource!
        '404':
          description: Resource not found!
        '422':
          description: Unprocessable Entity - Validation failed
          content:
            application/json:
              example:
                message:
                  - property: name
                    constraints:
                      isNotEmpty: name should not be empty
                      matches: >-
                        name can only contain alphanumeric characters, spaces,
                        hyphens, underscores, emojis, and common special
                        characters
                  - property: source
                    constraints:
                      isEnum: >-
                        source must be one of the following values: ticket,
                        account, custom_object
                  - property: fieldType
                    constraints:
                      isEnum: >-
                        fieldType must be one of the following values:
                        single_line, multi_line, number, single_select,
                        multi_select, date, time, datetime, boolean, email, url,
                        phone, rich_text, lookup
                error: Validation Error
                statusCode: 422
        '429':
          description: Too many requests!
        '500':
          description: Something went wrong!
        '503':
          description: This service/resource is currently unavailable.
components:
  schemas:
    CreateCustomFieldDto:
      type: object
      properties:
        isActive:
          type: boolean
          description: Whether the custom field is active
        description:
          type: string
          description: The description of the custom field
        name:
          type: string
          description: The name of the custom field
        source:
          type: string
          description: The source of the custom field
        fieldType:
          type: string
          description: The type of the custom field
        options:
          description: >-
            The options of the custom field. Each option should be an object
            with 'value' property
          type: array
          items:
            $ref: '#/components/schemas/CustomFieldOptionDto'
        metadata:
          type: object
          description: The metadata of the custom field
        placeholderText:
          type: string
          description: The placeholder text of the custom field
        hintText:
          type: string
          description: The hint text of the custom field
        mandatoryOnClose:
          type: boolean
          description: Whether the custom field is mandatory on close
        mandatoryOnCreation:
          type: boolean
          description: Whether the custom field is mandatory on creation
        visibleToCustomer:
          type: boolean
          description: Whether the custom field is visible to customer
        editableByCustomer:
          type: boolean
          description: Whether the custom field is editable by customer
        autoAddToAllForms:
          type: boolean
          description: Whether the custom field is auto added to all forms
        defaultValue:
          type: string
          description: The default value of the custom field
        teamId:
          type: string
          description: The team id of the custom field
        lookup:
          type: string
          description: The lookup object id or thena entity name
      required:
        - name
        - source
        - fieldType
    CustomFieldResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CustomFieldData'
        status:
          type: boolean
        message:
          type: string
        timestamp:
          format: date-time
          type: string
      required:
        - data
        - status
        - message
        - timestamp
    CustomFieldOptionDto:
      type: object
      properties:
        value:
          type: string
      required:
        - value
    CustomFieldData:
      type: object
      properties:
        name:
          type: string
        uid:
          type: string
        slug:
          type: string
        organizationId:
          type: string
        source:
          type: string
          enum:
            - ticket
            - account
            - custom_object
            - customer_contact
        fieldType:
          type: string
          enum:
            - single_line
            - multi_line
            - rich_text
            - integer
            - decimal
            - currency
            - date
            - date_time
            - time
            - single_choice
            - multi_choice
            - radio_button
            - checkbox
            - email
            - phone_number
            - url
            - ip_address
            - regex
            - password
            - file_upload
            - calculated
            - lookup
            - address
            - coordinates
            - rating
            - toggle
            - boolean
        options:
          nullable: true
          type: array
          items:
            type: string
        metadata:
          type: object
          nullable: true
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        isActive:
          type: boolean
        teamId:
          type: string
        autoAddToAllForms:
          type: boolean
        hintText:
          type: string
        placeholderText:
          type: string
        mandatoryOnCreation:
          type: boolean
        mandatoryOnClose:
          type: boolean
        visibleToCustomer:
          type: boolean
        editableByCustomer:
          type: boolean
        defaultValue:
          type: string
      required:
        - name
        - uid
        - slug
        - organizationId
        - source
        - fieldType
        - options
        - metadata
        - createdAt
        - updatedAt
        - isActive
        - teamId
        - autoAddToAllForms
        - hintText
        - placeholderText
        - mandatoryOnCreation
        - mandatoryOnClose
        - visibleToCustomer
        - editableByCustomer
        - defaultValue
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Enter your API key '

````