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:
- /v1/sortcode - Look up a UK bank branch by sort code
- /v1/sortcodesearch - Search for UK branches by bank name and location
From 5,165 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 322ms | 364ms | 407ms | 584ms | 1156ms |
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_coderequiredThe 6-digit UK sort code, with or without hyphens (e.g.
20-00-00or200000).
Headers
X-Api-KeyrequiredAPI 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_namepremium onlyThe name of the bank.
sort_codeThe 6-digit sort code, hyphenated.
branch_namepremium onlyThe name of the branch.
street_addresspremium onlyThe street address of the branch.
cityThe city of the branch.
postcodeThe UK postcode of the branch.
countryAlways
GB.phone_numberpremium onlyThe customer service phone number of the bank.
bacs_supportedpremium onlyWhether the branch supports Bacs Direct Debit and Direct Credit payments.
chaps_supportedpremium onlyWhether the branch supports CHAPS same-day wire transfers.
faster_payments_supportedpremium onlyWhether the branch supports Faster Payments.
swift_codepremium onlyThe SWIFT/BIC code of the bank, useful for international wire transfers. May be
nullif the bank does not participate in SWIFT. See our SWIFT Code API for full SWIFT lookups.checksum_validWhether the sort code passes the modulus check defined by the published Vocalink validation rules.
Sample Request Live Demo!
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-00Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
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_nameoptionalBank name to search for.
cityoptionalCity name to search for branches.
postcodeoptionalUK postcode (full or outward only, e.g.
E14) to search for branches.offsetoptional annual subscriptions onlyNumber of results to offset for pagination.
Headers
X-Api-KeyrequiredAPI 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!
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=BarclaysHeaders
X-Api-KeyLog in or sign up to get your API KeySample Search Response
Frequently Asked Questions
Can I use the Sort Code API for commercial purposes?
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.How do I get an API key and start using the Sort Code API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
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.What happens if a request to the Sort Code API fails?
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.What information does a sort code lookup return?
AGETrequest to/v1/sortcodewith the requiredsort_codeparameter returns thebank_name,branch_name,street_address,city,postcode,phone_number, andswift_code, plus payment-scheme flagsbacs_supported,chaps_supported, andfaster_payments_supported. Several of these fields are premium only.How does the API validate a sort code?
The response includes achecksum_validfield indicating whether the 6-digit code passes the modulus check defined by the published Vocalink validation rules, and you can supply thesort_codeparameter with or without hyphens (e.g.20-00-00or200000). See the error codes page for how invalid input is reported.Can I search for branches by bank name or location instead of by sort code?
Yes, the premium-only/v1/sortcodesearchendpoint lets you query bybank_name,city, and/orpostcode(full or outward only, e.g.E14), returning up to 10 matching branches per request with anoffsetparameter for pagination. Pagination viaoffsetrequires an annual subscription on the pricing page.Does this API cover bank codes outside the UK?
No, the Sort Code API only covers UK branches and thecountryfield is alwaysGB; for other countries see the Routing Number API (US), BSB API (Australia), or the global SWIFT Code API and IBAN API.