IBAN Calculation API

Part of the IBAN Suite service. One request turns a domestic bank code and account number into the IBAN, verifies the national check digits where the country has them, and identifies the bank with its BIC and address. 57 countries are supported; each has its own set of input fields, listed in the countries table together with a working example and the IBAN it produces.

Endpoint

POSThttps://api.iban.com/clients/api/calc-api.php
GEThttps://api.iban.com/clients/api/calc-api.php?api_key=YOUR_API_KEY&format=json&country=FR&bankcode=30006&branch=00001&account=1234567890189
  • HTTPS only. POST bodies are application/x-www-form-urlencoded; GET takes the same parameters in the query string. Both methods return the same response, and the parameters may be split between them.
  • The HTTP status is 200 for every processed request, whether the IBAN could be calculated or not; the outcome is in the response body. The only other status is 429 when the rate limit is exceeded; that response is a short HTML page, not JSON or XML, so check the status before parsing.
  • A successful response is a flat object with the IBAN and the bank details. A failed one is a single error member with a message. Test for error first.
  • Responses are UTF-8. The Content-Type follows the format parameter.
  • Submitted account numbers and the responses to them are not stored on our servers.
Your first request
  1. Copy your key from API Access.
  2. Run, with the key in place of YOUR_API_KEY:
curl "https://api.iban.com/clients/api/calc-api.php" -d api_key=YOUR_API_KEY -d format=json -d country=FR -d bankcode=30006 -d branch=00001 -d account=1234567890189

The full response to this request is in the Response section; the same request in six more languages is under Example request.

Keeping the key safe
  • Use POST in production. With GET the key is part of the URL and ends up in proxy, load-balancer and web-server access logs; with POST it travels in the request body.
  • Call the API from your server. A key embedded in browser JavaScript or a mobile app can be read from the source or the network traffic.
  • Restrict the key to the IP addresses of your servers under Settings; requests from anywhere else are refused.
  • Keep the key out of source control; load it from an environment variable or a configuration file. A key cannot be regenerated from the client area: if it is exposed, contact support to have it replaced.

Request parameters

api_key and country are always needed, and account for every country except when a RIB is sent. Which of the others a country uses, and what goes into them, is in the countries table.

ParameterRequiredValueDescription
api_keyyesstringYour personal key, shown under API Access.
formatnojson (default) or xmlResponse format, lower case. Any other value, including JSON in upper case, returns an HTML Page not found! page with HTTP 200. For BR, CY, EG, HR, IL, IS and RS the response is JSON even when xml is requested.
countryyesISO 3166-1 alpha-2, upper caseCountry of the account: FR, DE, GB. Lower case is not accepted for most countries. The countries table lists the 57 supported countries.
bankcodeper countrystringNational bank identifier: BLZ, sort code, clearing number, ABI, ISPB, a 4-letter bank code… The table says what each country expects. Spaces and dashes are removed. Not used by countries whose account number already contains the bank (BA, EE, FI, HU, MA, MK, NO, RS, TN); optional for PL.
branchper countrystringBranch identifier for the countries whose account structure has one: BR, ES, FR, IL, IT, JO, MC, MR, PT, SM.
accountyes, unless rib is sentstringDomestic account number. Where the table says up to, a shorter value is padded with leading zeros; a field with a fixed length (GB, IE, NO…) must be sent complete. Keep letters where the country uses them (CH, FR, MC, IT…). Spaces are removed. Send it as a string: leading zeros matter.
cdper countrystring, 2 digitsNational check digits: Spain (dígitos de control) and Portugal (NIB check) require them; Belgium accepts them and computes them when omitted. Always two digits (07, not 7).
prefixnostring, up to 6 digitsAccount prefix for CZ and SK (předčíslí / predčíslie). Omit when the account has none; zeros are padded.
ribFRstring, 23 charactersFrance only: the complete RIB (bank 5, branch 5, account 11, key 2) instead of bankcode, branch and account. Spaces are removed. When rib is sent, the three fields are ignored. For Monaco send the three fields.
acc_typeISstring, 2 digitsIcelandic account type (höfuðbók), e.g. 12 or 26.
kennitalaISstring, 10 digitsIcelandic national identification number of the account holder. Required for Iceland; it becomes the last ten characters of the IBAN.

