AfroToolsAfroWork SuitePayroll API

🔌 B2B API · Feature 7

African payroll compliance
as an API.

PAYE, pension, social security, minimum wage — for all 54 African countries. Integrate in minutes. 100 free calls/month, no credit card.

View Endpoints
54Countries
7Endpoints
100Free calls/month
<50msAvg latency
$0.01Per call after free tier

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:

https://afrotools.com/.netlify/functions/afrowork-api

All endpoints use POST with a JSON body. Responses are JSON. Authentication uses a Bearer token in the Authorization header.

Who uses this

🏦
Fintechs & Digital Banks
Net salary calculation for loan eligibility and salary advance products.
🧾
Accounting Firms
Payroll calculation for client portals without a full payroll system.
🖥️
HR & Payroll SaaS
Compliance logic for African countries you don't currently cover.
🛍️
Job Boards & Platforms
Real net salary display on job listings, across 54 countries.

Authentication

Every request requires a valid API key in the Authorization header:

curl
JavaScript
Python
curl -X POST \ https://afrotools.com/.netlify/functions/afrowork-api/v1/payroll/paye \ -H "Authorization: Bearer afro_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"country":"NG","gross_salary":450000,"frequency":"monthly"}'
// JavaScript (fetch) const response = await fetch( 'https://afrotools.com/.netlify/functions/afrowork-api/v1/payroll/paye', { method: 'POST', headers: { 'Authorization': 'Bearer afro_YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ country: 'NG', gross_salary: 450000, frequency: 'monthly' }) } ); const data = await response.json();
# Python (requests) import requests response = requests.post( 'https://afrotools.com/.netlify/functions/afrowork-api/v1/payroll/paye', headers={'Authorization': 'Bearer afro_YOUR_API_KEY'}, json={'country': 'NG', 'gross_salary': 450000, 'frequency': 'monthly'} ) data = response.json()
🔑
API keys start with 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).

POST /v1/payroll/paye PAYE income tax calculation

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

FieldTypeRequiredDescription
countrystringrequiredISO 3166-1 alpha-2 (e.g. NG, KE)
gross_salarynumberrequiredGross amount in local currency
frequencystringoptional"monthly" or "annual" (default: "annual")
regimestringoptionalTax regime, e.g. "NTA_2026" for Nigeria. Defaults to latest.

Response

FieldTypeDescription
paye_annualnumberAnnual PAYE tax
paye_monthlynumberMonthly PAYE tax
net_annualnumberAnnual net pay after tax and deductions
net_monthlynumberMonthly net pay
effective_ratenumberEffective tax rate (0–1)
law_referencestringSource law / authority

Example

Request
Response
{ "country": "NG", "gross_salary": 450000, "frequency": "monthly" }
{ "country": "NG", "gross_salary": 450000, "frequency": "monthly", "currency": "NGN", "tax_year": 2026, "regime": "NTA_2026", "paye_annual": 459000, "paye_monthly": 38250, "net_annual": 4941000, "net_monthly": 411750, "effective_rate": 0.085, "law_reference": "Federal Inland Revenue Service (FIRS)", "_meta": { "calls_remaining": 97, "resets": "2026-05-01" } }
POST /v1/payroll/social-security Pension & social contribution breakdown

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

Request
Response
{ "country": "KE", "gross_salary": 120000, "frequency": "monthly" }
{ "country": "KE", "grossMonthly": 120000, "contributions": [ { "scheme": "NSSF Tier I", "employee": 540, "employer": 540 }, { "scheme": "NSSF Tier II", "employee": 6660, "employer": 6660 }, { "scheme": "SHIF", "employee": 3300, "employer": 0 }, { "scheme": "Affordable Housing Levy", "employee": 1800, "employer": 1800 } ], "totalEmployeeDeductions": 12300, "totalEmployerContributions": 9000, "currency": "KES", "law": "NSSF Act 2013, SHIF Act 2023, Housing Levy Finance Act 2023" }
POST /v1/payroll/minimum-wage Minimum wage lookup + compliance check

Returns the statutory minimum wage for a country and sector. Pass proposed_salary to get a compliance check (is_compliant, margin).

Request

FieldRequiredNotes
countryrequiredISO code
sectoroptionalgeneral, domestic, farm
proposed_salaryoptionalMonthly salary to check compliance against

Example response

{ "country": "ZA", "sector": "general", "hourly": 28.79, "monthly": 4984, "currency": "ZAR", "effectiveDate": "2025-03-01", "proposed_salary": 5200, "is_compliant": true, "margin": 216, "margin_pct": 0.0433 }
POST /v1/payroll/payslip Full payslip: earnings + deductions + employer costs

