Developers

Payroll tax API: a Python example

Calculate a paycheck from Python in about twenty lines.

This example uses the requests library. It builds a paycheck, sends it with a bearer key, prints each tax line, and handles the two failures you will meet first: a validation error and a rate limit. Keep the key in an environment variable, not in source.

The call

import os
import requests

URL = "https://omniatax.io/v1/paycheck"
HEADERS = {"Authorization": f"Bearer {os.environ['OMNIA_KEY']}"}

paycheck = {
    "checkDate": "2026-09-15",
    "payFrequency": "biweekly",
    "earnings": [{"code": "REG", "category": "regular", "amount": 300000}],
    "deductions": [],
    "federalW4": {"filingStatus": "single", "multipleJobs": False,
                  "dependentCredit": 0, "otherIncome": 0,
                  "deductions": 0, "extraWithholding": 0},
    "ytd": {"socialSecurity": 0, "medicare": 0, "futa": 0},
    "workState": {"code": "TX", "certificate": {}},
}

resp = requests.post(URL, json=paycheck, headers=HEADERS, timeout=30)
if resp.status_code == 422:
    for problem in resp.json().get("details", []):
        print(problem["path"], "-", problem["message"])
    raise SystemExit(1)
if resp.status_code == 429:
    raise SystemExit(f"slow down; retry in {resp.headers['Retry-After']}s")
resp.raise_for_status()

result = resp.json()["result"]
for tax in result["taxes"]:
    print(f"{tax['id']:<14}{tax['payer']:<10}{tax['amount'] / 100:>10.2f}")
print("net pay", result["netPay"] / 100)

What it prints

Run against the Texas paycheck above, the loop prints one row per line, and the last line reads net pay 2450.12. Federal income tax is $320.38, Social Security $186.00 and Medicare $43.50.

Notes for production

Next

Add the employee's real W-4 answers, their year-to-date wages and the right workState. The JavaScript example does the same in Node, and the integration guide covers the order of work.

Keep reading

Payroll tax API JavaScript example · Payroll tax API cURL example · Payroll tax API error codes · Payroll tax API integration guide · All guides

Questions

How do I call a payroll tax API from Python?

Send a POST with the requests library to https://omniatax.io/v1/paycheck with a JSON body and an Authorization: Bearer header, then read result.taxes and result.netPay from the JSON response.

Should I convert cents to dollars in Python?

Keep integers for all arithmetic and divide by 100 only for display. That avoids floating-point rounding errors in totals.

Start the 14-day trial Read the docs →

14-day free trial, then $0.08 per paycheck calculation. Omnia Express calculates; it does not file, deposit tax, or give tax advice. Disclaimer.