Countries and required fields

Every example below was run against the API and returned the IBAN shown. Copy the query, add api_key and format, and you have a working request for that country. Where a field says up to, shorter values are padded with leading zeros.

CountryCodeParametersExample requestIBAN returned
AndorraADbankcode – bank and branch code together, 8 digits
account – up to 12 characters
country=AD&bankcode=00080001&account=1234567890
AD1400080001001234567890
AustriaATbankcode – Bankleitzahl, 5 digits
account – Kontonummer, up to 11 digits
country=AT&bankcode=12000&account=52700357958
AT401200052700357958
BahrainBHbankcode – bank code, 4 letters (an 8- or 11-character BIC is accepted)
account – up to 14 characters
country=BH&bankcode=CITI&account=1077181611
BH02CITI00001077181611
BelgiumBEbankcode – first 3 digits of the account number
account – next 7 digits
cd – last 2 digits; optional, computed when omitted
country=BE&bankcode=250&account=0135106&cd=70
BE60250013510670
Bosnia and HerzegovinaBAaccount – full domestic account number, 16 digits
country=BA&account=3380002210018390
BA393380002210018390
BrazilBRbankcode – ISPB code, 8 digits
branch – agência, 4 or 5 digits
account – conta, 10 digits, followed by the account type letter and the owner digit, e.g. 0009795493C1
country=BR&bankcode=00000000&branch=00001&account=0009795493C1
BR5100000000000010009795493C1
CroatiaHRbankcode – vodeći broj, 7 digits
account – broj računa, 10 digits
country=HR&bankcode=2360000&account=1101234565
HR1723600001101234565
CyprusCYbankcode – bank code and branch code together, 8 digits
account – up to 16 characters
country=CY&bankcode=00200195&account=357001234567
CY21002001950000357001234567
Czech RepublicCZbankcode – bank code, 4 digits
prefix – account prefix, up to 6 digits; optional
account – up to 10 digits
country=CZ&prefix=51&account=1707230277&bankcode=0100
CZ8001000000511707230277
DenmarkDKbankcode – registration number, 4 digits
account – up to 10 digits
country=DK&bankcode=2000&account=123456789
DK9520000123456789
Dominican RepublicDObankcode – bank code, 4 letters
account – up to 20 digits
country=DO&bankcode=ACAU&account=123456789
DO22ACAU00000000000123456789
EgyptEGbankcode – bank code and branch code together, 8 digits
account – up to 17 digits
country=EG&bankcode=00190005&account=00000000263180002
EG380019000500000000263180002
El SalvadorSVbankcode – bank code, 4 letters
account – up to 20 digits
country=SV&bankcode=ACAT&account=123123
SV43ACAT00000000000000123123
EstoniaEEaccount – full domestic account number, up to 14 digits
country=EE&account=55000005511439
EE525555000005511439
Faroe IslandsFObankcode – registration number, 4 digits
account – up to 10 digits
country=FO&bankcode=6460&account=0001631634
FO6264600001631634
FinlandFIaccount – tilinumero, 8 to 14 digits; the short form is expanded
country=FI&account=52900261901092
FI8452900261901092
FranceFRbankcode – code banque, 5 digits
branch – code guichet, 5 digits
account – numéro de compte, 11 characters, optionally followed by the 2-digit clé RIB
rib – alternative: the whole 23-character RIB instead of the three fields above
country=FR&bankcode=30006&branch=00001&account=1234567890189
FR7630006000011234567890189
GermanyDEbankcode – Bankleitzahl, 8 digits
account – Kontonummer, up to 10 digits
country=DE&bankcode=37010050&account=399509
DE57370100500000399509
GreeceGRbankcode – bank code and branch code together, 7 digits
account – up to 16 characters
country=GR&bankcode=0810001&account=1234567890
GR9608100010000001234567890
GreenlandGLbankcode – registration number, 4 digits
account – up to 10 digits
country=GL&bankcode=6471&account=0001000206
GL8964710001000206
GuatemalaGTbankcode – bank code, 4 letters
account – up to 20 characters
country=GT&bankcode=AGRO&account=1234567890
GT20AGRO00000000001234567890
HungaryHUaccount – bankszámlaszám, 16 or 24 digits
country=HU&account=107000240416330551100005
HU11107000240416330551100005
IcelandISbankcode – bank and branch, 4 digits
acc_type – account type, 2 digits
account – account number, 6 digits
kennitala – national identification number, 10 digits
country=IS&bankcode=0001&acc_type=12&account=123456&kennitala=3108962099
IS750001121234563108962099
IrelandIEbankcode – national sort code, 6 digits
account – account number, 8 digits
country=IE&bankcode=905838&account=71924374
IE42BOFI90583871924374
IsraelILbankcode – bank number, 3 digits
branch – branch number, 3 digits
account – up to 13 digits
country=IL&bankcode=010&branch=800&account=12612345
IL170108000000012612345
ItalyITbankcode – ABI, 5 digits
branch – CAB, 5 digits
account – conto corrente, up to 12 characters
country=IT&bankcode=02008&branch=30545&account=000103685854
IT27K0200830545000103685854
JordanJObankcode – bank code, 4 letters
branch – branch code, 4 digits
account – up to 18 characters
country=JO&bankcode=ARAB&branch=1100&account=1234567890
JO27ARAB1100000000001234567890
KuwaitKWbankcode – bank code, 4 letters
account – up to 22 characters
country=KW&bankcode=CBKU&account=1234560101
KW81CBKU0000000000001234560101
LatviaLVbankcode – bank code, 4 letters (an 8- or 11-character BIC is accepted)
account – up to 13 characters
country=LV&bankcode=HABA&account=12345678910
LV97HABA0012345678910
LiechtensteinLIbankcode – clearing number, 5 digits
account – up to 12 characters
country=LI&bankcode=08810&account=0418650028
LI9808810000418650028
LithuaniaLTbankcode – bank code, 5 digits
account – account number, 11 digits
country=LT&bankcode=10100&account=12345678901
LT601010012345678901
LuxembourgLUbankcode – bank code, 3 digits
account – up to 13 characters
country=LU&bankcode=001&account=01234567891
LU120010001234567891
MaltaMTbankcode – sort code, 5 digits
account – up to 18 characters
country=MT&bankcode=07113&account=199008240010
MT40MBWM07113000000199008240010
MauritaniaMRbankcode – bank code, 5 digits
branch – branch code, 5 digits
account – account number, 11 digits
country=MR&bankcode=00012&branch=00001&account=00000078326
MR1300012000010000007832637
MoldovaMDbankcode – bank code, 2 letters
account – up to 18 characters
country=MD&bankcode=EX&account=1234567
MD21EX000000000001234567
MonacoMCbankcode – code banque, 5 digits
branch – code guichet, 5 digits
account – numéro de compte, 11 characters, optionally followed by the 2-digit clé RIB
country=MC&bankcode=30002&branch=03260&account=0000079112A
MC3930002032600000079112A59
MoroccoMAaccount – RIB, 24 digits
country=MA&account=001810007800020110620318
MA64001810007800020110620318
NetherlandsNLbankcode – bank code, 4 letters
account – rekeningnummer, up to 10 digits
country=NL&bankcode=ABNA&account=0417164300
NL91ABNA0417164300
North MacedoniaMKaccount – full domestic account number, 15 digits
country=MK&account=200002785123453
MK07200002785123453
NorwayNOaccount – kontonummer, 11 digits including the register number
country=NO&account=96803502045
NO1996803502045
PakistanPKbankcode – bank code, 4 letters (an 8-character BIC is accepted)
account – up to 16 characters
country=PK&bankcode=HABBPKKA&account=39551148771
PK62HABB0000039551148771
PolandPLaccount – NRB, 26 digits
bankcode – alternative: bank and branch code, 8 digits, with the 16-digit account in account
country=PL&bankcode=11402004&account=0000360275244226
PL02114020040000360275244226
PortugalPTbankcode – banco, 4 digits
branch – balcão, 4 digits
account – conta, 11 digits
cd – NIB check digits, 2 digits
country=PT&bankcode=0035&branch=0000&cd=98&account=39551148771
PT50003500003955114877198
QatarQAbankcode – bank code, 4 letters
account – up to 21 characters
country=QA&bankcode=QNBA&account=693123456
QA54QNBA000000000000693123456
RussiaRUbankcode – BIK, 9 digits
account – account number, 20 digits
country=RU&bankcode=044525600&account=40702810412345678901
RU0204452560040702810412345678901
San MarinoSMbankcode – ABI, 5 digits
branch – CAB, 5 digits
account – up to 12 characters
country=SM&bankcode=03034&branch=09800&account=000060164676
SM38E0303409800000060164676
Saudi ArabiaSAbankcode – bank code, 2 digits
account – up to 18 characters
country=SA&bankcode=20&account=1234567891234
SA4420000001234567891234
SerbiaRSaccount – full domestic account number, 18 digits
country=RS&account=260005601001611379
RS35260005601001611379
SlovakiaSKbankcode – kód banky, 4 digits
prefix – predčíslie, up to 6 digits; optional
account – up to 10 digits
country=SK&account=4110053902&bankcode=3100
SK6031000000004110053902
SloveniaSIbankcode – bank code, 5 digits
account – account number, 10 digits
country=SI&bankcode=33000&account=0000102423
SI56330000000102423
SpainESbankcode – entidad, 4 digits
branch – oficina, 4 digits
cd – dígitos de control, 2 digits
account – cuenta, 10 digits
country=ES&bankcode=0081&branch=1731&cd=91&account=0006040912
ES5800811731910006040912
SwedenSEbankcode – clearingnummer, 4 digits, or 5 for Swedbank (a dash is allowed)
account – kontonummer, 7 to 10 digits
country=SE&bankcode=5000&account=1000004
SE4850000000050001000004
SwitzerlandCHbankcode – clearing number (IID), 4 or 5 digits
account – up to 12 characters
country=CH&bankcode=0240&account=240C08011570
CH6900240240C08011570
TunisiaTNaccount – RIB, 20 digits
country=TN&account=03104071011500451183
TN5903104071011500451183
UkraineUAbankcode – MFO, 6 digits
account – up to 19 characters
country=UA&bankcode=305299&account=2990004149123456789
UA903052992990004149123456789
United Arab EmiratesAEbankcode – bank code, 3 digits
account – up to 16 digits
country=AE&bankcode=009&account=0000000123456789
AE460090000000123456789
United KingdomGBbankcode – sort code, 6 digits (dashes allowed)
account – account number, 8 digits
country=GB&bankcode=090127&account=93496333
GB90ABBY09012793496333

