{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/poptin/json-schema/poptin-store-field-request-schema.json",
  "title": "StoreFieldRequest",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/poptin-api-openapi.yml#/components/schemas/StoreFieldRequest",
  "type": "object",
  "properties": {
    "type": {
      "$ref": "#/$defs/PropertyDataTypeEnum"
    },
    "label": {
      "type": "string",
      "maxLength": 50
    },
    "allow_multiple": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "This will allow your property to hold an array of values instead of just one at a time.\nExample: If a contact submits 'blue' in a poptin, then later submits 'red', both values will be stored like this 'blue, red'."
    },
    "is_recurring": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "This will allow your property to be recurring.\nE.g. date of birth, anniversary, etc."
    },
    "default_value": {
      "type": [
        "string",
        "null"
      ],
      "description": "You should only apply a default property for properties you never want to be empty.\nWhen applied, default values will be applied to all contacts that do not have any value saved for this property.\nAll default values will be overridden once another value is provided either through conversions or manually.",
      "maxLength": 255
    },
    "property_options": {
      "type": [
        "array",
        "null"
      ],
      "description": "Required for `boolean` properties. Must include exactly two options - one with value `0` and one with value `1`.\nExample of a boolean property:\n```json\n{\n  \"type\": \"boolean\",\n  \"label\": \"Subscribed to newsletter\",\n  \"property_options\": [\n    { \"label\": \"Yes\", \"value\": \"1\" },\n    { \"label\": \"No\", \"value\": \"0\" }\n  ]\n}\n```",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 255
          },
          "value": {
            "type": "string",
            "maxLength": 255
          }
        },
        "required": [
          "label",
          "value"
        ]
      },
      "uniqueItems": true
    }
  },
  "required": [
    "type",
    "label"
  ],
  "$defs": {
    "PropertyDataTypeEnum": {
      "type": "string",
      "description": "| |\n|---|\n| `text` <br/> When the field value is a string. |\n| `number` <br/> When the field value is a number. |\n| `date` <br/> When the field value is a date. |\n| `boolean` <br/> When the field value is a boolean. |",
      "enum": [
        "text",
        "number",
        "date",
        "boolean"
      ],
      "title": "PropertyDataTypeEnum"
    }
  }
}