NZ Banking Data API Specification v2.0.2

NZ Banking Data API Specification v2.0.2

Version Control

Version

Date

Author

Comments

Version

Date

Author

Comments

1.0.0

01 March 2019

Payments NZ API Working Group

Baseline

v2.0-draft1

Jun 4, 2019 

@Gavin Wong (Unlicensed)

Updates:

  • Combined duplication in draft1-Overview, "Payments NZ API Standards Overview" and "Steps" into one draft1-Overview section

  • Updated draft1-OverviewDiagram to reflect change in terminology in draft1-Steps

  • Updated draft1-Steps to:

    • Step 1: Agree Consent

    • Step 2: Create Consent

    • Step 3: Authorise Consent

    • Step 4: Access Protected Resources

    • Step 5: Retrieve Consent Status

  • draft1-MessageSigning section updated to reflect that "Message signing must not be implemented"

  • Updated draft1-UniqueIdentifiers(IdFields) "An API Provider that chooses to populate optional Id fields must ensure that the values are unique and immutable." to "An API Provider must ensure that populated Id fields values are unique and immutable." as this statement applies to mandatory Id fields also.

  • Consolidated duplication in draft1-Actors section - two tables to one table

  • Updated draft1-DateFormats - example header date from UTC to GMT as per standard

  • Updated draft1-ResourceURIPathStructure to align with OBIE v3.1.2 - but removed the PSD2 role from the path

  • Renamed NZ Banking Data API Specification v2.0-draft3#draft1-403(Forbidden)v/s404(NotFound)v/s501(NotImplemented) section to include 501 (Not Implemented)

  • Updated draft1-RequestHeaders:

    • x-fapi-customer-last-logged-time updated to x-fapi-auth-date (per latest FAPI spec). Aligned definition of date type (per OBIE v3.1.2 spec)

    • Accept header - reworded for clarity that "For requests to API endpoints that respond only with JSON, the Accept header must be set to value application/json." from "If specified, it must indicate that the only a JSON response is accepted (e.g by setting the value to application/json) as a content header for all endpoints that respond with JSON."

  • Updated draft1-ResponseHeaders - Content-Type aligned with Accept header rewording; updated Content-Type to Mandatory (align with OBIE v3.1.2)

  • Updated section title "Return & Error Codes" to draft1-HTTPStatusCodes

  • Update draft1-Idempotency:

    • To reflect guidance is for "If an idempotency key is required for an API endpoint" rather than "If idempotency is implemented for an API endpoint" (align OBIE v3.1.2)

    • To also reflect that the Third Party must not modify headers or parameters in an idempotent request - updated "The Third Party must not change the request body while using the same x-idempotency-key. " to "The Third Party must not change any part of an API request (i.e., parameters, header or body) while using the same x-idempotency-key. "

  • Updated draft1-Pagination section to clarify must, should, may behaviour. As per previous NZ WG decision - First and Last links are now mandatory.

  • Updated draft1-Archiving to refer to consent instead of intent

  • Separated "Scope and Grant Types" section to draft1-Scopes and draft1-SupportedGrantTypes

  • Reworded NZ Banking Data API Specification v2.0-draft3#draft1-ConsentAuthorisation section to make authorisation flow generic (not specific to the redirect flow)

  • Updated section heading "Changes to an Intent's Authorised State:" to draft1-ChangestoConsentStatus

  • Moved "Effect of Token Expiry on an Intent's Authorized State" section to new section on draft1-TokenExpiry, and clarified how access and refresh token expiration are communicated (per OBIE v3.1.2)

  • Aligned draft1-UsageExamples to rest of the specification

