JMSURF Tax API documentation: KRA eTIMS REST API
Overview
The JMSURF Tax signs your invoices and credit notes with KRA eTIMS (OSCU). Send a JSON invoice; the hub converts it to KRA's format, numbers it, sends it, retries if KRA is unavailable, and returns the KRA receipt details and QR link to print.
Base URL: https://jmsurftax.co.ke. All requests and responses are JSON. Amounts are numbers; dates are YYYY-MM-DD.
Authentication
Create keys in the dashboard under API keys & webhooks. Send the key as a bearer token. Keys starting jet_test_ use KRA's sandbox; jet_live_ keys sign real invoices.
curl https://jmsurftax.co.ke/v1/status \
-H "Authorization: Bearer jet_test_xxxxxxxxxxxxxxxxxxxxxxxx"Limit: 600 requests per minute per key. Keep keys on your server — never in a browser or mobile app.
Going live
- The business applies for OSCU on the KRA eTIMS portal and picks JMSURF as its integrator.
- KRA issues a device serial number. Enter PIN, branch and serial in KRA connection.
- Register every product or service you invoice (
POST /v1/items). - Send invoices. Test everything with sandbox keys first; JMSURF approves live access.
Items
Every invoice line must use a registered item. Use your own product id as external_id so you can refer to it later. Find classification codes with GET /v1/item-classes?q=research.
POST /v1/items
{
"external_id": "SKU-001",
"name": "Field Work Data Collection",
"item_class_code": "8010150000",
"tax_type": "B", // A exempt · B 16% · C 0% · D non-VAT · E 8%
"product_type": "3", // 1 raw material · 2 finished product · 3 service
"default_price": 1160
}
→ 201 { "item_code": "KE3NTU0000001", "registered": true, ... }Calling it again with the same external_id updates the item at KRA.
Invoices
POST /v1/invoices
{
"reference": "INV-2026-0016", // your invoice number (unique)
"date": "2026-10-07",
"customer": { "pin": "P000123456Z", "name": "Kantar East Africa", "phone": "0700998877" },
"payment_method": "02", // 01 cash · 02 credit · 06 mobile money …
"currency": "KES", // other currencies need "exchange_rate" to KES
"prices_include_tax": false, // false: unit_price excludes VAT
"lines": [
{ "item_id": "SKU-001", "quantity": 1, "unit_price": 18000 }
]
}The hub signs it immediately and answers 201 with the KRA details. If KRA is slow or down you get 202 with status: "pending"; it keeps retrying and calls your webhook when signed. Add ?wait=false to always return at once.
Sending the same reference again (or the same idempotency_key) returns the existing document instead of creating a duplicate — safe to retry on network errors.
→ 201
{
"id": "4f0c…", "object": "invoice", "reference": "INV-2026-0016", "status": "signed",
"etims_invoice_number": 7,
"totals": { "taxable": 20880, "tax": 2880, "amount": 20880, "currency": "KES" },
"kra": {
"cu_id": "KRACU0100000001", "cu_invoice_number": "KRACU0100000001/152",
"receipt_number": 152, "total_receipt_number": 160,
"internal_data": "TE68SLA234J5EAV3N56988LJQ7", "receipt_signature": "V249J39CFJ48HE2W",
"signed_at_kra": "20261007123015", "qr_url": "https://etims.kra.go.ke/common/link/…",
"print": { "scu_information": [ … ], "tax_table": [ … ] }
}
}Credit notes
POST /v1/credit-notes
{
"reference": "CN-0001",
"original_reference": "INV-2026-0016", // the signed invoice being credited
"reason_code": "06", // 01 missing qty · 02 data error · 03 damaged · 04 wasted · 05 shortage · 06 refund
"lines": [ { "item_id": "SKU-001", "quantity": 1, "unit_price": 5000 } ]
}Documents
GET /v1/documents/:id · GET /v1/documents?reference=INV-2026-0016 · GET /v1/documents?status=failed · POST /v1/documents/:id/retry (after fixing a data problem).
Printing a signed invoice
KRA requires an SCU INFORMATION block on every signed invoice. Print the lines in kra.print.scu_information as label/value pairs, the per-rate table in kra.print.tax_table, and a QR code that encodes kra.qr_url. Never print an invoice as a valid tax invoice while its status is not signed.
Webhooks
Events: document.signed, document.failed, ping. We retry for about a day if your endpoint does not answer 2xx. Verify the signature before trusting a webhook:
X-JMSURF-Signature: t=1760000000,v1=<hex>
// Node.js
const [t, v1] = header.split(",").map(p => p.split("=")[1]);
const expected = crypto.createHmac("sha256", WEBHOOK_SECRET).update(t + "." + rawBody).digest("hex");
const ok = crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected)) && Date.now() / 1000 - Number(t) < 300;X / Z reports
GET /v1/reports/daily?date=2026-10-07 — counts and totals per tax type for sales and credit notes signed that day (today = X report, earlier days = Z report).
Customers
Register customers that have a KRA PIN once; KRA keeps them for your branch. Sending the same external_id again updates the customer.
POST /v1/customers
{ "external_id": "CUST-0042", "pin": "P000123456Z", "name": "Customer name", "phone": "07XXXXXXXX", "email": "[email protected]" }
→ 201 { "customer_number": "000000001", "registered": true, ... }GET /v1/customers lists them. GET /v1/taxpayers/P000123456Z checks a PIN with KRA first.
Branch, users and insurance
GET /v1/branches — your branches as KRA has them. GET /v1/kra-items — the items KRA holds for this branch.
POST /v1/branch-users
{ "user_id": "cashier01", "name": "Cashier 1", "contact": "07XXXXXXXX" }
POST /v1/insurances
{ "code": "INS001", "name": "Insurance company name", "rate": 20 }Stock: POST /v1/stock/movements reports a movement; GET /v1/stock/movements?since=YYYYMMDDhhmmss lists movements KRA recorded for you (for example goods another branch sent).
Codes
GET /v1/codes?class=07 — KRA code lists (04 tax types, 07 payment methods, 10 quantity units, 17 packaging units, 32 credit-note reasons). GET /v1/item-classes?q=… — item classifications.
Errors
Errors return { "error": { "code": "...", "message": "...", "details": ... } } with HTTP 4xx/5xx. Common codes: unauthorized, validation_error, device_not_ready, item_not_found, item_not_registered, kra_rejected, kra_unavailable, rate_limited.
Powered by JMSURF TECHNOLOGIES LTD