FNB Gateway API v1
The full reference for version 1 of our FNB Gateway API, covering authentication, every endpoint with examples, sync state and coveredThrough, pagination, errors and versioning.
Overview#
Version 1 is live in sandbox at https://fnb.thought.bz/v1/ (release v0.1.3), serving synthetic demo data.
- Base URL:
https://fnb.thought.bz. Every path starts with/v1/. - Read only. Every route is a
GET. There is nothing to create, change or delete. - JSON responses, UTF-8.
- Money is an integer number of cents with a currency, for example
{"cents": 25000, "currency": "ZAR"}for R250.00. Never a float. - Dates are
YYYY-MM-DDbusiness dates in Africa/Johannesburg. Timestamps are RFC 3339 in UTC, with a few...Localfields in UTC+2 for convenience. - IDs are opaque strings with a prefix:
acc_for accounts,gt_for transactions,ev_for events. Do not parse them. Bank account numbers are never returned, only a masked form. - Sandbox data carries
"simulated": trueon every account, transaction and event. Production data never does.
All example values on this page are invented.
Authentication#
The API accepts only requests signed with AWS Signature Version 4 for the service execute-api in region af-south-1, from an IAM role on the gateway's allow list. It is meant for internal Thought services running in AWS; there are no API keys or public access.
- Each allowed role is mapped to a consumer, and each consumer sees only the accounts it has been granted. Anything outside that scope returns
404, so IDs cannot be probed. - To be added, a service owner sends the IAM role to the gateway owner, who adds it to the configuration. The role also needs
execute-api:Invokeon the gateway in its own IAM policy. - Roles that are not on the allow list are refused by API Gateway before the request reaches the service, even if another policy would allow them.
With awscurl, using credentials for an allowed role:
awscurl --service execute-api --region af-south-1 \
"https://fnb.thought.bz/v1/health"
In Python with botocore:
import boto3, requests
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
def signed_get(url):
creds = boto3.Session().get_credentials().get_frozen_credentials()
req = AWSRequest(method="GET", url=url)
SigV4Auth(creds, "execute-api", "af-south-1").add_auth(req)
return requests.get(url, headers=dict(req.headers), timeout=30)
print(signed_get("https://fnb.thought.bz/v1/sync-status").json())
Sign the exact URL you send, including the query string with its encoding.
Endpoints#
GET /v1/health#
Liveness, stage and the release the running service was built from.
Auth SigV4 from an allow-listed role (no consumer mapping needed)
Request
awscurl --service execute-api --region af-south-1 https://fnb.thought.bz/v1/health
Response
{
"status": "ok",
"stage": "sandbox",
"version": "v0.1.3",
"time": "2026-11-29T20:15:00Z"
}
version is the release tag (or git describe output in the sandbox). It requires an allow-listed role, but not a consumer mapping.
GET /v1/accounts#
The accounts this caller may see, each with its sync health.
Request
awscurl --service execute-api --region af-south-1 https://fnb.thought.bz/v1/accounts
Response
{
"items": [
{
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"label": "Example operating account",
"maskedNumber": "******0000",
"currency": "ZAR",
"simulated": true,
"historyStartsAt": "2026-11-20",
"sync": {
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"state": "ok",
"ok": true,
"lastSuccessfulPollAt": "2026-11-29T20:10:02Z",
"lastAttemptAt": "2026-11-29T20:10:02Z",
"lagSeconds": 298,
"coveredFrom": "2026-11-20",
"coveredThrough": "2026-11-29",
"errorClass": null,
"pollIntervalSeconds": 300,
"nextPollNotBefore": null
}
}
]
}
GET /v1/accounts/{accountId}/transactions#
List one account's transactions for a date range, oldest first.
| Name | In | Type | Description |
|---|---|---|---|
accountId required | path | string | An accountId from /v1/accounts. |
fromDate required | query | YYYY-MM-DD | First date, inclusive. |
toDate required | query | YYYY-MM-DD | Last date, inclusive. At most 366 days after fromDate. |
dateField | query | booking or value | Which date the range applies to. Default booking. |
creditDebit | query | CREDIT or DEBIT | Only money in, or only money out. |
limit | query | integer 1 to 500 | Page size. Default 100. |
cursor | query | string | The nextCursor from the previous page of this same listing. |
Request
awscurl --service execute-api --region af-south-1 \
"https://fnb.thought.bz/v1/accounts/acc_01EXAMPLEACCOUNT00000000AA/transactions?fromDate=2026-11-27&toDate=2026-11-29&creditDebit=CREDIT"
Response
{
"items": [
{
"id": "gt_01EXAMPLETRANSACTION00001",
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"bookingDate": "2026-11-27",
"valueDate": "2026-11-27",
"amount": { "cents": 25000, "currency": "ZAR" },
"creditDebit": "CREDIT",
"availability": { "cents": 1025000, "currency": "ZAR", "creditDebit": "CREDIT" },
"remittanceUnstructured": "EXAMPLE REF 0001",
"endToEndId": null,
"entryId": "EXAMPLE01",
"seenAt": "2026-11-27T08:05:12Z",
"seenAtLocal": "2026-11-27T10:05:12+02:00",
"ingestSeq": 42,
"futureDated": false,
"simulated": true,
"backfill": false,
"lateArrival": false,
"reversal": {
"suspected": false,
"role": null,
"relatedTransactionId": null,
"reason": null,
"matchBasis": [],
"confidence": null,
"candidates": []
},
"observations": []
}
],
"nextCursor": null,
"coveredThrough": "2026-11-29",
"sync": {
"state": "ok",
"healthy": true,
"coveredThrough": "2026-11-29",
"syncedAt": "2026-11-29T20:15:00Z",
"accounts": [ { "accountId": "acc_01EXAMPLEACCOUNT00000000AA", "state": "ok", "ok": true, "coveredThrough": "2026-11-29" } ]
}
}
| Status | Meaning |
|---|---|
400 | Missing or invalid dates, range over 366 days, bad dateField, creditDebit or limit, or a cursor from another listing. |
404 | Unknown account, or one this caller may not see. |
The sync accounts entries are shortened here; they carry the same fields as in /v1/accounts.
GET /v1/transactions#
Search transactions by payment reference, optionally narrowed by amount, direction, account and dates.
| Name | In | Type | Description |
|---|---|---|---|
reference required | query | string, 1 to 64 characters | The reference to look for in remittanceUnstructured, then endToEndId. |
match | query | exact or contains | exact (default) needs the whole field to equal the reference; contains finds it anywhere in the field. |
normalise | query | true or false | Default true. Ignores case, spaces and hyphens, so "EX 12-AB" equals "ex12ab". |
amountCents | query | non-negative integer | Only transactions of exactly this amount in cents. |
creditDebit | query | CREDIT or DEBIT | Only money in, or only money out. |
accountId | query | string | Limit to one account. Default all accounts this caller may see. |
fromDate | query | YYYY-MM-DD | Booking date from, inclusive. Default 30 days before toDate. |
toDate | query | YYYY-MM-DD | Booking date to, inclusive. Default today. Range at most 93 days. |
limit | query | integer 1 to 500 | Page size. Default 100. |
cursor | query | string | The nextCursor from the previous page of this search. |
Request
awscurl --service execute-api --region af-south-1 \
"https://fnb.thought.bz/v1/transactions?reference=EXAMPLE%20REF%200001&match=contains&amountCents=25000"
Response
{
"items": [
{
"id": "gt_01EXAMPLETRANSACTION00001",
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"bookingDate": "2026-11-27",
"amount": { "cents": 25000, "currency": "ZAR" },
"creditDebit": "CREDIT",
"remittanceUnstructured": "EXAMPLE REF 0001",
"matchedOn": "remittance"
}
],
"nextCursor": null,
"query": {
"reference": "EXAMPLE REF 0001",
"match": "contains",
"normalise": true,
"amountCents": 25000,
"fromDate": "2026-10-30",
"toDate": "2026-11-29"
},
"coveredThrough": "2026-11-29",
"sync": { "state": "ok", "healthy": true, "coveredThrough": "2026-11-29", "syncedAt": "2026-11-29T20:15:00Z", "accounts": [] }
}
| Status | Meaning |
|---|---|
400 | Missing or too long reference, bad match, normalise, amountCents or dates, range over 93 days, or a cursor from another query. |
404 | accountId given but unknown or not visible to this caller. |
Items are full transaction objects plus matchedOn (remittance or endToEndId); they are shortened here. The gateway only finds candidates. Callers apply their own rules, for example requiring that a code is not followed by another digit, before treating a hit as theirs.
GET /v1/transactions/{id}#
One transaction, including reversal flags and any observed changes.
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | A transaction id (gt_...). |
Request
awscurl --service execute-api --region af-south-1 \
https://fnb.thought.bz/v1/transactions/gt_01EXAMPLETRANSACTION00002
Response
{
"id": "gt_01EXAMPLETRANSACTION00002",
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"bookingDate": "2026-11-28",
"valueDate": "2026-11-28",
"amount": { "cents": 25000, "currency": "ZAR" },
"creditDebit": "DEBIT",
"availability": { "cents": 1000000, "currency": "ZAR", "creditDebit": "CREDIT" },
"remittanceUnstructured": "EXAMPLE REF 0001",
"endToEndId": null,
"entryId": "EXAMPLE02",
"seenAt": "2026-11-28T09:00:03Z",
"seenAtLocal": "2026-11-28T11:00:03+02:00",
"ingestSeq": 43,
"futureDated": false,
"simulated": true,
"backfill": false,
"lateArrival": false,
"reversal": {
"suspected": true,
"role": "reversal",
"relatedTransactionId": "gt_01EXAMPLETRANSACTION00001",
"reason": "Heuristic: a later DEBIT matches an earlier CREDIT.",
"matchBasis": ["amount+reference"],
"confidence": "high",
"candidates": [
{ "transactionId": "gt_01EXAMPLETRANSACTION00001", "matchBasis": ["amount+reference"], "confidence": "high" }
]
},
"observations": []
}
| Status | Meaning |
|---|---|
404 | Unknown id, or a transaction on an account this caller may not see. |
GET /v1/sync-status#
How up to date the gateway is, per account and overall.
Request
awscurl --service execute-api --region af-south-1 https://fnb.thought.bz/v1/sync-status
Response
{
"state": "ok",
"healthy": true,
"coveredThrough": "2026-11-29",
"syncedAt": "2026-11-29T20:15:00Z",
"accounts": [
{
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"state": "ok",
"ok": true,
"lastSuccessfulPollAt": "2026-11-29T20:10:02Z",
"lastAttemptAt": "2026-11-29T20:10:02Z",
"lagSeconds": 298,
"coveredFrom": "2026-11-20",
"coveredThrough": "2026-11-29",
"errorClass": null,
"pollIntervalSeconds": 300,
"nextPollNotBefore": null
}
]
}
GET /v1/events#
The ordered event log, for catching up on webhooks you missed.
| Name | In | Type | Description |
|---|---|---|---|
after | query | string | The nextCursor from your previous call. Leave out to start from the oldest event still kept. |
limit | query | integer 1 to 500 | Page size. Default 100. |
Request
awscurl --service execute-api --region af-south-1 \
"https://fnb.thought.bz/v1/events?after=eyJrIjoiZXZlbnRzIiwicyI6NDB9&limit=100"
Response
{
"items": [
{
"eventId": "ev_01EXAMPLEEVENT0000000000001",
"type": "transaction.created",
"occurredAt": "2026-11-27T08:05:12Z",
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"simulated": true,
"apiVersion": "v1",
"transaction": { "id": "gt_01EXAMPLETRANSACTION00001" },
"backfill": false,
"lateArrival": false
}
],
"nextCursor": "eyJrIjoiZXZlbnRzIiwicyI6NDF9",
"hasMore": false
}
| Status | Meaning |
|---|---|
400 | Invalid after cursor or limit. |
Items have exactly the same body as the webhooks (the transaction is shortened here). nextCursor is always returned: store it and pass it as after next time, even when hasMore is false.
GET /v1/reconciliation/daily#
The result of the daily balance-chain check for one date.
| Name | In | Type | Description |
|---|---|---|---|
date required | query | YYYY-MM-DD | The booking date to check. |
accountId | query | string | One account. Default all accounts this caller may see. |
Request
awscurl --service execute-api --region af-south-1 \
"https://fnb.thought.bz/v1/reconciliation/daily?date=2026-11-28"
Response
{
"date": "2026-11-28",
"timezone": "Africa/Johannesburg",
"accounts": [
{
"accountId": "acc_01EXAMPLEACCOUNT00000000AA",
"date": "2026-11-28",
"entryCount": 3,
"openingAvailabilityCents": 1025000,
"closingAvailabilityCents": 1000000,
"creditsCents": 0,
"debitsCents": 25000,
"expectedCloseCents": 1000000,
"ties": true,
"status": "ties",
"breaks": [],
"basis": "Opening and closing are derived from the first and last entry's availability; FNB has no balance endpoint."
}
]
}
| Status | Meaning |
|---|---|
400 | date missing or not YYYY-MM-DD. |
404 | accountId unknown or not visible to this caller. |
status is ties, break or cannot_verify (no entries that day, or entries without a running balance). Each break names the transaction, the expected and reported balance in cents, and a reason.
Sync state and coveredThrough#
The bank does not push, so the gateway is always a little behind the bank. Every list and search response says how far behind, so a caller never mistakes "not synced yet" for "not paid".
coveredThroughis the latest booking date for which the gateway has completed a full read, through the last page. For several accounts it is the earliest of their dates, andnullif any account has never completed a read. Everything booked on or before that date has been seen.sync.healthyistrueonly when every account involved is in stateok.sync.stateis the worst state among those accounts:
| State | Meaning |
|---|---|
ok |
Polling normally. |
never_polled |
No successful read yet. |
degraded |
Recent reads failed or returned an entry that could not be parsed; retrying. |
stalled |
No successful read for more than three poll intervals. |
reauth_required |
The bank login has expired. A person must renew it. |
consent_revoked |
The bank no longer allows access to this account. |
The rule for callers: only conclude that a payment has not arrived when sync.healthy is true and coveredThrough is on or after the date you expected it. Otherwise, wait and ask again, or rely on the webhook.
lagSeconds is the time since the last successful read. nextPollNotBefore is set while the gateway is backing off.
The transaction object#
| Field | Meaning |
|---|---|
id |
Gateway id (gt_...). Stable forever. Store this, not the bank's entryId. |
accountId |
Gateway account id. |
bookingDate, valueDate |
As reported by the bank. Money is available from valueDate. |
amount |
{cents, currency}, always positive. |
creditDebit |
CREDIT (in) or DEBIT (out). |
availability |
Running available balance after this entry, {cents, currency, creditDebit}, or null. |
remittanceUnstructured |
The statement reference, usually as typed by the payer. |
endToEndId |
The payment's end-to-end id, often null. |
entryId |
The bank's own label. Not unique; for reference only. |
seenAt, seenAtLocal |
When the gateway first saw it (UTC, and UTC+2). |
ingestSeq |
Increasing number in the order the gateway stored entries. |
futureDated |
true while valueDate is after today. Do not treat the money as available yet. |
simulated |
true for sandbox data. |
backfill |
true if it arrived during the first catch-up of an account's history, not as new activity. |
lateArrival |
true if it appeared with a booking date before the date the gateway had already fully read, so it showed up late. |
reversal |
Reversal suspicion, see below. |
observations |
Changes seen on later re-reads, see below. |
Reversals#
The bank's API has no reversal marker, so the gateway uses a heuristic: a later DEBIT with the same amount and currency as an earlier CREDIT on the same account, within a window, and with matching or related reference details. It flags only medium or high confidence matches.
suspected:truewhen flagged.role:reversalon the debit,originalon the credit it seems to undo.relatedTransactionId: the other side, set only when exactly one candidate has the top confidence.matchBasis: why, for exampleamount+reference,amount+endToEndId,amount+reference_containedoramount+reversal_keyword.confidence:low,mediumorhigh.candidates[]: every plausible original, each with its own basis and confidence.
A flag is a prompt for review. The gateway never changes or hides the original entry.
Observations#
If a re-read returns an entry with a different running balance, or a fully read window no longer returns an entry, the gateway keeps the stored transaction and adds an observation: kind (field_changed or not_returned), field, before, after, observedAt and pollId. A transaction.observed_changed event is sent at the same time.
Pagination#
- List and search return
nextCursor. Pass it back ascursorwith the same other parameters.nullmeans the last page. - The events log returns
nextCursorandhasMore. PassnextCursorasafter. It is always present, so you can store it and resume later. - Cursors are opaque. Do not build or edit them, and do not reuse one across different listings.
- Order is oldest first: by booking date (or value date when
dateField=value), then byingestSeq.
Errors#
Errors from the gateway have this body:
{ "error": { "code": "invalid_request", "message": "fromDate is required" } }
| Status | code |
When |
|---|---|---|
400 |
invalid_request |
A parameter is missing or invalid. The message says which. |
401 |
unauthenticated |
The request reached the service without a SigV4 identity. |
403 |
forbidden |
Signed, but the role is not a configured consumer. |
404 |
not_found |
Unknown route or id, or outside this caller's scope. |
500 |
internal |
Something failed inside the gateway. Safe to retry with backoff. |
Requests stopped before they reach the service come from AWS API Gateway and have a different body, {"message": "..."}: for example 403 for a missing or invalid signature or a role that is not allowed, and 429 when the request rate limit is exceeded (currently 50 requests per second, bursts of 100). Retry 429 and 5xx with exponential backoff.
Every response carries an x-request-id header. Quote it when reporting a problem.
Versioning#
- The version is in the path:
/v1/. These docs live at/fnb/gateway/v1. - Within v1, changes are additive only: new optional parameters, new fields, new endpoints, new event types and new values for
state,matchBasisandkind. Ignore anything you do not recognise. - Removing or renaming a field, or changing its meaning, would be a new major version (
/v2/), documented at/fnb/gateway/v2, with v1 kept running during the move. GET /v1/healthreturns the deployed release tag, which matches a tag in the public repository.
Changelog#
- 2026-12-01: Addresses now have no trailing slash.
- 2026-11-30: Updated for release v0.1.3: live in sandbox at fnb.thought.bz, webhooks live for verified consumers.
- 2026-11-29: First version.
Updated 2026-12-01