Additions:

  • draft1-KnownIssues (align with v3.1.2 OBIE)

  • draft1-MessageEncryption section added to reflect that "Message encryption must not be implemented" (align with v3.1.2 OBIE)

  • draft1-CategorisationofImplementationRequirements section (align with v3.1.2 OBIE) - but limited this to only Mandatory and Optional as agreed for the NZ Banking Data v1.0.0 standard

  • draft1-DateFormats - added guidance on dates in the JWT claims

  • draft1-RequestHeaders:

    • Added x-customer-user-agent (agreed for NZ v1.0 spec, but not documented)

    • Added x-merchant-ip-address (agreed for NZ v1.0 spec, but not documented)

  • draft1-HTTPStatusCodes - added:

    • 415 (Unsupported Media Type) for unsupported request payloads (per OBIE v3.1.2) - was not documented in v1.0 spec

    • 503 (Service Unavailable) for deprecated resources (per OBIE v3.1.2)

  • draft1-403(Forbidden)v/s404(NotFound)v/s501(NotImplemented) - added example of empty array of data for 200 OK response

  • NZ Banking Data API Specification v2.0-draft3#draft1-401(Unauthorized) - guidance for 401 (Unauthorized) - as per OBIE v3.1.2

  • draft1-Idempotency:

    • Guidance that "If an idempotency key is not required for an API endpoint: The API Provider must ignore the idempotency key if provided." (aligned to OBIE v3.1.2)

    • Guidance that "If a Third Party attempts a different API request (the parameters, header or body changed) with an x-idempotency-key used in the preceding 24 hours - the behaviour is unspecified - as the result will depend on whether the original request has been successfully received by the API Provider." (NZ standards WG agreement)

  • draft1-Filtering (aligned with v3.1.2 OBIE)

  • draft1-SupportedGrantTypes section to reflect (per OBIE v3.1.2 flows, but reworded for clarity):

    • draft1-ClientCredentialsGrant

    • draft1-RedirectFlow(Hybrid)

    • draft1-DecoupledFlow(CIBA)

  • draft1-ConsentRe-authentication (align with v3.1.2 OBIE)

  • draft1-ErrorResponseStructure (align with v3.1.2 OBIE but reworded)

  • draft1-OptionalFields (align with v3.1.2 OBIE)

  • draft1-Enumerations

Removed:

  • Reference in draft1-Standards to "The initial scope of these Standards is limited to current scope - i.e., PNZ API pilot. However, the intention is that the scope of the Standards will extend to include additional resources and APIs."

  • Reference in draft1-AgnostictoPaymentSchemes to "further mapping guidance to ensure that differences are understood between the Open Banking Payment API standard, and BECS payments"

  • Removed from draft1-RequestHeaders the x-fapi-financial-id (update to FAPI) and x-jws-signature headers (as per scope)

  • Removed from draft1-ResponseHeaders x-jws-signature header (as per scope)

Errata:

  • Typo in draft1-UniqueIdentifiers(IdFields) "option" should be "optional"

v2.0-draft2

Jul 8, 2019 

@Gavin Wong (Unlicensed)

Updates:

  • Completed statement in Step 1 of draft2-Steps

  • Clarified in draft2-StatusCodes that status codes are only used in API responses

  • Clarified in draft2-Optional that "If the API Provider cannot support a particular value in an Optional field, the API Provider must reject the request and respond with an error."

  • Updated in draft2-Headers - "mandatory" to "must use", "do not use" to "must not use", and "optional" to "may use"

  • Clarified in draft2-403(Forbidden)v/s404(NotFound)v/s501(NotImplemented) that 403 is used rather than 404 for non-disclosure

  • Clarified in draft2-401(Unauthorized) that list of situations for choosing to expire a token is non-exhaustive

  • Clarified in draft2-Idempotency.1 that response with current resource status is only for successful API responses

  • Clarified in draft2-RedirectFlow(Hybrid) that the authorization code exchange may also include a refresh token

  • Clarified in draft2-DecoupledFlow(CIBA) that:

    • The authentication device "may" be distinct from the consumption device

    • The API Provider will respond with an "error" not an "authentication error" if the API Provider does not support a method of customer identification

  • Renamed Consent Re-authentication to "Re-authorisation" in draft2-ConsentRe-authorisation

  • Clarified in Consent Re-authentication that the consent and ConsentId are the existing consent and existing ConsentId

  • Clarified in draft2-UseofRefreshToken that "If the Third Party fails to get an access token using a refresh token, the Third Party must initiate a consent re-authorisation flow."

  • Clarified in draft2-OptionalFields that an unspecified field must not be included in the payload with a value of null

  • Clarified in draft2-OptionalFields how empty objects will be included in a response

  • Clarified in draft2-NZRisk1 that "Ecommerce payments which have a delivery address must have the DeliveryAddress populated."

  • Updated all references to http://www.openbanking.org.uk to http://www.openbanking.org.nz (as per Tech Decision 001)

  • Clarified in draft2-DecoupledFlow(CIBA) that the "Using an Ephemeral UserId" is an API Provider Generated Id, and "Using a ConsentId" is a Third Party Generated Id

  • Updated DeliveryAddress class in NZRisk1 to OBPostalAddress8 to align with Technical Decision - 009 - Standardising Address Objects

  • Agreed error codes in draft2-DataDictionary as per Technical Decision - 003 - Error Codes

