Authentication
Every request to the Partner API must carry three headers. There is no session, no cookie, and no OAuth flow — just a per-request HMAC-SHA256 signature computed with the secret you were issued.
Why no session tokens?
This is deliberate, not a gap. A session/bearer token is a single artifact that, once issued, authorizes every request that carries it until it expires or is revoked — steal it once (a logged request, a compromised proxy, a leaky log aggregator) and it replays indefinitely within its lifetime. This API signs every individual request instead (the same model Stripe and AWS use): the secret itself never travels over the wire, each signature is only valid for the one exact method + path + body it was computed over, and — combined with the protections below — a captured request can't be reused even seconds later. There's no token to steal because there's no token.
Transport security
Every request must be HTTPS. A request that arrives over plain HTTP in production is rejected before any credential is even inspected:
| HTTP | error_code |
|---|---|
| 401 | HTTPS_REQUIRED |
This matters because the whole scheme — the signature, the 5-minute timestamp window, the replay guard below — only protects a request that travelled encrypted. Over plain HTTP, the signature and the full request/response are readable (and replayable) by anyone on the network path between you and us.
Replay protection
Two independent layers stop a captured, valid request from being reused:
- Timestamp window —
X-Timestampmust be within 5 minutes of the server's clock (REQUEST_EXPIREDotherwise). This bounds how long a captured request is even worth replaying. - Exact-request replay guard — within that same 5-minute window, the exact same signed request (identical
X-Signature) is only honoured once. A second attempt — whether from a network capture, a proxy retry, or an attacker resending it — is rejected:
| HTTP | error_code |
|---|---|
| 401 | DUPLICATE_REQUEST |
This is separate from idempotency_key (see Disbursements and Collections), which protects you against your own retries of a failed call — it lets you safely resend the same logical operation and get back the original result instead of a duplicate transaction. DUPLICATE_REQUEST protects against someone else replaying a request they intercepted; if you legitimately need to retry, build a fresh request (new X-Timestamp, new signature) rather than resending the same bytes.
Other protections that back this up
- Host binding — a sandbox credential only works on the sandbox host, a live credential only on the production host (
INVALID_HOSTotherwise, see Sandbox). A key captured or misconfigured against the wrong environment simply won't authenticate. - IP allowlisting (optional, see below) — restricts which source IPs a key will even be considered from.
- Per-partner rate limiting (see below) — bounds the damage a compromised key can do before it's noticed.
Taken together — HTTPS-only, per-request signing with no reusable token, a bounded timestamp window, exact-replay rejection, host binding, and optional IP allowlisting — a captured request has no path to being reused, and there's no persistent credential in flight for a hijacker to steal in the first place.
Required headers
| Header | Description |
|---|---|
X-Api-Key |
Identifies which partner is calling. |
X-Timestamp |
Unix timestamp (seconds) when the request was built. Must be within 5 minutes of the server's clock. |
X-Signature |
HMAC-SHA256 signature of the request, hex-encoded. |
Building the signature
The signature covers the timestamp, HTTP method, full request URI, Content-Type, and a hash of the body, so signing also protects the request from tampering in transit, not just from being replayed.
canonical_string = "{timestamp}|{METHOD}|{request_uri}|{content_type}|{sha256(body)}"
signature = HMAC_SHA256(canonical_string, your_api_secret){METHOD}is uppercase (GET,POST).{request_uri}is the path plus the query string, exactly as you send it, with no host. ForGET /accounts/SA-00123/statement?page=2, it is/api/partner/v1/accounts/SA-00123/statement?page=2. Keep the same parameter order and encoding in the signature and the request.{content_type}is the exact value of theContent-Typeheader you send, or empty if you send none. AGETwith noContent-Typetherefore has two pipes in a row:...balance||e3b0c442.... APOSTwith JSON usesapplication/json. If your HTTP client appends something such as; charset=utf-8, sign that full value.{sha256(body)}is the SHA-256 hex digest of the raw request body. For aGETrequest with no body, this is the hash of zero bytes of input.
Example: signing and calling the balance endpoint
Same request, four languages — pick yours. Every other endpoint in these docs signs the same way, just with a different method/path/body.
TIMESTAMP=$(date +%s)
BODY=''
REQUEST_URI="/api/partner/v1/accounts/SA-00123/balance"
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | sed 's/^.* //')
PAYLOAD="${TIMESTAMP}|GET|${REQUEST_URI}||${BODY_HASH}" # empty Content-Type on this GET
SIGNATURE=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" | sed 's/^.* //')
curl "https://prodsacco.officeug.com${REQUEST_URI}" \
-H "X-Api-Key: $API_KEY" \
-H "X-Timestamp: $TIMESTAMP" \
-H "X-Signature: $SIGNATURE"
<?php
$apiKey = getenv('PARTNER_API_KEY');
$apiSecret = getenv('PARTNER_API_SECRET');
$timestamp = (string) time();
$method = 'GET';
$path = '/api/partner/v1/accounts/SA-00123/balance';
$contentType = ''; // no Content-Type header on this GET
$body = '';
$bodyHash = hash('sha256', $body);
$payload = "{$timestamp}|{$method}|{$path}|{$contentType}|{$bodyHash}";
$signature = hash_hmac('sha256', $payload, $apiSecret);
$ch = curl_init("https://prodsacco.officeug.com{$path}");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-Api-Key: {$apiKey}",
"X-Timestamp: {$timestamp}",
"X-Signature: {$signature}",
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import hashlib
import hmac
import time
import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
timestamp = str(int(time.time()))
method = "GET"
path = "/api/partner/v1/accounts/SA-00123/balance"
content_type = "" # no Content-Type header on this GET
body = ""
body_hash = hashlib.sha256(body.encode()).hexdigest()
payload = f"{timestamp}|{method}|{path}|{content_type}|{body_hash}"
signature = hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).hexdigest()
response = requests.get(
f"https://prodsacco.officeug.com{path}",
headers={
"X-Api-Key": api_key,
"X-Timestamp": timestamp,
"X-Signature": signature,
},
)
print(response.json())
const crypto = require('crypto');
const apiKey = process.env.PARTNER_API_KEY;
const apiSecret = process.env.PARTNER_API_SECRET;
const timestamp = Math.floor(Date.now() / 1000).toString();
const method = 'GET';
const path = '/api/partner/v1/accounts/SA-00123/balance';
const contentType = ''; // no Content-Type header on this GET
const body = '';
const bodyHash = crypto.createHash('sha256').update(body).digest('hex');
const payload = `${timestamp}|${method}|${path}|${contentType}|${bodyHash}`;
const signature = crypto.createHmac('sha256', apiSecret).update(payload).digest('hex');
// Node 18+ has fetch built in; run this inside an async function.
const response = await fetch(`https://prodsacco.officeug.com${path}`, {
headers: {
'X-Api-Key': apiKey,
'X-Timestamp': timestamp,
'X-Signature': signature,
},
});
console.log(await response.json());
Scopes
Your API key is granted specific scopes by the SACCO that issued it. Calling an endpoint your key isn't scoped for returns a 403 with error code SCOPE_DENIED — even if the signature itself is perfectly valid.
Clock sync
Requests more than 5 minutes off the server's clock are rejected with REQUEST_EXPIRED, regardless of signature validity — this is a replay-attack window, not a generosity setting. Make sure your system clock is NTP-synced.
IP allowlisting (optional)
If you call us from a fixed set of egress IPs, ask the SACCO to restrict your API key to them. When set, a request from any other IP is rejected with IP_NOT_ALLOWED even with a perfectly valid signature. This is opt-in per partner — most integrations behind dynamic/cloud egress IPs skip it.
Rate limits
Each partner may send up to 120 requests per minute, and one partner's traffic never throttles another's. There is also a limit of 60 requests per minute per source IP, which applies first, so a single server should stay under 60 per minute. Going over the partner limit returns 429 with RATE_LIMITED; back off and retry, the limit resets every minute.
Webhooks use a different secret. If you also receive webhook callbacks, those are signed with a separate
webhook_secret— a leaked webhook secret never grants API access, and vice versa.