Cookie

Cookie consent

We use some essential cookies to make this website work. We'd like to set additional cookies to help us measure your experience when you view and interact with the website.

Cookie policy

bank

This endpoint validates a UK sort code and account number, and provides details about the bank and branch. Use it to instantly verify UK bank account details before setting up direct debits and payments.

Bank validation: Enable access on your API key using the Features page or by contacting us.

Request URL and body

POST https://ws.postcoder.com/pcw/{apikey}/bank
{
	"sortcode": "{sortcode}",
	"accountnumber": "{accountnumber}"
}

Path and body parameters

ParameterDescriptionExample
apikeyYour API keyPCW45-12345-12345-1234X
sortcodeThe URL-encoded sortcode you wish to validate100000
accountnumberThe URL-encoded account number you wish to validate31510604

Querystring parameters

ParameterDescriptionExample
formatSets the format of the response, xml or json (default unless "application/xml" header is detected)format=json
identifierSpecifies your own meaningful identifier for the request such as "websiteA" or "client123"; you can view usage for each identifier on the Identifier Usage page, which may be helpful when using your API key across multiple websites, apps or clientsidentifier=websiteA

Example request and response

POST https://ws.postcoder.com/pcw/PCW45-12345-12345-1234X/bank?format=json
{
	"sortcode": "100000",
	"accountnumber": "31510604"
}

HTTP response body

{
	"valid": true,
	"stateid": 0,
	"sortcode": "100000",
	"accountnumber": "31510604",
	"directdebits": true,
	"fasterpayments": true,
	"chaps": true,
	"bacs": true,
	"bankbic": "BKENGB33",
	"branchbic": "XXX",
	"bankname": "BANK OF ENGLAND",
	"branchname": "HEAD OFFICE",
	"addressline1": "Threadneedle Street",
	"addressline2": "",
	"addressline3": "",
	"addressline4": "",
	"posttown": "London",
	"postcode": "EC2R 8AH",
	"phone1": "020 34614717",
	"phone2": ""
}

Response fields

FieldDescriptionExample
validA true / false indicating whether the sort code and account number are validtrue
stateid0: This is a valid sortcode and account number combination
-1: This is not a valid sortcode
-2: This is not a valid sortcode and account number combination
0
sortcodeThe standardised version of the sort code; 6 digits long with no spaces or hyphens100000
accountnumberThe standardised version of the account number in the form expected for the Bankers' Automated Clearing System (BACS)31510604
directdebitsA true / false indicating whether the bank account can accept Direct Debits; note that not all accounts (such as savings accounts) can accept Direct Debitstrue
fasterpaymentsA true / false indicating whether the bank account supports the Faster Payments Service (FPS)true
chapsA true / false indicating whether the bank account supports sterling payments using the Clearing House Automated Payment System (CHAPS)true
bacsA true / false indicating whether the bank account supports BACStrue
bankbicThe Bank Identification Code (also known as the Swift Code) for the bank; an 8 to 11-character code that is used to identify the bank when you make an international transactionBKENGB33
branchbicThe Bank Identification Code (also known as the Swift Code) for the branch; an 8 to 11-character code that is used to identify the branch when you make an international transaction339
banknameThe full name of the bank which is formally approved by the Payment Systems RegulatorBANK OF ENGLAND
branchnameThe full name of the branch which is formally approved by the Payment Systems RegulatorHEAD OFFICE
addressline1The contact address for the branch to be used for BACs enquiries; usually a contact centre rather than the branch's physical addressThreadneedle Street
addressline2
addressline3
addressline4
posttownLondon
postcodeEC2R 8AH
phone1The primary telephone number for BACs enquiries including the country code (where international) and the area code020 76014717
phone2The secondary telephone number for BACs enquiries including the country code (where international) and the area code

Integration advice

  • URL encode all special characters (including /) in your request parameters with %xx encoding
  • Verify your request was successful by checking for an HTTP status code of 200; see all HTTP status codes with descriptions
  • No need to remove spaces, dashes, brackets or other non-numeric characters from the sort code and account number
  • When using your API key across multiple websites, apps or clients, set the identifier querystring parameter to a meaningful value such as "websiteA" or "client123"; you'll then be able to view these identifiers and the number of requests made by each one on the Identifier Usage page
  • Requests will usually return within a second but could take up to 5 seconds
  • The valid and stateid response fields are always returned; treat all other response fields as optional

Credit cost

Each request costs 1.2 credits.

Buy a credit pack or set up a monthly plan to use with all Postcoder endpoints.