ZakFin developers

A read-only API and signed webhooks, for the plan that includes API access. These pages are in English.

Start

The workspace owner or an admin signs in to ZakFin, opens Developers, and makes a key: a name, the scopes it may use, the companies it may see, an optional expiry and a rate limit. The key is shown once. Zakaria keeps only a hash, so a lost key cannot be shown again; make a new one and revoke the old.

curl -H "Authorization: Bearer zka_YOUR_KEY" \
  https://YOUR-ZAKARIA-ADDRESS/api/v1/receivables

A key is read-only. It cannot create, change, send, pay or approve anything, cannot see people, billing or settings, and only reaches the endpoints below. Every call is recorded in the workspace activity log under the key's name.

To test without real customer figures, make a key limited to the demo company (Control Center, demo company). There is no separate sandbox server.

Endpoints (version 1)

Base address: /api/v1. The machine-readable description is /api/v1/openapi.json (OpenAPI 3).

CallScopeWhat it returns
Loading…

Scopes

ScopeMeaning
Loading…

A key limited to some companies only sees those. Amounts are numbers in the currency shown with them. Totals are never added across currencies.

Limits and errors

Webhooks

ZakFin can tell your system when something happens. Add an https address under Developers and choose the events. The address must be public: private networks and redirects are refused.

EventWhen
Loading…

A message is JSON: {"id", "type", "created", "workspace", "data"}. data holds names, ids and amounts only (for example the invoice number), never a bank detail, key or document. Ask the API for the rest. Use id to ignore a message you already handled.

Check the signature

Each message has Zakaria-Signature: t=UNIX_SECONDS,v1=HEX. The value is HMAC-SHA256 of t + "." + raw body with the endpoint's secret (shown once, starts with whsec_). Compare in constant time and reject a t older than 5 minutes.

// Node
const crypto = require('crypto');
function valid(secret, header, rawBody) {
  const p = Object.fromEntries(header.split(',').map((x) => x.split('=')));
  if (Math.abs(Date.now() / 1000 - Number(p.t)) > 300) return false;
  const mac = crypto.createHmac('sha256', secret).update(p.t + '.' + rawBody).digest('hex');
  return mac.length === p.v1.length && crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(p.v1));
}
# Python
import hmac, hashlib, time
def valid(secret, header, raw_body):
    p = dict(x.split('=', 1) for x in header.split(','))
    if abs(time.time() - int(p['t'])) > 300: return False
    mac = hmac.new(secret.encode(), (p['t'] + '.').encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(mac, p['v1'])

Delivery

Versions and changes

The address carries the version (/api/v1). Within a version we add fields and endpoints but do not remove or rename them or change their meaning. A new version is a new address. When a version is replaced it stays available for at least 12 months, answers carry Deprecation and Sunset headers, and the change is written in the release notes first. Only version 1 exists today.

Not built yet

OAuth sign-in for other apps, write endpoints (creating invoices, recording payments), an official SDK, a separate sandbox server with test credentials, and an extension framework. Today: scoped read-only keys, signed webhooks, this page and the OpenAPI file.