{
  "openapi": "3.1.0",
  "info": {
    "title": "SortWare API",
    "version": "4",
    "summary": "Validate a UK sort code and account number, look the branch up in the EISCD and get its IBAN, BIC and payment schemes.",
    "description": "Part of the SortWare service of IBAN.com. One request validates a United Kingdom sort code and account\nnumber: it runs the modulus check-digit algorithm of the bank, looks the sort code up in the Extended\nIndustry Sort Code Directory, returns the branch with its BIC and address and the payment schemes the branch\ntakes part in, and calculates the IBAN. Irish national sort codes are accepted too. A `search` without an\naccount number looks a sort code up on its own.\n\nFull documentation with recorded examples: https://developer.iban.com/sortware-api\n\nThe HTTP status is 200 for every processed request, whether the sort code and account are valid or not and\nalso for account errors; the outcome is in the body. A request that is not understood gets a 200 with an\nempty body. Each processed request uses one query from the SortWare balance; the shared API accepts up to\n20 requests per second.\n",
    "termsOfService": "https://www.iban.com/terms",
    "license": {
      "name": "Proprietary — IBAN.com Terms & Conditions",
      "url": "https://www.iban.com/terms"
    },
    "contact": {
      "name": "IBAN.com support",
      "url": "https://clients.iban.com/support"
    }
  },
  "servers": [
    {
      "url": "https://api.iban.com/clients/api/v4",
      "description": "Production. There is no separate sandbox; test requests use queries like any other request."
    }
  ],
  "tags": [
    {
      "name": "SortWare",
      "description": "Sort code and account number validation, sort code search."
    }
  ],
  "paths": {
    "/sort/": {
      "post": {
        "tags": [
          "SortWare"
        ],
        "operationId": "validateSortCode",
        "summary": "Validate a sort code and account number, or search a sort code (POST)",
        "description": "Parameters as an `application/x-www-form-urlencoded` body, the key included (the parameters may also be\nsplit between the body and the query string). Preferred in production: the key travels in the request\nbody instead of the URL. Send `sortcode` + `account` to validate, or `search` alone to look a sort code\nup; `search` is ignored when `sortcode` is also sent. Returns the same response as the GET form.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SortRequest"
              },
              "examples": {
                "validate": {
                  "summary": "Validate 20-04-15 / 38290008 (recorded 8 Oct 2026)",
                  "value": {
                    "api_key": "YOUR_API_KEY",
                    "format": "json",
                    "sortcode": "200415",
                    "account": "38290008"
                  }
                },
                "search": {
                  "summary": "Look up sort code 20-04-15 alone (recorded 8 Oct 2026)",
                  "value": {
                    "api_key": "YOUR_API_KEY",
                    "format": "json",
                    "search": "200415"
                  }
                },
                "irish": {
                  "summary": "Irish national sort code 90-58-38 (recorded 8 Oct 2026)",
                  "value": {
                    "api_key": "YOUR_API_KEY",
                    "format": "json",
                    "sortcode": "905838",
                    "account": "71924374"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SortResult"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "get": {
        "tags": [
          "SortWare"
        ],
        "operationId": "validateSortCodeGet",
        "summary": "Validate a sort code and account number, or search a sort code (GET)",
        "description": "The same parameters in the query string, the key included (`api_key`). With GET the key is part of the\nURL and ends up in proxy and web-server access logs: use POST in production.\n",
        "security": [
          {
            "ApiKeyQuery": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/format"
          },
          {
            "$ref": "#/components/parameters/sortcode"
          },
          {
            "$ref": "#/components/parameters/account"
          },
          {
            "$ref": "#/components/parameters/search"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SortResult"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "api_key",
        "description": "Your personal key, shown under *API Access* in the client area, as the `api_key` parameter. On a POST\nrequest it is a field of the form body instead. Missing: 200 with an empty body; wrong: 200 with\n`errors` code 301.\n"
      }
    },
    "parameters": {
      "format": {
        "name": "format",
        "in": "query",
        "required": true,
        "description": "Response format, lower case: `json` or `xml`. Missing or any other value (`JSON` in upper case\nincluded) gives a 200 with an empty body.\n",
        "schema": {
          "type": "string",
          "enum": [
            "json",
            "xml"
          ]
        },
        "example": "json"
      },
      "sortcode": {
        "name": "sortcode",
        "in": "query",
        "required": false,
        "description": "The sort code (United Kingdom) or national sort code (Ireland), 6 digits; required for a validation.\nCharacters other than digits are reported by `chars_sortcode` (206) and then removed; more than six\ndigits are reported by `length_sortcode` (208) and only the first six are used.\n",
        "schema": {
          "type": "string"
        },
        "example": "200415"
      },
      "account": {
        "name": "account",
        "in": "query",
        "required": false,
        "description": "The account number, 8 digits; required for a validation. Characters other than digits are reported by\n`chars_account` (207) and removed; more than eight digits by `length_account` (209), only the first\neight are used. Six- and seven-digit numbers pass the length check but are not padded — send the full\neight digits as printed on the account.\n",
        "schema": {
          "type": "string"
        },
        "example": "38290008"
      },
      "search": {
        "name": "search",
        "in": "query",
        "required": false,
        "description": "Looks a sort code up in the directory without an account number (6 digits). Ignored when `sortcode` is also sent.",
        "schema": {
          "type": "string"
        },
        "example": "200415"
      }
    },
    "responses": {
      "SortResult": {
        "description": "Returned for every processed request. Three shapes:\n\n- **Validation** (`sortcode` + `account`): `errors` (empty), `validations` with one member per check,\n  `account_data`, `bank_data`, `payment_schemes`. `modulus` is absent when the sort code was not found;\n  `bank_data` and `payment_schemes` then hold `null` values and `account_data.iban` is `null`.\n- **Search** (`search`): `bank_data`, `payment_schemes` and three `validations` members\n  (`length_sortcode`, `chars_sortcode`, `sort_found`); no `errors`, no `account_data`. An unknown sort\n  code gives empty strings.\n- **Account error** (wrong key, expired service, no queries, no access, address not allowed): only\n  `errors` with one entry, codes 301–305 (in XML the other elements are present but empty).\n\nA request that is not understood (`api_key`, `format`, `sortcode`/`account` or `search` missing, or\n`format` not exactly `json` or `xml`) gets a **200 with an empty body** (`Content-Type:\napplication/xml`, zero bytes) — check for an empty body before parsing. The media type follows the\n`format` parameter, not the `Accept` header; in XML the member order of `validations` differs from JSON,\nso address the members by name.\n",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ValidationResponse"
                },
                {
                  "$ref": "#/components/schemas/SearchResponse"
                },
                {
                  "$ref": "#/components/schemas/AccountErrorResponse"
                }
              ]
            },
            "examples": {
              "valid": {
                "summary": "20-04-15 / 38290008 — valid, Barclays, IBAN calculated (recorded 8 Oct 2026)",
                "value": {
                  "errors": [],
                  "validations": {
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "chars_account": {
                      "code": "007",
                      "message": "Account Number does not contain illegal characters"
                    },
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "length_account": {
                      "code": "009",
                      "message": "Account Number length is correct"
                    },
                    "modulus": {
                      "code": "001",
                      "message": "Modulus Success: Check digit is valid"
                    },
                    "sort_found": {
                      "code": "002",
                      "message": "Sort Code found in bank directory"
                    }
                  },
                  "account_data": {
                    "sortcode": "200415",
                    "account": "38290008",
                    "iban": "GB46BUKB20041538290008"
                  },
                  "bank_data": {
                    "bic": "BUKBGB22XXX",
                    "bank": "BARCLAYS BANK UK PLC",
                    "branch": "BARCLAYBANK B'CARD N'PTON",
                    "address": " ",
                    "city": "Leicester",
                    "zip": "LE87 2BB",
                    "phone": "0345 7345345",
                    "country": "GB"
                  },
                  "payment_schemes": {
                    "DD": "NO",
                    "FPS_PAYMENTS": "YES",
                    "CHAPS": "YES",
                    "BACS": "YES",
                    "CCC_PAYMENTS": "YES"
                  }
                }
              },
              "modulus_failed": {
                "summary": "20-04-15 / 38290009 — check digit wrong, no IBAN (recorded 8 Oct 2026)",
                "value": {
                  "errors": [],
                  "validations": {
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "chars_account": {
                      "code": "007",
                      "message": "Account Number does not contain illegal characters"
                    },
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "length_account": {
                      "code": "009",
                      "message": "Account Number length is correct"
                    },
                    "modulus": {
                      "code": "201",
                      "message": "Modulus Failed: Check digit is not valid"
                    },
                    "sort_found": {
                      "code": "002",
                      "message": "Sort Code found in bank directory"
                    }
                  },
                  "account_data": {
                    "sortcode": "200415",
                    "account": "38290009",
                    "iban": ""
                  },
                  "bank_data": {
                    "bic": "BUKBGB22XXX",
                    "bank": "BARCLAYS BANK UK PLC",
                    "branch": "BARCLAYBANK B'CARD N'PTON",
                    "address": " ",
                    "city": "Leicester",
                    "zip": "LE87 2BB",
                    "phone": "0345 7345345",
                    "country": "GB"
                  },
                  "payment_schemes": {
                    "DD": "NO",
                    "FPS_PAYMENTS": "YES",
                    "CHAPS": "YES",
                    "BACS": "YES",
                    "CCC_PAYMENTS": "YES"
                  }
                }
              },
              "not_found": {
                "summary": "99-99-99 — sort code not in the directory, no modulus member (recorded 8 Oct 2026)",
                "value": {
                  "errors": [],
                  "validations": {
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "chars_account": {
                      "code": "007",
                      "message": "Account Number does not contain illegal characters"
                    },
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "length_account": {
                      "code": "009",
                      "message": "Account Number length is correct"
                    },
                    "sort_found": {
                      "code": "202",
                      "message": "Sort Code not found in bank directory"
                    }
                  },
                  "account_data": {
                    "sortcode": "999999",
                    "account": "12345678",
                    "iban": null
                  },
                  "bank_data": {
                    "bic": null,
                    "bank": null,
                    "branch": null,
                    "address": null,
                    "city": null,
                    "zip": null,
                    "phone": null,
                    "country": null
                  },
                  "payment_schemes": {
                    "DD": null,
                    "FPS_PAYMENTS": null,
                    "CHAPS": null,
                    "BACS": null,
                    "CCC_PAYMENTS": null
                  }
                }
              },
              "irish": {
                "summary": "Irish NSC 90-58-38 / 71924374 — IE IBAN, no UK payment schemes (recorded 8 Oct 2026)",
                "value": {
                  "errors": [],
                  "validations": {
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "chars_account": {
                      "code": "007",
                      "message": "Account Number does not contain illegal characters"
                    },
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "length_account": {
                      "code": "009",
                      "message": "Account Number length is correct"
                    },
                    "modulus": {
                      "code": "001",
                      "message": "Account number check digit is valid"
                    },
                    "sort_found": {
                      "code": "002",
                      "message": "Sort Code found in bank directory"
                    }
                  },
                  "account_data": {
                    "sortcode": "905838",
                    "account": "71924374",
                    "iban": "IE42BOFI90583871924374"
                  },
                  "bank_data": {
                    "bic": "BOFIIE2DXXX",
                    "bank": "Bank of Ireland",
                    "branch": "Tralee",
                    "address": "Lower Castle Street",
                    "city": "Tralee",
                    "zip": "",
                    "phone": null,
                    "country": "IE"
                  },
                  "payment_schemes": {
                    "DD": null,
                    "FPS_PAYMENTS": null,
                    "CHAPS": null,
                    "BACS": null,
                    "CCC_PAYMENTS": null
                  }
                }
              },
              "search": {
                "summary": "`search=200415` — the branch without an account number (recorded 8 Oct 2026)",
                "value": {
                  "bank_data": {
                    "bic": "BUKBGB22XXX",
                    "bank": "BARCLAYS BANK UK PLC",
                    "branch": "BARCLAYBANK B'CARD N'PTON",
                    "address": " ",
                    "city": "Leicester",
                    "zip": "LE87 2BB",
                    "phone": "0345 7345345",
                    "country": "GB"
                  },
                  "payment_schemes": {
                    "DD": "NO",
                    "FPS_PAYMENTS": "YES",
                    "CHAPS": "YES",
                    "BACS": "YES",
                    "CCC_PAYMENTS": "YES"
                  },
                  "validations": {
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "sort_found": {
                      "code": "002",
                      "message": "Sort Code found in bank directory"
                    }
                  }
                }
              },
              "search_unknown": {
                "summary": "`search=999999` — unknown sort code, empty strings (recorded 8 Oct 2026)",
                "value": {
                  "bank_data": {
                    "bic": "",
                    "bank": "",
                    "branch": "",
                    "address": "",
                    "city": "",
                    "zip": "",
                    "phone": "",
                    "country": ""
                  },
                  "payment_schemes": {
                    "DD": "",
                    "FPS_PAYMENTS": "",
                    "CHAPS": "",
                    "BACS": "",
                    "CCC_PAYMENTS": ""
                  },
                  "validations": {
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "sort_found": {
                      "code": "202",
                      "message": "Sort Code not found in bank directory"
                    }
                  }
                }
              },
              "wrong_key": {
                "summary": "Wrong key — code 301; 302–305 have the same shape (recorded 8 Oct 2026)",
                "value": {
                  "errors": [
                    {
                      "code": "301",
                      "message": "API Key is invalid"
                    }
                  ]
                }
              }
            }
          },
          "application/xml": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ValidationResponse"
                },
                {
                  "$ref": "#/components/schemas/SearchResponse"
                },
                {
                  "$ref": "#/components/schemas/AccountErrorResponse"
                }
              ]
            },
            "examples": {
              "valid": {
                "summary": "20-04-15 / 38290008 with `format=xml` (recorded 8 Oct 2026)",
                "description": "Verbatim (one line after the declaration). `validations` comes last and in another member order\nthan in JSON:\n\n```xml\n<?xml version=\"1.0\"?>\n<result><account_data><sortcode>200415</sortcode><account>38290008</account><iban>GB46BUKB20041538290008</iban></account_data><bank_data><bic>BUKBGB22XXX</bic><bank>BARCLAYS BANK UK PLC</bank><branch>BARCLAYBANK B'CARD N'PTON</branch><address> </address><city>Leicester</city><zip>LE87 2BB</zip><phone>0345 7345345</phone><country>GB</country></bank_data><payment_schemes><DD>NO</DD><FPS_PAYMENTS>YES</FPS_PAYMENTS><CHAPS>YES</CHAPS><BACS>YES</BACS><CCC_PAYMENTS>YES</CCC_PAYMENTS></payment_schemes><validations><modulus><code>001</code><message>Modulus Success: Check digit is valid</message></modulus><chars_account><code>007</code><message>Account Number does not contain illegal characters</message></chars_account><chars_sortcode><code>006</code><message>Sort Code does not contain illegal characters</message></chars_sortcode><length_sortcode><code>008</code><message>Sort Code length is correct</message></length_sortcode><length_account><code>009</code><message>Account Number length is correct</message></length_account><sort_found><code>002</code><message>Sort Code found in bank directory</message></sort_found></validations><errors/></result>\n```\n",
                "value": {
                  "errors": [],
                  "validations": {
                    "chars_sortcode": {
                      "code": "006",
                      "message": "Sort Code does not contain illegal characters"
                    },
                    "chars_account": {
                      "code": "007",
                      "message": "Account Number does not contain illegal characters"
                    },
                    "length_sortcode": {
                      "code": "008",
                      "message": "Sort Code length is correct"
                    },
                    "length_account": {
                      "code": "009",
                      "message": "Account Number length is correct"
                    },
                    "modulus": {
                      "code": "001",
                      "message": "Modulus Success: Check digit is valid"
                    },
                    "sort_found": {
                      "code": "002",
                      "message": "Sort Code found in bank directory"
                    }
                  },
                  "account_data": {
                    "sortcode": "200415",
                    "account": "38290008",
                    "iban": "GB46BUKB20041538290008"
                  },
                  "bank_data": {
                    "bic": "BUKBGB22XXX",
                    "bank": "BARCLAYS BANK UK PLC",
                    "branch": "BARCLAYBANK B'CARD N'PTON",
                    "address": " ",
                    "city": "Leicester",
                    "zip": "LE87 2BB",
                    "phone": "0345 7345345",
                    "country": "GB"
                  },
                  "payment_schemes": {
                    "DD": "NO",
                    "FPS_PAYMENTS": "YES",
                    "CHAPS": "YES",
                    "BACS": "YES",
                    "CCC_PAYMENTS": "YES"
                  }
                }
              },
              "wrong_key": {
                "summary": "Wrong key with `format=xml` (recorded 8 Oct 2026)",
                "description": "In XML the other elements are present but empty:\n\n```xml\n<?xml version=\"1.0\"?>\n<result><account_data/><bank_data/><payment_schemes/><validations><modulus><code/><message/></modulus><chars_account><code/><message/></chars_account><chars_sortcode><code/><message/></chars_sortcode><length_sortcode><code/><message/></length_sortcode><length_account><code/><message/></length_account><sort_found><code/><message/></sort_found></validations><errors><error><code>301</code><message>API Key is invalid</message></error></errors></result>\n```\n",
                "value": {
                  "errors": [
                    {
                      "code": "301",
                      "message": "API Key is invalid"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "More than 20 requests per second. Rejected by the web server before reaching the API: not processed,\nnot charged; the body is a small HTML page, there is no `Retry-After` header. Wait a moment and resend.\n",
        "content": {
          "text/html": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "ServerError": {
        "description": "Empty body. Recorded for a parameter sent in a form the API cannot read (`sortcode[]`); for anything else a temporary problem — retry with increasing delays. A request that got no answer may still have been processed, so a retry costs at most one extra query.",
        "content": {
          "application/xml": {
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "schemas": {
      "SortRequest": {
        "type": "object",
        "required": [
          "api_key",
          "format"
        ],
        "description": "Send `sortcode` and `account` to validate, or `search` alone to look a sort code up.",
        "properties": {
          "api_key": {
            "type": "string",
            "description": "Your personal key, shown under *API Access* in the client area.",
            "examples": [
              "YOUR_API_KEY"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "json",
              "xml"
            ],
            "description": "Response format, lower case. Any other value gives a 200 with an empty body."
          },
          "sortcode": {
            "type": "string",
            "description": "UK sort code or Irish NSC, 6 digits; separators are reported (206) and removed.",
            "examples": [
              "200415",
              "20-04-15",
              "905838"
            ]
          },
          "account": {
            "type": "string",
            "description": "Account number, 8 digits; not padded.",
            "examples": [
              "38290008"
            ]
          },
          "search": {
            "type": "string",
            "description": "Sort code to look up without an account number; ignored when `sortcode` is sent.",
            "examples": [
              "200415"
            ]
          }
        }
      },
      "Check": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[0-9]{3}$",
            "description": "Three-character result code; success codes start with 0, failure codes with 2."
          },
          "message": {
            "type": "string",
            "description": "English text for the code; may change."
          }
        }
      },
      "ValidationResponse": {
        "type": "object",
        "required": [
          "errors",
          "validations",
          "account_data",
          "bank_data",
          "payment_schemes"
        ],
        "properties": {
          "errors": {
            "type": "array",
            "description": "Empty — the request was accepted.",
            "maxItems": 0,
            "items": {
              "$ref": "#/components/schemas/AccountError"
            },
            "xml": {
              "wrapped": true
            }
          },
          "validations": {
            "type": "object",
            "required": [
              "chars_sortcode",
              "chars_account",
              "length_sortcode",
              "length_account",
              "sort_found"
            ],
            "description": "One member per check (three-character string codes). `modulus` is absent when the sort code was not found.",
            "properties": {
              "chars_sortcode": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "006",
                          "206"
                        ]
                      }
                    }
                  }
                ],
                "description": "006 no illegal characters in the sort code; 206 illegal characters (removed before the other checks)."
              },
              "chars_account": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "007",
                          "207"
                        ]
                      }
                    }
                  }
                ],
                "description": "007 no illegal characters in the account number; 207 illegal characters."
              },
              "length_sortcode": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "008",
                          "208"
                        ]
                      }
                    }
                  }
                ],
                "description": "008 six digits; 208 more than six (only the first six are used)."
              },
              "length_account": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "009",
                          "209"
                        ]
                      }
                    }
                  }
                ],
                "description": "009 up to eight digits; 209 more than eight (only the first eight are used)."
              },
              "modulus": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "001",
                          "201"
                        ]
                      }
                    }
                  }
                ],
                "description": "001 check digit valid (a bank without a published rule reports 001); 201 check digit not valid. Irish sort codes: 'Account number check digit is (not) valid'."
              },
              "sort_found": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "002",
                          "202"
                        ]
                      }
                    }
                  }
                ],
                "description": "002 sort code found in the directory; 202 not found."
              }
            }
          },
          "account_data": {
            "type": "object",
            "required": [
              "sortcode",
              "account",
              "iban"
            ],
            "properties": {
              "sortcode": {
                "type": "string",
                "description": "The sort code as used — digits only, at most six. Keep leading zeros."
              },
              "account": {
                "type": "string",
                "description": "The account number as used — digits only, at most eight, not padded."
              },
              "iban": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The IBAN (GB… or IE…) when the modulus check passed and the sort code was found. Empty string when the modulus check failed (`null` for Irish sort codes); `null` when the sort code was not found."
              }
            }
          },
          "bank_data": {
            "$ref": "#/components/schemas/BankData"
          },
          "payment_schemes": {
            "$ref": "#/components/schemas/PaymentSchemes"
          }
        },
        "xml": {
          "name": "result"
        }
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "bank_data",
          "payment_schemes",
          "validations"
        ],
        "additionalProperties": false,
        "description": "Answer to `search`. Unknown sort code → empty strings in `bank_data` and `payment_schemes`, `sort_found` 202.",
        "properties": {
          "bank_data": {
            "$ref": "#/components/schemas/BankData"
          },
          "payment_schemes": {
            "$ref": "#/components/schemas/PaymentSchemes"
          },
          "validations": {
            "type": "object",
            "required": [
              "length_sortcode",
              "chars_sortcode",
              "sort_found"
            ],
            "additionalProperties": false,
            "properties": {
              "length_sortcode": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "008",
                          "208"
                        ]
                      }
                    }
                  }
                ]
              },
              "chars_sortcode": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "006",
                          "206"
                        ]
                      }
                    }
                  }
                ]
              },
              "sort_found": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Check"
                  },
                  {
                    "properties": {
                      "code": {
                        "enum": [
                          "002",
                          "202"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "xml": {
          "name": "result"
        }
      },
      "AccountErrorResponse": {
        "type": "object",
        "required": [
          "errors"
        ],
        "additionalProperties": false,
        "description": "The request was refused before any lookup; no query is used.",
        "properties": {
          "errors": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/AccountError"
            },
            "xml": {
              "wrapped": true
            }
          }
        },
        "xml": {
          "name": "result"
        }
      },
      "AccountError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "301",
              "302",
              "303",
              "304",
              "305"
            ],
            "description": "301 API key is invalid · 302 subscription expired · 303 no queries available · 304 no access to this API · 305 IP address not allowed."
          },
          "message": {
            "type": "string",
            "examples": [
              "API Key is invalid",
              "Subscription expired",
              "No queries available",
              "You have no access to this API",
              "IP Address not allowed"
            ]
          }
        },
        "xml": {
          "name": "error"
        }
      },
      "BankData": {
        "type": "object",
        "required": [
          "bic",
          "bank",
          "branch",
          "address",
          "city",
          "zip",
          "phone",
          "country"
        ],
        "description": "The branch the sort code is assigned to, from the EISCD. `null` values when the sort code was not found (empty strings on a search).",
        "properties": {
          "bic": {
            "type": [
              "string",
              "null"
            ],
            "description": "BIC of the bank and branch, 11 characters."
          },
          "bank": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name of the bank that owns the sort code."
          },
          "branch": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name of the branch."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "Street address; may be a single space or empty."
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip": {
            "type": [
              "string",
              "null"
            ],
            "description": "Postal code; may be empty, as it is for most Irish branches."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Telephone number; empty or `null` when the directory has none."
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "`GB` or `IE`."
          }
        }
      },
      "PaymentSchemes": {
        "type": "object",
        "required": [
          "DD",
          "FPS_PAYMENTS",
          "CHAPS",
          "BACS",
          "CCC_PAYMENTS"
        ],
        "description": "`YES` / `NO` per scheme for the branch; `null` when the sort code was not found or is Irish (no UK schemes), empty strings on an unknown search.",
        "properties": {
          "DD": {
            "$ref": "#/components/schemas/YesNo",
            "description": "Bacs Direct Debits."
          },
          "FPS_PAYMENTS": {
            "$ref": "#/components/schemas/YesNo",
            "description": "Faster Payments Service."
          },
          "CHAPS": {
            "$ref": "#/components/schemas/YesNo",
            "description": "CHAPS sterling payments."
          },
          "BACS": {
            "$ref": "#/components/schemas/YesNo",
            "description": "Bacs credits."
          },
          "CCC_PAYMENTS": {
            "$ref": "#/components/schemas/YesNo",
            "description": "Cheque clearing (Image Clearing System)."
          }
        }
      },
      "YesNo": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "YES",
          "NO",
          "",
          null
        ]
      }
    }
  }
}