Additions:

  • Merchant definition in draft2-Actors

  • Guidance on all dates in query parameters in draft2-DateFormats

  • Location header in draft2-Headers

  • Guidance in on draft2-StatusCodes "Communicating a rejection status is done in two ways:"

  • Added definitions in draft2-ConsentAuthorisation for "short lived consent" and "long lived consent"

Removed:

  • References to "intent-id" - the Security Profile will be updated to explain that the "intent-id" within the profile is the ConsentId

  • Removed references to "payments" and "accounts" scopes in draft2-Pre-Conditions as these are duplicated

  • Reference to "Payments" member in draft2-Links section

Errata:

  • Removed resource-group from draft2-ResourceURIPathStructure

  • Updated draft2-Pre-Conditions to reflect that certificates are issued by one of the accepted Certificate Authorities

  • Typo in draft2-Archiving

  • References to Open Banking Read/Write removed from draft2-SupportedGrantTypes

  • Updated "open-banking" to "open-banking-nz" in draft2-ResourceURIPathStructure

  • Typos

v2.0-draft3

Oct 1, 2019 

@Gavin Wong (Unlicensed)

Updates:

Additions:

  • Added UML Diagram and Data Dictionary in draft3-DecoupledFlow(CIBA) for the Login Hint Token

Errata:

  • Typos

v2.0-rc2

Dec 24, 2019

@Gavin Wong (Unlicensed)

Updates:

  • Updated the id_token_hint as mandatory if the CIBA flow is supported

  • Clarified in the Error Response Structure that “The error response structure is used to structure the response body for API Provider error responses.”

  • Clarified the two scenarios for archiving consents in the Archiving section

Additions:

  • Table in Supported Grant Types to outline mandatory and optional grant types that must be supported

  • Clarification in Consent Re-authentication that “Consent re-authorisation is the scenario where the API Provider requests a long-lived consent to be re-authorised (e.g., because of fraud risk). In this scenario, the Third Party reuses the existing ConsentId, and the API Provider may tailor the re-authorisation flow to be more efficient than the full consent authorisation flow.”

  • In the Data section that “The structure of this element differs for each API endpoint, and is documented on each API resource sub-page.“

  • In the Risk section that “The structure of the Risk section is documented in the section for NZRisk1.”

Errata:

  • Updating references to “resources” to clarify language

  • Typos and clarifications

v2.0.0

Mar 31, 2020

@Gavin Wong (Unlicensed)

No updates

v2.0.1

Jul 17, 2020

@Gavin Wong (Unlicensed)

No updates to API specification from v2.0.0.

Patch update to Swagger specification to include documented query parameters.

v2.0.2

Nov 5, 2022

@Nigel Somerfield

Patch update to Swagger specification to BECSRemittance - DebtorReference and CreditorReference - specify additionalProperties: false

Overview

The NZ Banking Data API Specification was designed to create an API based payments ecosystem for NZ and simplify partnering in the payments industry. These standards enable Banks to develop API endpoints to an agreed standard so that Third Parties can build web and mobile applications that make it easier for banking customers to pay for goods and services. This main specification provides a description of the elements that are common across all the NZ Banking Data APIs.

This specification should be read in conjunction with the individual NZ Banking API Specifications for:

  • Account Information API Specification

  • Payment Initiation API Specification

The PNZ API standards are based on the UK Open Banking standard. The PNZ API standards include adjustments to and place limitations on the UK Open Banking standard to make the standards more suitable to the NZ market. The Open Banking standard is now in the public domain; the PNZ API standards are not in the public domain as they are currently under development. Access to the PNZ API standards is currently limited to those organisations approved/authorised to operate in the NZ payments API ecosystem - Bank's and Third Parties. Approval and authorisation is managed by Payments NZ.

Overview Diagram

The figure below provides a general outline of a flow using the NZ Banking Data APIs.

Steps

Step 1: Agree Consent

  • This flow begins with a Customer consenting to allow a Third Party to access the Customer's protected resources with the API Provider.

Step 2: Create Consent

  • The Third Party connects to the API Provider that services the Customer's account(s) and creates a consent.

  • The API Provider responds with an identifier for the consent (the ConsentId).

Step 3: Authorise Consent

  • The Third Party initiates the authorisation flow for the Customer to authorise the consent.

  • The Customer authorises the consent with the API Provider. The Customer will only be able to authorise or reject the consent details in its entirety.

