{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postzen-dev/json-schema/postzen-dev-contact-create-request-schema.json",
  "title": "ContactCreateRequest",
  "description": "Creates a contact and optionally its first channel. If accountId, platformIdentifier, or platform is supplied, both accountId and platformIdentifier are required. Maximum 5000 contacts per user, 20 channels per contact. Duplicate email within the profile or duplicate channel returns 409.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postzen-dev-openapi.json#/components/schemas/ContactCreateRequest",
  "type": "object",
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Owning profile id; immutable and must be in the API key scope."
    },
    "name": {
      "type": "string",
      "description": "Trimmed contact name, 1–200 characters.",
      "minLength": 1,
      "maxLength": 200
    },
    "email": {
      "type": "string",
      "description": "Trimmed lowercase email; unique within its profile.",
      "maxLength": 254,
      "pattern": "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$"
    },
    "company": {
      "type": "string",
      "description": "Company name, at most 200 characters.",
      "maxLength": 200
    },
    "tags": {
      "type": "array",
      "description": "At most 50 tags, trimmed and deduplicated case-insensitively, preserving original case. Send [] to clear.",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 50
      },
      "maxItems": 50
    },
    "isSubscribed": {
      "type": "boolean",
      "description": "Contact subscription state. False prevents comment automation sends.",
      "default": true
    },
    "notes": {
      "type": "string",
      "description": "Free-form notes, at most 5000 characters.",
      "maxLength": 5000
    },
    "customFields": {
      "type": "object",
      "description": "At most 50 keys of 1–64 characters. Keys follow Convex record rules: printable ASCII, not starting with $ or _. Values are strings (at most 1000 characters), finite numbers, booleans, or null. PATCH replaces the entire object.",
      "maxProperties": 50,
      "propertyNames": {
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^(?![$_])[\\x20-\\x7e]+$"
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string",
            "maxLength": 1000
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "accountId": {
      "type": "string",
      "description": "Connected account id; must belong to the same profile and caller."
    },
    "platformIdentifier": {
      "type": "string",
      "description": "Platform identity (IGSID, PSID, or handle), trimmed, 1–200 characters. Unique per connected account.",
      "minLength": 1,
      "maxLength": 200
    },
    "displayIdentifier": {
      "type": "string",
      "description": "Optional username or friendly handle, at most 200 characters. Without a channel it is ignored and a warning is returned.",
      "maxLength": 200
    },
    "platform": {
      "type": "string",
      "description": "Optional assertion of the account platform. Must equal account.platform; requires accountId and platformIdentifier.",
      "enum": [
        "x",
        "instagram",
        "tiktok",
        "linkedin",
        "facebook",
        "youtube",
        "threads",
        "pinterest",
        "bluesky",
        "telegram"
      ]
    }
  },
  "required": [
    "profileId",
    "name"
  ],
  "additionalProperties": false
}