{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-account-jsonpatch-request-schema.json",
  "title": "AccountJSONPatchRequest",
  "description": "JSON Patch Request",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-accounts-api-openapi.yml#/components/schemas/AccountJSONPatchRequest",
  "type": "array",
  "items": {
    "oneOf": [
      {
        "$ref": "#/$defs/AccountJSONPatchReplaceAlias"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchRemoveAlias"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchReplaceEntity"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchReplaceMetadataKey"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchRemoveMetadataKey"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchAddPaymentOptionsInstrument"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchReplacePaymentOptionsInstrument"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchRemovePaymentOptionsInstrument"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchReplacePaymentOptionsInitiatorId"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchRemovePaymentOptionsInitiatorId"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchReplaceStatus"
      },
      {
        "$ref": "#/$defs/AccountJSONPatchReplaceType"
      }
    ]
  },
  "$defs": {
    "AccountJSONPatchAddPaymentOptionsInstrument": {
      "description": "Add an instrument to payment options.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "add"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/paymentOptions/instruments/-"
          ]
        },
        "value": {
          "$ref": "#/$defs/Instrument"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchRemoveAlias": {
      "description": "Remove alias.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "remove"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/alias"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path"
      ]
    },
    "AccountJSONPatchRemoveMetadataKey": {
      "description": "Remove a specific metadata key.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "remove"
          ]
        },
        "path": {
          "type": "string",
          "minLength": 11,
          "maxLength": 74,
          "pattern": "^/metadata/[A-Za-z0-9_\\.\\+\\-]{1,64}$"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path"
      ]
    },
    "AccountJSONPatchRemovePaymentOptionsInitiatorId": {
      "description": "Remove the InitiatorId from payment options.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "remove"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/paymentOptions/initiatorId"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path"
      ]
    },
    "AccountJSONPatchRemovePaymentOptionsInstrument": {
      "description": "Remove an instrument from payment options.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "remove"
          ]
        },
        "path": {
          "type": "string",
          "pattern": "^/paymentOptions/instruments/[0-9]$"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path"
      ]
    },
    "AccountJSONPatchReplaceAlias": {
      "description": "Set alias.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/alias"
          ]
        },
        "value": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchReplaceEntity": {
      "description": "Change the holder entity of this Account.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/entityId"
          ]
        },
        "value": {
          "type": "string",
          "minLength": 32,
          "maxLength": 64
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchReplaceMetadataKey": {
      "description": "Set or replace the value of a specific metadata key.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "minLength": 11,
          "maxLength": 74,
          "pattern": "^/metadata/[A-Za-z0-9_\\.\\+\\-]{1,64}$"
        },
        "value": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchReplacePaymentOptionsInitiatorId": {
      "description": "Set the InitiatorId for payment options.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/paymentOptions/initiatorId"
          ]
        },
        "value": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchReplacePaymentOptionsInstrument": {
      "description": "Replace an instrument in payment options.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "pattern": "^/paymentOptions/instruments/[0-9]$"
        },
        "value": {
          "$ref": "#/$defs/Instrument"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchReplaceStatus": {
      "description": "Set account status.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/status"
          ]
        },
        "value": {
          "$ref": "#/$defs/AccountStatus"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountJSONPatchReplaceType": {
      "description": "Set account type.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/type"
          ]
        },
        "value": {
          "$ref": "#/$defs/BankAccountType"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "AccountStatus": {
      "description": "Operational status of the account with the holding financial institution.",
      "type": "string",
      "enum": [
        "OPEN",
        "CLOSED"
      ]
    },
    "BankAccountType": {
      "type": "string",
      "enum": [
        "WALLET",
        "SAVINGS",
        "CHECKING",
        "INVESTMENT"
      ]
    },
    "CitiWorldlinkInstrument": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/InstrumentType"
        },
        "citiWorldlinkId": {
          "type": "string",
          "description": "The WorldLink ID assigned to the account to initiate payments."
        }
      },
      "required": [
        "type",
        "citiWorldlinkId"
      ]
    },
    "Instrument": {
      "type": "object",
      "description": "The payment instrument used to initiate the payment. For example Citi has a proprietary payment instrument called WorldLink, which can be used to initiate payments.",
      "oneOf": [
        {
          "$ref": "#/$defs/CitiWorldlinkInstrument"
        },
        {
          "$ref": "#/$defs/USACHInstrument"
        }
      ]
    },
    "InstrumentType": {
      "type": "string",
      "description": "The type of the payment instrument.",
      "enum": [
        "US_ACH",
        "CITI_WORLDLINK"
      ]
    },
    "USACHInstrument": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/InstrumentType"
        },
        "usAchCompanyId": {
          "type": "string",
          "description": "The US ACH Company ID assigned to the account to initiate US ACH payments."
        },
        "usAchCompanyName": {
          "type": "string",
          "description": "Optional US ACH Company Name override. When set, it is used as the debtor name (Dbtr/Nm)\non outgoing US ACH payments from this account instead of the account holder's legal name.\nOnly used for US ACH payments.\n"
        },
        "usAchImmediateOrigin": {
          "type": "string",
          "description": "Optional US ACH Immediate Origin. When set, it populates the Immediate Origin field of the\nNACHA file header instead of the US ACH Company ID. Some banks assign an Immediate Origin\nthat is distinct from the Company ID. Only used for US ACH payments.\n"
        }
      },
      "required": [
        "type",
        "usAchCompanyId"
      ]
    }
  }
}