openapi: 3.0.2
info:
  title: TrueNorth
  version: 2.0.0
  description: 'Business answers for Canada, Australia and the United States, in one API. Canada: exact sales tax for every
    province and territory, payroll, holidays and business days, postal code intelligence, business number
    validation, and address checks. Australia: payroll with PAYG withholding, Medicare and super, GST
    classification, holidays and business days, postcode intelligence, and ABN validation with a live
    register lookup. United States: federal payroll withholding, federal holidays and business days, ZIP code intelligence, and EIN validation by format and campus prefix. Send a plain product description and the tax category is classified for you. Built
    for checkouts, payroll tools, and back office systems that need the right answer, not a guess.'
servers:
- url: https://prsorfaeexugwkvjuwzw.supabase.co/functions/v1/canadian-api
  description: Production
paths:
  /calculate-tax:
    get:
      summary: Calculate Canadian sales tax
      description: Calculates GST, PST, HST, and QST for a purchase amount in any Canadian province or
        territory, applying the correct rules for the product tax categories. Pass a category code directly,
        or pass a plain product description and the category is detected automatically.
      parameters:
      - name: province
        in: query
        required: true
        schema:
          type: string
        example: BC
        description: Two letter province or territory code.
      - name: amount
        in: query
        required: true
        schema:
          type: number
          minimum: 0
        example: 100
        description: Pre tax purchase amount.
      - name: category
        in: query
        required: false
        schema:
          type: string
        example: general
        description: Product tax category code, see GET /tax-categories.
      - name: description
        in: query
        required: false
        schema:
          type: string
          maxLength: 500
        example: organic cotton baby onesie
        description: Plain product description for automatic classification.
      - name: seller_province
        in: query
        required: false
        schema:
          type: string
        example: true
        description: Seller province, for place of supply decisions.
      - name: date
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-15'
        description: Transaction date, YYYY-MM-DD. Defaults to today.
      responses: &id001
        '200':
          description: Successful answer.
          headers:
            X-Credits-Remaining:
              $ref: '#/components/headers/XCreditsRemaining'
        '400':
          description: The request was missing something or did not check out. Caller errors are not charged.
        '402':
          description: The account is out of credits.
        '500':
          description: Something failed on our side. Server errors are not charged.
  /tax-categories:
    get:
      summary: List the Canadian product tax categories
      description: Returns every Canadian product tax category code with its treatment.
      responses: *id001
  /classify-product:
    get:
      summary: Classify a product description, Canada
      description: Send a plain product description and get back the Canadian tax category, with a confidence
        score.
      parameters:
      - name: description
        in: query
        required: true
        schema:
          type: string
          maxLength: 500
        example: frozen pizza
      responses: *id001
  /shipping-check:
    get:
      summary: Shipping check for a Canadian postal code
      description: Checks a Canadian postal code and returns what a seller needs for a shipping decision.
      parameters:
      - name: postal_code
        in: query
        required: true
        schema:
          type: string
        example: V7M 2G8
      responses: *id001
  /validate-address:
    post:
      summary: Validate a Canadian street address
      description: Validates a Canadian street address and returns a clear verdict with the corrected
        writing of the address when it checks out.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                street:
                  type: string
                  example: 123 Main Street
                city:
                  type: string
                  example: North Vancouver
                province:
                  type: string
                  example: BC
                postal_code:
                  type: string
                  example: V7M 2G8
      responses: *id001
  /holidays:
    get:
      summary: Canadian public holidays
      description: Statutory holidays for Canada, federal or by province and territory, for a given year.
      parameters:
      - name: year
        in: query
        required: false
        schema:
          type: integer
        example: 2026
      - name: province
        in: query
        required: false
        schema:
          type: string
        example: BC
        description: Province code. Omit for the federal list.
      responses: *id001
  /business-days:
    get:
      summary: Canadian business day calculations
      description: Whether a date is a business day, the next business day, and business day counts over
        a range, by province.
      parameters:
      - name: date
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-15'
      - name: from
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-01'
      - name: to
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-31'
      - name: province
        in: query
        required: false
        schema:
          type: string
        example: BC
      responses: *id001
  /postal-code:
    get:
      summary: Canadian postal code intelligence
      description: City, province, and area intelligence for a Canadian postal code.
      parameters:
      - name: code
        in: query
        required: true
        schema:
          type: string
        example: V7M
      responses: *id001
  /business-number:
    get:
      summary: Canadian business number validation and lookup
      description: Validates a Canadian business number or federal corporation number, and looks the corporation
        up by number or name.
      parameters:
      - name: bn
        in: query
        required: false
        schema:
          type: string
        example: '123456789'
      - name: corporation_number
        in: query
        required: false
        schema:
          type: string
      - name: name
        in: query
        required: false
        schema:
          type: string
        example: Example Corp
      responses: *id001
  /payroll:
    get:
      summary: Canadian payroll calculator
      description: 'Paycheque deductions for any province: income tax, CPP or QPP, and EI, with net pay,
        per pay period or annual.'
      parameters:
      - name: province
        in: query
        required: true
        schema:
          type: string
        example: BC
      - name: gross_per_period
        in: query
        required: false
        schema:
          type: number
        example: 3000
      - name: salary
        in: query
        required: false
        schema:
          type: number
        example: 78000
      - name: frequency
        in: query
        required: false
        schema:
          type: string
        example: biweekly
      - name: pay_date
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-15'
      responses: *id001
  /au-payroll:
    get:
      summary: Australian payroll calculator
      description: PAYG withholding, HELP repayments, a Medicare levy estimate, and the super guarantee
        for an Australian pay, weekly, fortnightly, or monthly, for the 2025-26 and 2026-27 financial
        years.
      parameters:
      - name: gross_per_period
        in: query
        required: false
        schema:
          type: number
        example: 3000
      - name: salary
        in: query
        required: false
        schema:
          type: number
        example: 78000
      - name: frequency
        in: query
        required: false
        schema:
          type: string
        example: fortnightly
      - name: financial_year
        in: query
        required: false
        schema:
          type: string
        example: 2026-27
      - name: residency
        in: query
        required: false
        schema:
          type: string
        example: resident
      - name: tax_free_threshold
        in: query
        required: false
        schema:
          type: string
        example: claimed
      - name: medicare_exemption
        in: query
        required: false
        schema:
          type: string
        example: none
      - name: help_debt
        in: query
        required: false
        schema:
          type: boolean
        example: false
      - name: no_tfn
        in: query
        required: false
        schema:
          type: boolean
        example: false
      responses: *id001
  /au-tax-categories:
    get:
      summary: List the Australian GST treatments
      description: 'The Australian GST treatments: taxable, GST free under Division 38, and input taxed
        under Division 40, each with its section of the GST Act.'
      responses: *id001
  /au-classify-product:
    get:
      summary: Classify a product or service for Australian GST
      description: Send a plain description and get back the Australian GST treatment, the rate, and whether
        input credits can be claimed. Where the deciding fact is missing the answer says so instead of
        guessing.
      parameters:
      - name: description
        in: query
        required: true
        schema:
          type: string
          maxLength: 500
        example: fresh bread roll
      responses: *id001
  /au-holidays:
    get:
      summary: Australian public holidays
      description: Public holidays for Australia by state and territory, for a given year.
      parameters:
      - name: year
        in: query
        required: false
        schema:
          type: integer
        example: 2026
      - name: state
        in: query
        required: false
        schema:
          type: string
        example: NSW
      responses: *id001
  /au-business-days:
    get:
      summary: Australian business day calculations
      description: Whether a date is a business day in a state, the next business day, adding business
        days, and counts over a range. A state is required, because holiday calendars differ too much
        for a national answer.
      parameters:
      - name: state
        in: query
        required: true
        schema:
          type: string
        example: NSW
      - name: date
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-15'
      - name: from
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-01'
      - name: to
        in: query
        required: false
        schema:
          type: string
        example: '2026-01-31'
      - name: add
        in: query
        required: false
        schema:
          type: integer
        example: 5
      responses: *id001
  /au-postal-code:
    get:
      summary: Australian postcode intelligence
      description: Suburbs, state, coordinates, and time zone for an Australian postcode. Also searches
        by suburb name.
      parameters:
      - name: postcode
        in: query
        required: false
        schema:
          type: string
        example: '2000'
      - name: suburb
        in: query
        required: false
        schema:
          type: string
        example: Sydney
      responses: *id001
  /au-business-number:
    get:
      summary: ABN validation with live register lookup
      description: Validates an Australian business number. The ABN status, entity name, and GST registration
        are read from the Australian Business Register at request time, with the official checksum built
        in. Nine digit inputs are recognised as an ACN and checked with the ASIC checksum.
      parameters:
      - name: abn
        in: query
        required: true
        schema:
          type: string
        example: '51824753556'
      responses: *id001
  /us-payroll:
    get:
      summary: United States federal and state payroll
      description: Federal and state payroll for one pay period. Income tax withholding per IRS Publication 15-T (2026),
        Social Security up to the annual wage base, Medicare including the additional tax, and FUTA net of
        the state credit. Send the state parameter to add state withholding, state unemployment tax and
        employee paid state contributions for that state, each computed on the state own tables.
      parameters:
      - name: gross_per_period
        in: query
        required: false
        schema:
          type: number
        example: 3000
      - name: salary
        in: query
        required: false
        schema:
          type: number
        example: 78000
      - name: frequency
        in: query
        required: false
        schema:
          type: string
        example: biweekly
      - name: filing_status
        in: query
        required: false
        schema:
          type: string
        example: single
      - name: wage_type
        in: query
        required: false
        schema:
          type: string
          enum: [regular, supplemental]
        example: regular
      - name: ytd_supplemental_wages
        in: query
        required: false
        schema:
          type: number
        example: 25000
      - name: ytd_wages
        in: query
        required: false
        schema:
          type: number
        example: 50000
      - name: nonresident_alien
        in: query
        required: false
        schema:
          type: boolean
        example: false
      - name: futa_state
        in: query
        required: false
        schema:
          type: string
        example: CA
      - name: state
        in: query
        schema:
          type: string
        description: Two letter state or DC code. Adds state withholding, state unemployment tax and employee paid state contributions for that state.
      - name: state_allowances
        in: query
        schema:
          type: integer
          default: 1
        description: Allowances or exemptions claimed on the state withholding form.
      - name: state_extra_withholding
        in: query
        schema:
          type: number
        description: Extra state withholding per pay period.
      - name: local_rate_percent
        in: query
        schema:
          type: number
        description: Local tax rate where the state rides a local layer on withholding (Maryland and Indiana counties, Pennsylvania and New York local taxes).
      - name: suta_rate
        in: query
        schema:
          type: number
        description: Employer state unemployment rate. Defaults to the state new employer rate where the state publishes one.
      - name: state_rate_percent
        in: query
        schema:
          type: number
        description: Arizona only, the percentage the employee elected on Form A 4 (0.5 to 3.5, default 2.0).
      - name: futa_credit_reduction_rate
        in: query
        required: false
        schema:
          type: number
        example: 1.2
      responses: *id001
  /us-holidays:
    get:
      summary: United States federal holidays
      description: The 11 federal holidays for a given year, each with its observed date under the federal
        weekend rule.
      parameters:
      - name: year
        in: query
        required: false
        schema:
          type: integer
        example: 2026
      responses: *id001
  /us-business-days:
    get:
      summary: United States business day calculations
      description: Whether a date is a business day on the federal calendar, the next business day, adding
        business days, and counts over a range.
      parameters:
      - name: date
        in: query
        required: false
        schema:
          type: string
        example: '2026-12-24'
      - name: from
        in: query
        required: false
        schema:
          type: string
        example: '2026-12-20'
      - name: to
        in: query
        required: false
        schema:
          type: string
        example: '2027-01-05'
      responses: *id001
  /us-postal-code:
    get:
      summary: United States ZIP code intelligence
      description: Primary place, state, county, and coordinates for a five digit ZIP code, from open data
        covering 41,488 ZIP codes.
      parameters:
      - name: zip
        in: query
        required: true
        schema:
          type: string
        example: '90210'
      responses: *id001
  /us-business-number:
    get:
      summary: EIN validation
      description: Validates an employer identification number by its nine digit format and its IRS campus
        prefix. An EIN has no check digit and no public register exists, so the answer reports format and
        prefix only.
      parameters:
      - name: ein
        in: query
        required: true
        schema:
          type: string
        example: '12-3456789'
      responses: *id001
  /us-sales-tax:
    get:
      summary: Sales tax rate by ZIP code (Streamlined member states)
      description: Returns the combined destination sales tax rate for a ZIP code, or for a ZIP plus 4
        where a ZIP spans more than one rate, in the Streamlined Sales Tax member states, with the state,
        county, city and district parts, figured from the member states own published rate and boundary
        files. A ZIP outside the covered states returns a 404 and is not charged.
      parameters:
      - name: zip
        in: query
        required: true
        schema:
          type: string
        example: '98101'
      - name: plus4
        in: query
        required: false
        schema:
          type: string
        example: '4698'
      - name: amount
        in: query
        required: false
        schema:
          type: number
        example: 100
      responses: *id001
components:
  headers:
    XCreditsRemaining:
      description: The credit balance remaining after this call.
      schema:
        type: integer