A country not in this table (for example AL, BG, RO, TR or XK) is answered with Country or Bank not supported or Bank Code not found. Use the IBAN Validation API to check IBANs from those countries.

Example request

Every example calculates the same French IBAN from bank code 30006, branch 00001 and account 1234567890189; the response is shown in the next section. Replace YOUR_API_KEY with the key from API Access.

curl "https://api.iban.com/clients/api/calc-api.php" \
  -d api_key=YOUR_API_KEY \
  -d format=json \
  -d country=FR \
  -d bankcode=30006 \
  -d branch=00001 \
  -d account=1234567890189
The same request with a RIB

For France the three fields can be replaced by the complete RIB:

GEThttps://api.iban.com/clients/api/calc-api.php?api_key=YOUR_API_KEY&format=json&country=FR&rib=30006000011234567890189

The response is the same except that the rib and zip fields are not included.

Response

A flat object. The first three fields are the ones to read: iban, bic and bank. The response to the example request:

{
   "iban": "FR7630006000011234567890189",
   "rib": "30006000011234567890189",
   "bic": "AGRIFRPP",
   "bank": "CREDIT AGRICOLE S A",
   "address": "12 PL DES ETATS UNIS",
   "city": "MONTROUGE CEDEX",
   "zip": "92127",
   "country": "FR"
}
Fields

