Overview
The AfroTools Payroll API exposes the same calculation engine that powers AfroTools' 14 free payroll calculators — as a REST API. Integrate African payroll compliance into your own app, HR platform, or fintech product without rebuilding the regulatory logic yourself.
Base URL:
All endpoints use POST with a JSON body. Responses are JSON. Authentication uses a Bearer token in the Authorization header.
Who uses this
Authentication
Every request requires a valid API key in the Authorization header:
afro_. Keep them secret — treat them like passwords. Never expose them client-side in production. They carry your rate limit quota.Endpoints
All endpoints accept POST requests with a JSON body. The country code is always an ISO 3166-1 alpha-2 code (e.g. NG, KE, ZA).
Calculate PAYE income tax for any African country. Uses the same engine as the AfroTools payslip calculators — current tax bands, personal reliefs, and deductible contributions.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| country | string | required | ISO 3166-1 alpha-2 (e.g. NG, KE) |
| gross_salary | number | required | Gross amount in local currency |
| frequency | string | optional | "monthly" or "annual" (default: "annual") |
| regime | string | optional | Tax regime, e.g. "NTA_2026" for Nigeria. Defaults to latest. |
Response
| Field | Type | Description |
|---|---|---|
| paye_annual | number | Annual PAYE tax |
| paye_monthly | number | Monthly PAYE tax |
| net_annual | number | Annual net pay after tax and deductions |
| net_monthly | number | Monthly net pay |
| effective_rate | number | Effective tax rate (0–1) |
| law_reference | string | Source law / authority |
Example
Returns a full breakdown of employee and employer social security contributions — pension, NSSF, NHIS, UIF, SSNIT — by scheme, with total deductions and law reference.
Example
Returns the statutory minimum wage for a country and sector. Pass proposed_salary to get a compliance check (is_compliant, margin).
Request
| Field | Required | Notes |
|---|---|---|
| country | required | ISO code |
| sector | optional | general, domestic, farm |
| proposed_salary | optional | Monthly salary to check compliance against |
Example response
Complete payslip calculation — PAYE, all social security contributions, employer costs, and net pay. Mirrors the AfroTools payslip generator output.
Example
Calculate overtime pay using country-specific multipliers (weekday, weekend, public holiday, night shift). Returns base hourly rate, multiplier, overtime amount, and the applicable law.
Request
| Field | Required | Notes |
|---|---|---|
| country | required | ISO code |
| monthly_salary | required | Gross monthly salary |
| overtime_hours | required | Hours of overtime worked |
| day_type | optional | weekday | weekend | public-holiday | night-shift |
Example response
Returns statutory leave entitlements for a country: annual, sick, maternity (with pay source), paternity, and public holidays.
Total cost to the employer: gross salary plus all employer-side contributions (pension, social security, levies). Includes a cost premium percentage.
Request
| Field | Required |
|---|---|
| country | required |
| gross_salary | required |
| frequency | optional |
Example response
Error Codes
All error responses return JSON with an error field describing what went wrong.
| Status | Code | Meaning |
|---|---|---|
| 200 | OK | Request succeeded. Result in body. |
| 400 | Bad Request | Invalid JSON body, missing required field, or unsupported country. |
| 401 | Unauthorized | Missing or invalid API key. Check your Authorization header. |
| 404 | Not Found | Unknown route. Check the endpoint path. |
| 405 | Method Not Allowed | Use POST for all payroll endpoints. |
| 429 | Too Many Requests | Monthly call limit reached. Response includes resets date and upgrade link. |
| 500 | Server Error | Calculation error. Report via GitHub Issues. |
Rate Limits
Rate limits are applied per API key, per calendar month (UTC). Limits reset on the 1st of each month at 00:00 UTC.
| Plan | Monthly calls | Per-minute burst | Overage |
|---|---|---|---|
| Free | 100 | 10 req/min | Blocked until next month |
| Starter | 5,000 | 60 req/min | $0.01 / call |
| Growth | 25,000 | 200 req/min | $0.01 / call |
| Pro | 100,000 | 500 req/min | $0.01 / call |
| Enterprise | Unlimited | Custom | Dedicated SLA |
Every response includes rate limit headers:
Pricing
Start free. Upgrade when you scale. All plans cover all 54 African countries and all 7 endpoints.
Overage (Starter and above): $0.01 per call beyond monthly limit. Email api@afrotools.com to upgrade.
Changelog
NEWNigeria NTA 2026 tax bands live.
NEWKenya SHIF (Oct 2024), Affordable Housing Levy live.
UPDATEGhana minimum wage updated to GHS 18.15/day.
Get Your API Key
Free tier: 100 calls/month. No credit card. Enter your email to generate a key instantly.
Check Your Usage
Enter your API key to check your current month's usage.