{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paypal/json-schema/paypal-customer-create-request-schema.json",
  "title": "CustomerCreateRequest",
  "description": "Request body for creating a new customer.A customer represents an individual or organization that can be billed for services. It includes personal information, contact details, and metadata.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paypal-customers-api-openapi.yml#/components/schemas/CustomerCreateRequest",
  "type": "object",
  "required": [
    "name",
    "email",
    "external_id"
  ],
  "properties": {
    "name": {
      "type": "string",
      "nullable": false,
      "minLength": 1,
      "maxLength": 512,
      "description": "Full name of the customer"
    },
    "external_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "External identifier for the customer. Must contain only alphanumeric characters, underscores, and hyphens.",
      "pattern": "^[a-zA-Z0-9_-]*$"
    },
    "email": {
      "$ref": "#/$defs/EmailAddress"
    },
    "billing_entity_code": {
      "$ref": "#/$defs/BillingEntityCode"
    },
    "address": {
      "$ref": "#/$defs/Address"
    },
    "phone": {
      "type": "string",
      "format": "phone",
      "description": "Primary phone number of the customer, including country code if available."
    },
    "payment_method_token": {
      "allOf": [
        {
          "$ref": "#/$defs/PaymentMethodToken"
        }
      ],
      "description": "Token representing the customer's saved payment method in PayPal Vault."
    },
    "tax_codes": {
      "$ref": "#/$defs/TaxCodes"
    },
    "metadata": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomerMetadata"
      }
    }
  },
  "$defs": {
    "Address": {
      "description": "Address of the customer or party.",
      "type": "object",
      "properties": {
        "line1": {
          "type": "string",
          "nullable": false,
          "minLength": 1,
          "maxLength": 254,
          "description": "First line of the address."
        },
        "line2": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "description": "Second line of the address (optional). This can include apartment, suite, or unit numbers."
        },
        "city": {
          "type": "string",
          "nullable": false,
          "minLength": 1,
          "maxLength": 512,
          "description": "City of the customer or party."
        },
        "state": {
          "type": "string",
          "nullable": false,
          "minLength": 1,
          "maxLength": 512,
          "description": "State or region of the customer or party."
        },
        "postal_code": {
          "type": "string",
          "nullable": false,
          "minLength": 1,
          "maxLength": 512,
          "description": "Postal or ZIP code of the customer or party. Typically required for countries with a postal code or an equivalent."
        },
        "country": {
          "type": "string",
          "nullable": false,
          "pattern": "^[A-Z]{2}$",
          "minLength": 2,
          "maxLength": 2,
          "description": "Country of the customer or party. Use ISO 3166-1 alpha-2 country codes."
        }
      }
    },
    "BillingEntityCode": {
      "type": "string",
      "description": "Unique code used to identify the billing entity. Must contain only alphanumeric characters, underscores, and hyphens.",
      "pattern": "^[a-zA-Z0-9_-]*$"
    },
    "CustomerMetadata": {
      "type": "object",
      "description": "Set of key-value pairs that you can attach to a customer. This can be useful for storing additional information about the customer in a structured format",
      "required": [
        "key",
        "value",
        "display_in_invoice"
      ],
      "properties": {
        "key": {
          "type": "string",
          "description": "The metadata object key",
          "maxLength": 20
        },
        "value": {
          "type": "string",
          "description": "The metadata object value",
          "maxLength": 100
        },
        "display_in_invoice": {
          "type": "boolean",
          "description": "Determines whether the item or information should be displayed in the invoice. If set to true, the item or information will be included and visible in the generated invoice. If set to false, the item or information will be excluded and not displayed in the invoice."
        }
      }
    },
    "EmailAddress": {
      "type": "string",
      "description": "The internationalized email address.",
      "minLength": 3,
      "maxLength": 254,
      "pattern": "^.+@[^\"\\-].+$"
    },
    "PaymentMethodToken": {
      "type": "string",
      "minLength": 1,
      "maxLength": 36,
      "description": "Token representing the customer's saved payment method in PayPal Vault."
    },
    "TaxCodes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of unique codes used to identify taxes to be applied."
    }
  }
}