{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tale-dev/json-schema/tale-dev-contact-patch-schema.json",
  "title": "ContactPatch",
  "description": "Every field optional. `null` clears any optional field, and a blank string reads as `null`; `metadata` merges per RFC 7396 while `address` is replaced whole. A patch may not clear the last of `name`, `email` and `externalId` (400 `CONTACT_IDENTITY_REQUIRED`). Send `expectedUpdatedAt` from the last contact read to update only that revision: a stale one answers 409 `CONTACT_STALE` without changing any field.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tale-dev-contacts-api-openapi.yml#/components/schemas/ContactPatch",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 300,
      "description": "Trimmed"
    },
    "email": {
      "type": [
        "string",
        "null"
      ],
      "format": "email",
      "maxLength": 320,
      "description": "Trimmed and stored lowercase — a duplicate matches case-insensitively; the part before `@` is at most 64 characters"
    },
    "phone": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 50,
      "description": "Trimmed — digits and phone punctuation only (`+`, spaces, dashes, parentheses, dots); at least one digit"
    },
    "source": {
      "type": "string",
      "enum": [
        "manual_import",
        "file_upload",
        "api_import",
        "conversation",
        "shopify",
        "woocommerce",
        "magento",
        "bigcommerce",
        "prestashop",
        "chargebee",
        "stripe",
        "recurly",
        "salesforce",
        "hubspot",
        "pipedrive",
        "zoho",
        "sap",
        "oracle",
        "netsuite",
        "mailchimp",
        "klaviyo",
        "sendgrid",
        "webhook",
        "zapier",
        "custom"
      ],
      "description": "Where the contact came from — one of the platform’s data sources; defaults to `api_import`, and `custom` is the catch-all for anything not listed"
    },
    "locale": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 20,
      "description": "Trimmed"
    },
    "address": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "maxProperties": 500,
      "description": "Free-form. On PATCH it is REPLACED whole — an address is a unit. At most 64 KiB of JSON, 8 levels of nesting and 500 keys in total (every nested object counted); a larger value answers 400 `INVALID_BODY` naming the path."
    },
    "externalId": {
      "oneOf": [
        {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 256
        },
        {
          "type": [
            "integer",
            "null"
          ],
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      ],
      "description": "Stored as a trimmed string. Send a source system’s id as a string: a number beyond 2^53 − 1 cannot be carried exactly and is refused"
    },
    "tags": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "maxLength": 60,
        "description": "Trimmed"
      },
      "maxItems": 50
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "maxProperties": 500,
      "description": "Free-form. On PATCH it MERGES per RFC 7396 — sent keys are set, omitted keys stay, a key sent as `null` is removed, and the whole field sent as `null` clears it. At most 64 KiB of JSON, 8 levels of nesting and 500 keys in total (every nested object counted); a larger value answers 400 `INVALID_BODY` naming the path."
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 10000,
      "description": "Trimmed"
    },
    "expectedUpdatedAt": {
      "type": "integer",
      "minimum": 0,
      "maximum": 8640000000000000,
      "description": "The `updatedAt` of the revision this update is based on"
    }
  }
}