{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thrivedesk/json-schema/thrivedesk-custom-field-create-schema.json",
  "title": "CustomFieldCreate",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thrivedesk-openapi.yml#/components/schemas/CustomFieldCreate",
  "type": "object",
  "required": [
    "name",
    "type",
    "key"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 3,
      "maxLength": 25
    },
    "type": {
      "type": "string",
      "enum": [
        "text",
        "textarea",
        "dropdown",
        "toggle",
        "number"
      ]
    },
    "key": {
      "type": "string",
      "minLength": 3,
      "maxLength": 25,
      "pattern": "^[A-Za-z0-9_]+$",
      "description": "Unique per inbox."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 250
    },
    "is_required": {
      "type": "boolean"
    },
    "is_active": {
      "type": "boolean"
    },
    "default_value": {
      "description": "Type must match the field type (string, boolean, or number)."
    },
    "options": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      },
      "description": "Only for dropdown fields, rejected for other types."
    },
    "conditions": {
      "type": "array",
      "description": "Only for field types that support conditional visibility.",
      "items": {
        "type": "object",
        "required": [
          "expected_value",
          "dependent_field_ids"
        ],
        "properties": {
          "expected_value": {
            "type": "string",
            "maxLength": 255
          },
          "dependent_field_ids": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      }
    }
  }
}