NewConnect Claude, Cursor, 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
326ms366ms425ms602ms1271ms

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 this API endpoint with all available parameters in our API playground

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 this API endpoint with all available parameters in our API playground

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
    },
    "..."
]