ThoughtAPI

Docs FNB FNB bank APIs Transaction History

Dates, pagination and polling

How fromDate, toDate and lastItemKey work together in FNB's Transaction History API, and a polling pattern that never misses or double counts an entry.

Base URL
https://api.fnb.co.za/apigateway
Version
OpenAPI 1.0.5
Auth
OAuth 2.0 bearer token
Status
Live

Please note: This page is our own understanding of an FNB API, written in our own words. It is not FNB's official documentation. See Copyright and disclaimer.

Date filters#

Parameter Format What the documents say What we recommend
fromDate YYYY-MM-DD Entries on this date and later are returned (Spec 1.5.1, OpenAPI) Always send it. Treat it as inclusive.
toDate YYYY-MM-DD End value of the range Always send it. Treat it as inclusive.

Dates are calendar dates without a time or time zone. Our reading is that they are South African business dates (UTC+2).

Open questions:

  • Whether the range filters on bookingDate or valueDate. The documents do not say. Until confirmed, store both dates and check results against both.
  • The furthest back fromDate may go, and the longest range per call. Neither is documented. Our own client clamps each call to 31 days, which is a cautious choice of ours, not a bank rule.
  • Whether a range with no entries returns 200 with an empty entry list, or 204. See Status codes.

Pagination with lastItemKey#

The response carries a pagination block:

{ "groupHeader": { "pagination": { "lastPageIndicator": false, "lastItemKey": "EXAMPLEKEY01" } } }

The loop is simple:

  1. Call with fromDate and toDate and no lastItemKey.
  2. Process entry[].
  3. If lastPageIndicator is true, you are done with this range.
  4. Otherwise call again with the same fromDate and toDate, plus lastItemKey set to the value you just received. Go to step 2.

Things to keep in mind:

  • Keep the dates identical on every page of one range. The Spec describes the key as continuing the same range, not starting a new one (Spec p9).
  • The key is not a change feed. The Spec says it cannot be used to fetch only what changed (Spec p9). You cannot save a key and come back tomorrow for only the new entries.
  • Expect a possible overlap at page edges. The OpenAPI says the next page starts with, and includes, the keyed entry, which suggests that the last item of one page may appear again first on the next. Deduplicating handles this either way.
  • Guard against loops. If the bank ever returns the same lastItemKey twice in a row, stop and alert rather than looping.
  • Page size is not documented and cannot be set.

A polling pattern that works#

There is no push in this API, so you poll. This pattern copes with late postings, retries and overlapping pages:

  1. Pick a window. Each run reads from a few days before the last fully read date up to today. We use 3 days of overlap, and once a day a deeper re-read of the last 14 days.
  2. Read every page of the window, as above.
  3. Deduplicate with your own key. Build it from the entry's content (account, both dates, amount, credit or debit, reference, endToEndId, entryId, availability) plus an occurrence counter for genuinely identical entries. entryId alone is not unique.
  4. Only advance your "fully read up to" date when the last page succeeded. If a run fails half way, the next run simply reads the same window again.
  5. Check the running balance. For entries in order, previous availability plus or minus the current amount should equal the current availability. Raise an alert on a gap.
  6. Expect interbank payments in batches (our reading). The bank's EFT Domestic Payments documents explain that a same-day payment from one FNB account to another shows immediately, while one to another bank is credited in the end-of-day batch and shows by the next morning. Payments into an FNB account from other banks most likely clear in similar batches, so an early-morning poll will often find the previous day's interbank credits. Please treat this as a hint, not a promise.
  7. Space your calls. No rate limit is published. Start gently (we poll every 5 minutes per account) and back off on 429, 423 and 5xx.

Each page request needs a new X-Request-ID. Use a new X-Idempotency-ID for each page too, and keep that same value when you retry that page.

Changelog#

  • 2026-12-01: Copyright and disclaimer notice added.
  • 2026-12-01: Note on when interbank credits appear, from the EFT Domestic Payments documents. Addresses now have no trailing slash.
  • 2026-11-30: Quoted passages from the bank documents rewritten in our own words.
  • 2026-11-29: First version.

Updated 2026-12-01