Income Tax API

The Income Tax API provides detailed information about current and historical income tax rates for different countries.

Currently this API supports United States (including state income tax) and Canada (including provincial income tax). If you would like to see other countries added, please let us know.

Looking for a detailed income tax calculator instead? Check out our Income Tax Calculator API.

/v1/incometax GET

https://api.api-ninjas.com/v1/incometax

Returns comprehensive income tax information including tax brackets and rates at both federal and state/provincial levels (where applicable).


Parameters

  • country  required

    2-letter country code (e.g., US, CA)

  • year  required

    The tax year for which to retrieve data

  • federal_only  optional

    If set to true, returns only federal tax information without state/provincial data.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

country
year
https://api.api-ninjas.com/v1/incometax?country=US&year=2024

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 { "country": "US", "year": "2024", "federal": { "single": { "brackets": [ { "rate": 0.1, "min": 1, "max": 11600 }, { "rate": 0.12, "min": 11601, "max": 47150 }, { "rate": 0.22, "min": 47151, "max": 100525 }, { "rate": 0.24, "min": 100526, "max": 191950 }, { "rate": 0.32, "min": 191951, "max": 243725 }, { "rate": 0.35, "min": 243726, "max": 609350 }, { "rate": 0.37, "min": 609351, "max": "Infinity" } ] }, "...": "..." } }

Code Examples

1 2 3 4 5 6 7 8 9 10 11 import requests country = 'US' year = '2024' api_url = 'https://api.api-ninjas.com/v1/incometax?country={}&year={}'.format(country, year) response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) if response.status_code == requests.codes.ok: print(response.text) else: print("Error:", response.status_code, response.text)

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.