Which fields come back depends on the country, because each national directory holds different data. Five fields are always there; the rest are listed with the countries that return them. A field without a value is an empty string in JSON and an empty element in XML; treat null the same way.

FieldPresent forDescription
ibanall countriesThe calculated IBAN, without spaces.
bicall countriesBIC of the bank or branch from the directory: 11 characters, or 8 where the directory holds the head-office BIC only (BR, FR, GT, MA, MC, MR, SE, SV, TN). Empty when the institution has no BIC.
bankall countriesName of the bank or institution.
addressall countriesStreet address of the bank or branch; may be empty.
cityall countriesCity of the bank or branch.
zipall except MA, TNPostal code; may be empty.
country38 countriesISO 3166-1 alpha-2 code. Not returned for every country and sometimes empty: read the country from the first two characters of the IBAN instead.
branch24 countriesBranch name, where the directory has one (AD, AE, BH, BR, DO, GB, GR, GT, IE, IL, IS, IT, KW, LT, LU, LV, MD, PK, PT, QA, SA, SM, SV, UA); often empty.
phone, fax, email, websitesome countriesContact details of the bank. The fields are present for AT, BA, BR, CY, DK, EE, EG, ES, FO, GB, GL, GR, HU, IE, IL, IS, JO, MK, NL, NO, RS in varying combinations, but only the United Kingdom returns a value (phone); for the other countries they are empty.
ribFR, MC, MRThe 23-character RIB: bank, branch, account and key. Not returned when the request used the rib parameter.
account, sort_codeGB; account also GR, ISThe account number and sort code as normalised by the API.
stateIT, SMProvince; may be empty.
currencyIEAccount currency from the directory.
detailsPLReserved; empty.
A country with more fields