Complete payslip calculation — PAYE, all social security contributions, employer costs, and net pay. Mirrors the AfroTools payslip generator output.

Example

Request
Response
{ "country": "GH", "employee": { "name": "Kofi Mensah", "id": "EMP-001" }, "period": { "month": 4, "year": 2026 }, "earnings": { "basic": 5000, "housing": 1000, "transport": 500 } }
{ "country": "GH", "period": "April 2026", "earnings": { "basic": 5000, "housing": 1000, "transport": 500, "gross": 6500 }, "deductions": { "paye": 812, "social_security": 358, "total": 1170 }, "employer_contributions": { "total": 877 }, "net_pay": 5330, "currency": "GHS" }
POST /v1/payroll/overtime Overtime pay calculation

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

FieldRequiredNotes
countryrequiredISO code
monthly_salaryrequiredGross monthly salary
overtime_hoursrequiredHours of overtime worked
day_typeoptionalweekday | weekend | public-holiday | night-shift

Example response

{ "country": "NG", "base_hourly_rate": 1152.07, "multiplier": 1.5, "multiplier_label": "Standard Overtime", "overtime_pay": 20737.26, "total_monthly_pay": 220737.26, "law_reference": "Labour Act Cap L1, Section 13" }
POST /v1/payroll/leave Statutory leave entitlements

Returns statutory leave entitlements for a country: annual, sick, maternity (with pay source), paternity, and public holidays.

Request
Response
{ "country": "TZ" }
{ "country": "TZ", "annualLeaveDays": 28, "sickLeaveDays": 126, "maternityLeaveDays": 84, "maternityPayPct": 100, "maternityPaySource": "employer", "paternityLeaveDays": 3, "publicHolidays": 16, "totalDaysOffPerYear": 44, "law": "Employment and Labour Relations Act 2004" }
POST /v1/payroll/staff-cost Total employer cost of an employee

Total cost to the employer: gross salary plus all employer-side contributions (pension, social security, levies). Includes a cost premium percentage.

Request

FieldRequired
countryrequired
gross_salaryrequired
frequencyoptional

Example response

{ "gross_monthly": 300000, "employer_contributions": 66000, "total_monthly_cost": 366000, "cost_premium_pct": 0.22, "currency": "NGN" }

Error Codes

All error responses return JSON with an error field describing what went wrong.

StatusCodeMeaning
200OKRequest succeeded. Result in body.
400Bad RequestInvalid JSON body, missing required field, or unsupported country.
401UnauthorizedMissing or invalid API key. Check your Authorization header.
404Not FoundUnknown route. Check the endpoint path.
405Method Not AllowedUse POST for all payroll endpoints.
429Too Many RequestsMonthly call limit reached. Response includes resets date and upgrade link.
500Server ErrorCalculation error. Report via GitHub Issues.
# Example 401 response { "error": "Invalid or revoked API key", "docs": "https://afrotools.com/afrowork/api/" } # Example 429 response { "error": "Monthly rate limit exceeded", "plan": "free", "limit": 100, "calls_used": 100, "resets": "2026-05-01T00:00:00.000Z", "upgrade": "https://afrotools.com/afrowork/api/#pricing" }

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.

PlanMonthly callsPer-minute burstOverage
Free10010 req/minBlocked until next month
Starter5,00060 req/min$0.01 / call
Growth25,000200 req/min$0.01 / call
Pro100,000500 req/min$0.01 / call
EnterpriseUnlimitedCustomDedicated SLA

Every response includes rate limit headers:

X-RateLimit-Limit: 100 X-RateLimit-Remaining: 97

Pricing

Start free. Upgrade when you scale. All plans cover all 54 African countries and all 7 endpoints.

Free
$0
/ month
100 calls
No SLA
Get key
Starter
$29
/ month
5,000 calls
Email support
Contact us
Pro
$299
/ month
100,000 calls
Priority + Slack
Contact us
Enterprise
Custom
 
Unlimited
Dedicated SLA
Contact us

Overage (Starter and above): $0.01 per call beyond monthly limit. Email api@afrotools.com to upgrade.


Changelog

Apr 2026
NEWv1 public launch — 7 endpoints, 54 countries.
NEWNigeria NTA 2026 tax bands live.
NEWKenya SHIF (Oct 2024), Affordable Housing Levy live.
Mar 2026
UPDATESouth Africa NMW updated to R28.79/hr (Mar 2025).
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.

YOUR API KEY — copy it now, it won't be shown again
⚠ Store this securely. Treat it like a password — never commit to git or expose client-side.

Check Your Usage

Enter your API key to check your current month's usage.