IRS API Python Client
Unofficial Python wrapper for accessing IRS (Internal Revenue Service) public data and tax-related information programmatically. Provides convenience methods for retrieving tax forms, instructions, and other IRS public resources.
Warnings
- gotcha The pip package name is irs-api but the import module uses an underscore: irs_api. Using 'import irs_api' not 'import irs-api'.
- gotcha This is an unofficial wrapper around publicly available IRS data. It is not endorsed or maintained by the IRS. Endpoints may break if the IRS changes their public website structure.
- deprecated The package has not been updated frequently. The last PyPI release is 0.0.3. API surface may be limited or stale.
- gotcha Rate limiting or IP blocking may occur if too many requests are made to IRS endpoints in a short period.
Install
-
pip install requests
Imports
- IRS
from irs_api import IRS
Quickstart
import requests
# IRS provides several public REST APIs (no key required for most)
# Forms and publications search
resp = requests.get(
"https://www.irs.gov/api/forms-pubs/1040",
headers={"Accept": "application/json"}
)
# IRS APIs may return HTML on error — check content-type before parsing
if resp.ok and "application/json" in resp.headers.get("Content-Type", ""):
print(resp.json())
else:
print(f"Status: {resp.status_code}")