Canada Routing Number Validation

Routing number in Canada (CRN) is an eight-digit number used to identify the branch location and financial institution associated with a bank account. It’s much like a SWIFT code but for a Canadian bank account.

A routing number consists of 8 digits with an optional dash between the fifth and sixth digit and contains the transit number (5 digits) and the financial institution number (3 digits).

For example, routing number 24182-001:

When you send money using an invalid routing number, the bank should reverse the transaction and return the money, but this might take some time and your bank may charge you a fee. Using our flexible and fast RESTful API you can validate a routing number and receive all possible information about it - see whether it's valid and which bank, province and branch it belongs to, as well as branch city, address and postcode.

How to validate a Canada routing number

To start using our SWIFT codes API sign up here and create your API key. Pass this key either via x-api-key HTTP header or via api_key query param.

To validate a routing number call /v1/crns/{crn_number} endpoint using HTTP client of your preference, i.e.:

curl 'https://swiftcodesapi.com/v1/crns/24182-001' \
    --header 'X-Api-Key: your-api-key-here' \
    --header 'Accept: application/json'
# INSTALLATION
$ composer require guzzlehttp/guzzle
# REQUEST
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://swiftcodesapi.com/v1/crns/24182-001', [
    'headers' => [
        'Accept' => 'application/json',
        'X-Api-Key' => 'your-api-key-here',
    ],
]);

echo $response->getBody();
# INSTALLATION
$ python -m pip install requests
# REQUEST
import requests

url = "https://swiftcodesapi.com/v1/crns/24182-001"

headers = {
    "Accept": "application/json",
    "X-Api-Key": "your-api-key-here"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
# INSTALLATION
$ npm install node-fetch --save
// REQUEST
const fetch = require('node-fetch');

const url = 'https://swiftcodesapi.com/v1/crns/24182-001';
const options = {method: 'GET', headers: {'Accept': 'application/json', 'X-Api-Key': 'your-api-key-here'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));)
const options = {method: 'GET', headers: {'Accept': 'application/json', 'X-Api-Key': 'your-api-key-here'}};

fetch('https://swiftcodesapi.com/v1/crns/24182-001', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

The response should be:

{
    "success": true,
    "data": {
        "id": "24182-001",
        "branch_name": "King & University",
        "address": "200 King St. W.",
        "city": "Toronto",
        "province": "ON",
        "postcode": "M5H 3T4",
        "institution_type": 1,
        "bank": {
            "id": "2a8e87fd-ba6f-443f-a437-c59081730566",
            "country_id": "CA",
            "code": "001",
            "name": "BANK OF MONTREAL"
        }
    }
}

You can find full documentation here.