{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elocuenti-com/json-schema/elocuenti-com-contact-create-body-schema.json",
  "title": "ContactCreateBody",
  "description": "The contact to create or update. Only `phone` is required; every other field you send is saved, and every field you leave out stays as it is.",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elocuenti-com-openapi.json#/components/schemas/ContactCreateBody",
  "type": "object",
  "properties": {
    "phone": {
      "type": "string",
      "maxLength": 16,
      "pattern": "^\\+[1-9]\\d{6,14}$",
      "description": "The contact's phone in international format (E.164: `+`, the country code and the number, no spaces). It identifies the contact: if your business already has one with this phone, that one is updated. An old regional format (a Mexican mobile with the extra 1) matches the same contact.",
      "title": "Phone"
    },
    "name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "description": "The contact's name (up to 255 characters). Send `null` to remove it. If you leave it out, the current name stays. An empty text means «no value»: `PATCH` removes the name with it, as `null` does, and `POST` ignores it and leaves the current name.",
      "title": "Name"
    },
    "email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 254
        },
        {
          "type": "null"
        }
      ],
      "format": "email",
      "description": "The contact's email address (up to 254 characters). Send `null` to remove it. If you leave it out, the current email stays. An empty text means «no value»: `PATCH` removes the email with it, as `null` does, and `POST` ignores it and leaves the current email. Two contacts may share an email.",
      "title": "Email"
    },
    "external_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "The identifier this contact has in your own system (your CRM, your store). Up to 255 characters. A contact has one, and one identifier cannot belong to two contacts. You can look a contact up by it with `GET /api/v1/contacts?external_id=`.",
      "title": "External Id"
    },
    "attributes": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_]{0,63}$"
      },
      "additionalProperties": {
        "anyOf": [
          {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "type": "object",
            "properties": {
              "start-date": {
                "type": "string",
                "format": "date",
                "title": "Start-Date"
              },
              "end-date": {
                "type": "string",
                "format": "date",
                "title": "End-Date"
              }
            },
            "required": [
              "start-date",
              "end-date"
            ],
            "additionalProperties": false
          }
        ]
      },
      "description": "Values for the contact attributes your business has defined (list them with `GET /api/v1/contact-attributes`), by key. Each value must fit the attribute's type (a list takes an array of texts; a date range takes an object with start-date and end-date, both YYYY-MM-DD). Send `null` for a key to remove its value; a key you leave out keeps its value. Up to 50 keys per request. An attribute that does not exist in your business is refused.",
      "title": "Attributes"
    }
  },
  "required": [
    "phone"
  ],
  "additionalProperties": false
}