Guide6 min readAlberto García

Canadian Business Number (BN) API: Tax ID Validation Guide

Canadian businesses have a 9-digit Business Number (BN) plus a 6-character program account suffix for GST/HST. This guide explains the format and how to validate Canadian tax IDs programmatically.

canadabngsthstapiguide

Canada uses a Business Number (BN) system administered by the Canada Revenue Agency (CRA). A BN is a 9-digit identifier assigned to businesses for federal tax purposes. When a business registers for GST/HST, they get a 15-character Program Account Number: the 9-digit BN followed by a 2-letter program identifier (RT for GST/HST) and a 4-digit reference number. The TaxID API validates Canadian business numbers against CRA's Business Registry.

Canadian Tax ID Formats

FormatExampleDescription
9 digits123456789Business Number (BN) — base identifier
BN + RT + 0001123456789RT0001GST/HST Program Account Number
With dashes12 3456789Display format — spaces stripped automatically

Validating Canadian Business Numbers

typescriptlib/validate-canada-bn.ts
export async function validateCanadaBn(bnNumber: string) {
  // Normalise: strip spaces and dashes
  const normalised = bnNumber.replace(/[\s\-]/g, '').toUpperCase();

  // Add CA prefix if not present
  const withPrefix = normalised.startsWith('CA') ? normalised : `CA${normalised}`;

  const res = await fetch(
    `https://taxid.dev/api/v1/validate/CA/${withPrefix}`,
    { headers: { Authorization: `Bearer ${process.env.TAXID_API_KEY}` } }
  );

  return res.json();
}

// Usage:
const result = await validateCanadaBn('123456789');
// or with full GST account number:
const result2 = await validateCanadaBn('123456789RT0001');
pythonvalidate_canada_bn.py
import os, re, requests

def validate_canada_bn(bn_number: str) -> dict:
    normalised = re.sub(r'[\s\-]', '', bn_number).upper()
    if not normalised.startswith('CA'):
        normalised = 'CA' + normalised

    resp = requests.get(
        f'https://taxid.dev/api/v1/validate/CA/{normalised}',
        headers={'Authorization': f'Bearer {os.environ["TAXID_API_KEY"]}'},
        timeout=5,
    )
    resp.raise_for_status()
    return resp.json()

GST/HST and Provincial Sales Tax

Canada has two levels of sales tax: federal GST (5%) and provincial HST or PST depending on the province. Provinces with HST (Ontario, New Brunswick, Nova Scotia, Prince Edward Island, Newfoundland) collect both in a single tax. Provinces with PST (British Columbia, Saskatchewan, Manitoba) collect them separately. The TaxID API validates GST/HST registration at the federal level — provincial tax registration is a separate system.

Note

For digital services sold to Canadian businesses: B2B digital services between registered businesses are generally zero-rated under the GST/HST rules for intangible personal property. Validate the Canadian business's BN to confirm registration before applying zero-rate.

Start validating EU VAT numbers

Free plan — 100 validations/month. No credit card required.

AG
Alberto García

Founder, TaxID

Building EU VAT validation tools for developers. Obsessed with compliance automation and developer experience.