The United Kingdom returns the normalised sort code and account number and the branch name:

{
   "iban": "GB90ABBY09012793496333",
   "account": "93496333",
   "sort_code": "090127",
   "bank": "Santander UK plc",
   "branch": "SANTANDER BANK ACCOUNT",
   "bic": "ABBYGB2LXXX",
   "address": "Santander Sapien6 - SR43 4ET Santander Domestic Payments ",
   "city": "Sunderland",
   "zip": "SR43 4ET",
   "country": "GB",
   "phone": "0800 0851785"
}
Response to a failed calculation

One member only. The example is Belgium with wrong check digits:

{
   "error": "Account number is invalid"
}

A wrong or missing key is answered the same way, with the message API Key is invalid (in XML without the declaration line).

Error messages

Messages are English text and differ by country; there are no numeric codes. Act on the presence of error, and show the message to the user. The messages recorded during testing, grouped by meaning:

MessageMeaning
API Key is invalidThe key is missing or wrong.
Country or Bank not supportedThe country is not in the table.
Required fields not submitted. / Required field is missing. Please enter Bank Code and Account NumberA parameter the country needs is missing (account, branch, country…).
Illegal characters submittedA numeric field contains letters or other characters.
Bank Code not found. / Bank not found! / Sort code cannot be found / Bank Code/Branch Code not found. / SortCode / BankCode can not be identified. IBAN can not be calculated.The bank, branch or sort code is not in the directory, so the IBAN cannot be built. The wording depends on the country.
Bank Code invalid. / Bank Code is not valid / Bank Code not valid / bankcode invalid. / BLZ/Bank Code not valid / Bank Code length not correct. Must be 8 digits.The bank code has the wrong length or form for the country (see the table), or is missing where it is required.
Account number is invalid / Account Number is not valid / Account number invalid. / Kontonummer/Account Number is not valid / Account Number checksum is invalid. / Account Number (checksum) is not correct. / Clearingnummer/Account Number is not valid. Check digit incorrect.The account number fails the national check digit, has the wrong length or form, or the check digits in cd do not match.
Account Number has to be 11 characters long / Account Number prefix too long. / Clearingnummer or Account Number too long.Length rule of the country not met (NO, CZ/SK prefix, SE).
Bank Code/ Branch Code (checksum) is not correct.Spain: cd missing or wrong for the given bank and branch.
RIB is not validFrance: the RIB key does not match, a field is missing, or the bank is unknown.

Handling errors

What each outcome means for your code. A calculation is deterministic for a given input, so there is never a reason to resend one; bank data does change over time, so if you cache responses, give the cache a limited lifetime.

SituationMeaningWhat to do
HTTP 200, body is an HTML pageformat is not json or xml in lower case.Fix the parameter.
error = API Key is invalidWrong or missing key.Stop sending; check the key under API Access.
error about a missing field, the bank code or the countryThe request does not match what the country needs.Compare with the countries table; do not retry unchanged.
error about the account number, check digits or RIBThe input fails the national check or length rule. The data is wrong, not the request.Show the message to the user; do not retry with the same input.
error about a bank or sort code not foundInput is well-formed but the bank is not in the directory.Verify the bank code with the account holder; a new bank code may not be in the directory yet.
HTTP 429, HTML bodyMore than 20 requests per second. Rejected before reaching the API: not processed, not charged.Wait a moment and resend; lower the sending rate. There is no Retry-After header.
HTTP 5xx, timeout, connection errorTemporary problem on the way to the API or on the API itself.Retry with increasing delays (1 s, 2 s, 4 s, then give up and queue).

