{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grainfinance-co/json-schema/grainfinance-co-create-update-customer-request-body-schema.json",
  "title": "CreateUpdateCustomerRequestBody",
  "description": "The payload required in order to create a customer.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grainfinance-co-customers-api-openapi.yml#/components/schemas/CreateUpdateCustomerRequestBody",
  "$ref": "#/$defs/Pick_Customer.-or-contactEmail-or-contactFullName-or-contactPhoneNumber-or-companyName-or-companyAddress-or-companyCity-or-companyState-or-companyCountry-or-companyTaxId-or-externalCustomerId-or-extraFields_",
  "$defs": {
    "ContactEmail": {
      "type": "string",
      "description": "The email address of the company's primary contact"
    },
    "CountryCode": {
      "type": "string",
      "description": "The alpha-2 ISO 3166 country code of the entity's country.",
      "pattern": "^[A-Za-z]{2}$"
    },
    "CustomersExtraFieldsParam": {
      "properties": {},
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number",
            "format": "double"
          },
          {
            "type": "boolean"
          }
        ]
      },
      "type": "object",
      "description": "Additional fields that provide further details about the company.\nThese fields should be specified as a valid JSON object."
    },
    "Pick_Customer.-or-contactEmail-or-contactFullName-or-contactPhoneNumber-or-companyName-or-companyAddress-or-companyCity-or-companyState-or-companyCountry-or-companyTaxId-or-externalCustomerId-or-extraFields_": {
      "properties": {
        "contactEmail": {
          "$ref": "#/$defs/ContactEmail",
          "description": "The email for the company's primary contact"
        },
        "contactFullName": {
          "type": "string",
          "description": "The name of the company's primary contact"
        },
        "contactPhoneNumber": {
          "type": "string",
          "description": "The phone number of the company's primary contact"
        },
        "companyName": {
          "type": "string",
          "description": "The legal name of the customer's company"
        },
        "companyAddress": {
          "type": "string",
          "description": "The address of the company"
        },
        "companyCity": {
          "type": "string",
          "description": "The city of the company"
        },
        "companyState": {
          "type": "string",
          "description": "The state the company is in (US based)"
        },
        "companyCountry": {
          "$ref": "#/$defs/CountryCode"
        },
        "companyTaxId": {
          "type": "string",
          "description": "The tax identification or registration number of the company"
        },
        "externalCustomerId": {
          "type": "string",
          "description": "The id used to identify the customer within your platform"
        },
        "extraFields": {
          "$ref": "#/$defs/CustomersExtraFieldsParam",
          "description": "Additional fields that provide further details about the customer.\nThese fields should be specified as a valid JSON object."
        }
      },
      "required": [
        "companyName",
        "companyCountry",
        "externalCustomerId"
      ],
      "type": "object",
      "description": "From T, pick a set of properties whose keys are in the union K"
    }
  }
}