Authentication
Ruva uses JWT bearer tokens. Log in once for an access/refresh pair, then send the access
token on every request. Business endpoints are namespaced under /api/v1.
curl -s -X POST https://www.ruvapos.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "you@yourbusiness.co.za",
"password": "your-password"
}'
{
"accessToken": "eyJhbGciOi...",
"refreshToken": "8f3c2e1a-...",
"expiresInSeconds": 3600,
"user": {
"id": "...",
"email": "you@yourbusiness.co.za",
"role": "MANAGER",
"locale": "en-ZA"
}
}
Then authorise subsequent calls with Authorization: Bearer <accessToken>,
and refresh when it expires. The token carries your business and your role, so every
call is scoped to your own business.
Sign-in takes an email and a password. If your email belongs to more than one business, the answer asks you to name which, and every query is scoped to that business.
Public, unauthenticated routes
A small number of routes sit outside /api/v1 because they're deliberately public:
| Method | Route | What it is |
|---|---|---|
GET | /health, /ready | Liveness and readiness |
GET | /docs, /docs/openapi.yaml | The reference and the spec |
GET | /receipts/{number} | Digital receipts, signed-link access only |
A few routes inside /api/v1 are public too, because the caller is a guest
with no account — the guest self-order surface (/api/v1/qr/*), online booking and
public click-and-collect. They resolve the venue from a location id printed on the table code
and are rate-limited. The QR routes additionally answer 403 qr_not_licensed unless
the venue holds the QR Ordering product and its licence is current or
within its grace period, so build that branch in
before you ship.
Conventions
- Money is integer cents. No floats anywhere near a total — a POS that rounds in binary floating point eventually loses a cent.
- Menu prices are VAT-inclusive, matching how the till works. VAT is exact: 15/115 of each sale's total after discounts, rounded once to the nearest cent, and shared across its lines.
- Manager-gated endpoints mirror the in-app permission model: the token's role is checked server-side regardless of what the client showed.
- Errors use one shape with a documented code catalogue, so a client can branch on the code rather than parse prose.
- Pagination is consistent across the list endpoints, with shared query parameters.
- Entitlement is part of the contract. An account holds one or more of
three products (Restaurant, Shop and QR Ordering), and the set
rides in the access token as a claim, so a client can read it without a round trip.
GET /api/v1/licence/entitlementsreturns the same thing for a UI that has just changed it. Endpoints that belong to a product a caller doesn't hold refuse with a specific code rather than pretending: guest ordering answersqr_not_licensed, and adding a guest order to a table's tab answerstab_not_availableunless the venue offers a tab.
Request and response schemas, the error-code catalogue and the endpoint index live in the
API reference at /docs. This page is the orientation, not the reference. The
reference renders the OpenAPI spec, which currently describes the integration surface
rather than the whole server — the back-office administration routes the console uses are
largely absent from it. If an endpoint is missing from /docs, it may still
exist.
Idempotency
Payments and sale commits accept an idempotency key. This matters more than usual here because a terminal that loses its connection mid-request retries, and a retried payment must not charge twice. Send the same key and you get the same result rather than a second capture.
Design assumption worth knowing. Receipt numbers are sequential per device per day, so two tills ringing simultaneously — and a till that rang offline all afternoon — can't collide when everything syncs.
Webhooks
Payment providers (Yoco and PayFast) confirm asynchronously. Ruva verifies the provider's signature before trusting a delivery, and capture is idempotent, so a provider retry can't double-capture a bill.
| Provider | Behaviour |
|---|---|
| Yoco | Signature-verified. Yoco retries a failed delivery for roughly 28 hours before deactivating the subscription, so transient downtime is recoverable without manual replay. |
| PayFast | Each notification is checked four ways before anything is captured: its signature, the address it came from, its amount against the order, and PayFast's own confirmation of it. |
Pay-by-link depends on this path end to end: the POS creates the checkout, shows a waiting screen, and the bill closes itself when the webhook confirms.
Webhooks to your own systems
The other direction: Ruva tells your systems when something happens — sale.completed, sale.refunded, product.created, product.updated, stock.adjusted, order.created, order.updated, customer.created, customer.updated, kitchen.ticket_ready and kitchen.ticket_bumped. A sale is announced however it was taken, including on a till that was offline and synced later. Add an endpoint on the back office's Developer page, choose its events, and keep the signing secret it shows you once; the page's test button sends a signed ping.
Every delivery is a signed JSON POST in the Standard Webhooks scheme, under
Ruva-Webhook-* headers: pass those to a Standard Webhooks library to verify it. Answer 2xx within 10 seconds; anything else is
retried with backoff, eight attempts in all, and any delivery can be replayed from
the Developer page. The header id is the same on every retry of one delivery; the body's
id is the same on a replay, so you can tell a fact you have already applied. Customer
events carry the customer's id and never their name or contact details.
Verifying one by hand, in Node:
import crypto from "node:crypto";
// secret: the endpoint's whsec_… value; rawBody: the request body exactly as received.
export function verifyRuva(secret, headers, rawBody, nowSeconds = Date.now() / 1000) {
const id = headers["ruva-webhook-id"], ts = Number(headers["ruva-webhook-timestamp"]);
if (!id || !Number.isFinite(ts) || Math.abs(nowSeconds - ts) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest();
return (headers["ruva-webhook-signature"] || "").split(" ").some((entry) => {
if (!entry.startsWith("v1,")) return false;
const given = Buffer.from(entry.slice(3), "base64");
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
});
}
To pull instead, an API app with webhooks:read lists the same events:
TOKEN=$(curl -s -u "$CLIENT_ID:$CLIENT_SECRET" -d grant_type=client_credentials \
"$RUVA/api/v1/platform/oauth/token" | jq -r .access_token)
curl -s -H "Authorization: Bearer $TOKEN" "$RUVA/api/v1/platform/app/events?type=sale.completed"
Refuse a timestamp more than 5 minutes from your clock. Every event, header and
field is in the reference's x-webhooks section, generated from the code that sends
them: /docs/openapi.yaml.
Real-time events
Terminals subscribe to a WebSocket stream so a change on one till appears on the others in a second or two, with a background poll as the safety net.
kitchen fired · bumped · ready · rush · recalled
table seated · cleared
payment captured
The green "ready to run" banner every terminal pops when the kitchen plates a ticket is this stream, in the browser too.
The sync protocol
Terminals hold a local database and reconcile with the server rather than depending on it:
- Push — queued changes go up every 30 seconds while online, and immediately on reconnect.
- Retry — per item, backing off from 1 minute to 1 hour, so a flaky link doesn't hammer the server or drain a tablet.
- Dead-letter — anything the server refuses, or anything that has failed 10 times, is parked for review, rather than blocking everything behind it.
- Pull — the device also pulls menu, prices, staff, customers, tables and reservations, so every terminal converges.
Sales rung offline generate their double-entry journals when they sync, so the ledger ends up identical either way. The protocol is documented in full in the API reference.
The morning jobs
These two jobs run by themselves each morning, once a day for each location; a manager can also call their endpoints, signed in as themselves. A call after the morning's run is done answers "already done today" and does nothing more:
| Method | Route | What it does |
|---|---|---|
POST | /api/v1/loyalty/birthday-vouchers | Issues today's 20% birthday vouchers, valid 30 days |
POST | /api/v1/checklists/summary/send | Emails the day's checklist digest |
Rate limits
Built in, and every allowance is somebody's own: a client's, by the address its request reached
our network from (a forwarded address it typed itself changes nothing), or an API app's, by its token,
whichever address it calls from. Past one, the answer is 429 with Retry-After:
| What | Allowance |
|---|---|
| Sign-in | 10 a minute per client |
| Token refresh | 30 a minute per client |
| Screen pairing | 10 a minute per client |
| Password reset | 10 a minute per client |
| Stop link in a message | 10 a minute per client |
| Stop link in a message, pressed | 10 a minute per stop link |
| Screen pairing: starting | 20 a minute per client |
| Screen pairing: waiting | 240 a minute per client |
| Screen pairing: adding | 30 a minute per client |
| One pairing | 90 a minute per pairing token |
| Screen pairing: one business | 20 a minute per business |
| Sign-up | 5 a minute per client |
| Sign-up: what it offers | 60 a minute per client |
| Integration sign-in | 20 a minute per client |
| The API | 600 a minute per API app |
| Guest ordering | 600 a minute per client |
| Guest ratings | 30 a minute per client |
| Guest email codes | 30 a minute per client |
| Receipts by email | 10 an hour per client |
| A takeaway guest's "I'm here" | 6 a minute per order |
| A guest calling a waiter or asking for the bill | 60 an hour per client |
| Calls from one order | 10 an hour per order |
| Counted menu scans | 5 an hour per client |
| WhatsApp orders from one guest | 10 an hour per guest number |
| WhatsApp orders at one location | 120 an hour per location |
| The public sample café | 20 a minute per sample café visitor |
| Wrong table codes | 5 a minute per address and venue |
| Wrong table codes at one table | 10 a minute per table |
| Guest booking | 60 a minute per client |
| Large-party booking enquiries | 5 an hour per client |
| Till sync | 600 a minute per client |
| Readiness and status | 300 a minute per client |
| Payment webhooks | 1000 a minute per client |
| WhatsApp webhook | 6000 a minute per client |
| Support mail webhook | 600 a minute per client |
| Kitchen reprints | 60 a minute per signed-in device |
| Kiosk counts | 6 a minute per signed-in device |
| Kiosk orders | 60 a minute per signed-in device |
| Kiosk loyalty sign-ins | 10 a minute per signed-in device |
| Kiosk loyalty sign-ins: one business | 30 a minute per business |
| Live-update sockets (browser) | 30 a minute per signed-in device |
| Counted-stock reads (a till) | 30 a minute per signed-in device |
| Billing changes | 10 a minute per business |
| Billing change links | 10 a minute per client |
| Checklist digest sends | 5 an hour per business |
| Asking the agent you forgot to name | 5 an hour per business |
| WhatsApp codes confirming a new business's mobile number | 5 an hour per business |
| Ledgr key checks | 10 an hour per client |
| Second-factor code attempts | 10 a minute per signed-in device |
| Changing your own password | 5 an hour per person |
| Changing your own name | 20 an hour per person |
| Sign-ins at a till's PIN pad | 20 a minute per signed-in device |
| PINs set for someone else | 30 an hour per person |
Configuration
Ruva runs the server, so there is nothing to configure on it. Your own systems need only your business's API apps and webhook endpoints, made on the back office's Developer page.