{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ordogrid/json-schema/ordogrid-client-update-schema.json",
  "title": "ClientUpdate",
  "description": "Partial update: a field left out keeps its stored value. null, or \"\" for a text field, removes email, phone, website, contact_person, notes, vat_number, quote_slug or billing_address, returns purchase_order_format to the default \"PO: {input}\" and sets invoice_requires_po to false. Required values cannot be removed: null or blank type, status, address, a company's name or an individual's first_name or last_name returns 400 REQUIRED_FIELD with the fields in details.fields, as does switching type without the new type's names. Setting type to individual also removes the VAT number unless the same request sends one. Documents already created keep the client details they were created with.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ordogrid-clients-api-openapi.yml#/components/schemas/ClientUpdate",
  "additionalProperties": false,
  "properties": {
    "address": {
      "$ref": "#/$defs/AddressInput"
    },
    "billing_address": {
      "anyOf": [
        {
          "$ref": "#/$defs/AddressInput"
        },
        {
          "type": "null"
        }
      ]
    },
    "contact_person": {
      "type": [
        "string",
        "null"
      ]
    },
    "email": {
      "type": [
        "string",
        "null"
      ]
    },
    "first_name": {
      "minLength": 1,
      "type": "string"
    },
    "invoice_requires_po": {
      "description": "null means false.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "last_name": {
      "minLength": 1,
      "type": "string"
    },
    "name": {
      "minLength": 1,
      "type": "string"
    },
    "notes": {
      "type": [
        "string",
        "null"
      ]
    },
    "phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "purchase_order_format": {
      "type": [
        "string",
        "null"
      ]
    },
    "quote_slug": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "enum": [
        "active",
        "archived"
      ],
      "type": "string"
    },
    "type": {
      "enum": [
        "company",
        "individual"
      ],
      "type": "string"
    },
    "vat_number": {
      "type": [
        "string",
        "null"
      ]
    },
    "website": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "type": "object",
  "$defs": {
    "AddressInput": {
      "additionalProperties": false,
      "properties": {
        "city": {
          "minLength": 1,
          "type": "string"
        },
        "country": {
          "description": "ISO 3166-1 alpha-2 code, e.g. BE. A country name in French, Dutch, English or German is accepted and stored as its code; an unknown country is a 400 INVALID_COUNTRY.",
          "minLength": 1,
          "type": "string"
        },
        "postal_code": {
          "minLength": 1,
          "type": "string"
        },
        "street": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "street",
        "city",
        "postal_code",
        "country"
      ],
      "type": "object"
    }
  }
}