Step 4: Access Protected Resources

  • The API Provider authenticates the Third Party and Customer has authorised consent for the request before providing access to protected resources.

Step 5: Retrieve Consent Status

  • The Third Party may retrieve the status of the consent (with the ConsentId).

Document Structure

This document consists of the following parts:

  • Overview: Provides an overview of the Payments NZ API Standards and the key decisions and principles that contributed to the specification.

  • Basics: The section begins with an introduction to how the APIs are used.

  • Security & Access Control: Specifies the means for Third Parties and Customers to authenticate themselves and provide consent.

  • Data Model: Describes the data model for the API payloads.

Known Issues

This document and its sub-pages must be read in conjunction with the https://paymentsnz.atlassian.net/wiki/spaces/PaymentsDirectionAPIStandardsDevelopment/pages/139788339.

Design Principles

RESTful APIs

The API adheres to RESTful API concepts where possible and sensible to do so.

However, the priority is to have an API that is simple to understand and easy to use. In instances where following RESTful principles would be convoluted and complex, the principles have not been followed.

References:

  • Best Practice has also been taken from the Data Description Language for APIs; JSON API : http://jsonapi.org/

  • The Interface Description Language used is the Swagger Specification version 2.0 (also known as Open API) : http://swagger.io/

Standards

The PNZ API Working Group principles for developing API standards:

  • PNZ API Working Group will adopt existing standards where relevant/appropriate to minimise re-inventing the wheel.

  • PNZ API Working Group will work with other relevant bodies to align with, contribute to and/or adopt other Standards work, especially relating to Open Banking UK.

Extensibility

It is intended that the API flows will be extended to cater for more complex use-cases in subsequent releases, and we have kept this in mind during the design.

Idempotency

Idempotency is difficult to implement consistently and leverage consistently. 

As a result, idempotency is used sparingly in these specifications; with a preference to allow Third Parties to simply re-submit a request under failure conditions.

APIs have been defined to be idempotent, where not doing so would cause a poor Customer user-experience or increase false positive risk indicators.

Message Signing

Message signing must not be implemented for the Account Information API and Payment Initiation API request and responses.

Message Encryption

Message encryption must not be implemented for the Account Information API and Payment Initiation API request and responses.

Agnostic to Payment Schemes

The API will be designed so that it is agnostic to the underlying payment scheme that is responsible for carrying out the payment.

Status Codes

API responses use two status codes that serve two different purposes:

  • The HTTP Status Code reflects the outcome of the API call (the HTTP operation on the resource). Granular Functional Error Codes are specified as part of API Error Response Structure.

  • The Status field in a resource payload reflects the status of the resource.

Communicating a rejection status is done in two ways:

  • If the API Provider establishes a rejection scenario with payload or any contextual error during the API call, the API Provider must reject the request immediately with a 400 (Bad Request).

  • If the API Provider establishes a rejection scenario with the consent after the API call, the API Provider must set the Status of the consent to Rejected.

Unique Identifiers (Id Fields)

A REST resource should have a unique identifier (e.g. a primary key) that may be used to identify specific instances of a resource. These unique identifiers are used to construct URLs to identify and address specific instances of a resource.

However, considering that some of the resources described in this specification do not have a primary key in the system of record, the Id fields will be optional for some resources.

An API Provider must ensure that populated Id fields values are unique and immutable.

Categorisation of Implementation Requirements

The functionality, endpoints and fields within each resource are categorised as 'Mandatory' or 'Optional'.

API Providers must make documentation available to Third Parties (e.g. on their developer portals) specifying which 'Optional' endpoints and fields are implemented for any given implementation of the specification.

Mandatory

For functionalities and endpoints: 

  • An API Provider must implement an endpoint that is marked Mandatory.

  • An API Provider must implement functionality that is marked Mandatory.

For fields:

  • A Third Party must specify the value of a Mandatory field.

  • An API Provider must process a Mandatory field when provided by the Third Party in an API request.

  • An API Provider must include meaningful values for Mandatory fields in an API response.

Optional

For functionalities and endpoints:

  • An API Provider may implement an Optional endpoint.

  • An API Provider may implement Optional functionality.

For fields:

  • A Third Party may specify the value of an Optional field.

  • An API Provider must process an Optional field when provided by the Third Party in an API request. If the API Provider cannot support a particular value in an Optional field, the API Provider must reject the request and respond with an error.

  • An API Provider may specify the value of an Optional field in an API response.

Open Banking UK

