NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Sort Code API

The Sort Code API is a comprehensive sort code checker and sort code lookup tool. Validate any 6-digit UK sort code and retrieve full branch information including bank name, address, and payment scheme support (Bacs, CHAPS, Faster Payments).

A sort code is a 6-digit number that identifies the bank and branch holding a UK bank account, usually written as three pairs separated by hyphens (e.g. 20-00-00). It is used for routing domestic UK payments via Bacs, CHAPS, Faster Payments, and Cheque & Credit.

Looking up bank codes in other countries? See our Routing Number API (US), Canada Routing Number API, and BSB API (Australia).

Available endpoints:

(4.2)

From 5,165 users

2,400+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
322ms364ms407ms584ms1156ms

Didn't find what you were looking for? Suggest an improvement


/v1/sortcode GET

https://api.api-ninjas.com/v1/sortcode

Returns detailed information about a UK bank branch based on its sort code.

Parameters

  • sort_code  required

    The 6-digit UK sort code, with or without hyphens (e.g. 20-00-00 or 200000).

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • bank_name premium only

    The name of the bank.

  • sort_code

    The 6-digit sort code, hyphenated.

  • branch_name premium only

    The name of the branch.

  • street_address premium only

    The street address of the branch.

  • city

    The city of the branch.

  • postcode

    The UK postcode of the branch.

  • country

    Always GB.

  • phone_number premium only

    The customer service phone number of the bank.

  • bacs_supported premium only

    Whether the branch supports Bacs Direct Debit and Direct Credit payments.

  • chaps_supported premium only

    Whether the branch supports CHAPS same-day wire transfers.

  • faster_payments_supported premium only

    Whether the branch supports Faster Payments.

  • swift_code premium only

    The SWIFT/BIC code of the bank, useful for international wire transfers. May be null if the bank does not participate in SWIFT. See our SWIFT Code API for full SWIFT lookups.

  • checksum_valid

    Whether the sort code passes the modulus check defined by the published Vocalink validation rules.

Sample Request Live Demo!

sort_code

Try our APIs in the API playground

Sign up for a free API key to get started — no credit card required.

https://api.api-ninjas.com/v1/sortcode?sort_code=20-00-00

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      bank_name:"BARCLAYS BANK UK PLC",
      sort_code:"20-00-00",
      branch_name:"Head Office Collection Account",
      street_address:"1 Churchill Place",
      city:"London",
      postcode:"E14 5HP",
      country:"GB",
      phone_number:"0345 734 5345",
      bacs_supported:true,
      chaps_supported:true,
      faster_payments_supported:true,
      swift_code:"BUKBGB22",
      checksum_valid:true
    }
]

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/sortcode?sort_code=20-00-00" \ -H "X-Api-Key: YOUR_API_KEY"

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.


/v1/sortcodesearch GETPremium Only

https://api.api-ninjas.com/v1/sortcodesearch

Search for UK bank branches and their sort codes by bank name and location. Returns a list of branches matching the search criteria.

At least one of the parameters listed below is required. Each request can only return up to 10 results - use the offset parameter to paginate through results.

Parameters

  • bank_name  optional

    Bank name to search for.

  • city  optional

    City name to search for branches.

  • postcode  optional

    UK postcode (full or outward only, e.g. E14) to search for branches.

  • offset  optional annual subscriptions only

    Number of results to offset for pagination.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the same fields as the previous response , or an error if the request is unsuccessful.

Sample Search Request Live Demo!

bank_name
city
postcode
offset

Try our APIs in the API playground

Sign up for a free API key to get started — no credit card required.

https://api.api-ninjas.com/v1/sortcodesearch?bank_name=Barclays

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Search Response

JSON
[
    {
      bank_name:"BARCLAYS BANK UK PLC",
      sort_code:"20-00-00",
      branch_name:"Head Office Collection Account",
      street_address:"1 Churchill Place",
      city:"London",
      postcode:"E14 5HP",
      country:"GB",
      phone_number:"0345 734 5345",
      bacs_supported:true,
      chaps_supported:true,
      faster_payments_supported:true,
      swift_code:"BUKBGB22",
      checksum_valid:true
    },
    {
      bank_name:"BARCLAYS BANK UK PLC",
      sort_code:"20-32-53",
      branch_name:"London Lombard Street",
      street_address:"54 Lombard Street",
      city:"London",
      postcode:"EC3V 9EX",
      country:"GB",
      phone_number:"0345 734 5345",
      bacs_supported:true,
      chaps_supported:true,
      faster_payments_supported:true,
      swift_code:"BUKBGB22",
      checksum_valid:true
    },
    "..."
]

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the Sort Code API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • A GET request to /v1/sortcode with the required sort_code parameter returns the bank_name, branch_name, street_address, city, postcode, phone_number, and swift_code, plus payment-scheme flags bacs_supported, chaps_supported, and faster_payments_supported. Several of these fields are premium only.
  • The response includes a checksum_valid field indicating whether the 6-digit code passes the modulus check defined by the published Vocalink validation rules, and you can supply the sort_code parameter with or without hyphens (e.g. 20-00-00 or 200000). See the error codes page for how invalid input is reported.
  • Yes, the premium-only /v1/sortcodesearch endpoint lets you query by bank_name, city, and/or postcode (full or outward only, e.g. E14), returning up to 10 matching branches per request with an offset parameter for pagination. Pagination via offset requires an annual subscription on the pricing page.
  • No, the Sort Code API only covers UK branches and the country field is always GB; for other countries see the Routing Number API (US), BSB API (Australia), or the global SWIFT Code API and IBAN API.