Reading the result

  • An IBAN is returned only when the bank identifier was found in the directory, so a response with iban always carries bank; bic is empty for the few institutions that have none. The IBAN check digits are computed by the API; every returned IBAN passes the ISO 13616 check.
  • The national account check digit is verified before the IBAN is built for BE, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GL, HR, HU, NO, PL, PT, SE, SI, SK. In Germany and Denmark the rule depends on the bank: accounts of a bank without a published check-digit method are accepted as sent. For the other countries the account number is checked for length and characters and taken as sent.
  • Read the country from the IBAN, not from the country field, which is not present for every country.
  • bic is 8 or 11 characters. If your system needs 11, append XXX to an 8-character value.
  • Bank code, branch and account are normalised before the calculation: spaces and dashes are removed, numeric fields are padded with leading zeros, and for Belgium missing check digits are computed. The IBAN tells you exactly what was used.
  • To check an IBAN you already have, use the IBAN Validation API; it also reports SEPA reachability, which this API does not.

Checking your balance

Each calculation uses one query from your IBAN Suite balance, the same balance as the Validation API. The services endpoint returns every service active on your account with its remaining queries and expiry date; it takes api_key and format and does not use a query. It is documented with a sample response on the Validation API page.

GEThttps://api.iban.com/clients/api/v4/services/?api_key=YOUR_API_KEY&format=json

Rate limits and queries

  • The shared API accepts up to 20 requests per second. A short burst of a few dozen requests above that rate is absorbed; beyond it every request is rejected with HTTP 429 Too Many Requests and a small HTML body. A rejected request never reaches the API: it is not processed and not charged. Acceptance resumes as soon as your rate drops below the limit, so wait a moment and resend; keep the sending rate at or below 20 per second with a queue or a token bucket. If several processes send requests, apply the limit to their total.
  • Need more throughput? A dedicated API server is available for your account with no per-second limit, on its own hostname. Contact support with your expected volume.

Glossary

TermMeaning
BBANBasic Bank Account Number: the national part of the IBAN after the country code and check digits. This API builds it from the parameters you send and computes the check digits.
BLZBankleitzahl, the bank code in Germany (8 digits) and Austria (5 digits).
Sort codeSix-digit bank and branch code in the United Kingdom and Ireland (national sort code), often written 09-01-27. Malta uses a five-digit sort code.
Clearingnummer / IIDBank identifier in Sweden (4 digits, 5 for Swedbank) and Switzerland or Liechtenstein (IID, up to 5 digits).
RIBRelevé d’identité bancaire: in France and Monaco the 23-character bank account identifier (code banque 5, code guichet 5, numéro de compte 11, clé RIB 2). Morocco and Tunisia use the same word for their full domestic account numbers.
Clé RIBThe two check digits at the end of a French RIB, verified by the API.
ABI / CABItalian and Sammarinese bank code (Associazione Bancaria Italiana, 5 digits) and branch code (Codice di Avviamento Bancario, 5 digits). The CIN check letter of the IBAN is computed by the API.
NIBNúmero de Identificação Bancária, the 21-digit Portuguese account identifier: bank 4, branch 4, account 11, check digits 2.
CCCCódigo Cuenta Cliente, the 20-digit Spanish account identifier: entidad 4, oficina 4, dígitos de control 2, cuenta 10.
NRBNumer Rachunku Bankowego, the 26-digit Polish account number: 2 check digits, 8-digit bank and branch code, 16-digit account.
ISPBIdentificador do Sistema de Pagamentos Brasileiro, the 8-digit bank identifier used in Brazilian IBANs (Banco do Brasil is 00000000).
MFOSix-digit bank identifier in Ukraine.
BIKBankovsky identifikatsionny kod, the 9-digit bank identifier in Russia.
KennitalaIcelandic national identification number (10 digits) of the account holder; part of every Icelandic IBAN.