AuditRangers API for developers
A simple REST API and signed webhooks so you can connect Zapier, Make, n8n, POS systems, online shops and your own scripts to your Hong Kong books.
Getting started
- An owner or admin creates an API key in Settings → API & webhooks
- Choose the permissions (read, write) and which companies the key may access. Copy the key — it is shown only once.
- Call the API over HTTPS with the key in the Authorization header. All requests and responses are JSON; dates are YYYY-MM-DD; amounts are in the company's base currency with 2 decimals.
The API and webhooks are included in every paid plan and in the 14-day free trial. If a subscription lapses, keys stop working until it is renewed; your data is kept.
Base URL: https://auditrangers.com/api/v1
Authentication
Send your key as a Bearer token on every request:
Authorization: Bearer ar_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX- Keep keys secret and only use them from servers — never put a key in a web page or mobile app.
- A read key can read data; a write key can also create contacts and draft vouchers. Vouchers created through the API are always drafts: a colleague reviews and posts them in AuditRangers.
- A key can be limited to some companies. A key stops working when it is revoked, or when the person who created it is no longer an owner or admin.
- We store only a fingerprint (SHA-256) of each key, so a lost key cannot be recovered — revoke it and create a new one.
Errors
Errors use standard HTTP status codes and a JSON body:
{ "error": { "code": "unbalanced", "message": "debits (100) must equal credits (90)" } }| 400 | invalid_request / invalid_json |
| 401 | unauthorized |
| 403 | insufficient_scope / company_forbidden / plan_required |
| 404 | not_found |
| 413 | payload_too_large |
| 415 | unsupported_media_type |
| 422 | unbalanced / period_locked |
| 429 | rate_limited |
Rate limits & paging
Each key may make up to 120 requests per minute. Above that you receive 429 with a Retry-After header. Repeated requests with invalid keys are blocked for a minute.
Lists of vouchers and invoices return next_cursor; pass it as cursor to get the next page (null means the end). Contacts use limit and offset and return next_offset.
Endpoints
Replace $AR_KEY with your key and $COMPANY with a company id from GET /companies.
GET/api/v1/companiesread
Lists the companies this key can access, with base currency and financial year start month.
curl https://auditrangers.com/api/v1/companies \
-H "Authorization: Bearer $AR_KEY"GET/api/v1/companies/{id}/accountsread
The chart of accounts: code, names in Traditional Chinese, English and Simplified Chinese, type, and whether the account is tracked by contact.
curl https://auditrangers.com/api/v1/companies/$COMPANY/accounts \
-H "Authorization: Bearer $AR_KEY"GET/api/v1/companies/{id}/contactsread
Customers, suppliers, employees and other contacts.
Query parameters: kind, limit (≤500), offset
curl "https://auditrangers.com/api/v1/companies/$COMPANY/contacts?kind=customer&limit=100" \
-H "Authorization: Bearer $AR_KEY"POST/api/v1/companies/{id}/contactswrite
Creates a contact. Fields: kind (customer, supplier, employee, other), name, and optional code, email, phone, address, currency, credit_days.
curl -X POST https://auditrangers.com/api/v1/companies/$COMPANY/contacts \
-H "Authorization: Bearer $AR_KEY" -H "Content-Type: application/json" \
-d '{"kind":"customer","name":"Example Trading Ltd","email":"ap@example.com","currency":"HKD","credit_days":30}'GET/api/v1/companies/{id}/vouchersread
Vouchers with their lines (draft, submitted, approved, posted and void), ordered by date.
Query parameters: from, to (YYYY-MM-DD), limit (≤500), cursor
curl "https://auditrangers.com/api/v1/companies/$COMPANY/vouchers?from=2026-04-01&to=2026-11-30&limit=200" \
-H "Authorization: Bearer $AR_KEY"POST/api/v1/companies/{id}/voucherswrite
Creates a DRAFT voucher. Each line has account_code and either debit or credit (up to 2 decimals), plus optional description and contact_id. Debits must equal credits. Dates in a locked period are rejected.
curl -X POST https://auditrangers.com/api/v1/companies/$COMPANY/vouchers \
-H "Authorization: Bearer $AR_KEY" -H "Content-Type: application/json" \
-d '{"date":"2026-11-28","description":"POS daily takings",
"lines":[{"account_code":"1010","debit":1250.50},
{"account_code":"4000","credit":1250.50,"description":"Sales"}]}'GET/api/v1/companies/{id}/invoicesread
Sales invoices with their lines, totals, amounts paid and balance.
Query parameters: status (draft|issued|partial|paid|void), limit, cursor
curl "https://auditrangers.com/api/v1/companies/$COMPANY/invoices?status=issued" \
-H "Authorization: Bearer $AR_KEY"GET/api/v1/companies/{id}/reports/trial-balanceread
Trial balance from posted vouchers: opening balance, debits, credits and closing balance for each account. from defaults to the start of the financial year.
Query parameters: from, to
curl "https://auditrangers.com/api/v1/companies/$COMPANY/reports/trial-balance?to=2027-03-31" \
-H "Authorization: Bearer $AR_KEY"GET/api/v1/companies/{id}/reports/profit-and-lossread
Profit and loss from posted vouchers, with prior-period comparison.
Query parameters: from, to
curl "https://auditrangers.com/api/v1/companies/$COMPANY/reports/profit-and-loss?from=2026-04-01&to=2026-11-30" \
-H "Authorization: Bearer $AR_KEY"GET/api/v1/companies/{id}/reports/balance-sheetread
Balance sheet from posted vouchers as at a date, with prior-year comparison.
Query parameters: to
curl "https://auditrangers.com/api/v1/companies/$COMPANY/reports/balance-sheet?to=2026-11-30" \
-H "Authorization: Bearer $AR_KEY"Uploading receipts and invoices through the API is not available yet. Upload them in the app, by email or WhatsApp — the document.uploaded webhook tells your system when a new document arrives.
Webhooks
Add a webhook in Settings → API & webhooks and choose the events you want:
| voucher.created | A voucher was created (any status) |
| voucher.posted | A voucher was posted |
| invoice.created | A sales invoice was created |
| invoice.paid | A sales invoice was fully paid |
| document.uploaded | A receipt or document was uploaded |
We send an HTTPS POST with a JSON body like this. The data object contains the main fields only; call the API for full details.
{
"id": "6f1c…", // event id (same across retries)
"event": "voucher.posted",
"created_at": "2026-11-28T09:15:02.123+00:00",
"data": { "id": "…", "company_id": "…", "number": "202611-0042",
"date": "2026-11-28", "status": "posted", "amount": 1250.50 }
}Each request includes these headers:
X-AuditRangers-Event: voucher.posted
X-AuditRangers-Delivery: <event id>
X-AuditRangers-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + "." + raw body)>Verify the signature with the signing secret shown when you created the webhook (Node.js example):
import { createHmac, timingSafeEqual } from 'node:crypto';
import express from 'express';
const app = express();
// Verify against the raw body (do not JSON.parse and re-stringify first)
app.post('/auditrangers', express.raw({ type: 'application/json' }), (req, res) => {
const header = req.get('X-AuditRangers-Signature') ?? ''; // t=1764300000,v1=ab12…
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const body = req.body.toString('utf8');
const expected = createHmac('sha256', process.env.AR_WEBHOOK_SECRET)
.update(`${parts.t}.${body}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300; // within 5 minutes
const ok = fresh && parts.v1?.length === 64 &&
timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(parts.v1, 'hex'));
if (!ok) return res.status(400).send('bad signature');
const event = JSON.parse(body); // { id, event, created_at, data }
// De-duplicate by event.id: retries keep the same id
res.sendStatus(200);
});- Reply with any 2xx status within 10 seconds. Redirects are not followed.
- If delivery fails we retry up to 8 times, waiting about 2, 4, 8, 16… minutes. Events may occasionally arrive more than once or out of order — use the event id to de-duplicate.
- Webhook URLs must use https and a public domain name; private and local network addresses are refused.
Zapier, Make & n8n
No coding needed: Zapier, Make and n8n can work with this API through their built-in Webhooks and HTTP modules.
- To react to events: create a “Catch Hook” (Zapier Webhooks), “Custom webhook” (Make) or “Webhook” trigger (n8n) and paste its https URL as a webhook here.
- To send data in: use “Webhooks by Zapier → Custom Request”, Make's “HTTP → Make a request” or n8n's “HTTP Request” node with the Authorization header Bearer and your key.
- Example: when your online shop records a sale, create a draft voucher debiting bank and crediting sales; your accountant reviews and posts it.