ThoughtAPI

Docs FNB FNB bank APIs Transaction History

Authentication

How to get credentials for FNB's Transaction History API, how the OAuth 2.0 token flow works, and how to keep tokens alive.

Base URL
https://api.i.fnb.co.za/apigateway
Version
OpenAPI 1.0.5
Auth
OAuth 2.0 authorisation code, then refresh 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.

The short version#

  1. Subscribe to Transaction History on the Integration Channel in Online Banking Enterprise, and choose the accounts it may read. You receive a client ID and client secret (Manual p3 and p5).
  2. Get an authorisation code. On your own behalf, it comes from the subscription. Through a third party, either you share the code with them securely, or they use an OAuth redirect URL that the bank sends you to (Manual p3 and p6).
  3. Exchange the code for tokens at the OAuth 2.0 token endpoint. You get an access token and a refresh token (Manual p4).
  4. Call the API with Authorization: Bearer <access-token>.
  5. On 401, use the refresh token to get a new access token, then retry (Manual p5).
  6. If the refresh token has expired too, the subscription step has to be repeated to get a new pair (Manual p4).

Endpoints#

From the OpenAPI securitySchemes. Only the integration environment is listed:

Purpose URL (integration)
Authorise https://api.i.fnb.co.za/apigateway/oauth2/authorize
Token https://api.i.fnb.co.za/apigateway/oauth2/token/v2

The scope is i_can. The OpenAPI explains it as granting whatever your partner permissions allow.

Open question: the token and authorise URLs for pre-production and production. The natural guess is the same paths on api.p.fnb.co.za and api.fnb.co.za. The bank's Statements OpenAPI supports that guess for the token URL: it gives https://api.fnb.co.za/apigateway/oauth2/token/v2 for production, and the EFT Domestic Payments OpenAPI gives https://api.p.fnb.co.za/apigateway/oauth2/token/v2 for pre-production. So all three hosts have appeared in the bank's documents with the same token path. Please still confirm with the bank before relying on it.

Open question: the Statements and EFT Domestic Payments OpenAPI files declare the OAuth 2.0 client credentials grant, while both manuals describe the authorisation code flow. If client credentials is also available for Transaction History, a server-only integration would not need refresh tokens or a repeated subscription. See Statements ST-01.

Token requests#

The Manual says clients authenticate with signed JWTs, using a client ID and secret (Manual p3), and that authorisation follows OAuth 2.0 with the authorisation code flow. They do not show the exact request. Until the bank confirms the format, we recommend starting with the standard OAuth 2.0 requests from RFC 6749, which is what the OpenAPI declares:

POST /apigateway/oauth2/token/v2 HTTP/1.1
Host: api.i.fnb.co.za
Authorization: Basic <base64(client_id:client_secret)>
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=<authorisation-code>&redirect_uri=<your-redirect-uri-if-any>
POST /apigateway/oauth2/token/v2 HTTP/1.1
Host: api.i.fnb.co.za
Authorization: Basic <base64(client_id:client_secret)>
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&refresh_token=<refresh-token>

A standard response looks like {"access_token": "...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "..."}. The documents do not give the lifetimes, so read expires_in when present rather than hard-coding one.

If the bank expects the client ID and secret in the form body (client_id=...&client_secret=...) instead of HTTP Basic, or a signed JWT client assertion, only the authentication part changes. Our own client keeps this configurable for exactly that reason.

Keeping tokens healthy#

  • Store tokens before you use them. If your process dies after a refresh but before saving, you may lose the only valid refresh token.
  • Refresh once, not in parallel. If several workers hit 401 at the same moment, let one refresh and the others reuse the result. Some OAuth servers issue a new refresh token on each use and invalidate the old one; the documents do not say whether FNB does, so it is safer to assume it might.
  • Refresh a little early. When expires_in is known, refresh a minute or two before expiry to avoid a failed call.
  • Treat an expired refresh token as a human task. Raise an alert saying the subscription needs renewing. Retrying will not fix it.
  • Never log tokens, secrets or account numbers. Log the X-Request-ID instead; the bank echoes it as X-Correlation-ID, which is enough to trace a call.

The account holder chooses which accounts the subscription may read, and can change or revoke that at any time on the Integration Channel, including consent given to a third party (Manual p2, p3 and p6). If a previously working account starts returning 403, a changed account selection or revoked consent is a likely cause.

Open questions on authentication#

  • The exact client authentication method on the token endpoint (Basic, form body, or signed JWT).
  • Access token and refresh token lifetimes, and whether refresh tokens rotate.
  • Production and pre-production token and authorise URLs.
  • Whether a server-only integration can avoid repeating the subscription when a refresh token expires.
  • Whether source IP allow-listing is required.

Changelog#

  • 2026-12-01: Copyright and disclaimer notice added.
  • 2026-12-01: Production token URL and client credentials, as seen in the Statements OpenAPI. Addresses now have no trailing slash. Pre-production token URL from the EFT Domestic Payments OpenAPI.
  • 2026-11-30: Quoted passages from the bank documents rewritten in our own words.
  • 2026-11-29: First version.

Updated 2026-12-01