{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/ibanfirst/main/json-schema/ibanfirst-external-bank-account-schema.json",
  "title": "ExternalBankAccount",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ibanfirst-beneficiaries-api-openapi.yml#/components/schemas/ExternalBankAccount",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ID"
    },
    "currency": {
      "description": "The three-digit code specifying the currency of the account.\n",
      "type": "string"
    },
    "tag": {
      "type": "string",
      "maxLength": 50,
      "description": "Custom reference of the account.\n"
    },
    "accountNumber": {
      "type": "string",
      "maxLength": 40,
      "description": "The code specifying the account (can be either an Iban or an account number).\n"
    },
    "correspondentBank": {
      "$ref": "#/$defs/CorrespondantBank"
    },
    "holderBank": {
      "$ref": "#/$defs/HolderBank"
    },
    "holder": {
      "$ref": "#/$defs/Holder"
    },
    "contactEmail": {
      "$ref": "#/$defs/Email"
    }
  },
  "$defs": {
    "Address": {
      "type": "object",
      "description": "Representation of an address\n",
      "required": [
        "country"
      ],
      "properties": {
        "street": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 255,
          "description": "The street and street number for the address described.\n"
        },
        "postCode": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 15,
          "description": "The ZIP/Post code for the address described.\n"
        },
        "city": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 35,
          "description": "The city for the address described.\n"
        },
        "province": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 2,
          "description": "The province code for the address described. This field could be required if the country use a province system, like United States or Canada. To see a full list of province code, please refer to http://www.mapability.com/ei8ic/contest/states.php.\n"
        },
        "country": {
          "type": "string",
          "maxLength": 8,
          "description": "The two-letters abbreviation for the country, following the ISO-3166 for the address described.\n"
        }
      }
    },
    "CorrespondantBank": {
      "type": [
        "object",
        "null"
      ],
      "description": "Representation of a correspondant bank.\n",
      "properties": {
        "bic": {
          "type": "string",
          "maxLength": 11,
          "description": "Eight or eleven-digit ISO 9362 Business Identifier Code specifying the Recipient Bank.\n"
        },
        "name": {
          "type": "string",
          "maxLength": 120,
          "description": "The beneficiary bank name.\n"
        },
        "address": {
          "$ref": "#/$defs/Address"
        }
      }
    },
    "Email": {
      "type": "string",
      "description": "Beneficiary email address",
      "pattern": "^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\\.[A-Za-z]{2,}$"
    },
    "Holder": {
      "type": "object",
      "description": "What we call a Holder can be either an Individual or an Organisation that own the account.\nMay also be referred to as: Beneficiary/Supplier/Vendor/Payee/Recipient.\n\nIn the beneficiary address, only the Country is mandatory, but you can specify all fields to be more precise.\n",
      "required": [
        "name",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "description": "The name of the account owner.\n"
        },
        "type": {
          "type": "string",
          "maxLength": 10,
          "description": "The code identifying the type of account owner.\n",
          "enum": [
            "Individual",
            "Corporate"
          ]
        },
        "address": {
          "$ref": "#/$defs/Address"
        }
      }
    },
    "HolderBank": {
      "type": "object",
      "description": "Representation of a beneficiary bank.\n",
      "properties": {
        "bic": {
          "type": "string",
          "maxLength": 11,
          "description": "Eight or eleven-digit ISO 9362 Business Identifier Code specifying the Recipient Bank.\nThis field is optional only when the account number does not have an Iban format."
        },
        "clearingCodeType": {
          "type": "string",
          "maxLength": 2,
          "description": "The two-digit code specifying the local clearing network.\nIf you does not have a bic, this field is required."
        },
        "clearingCode": {
          "type": "string",
          "maxLength": 15,
          "description": "The code identifying the branch number on the local clearing network.\nIf you does not have a bic, this field is required."
        },
        "name": {
          "type": "string",
          "maxLength": 120,
          "description": "The beneficiary bank name.\n"
        },
        "address": {
          "$ref": "#/$defs/Address"
        }
      }
    },
    "ID": {
      "type": "string",
      "pattern": "^[A-Za-z0-9]+$",
      "format": "^[A-Za-z0-9]+$",
      "description": "A String representing the id of an object. This string contains alpha-numeric characters, including the capital ones.\n"
    }
  }
}