{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/poptin/json-schema/poptin-upsert-contact-request-schema.json",
  "title": "UpsertContactRequest",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/poptin-api-openapi.yml#/components/schemas/UpsertContactRequest",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Contact status.",
      "enum": [
        "subscribed",
        "unconfirmed",
        "unsubscribed"
      ],
      "default": "unconfirmed"
    },
    "info": {
      "type": "object",
      "description": "Default contact fields keyed by field tag (e.g. `EMAIL`, `FIRST_NAME`, `BIRTHDAY`, `COUNTRY`). Keys are case-insensitive. `EMAIL` is required; other tags must exist on your mail list. `COUNTRY` accepts an ISO country code. `BIRTHDAY` must be a date that is not in the future.",
      "properties": {
        "EMAIL": {
          "type": "string",
          "format": "email",
          "description": "Email address used to find or create the contact."
        }
      },
      "required": [
        "EMAIL"
      ]
    },
    "custom": {
      "type": [
        "array",
        "null"
      ],
      "description": "Mail-list custom fields keyed by tag (e.g. `CUSTOM_1`). Keys are case-insensitive; values are validated against each field's type (text, number, date, boolean).",
      "default": [],
      "items": {
        "type": "string"
      }
    },
    "tags": {
      "type": [
        "array",
        "null"
      ],
      "description": "Tag names to assign to the contact. Include this key to replace all tags; omit it to leave existing tags unchanged.",
      "default": [],
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "preferences": {
      "type": [
        "array",
        "null"
      ],
      "description": "Subscription preference names to assign. Include this key to replace preferences; omit it to leave them unchanged. Unknown names are rejected.",
      "default": [],
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    }
  },
  "required": [
    "status",
    "info"
  ]
}