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

# Define Custom Field

> Defines a custom field for this client and sets its type. Existing values are checked against the type first: a number field rejects non-numeric values, a date field rejects anything but YYYY-MM-DD, and a dropdown rejects values outside available_options. Repeating the call for an existing field updates its type.



## OpenAPI

````yaml POST /public/custom-fields/schema
openapi: 3.0.3
info:
  title: RevyOps API
  version: 1.0.0
servers:
  - url: https://app.revyops.com/api
security:
  - ApiKeyAuth: []
paths:
  /public/custom-fields/schema:
    post:
      tags:
        - public
      description: >-
        Defines a custom field for this client and sets its type. Existing
        values are checked against the type first: a number field rejects
        non-numeric values, a date field rejects anything but YYYY-MM-DD, and a
        dropdown rejects values outside available_options. Repeating the call
        for an existing field updates its type.
      operationId: Create custom field definition
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldDefinition'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CustomFieldDefinition'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CustomFieldDefinition'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionRow'
          description: OK. The field already existed; its type was applied.
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionRow'
          description: Created. The field is now defined for this client.
        '400':
          description: >-
            Bad Request. Reserved name, unsupported type, missing dropdown
            options, or existing values that the type would reject.
        '409':
          description: Conflict. The agency master schema owns this field and its type.
components:
  schemas:
    CustomFieldDefinition:
      type: object
      properties:
        object:
          $ref: '#/components/schemas/ObjectEnum'
        field_name:
          type: string
          maxLength: 255
        type:
          allOf:
            - $ref: '#/components/schemas/TypeEnum'
          default: text
        available_options:
          type: array
          items:
            type: string
            maxLength: 255
      required:
        - field_name
        - object
    CustomFieldDefinitionRow:
      type: object
      properties:
        object:
          $ref: '#/components/schemas/ObjectEnum'
        field_name:
          type: string
        type:
          $ref: '#/components/schemas/TypeEnum'
        available_options:
          type: array
          items:
            type: string
        source:
          allOf:
            - $ref: '#/components/schemas/SourceEnum'
          description: >-
            agency: defined in the agency master schema, its type is managed
            there; client: defined for this workspace only.


            * `agency` - agency

            * `client` - client
        created_by:
          type: string
          nullable: true
          description: >-
            Firebase uid of the user who added it in the UI; null for fields
            created by the API, MCP or an import.
        filter_key:
          type: string
          description: The field id to use in filter conditions, e.g. custom.fit_score.
      required:
        - available_options
        - created_by
        - field_name
        - filter_key
        - object
        - source
        - type
    ObjectEnum:
      enum:
        - contact
        - company
      type: string
      description: |-
        * `contact` - contact
        * `company` - company
    TypeEnum:
      enum:
        - text
        - number
        - date
        - dropdown_singleselect
        - dropdown_multiselect
      type: string
      description: |-
        * `text` - text
        * `number` - number
        * `date` - date
        * `dropdown_singleselect` - dropdown_singleselect
        * `dropdown_multiselect` - dropdown_multiselect
    SourceEnum:
      enum:
        - agency
        - client
      type: string
      description: |-
        * `agency` - agency
        * `client` - client
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````