The principles we have applied to re-use of the Open Banking UK specifications are:

  • Only resources that are required will be included in the API specification.

  • We will modify Open Banking UK elements where the existing standard does not cater for the NZ Market (such as adding the "BECSElectronicCredit" Scheme). 

Basics

Actors

In the NZ context, there are three main actors (API Provider, Third Party, and Customer).

The upstream Open Banking UK standard uses PSD2 parlance and acronyms that are not applicable or relevant to the New Zealand market. Below is a summary of the NZ equivalent for many common PSD2 terms.

Actor

Type

PSD2 Actor

NZ Description

Actor

Type

PSD2 Actor

NZ Description

API Provider

Legal Entity

Account Servicing Payment Service Provider (ASPSP)

API Provider refers to a Registered Bank or Non-Bank Deposit Taker that has been accredited by the Payments NZ API Standards Body to utilise its API specifications and standards, and contribute to the standards ecosystem. The API Provider provides APIs in a manner that complies with the API Standards (e.g. Account Information and Payment Initiation APIs), and connects those APIs with a Third Party(s).

Third Party

Legal Entity

Third Party Provider (TPP)

  • Account Information Service Provider (AISP)

  • Payment Initiation Service Provider (PISP)

Third Party refers to a legal entity that has been accredited by the Payments NZ API Standards Body to utilise its API specifications and standards, and contribute to the standards ecosystem. The Third Party is the entity that consumes an API in a manner that complies with the API Standards.

References to a "Third Party" in the specification relate to a piece of registered software with an API Provider (with a specific client_id).

A Third Party may engage in either or both of these services:

  • Payment initiation services

  • Account information services

Customer

Person

Payment Service User (PSU)

Individuals who operate retail banking accounts who make use of an account information service or payment service. The banking accounts may be personal accounts or associated with businesses, trusts, etc.

Merchant

Legal Entity



Merchant refers to a legal entity that interacts with the Customer and Third Party in an interaction not defined within the API specifications and standards.

Character Encoding

The API requests and responses must use a UTF-8 character encoding. This is the default character encoding for JSON (RFC 7158 - Section 8.1).

However, an API Provider's downstream system may not accept some UTF-8 characters, such as emoji characters (e.g. "Happy Birthday 🎂🎂!" may not be an acceptable Payment Reference). If the API Provider rejects the message with a UTF-8 character that cannot be processed, the API Provider must respond with an HTTP 400 (Bad Request) status code.

Date Formats

An API Provider must accept all valid ISO-8601 date formats including its permitted variations (e.g. variations in how the timezone is defined, dates with or with a seconds or milliseconds part etc.) in the requests.

All dates in the JSON payloads are represented in ISO 8601 date-time format. All date-time fields in responses must include the timezone. For Example:

2017-04-05T10:43:07+00:00

All dates in the query string (e.g., filter parameters) are represented in ISO 8601 date-time format and must not include the timezone.

If the DateTime contains a timezone, the API Provider must ignore the timezone component. The filter values will be assumed to refer to the same timezone as the timezone in which the resource is maintained.

For example:

2017-04-05T10:43:07 2017-04-05

All dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below:

Sun, 10 Sep 2017 19:43:31 GMT

All dates in the JWT claims are expressed as a JSON number, representing the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time. 

//Sun, 12 Feb 2018 14:45:00 UTC 1518446700

Resource URI Path Structure

The path of the URI must follow the structure below (from the OB API Release Management document).

  • [participant-path-prefix]/open-banking-nz/[version]/[resource]/[resource-id]/[sub-resource]

This consists of the following elements:

  • [participant-path-prefix]
    An optional API Provider specific path prefix.

  • open-banking-nz
    The constant string "open-banking-nz".

  • [version]
    The version of the APIs expressed as /v[major-version].[minor-version]/.

  • [resource]/[resource-id]
    Details the resource.

  • [sub-resource]
    Details the sub-resource.

An API Provider must use the same [participant-path-prefix] and host name for all its NZ Banking Data API resources.

Examples:

https://superbank.com/apis/open-banking-nz/v2.0/domestic-payment-consents https://superbank.com/apis/open-banking-nz/v2.0/domestic-payments https://superbank.com/apis/open-banking-nz/v2.0/account-access-consents https://superbank.com/apis/open-banking-nz/v2.0/accounts

For brevity, the APIs are referred to by their resource names in these documents and in all examples.

Headers

Request Headers

The following headers should be inserted by the Third Party in each API call:

Header Value

Notes

POST Requests

Header Value

Notes

POST Requests