API endpoint fields are described in this specification as follows:
→ Request optionality
← Response optionality
O Field is optional
M Field is mandatory
C Field is conditional
NA Field does not need to be supplied. If supplied, it will be ignored.
TIP
Please note that string fields have a default maximum length of 256 characters unless specified otherwise.
The Mobile Money API uses the following URI format:
{…]/{version}/mm/{Resource}
Where:
The specification supports the following request methods:
Updates to resources are accomplished by use of the HTTP PATCH method. The PATCH format is based upon IETF RFC 6902. (opens new window). IETF RFC 6902. The replace operation replaces the value of the target property with the supplied value. An example of a replace operation is [{ "op": "replace", "path": "/XYZ", "value": “test” }] where XYZ is the target property.
The resource part of the URI path identifies the type of resource and if applicable, the specific resource for which an operation is to be performed. Resources are reflected in plural and by use of nouns, for example, /accounts/bills.
A client correlation id can be supplied by the API client on HTTP POST and PATCH requests. The client correlation id is a UUID that enables the client to correlate the API request with the resource created/updated by the provider. The client correlation id is specified in the HTTP Request Header. (opens new window) When a provider issues a callback, the provider should ensure that the original correlation id provided by the client is placed in request header.
The client correlation ID supports safe operations. A POST request that is submitted with a correlation ID that has already been supplied will be rejected as unsafe, thus avoiding transaction duplication.
All use cases supported by the API are built on standardised flow patterns. Flow patterns exist for viewing, updating, and creating resources.
There are two standard flows:
More detail can be found in the API Behavioural Model section.
All API properties are defined in camelCase format.
All enumeration values referenced within the API use lower case notation – this includes acronyms and abbreviations. The only exceptions are for
The following header information can be supplied for the mobile money API.
For the security headers, please also refer to the Mobile Money API Security Design for further information.
| Header | Value | Optionality | Notes |
|---|---|---|---|
| Accept | application/json | Mandatory | |
| Accept-Charset | utf-8 | Mandatory | |
| Authorization | Authorization: Basic {base64Encode(concatenated client's username followed by ‘:’ and password)} OR OAuth2 Access Token. For OAuth2 format is {‘Bearer’ token value} | Mandatory | |
| Content-Length | Length of request content in 8-bit bytes | Mandatory | |
| Content-Type | application/json | Mandatory |
| Header | Value | Optionality | Notes |
|---|---|---|---|
| Content-Length | Length of response content | Conditional | Applicable only if the HTTP response contains JSON body |
| Content-Type | application/json; charset=utf-8 | Conditional | Applicable only if the HTTP response contains JSON body |
| Header | Value | Optionality | Notes |
|---|---|---|---|
| X-API-Key | Used to pass pre-shared client's API key to the server | Conditional | Only required when API Client Authentication based on API key is used. |
| X-User-Bearer | Used to pass user’s access token | Conditional | Only required when OAuth 2.0/OIDC authorisation framework is used for end-user authentication. |
| X-Date | {The date and time that the message was sent in HTTP-date format - RFC 7231} | Conditional | Used for Basic message integrity checks. |
| X-Client-Id | Used to pass pre-shared client's identifier to the server | Conditional | Can be used in addition to X-API-Key. |
| X-Content-Hash | SHA-256 hex digest of the request content (encrypted or plain) | Conditional | Applicable only if the HTTP request contains JSON body and basic data integrity checking is to be performed. |
| X-CorrelationID | UUID | Conditional | Please refer to Client Correlation ID. |
| X-User-Credential-1 | Contains an authentication credential of the end user (e.g. PIN, Password). | Conditional | Should only be used when OAuth 2.0/OIDC authorisation framework has not been implemented by the API Provider. |
| X-User-Credential-2 | Contains an authentication credential of the end user (e.g. PIN, Password). Can be used when a second credential is required. | Conditional | Should only be used when OAuth 2.0/OIDC authorisation framework has not been implemented by the API Provider. |
| X-Channel | string containing the channel that was used to originate the request. For example, USSD, Web, App. | Conditional | Used to identify the API invocation channel. |
| X-Callback-URL | string containing the URL which should receive the Callback for asynchronous requests. | Conditional | Will only be used by the API provider if they have implemented the Callback method. |
| Header | Value | Optionality | Notes |
|---|---|---|---|
| X-Date | {The date and time that the response was sent in HTTP-date format - RFC 7231} | Conditional | Used for Basic message integrity checks |
When changes are made to the Mobile Money API, a new version is released. There are three types of API versions:
The following types of changes are considered to be backwards compatible:
The following types of changes are considered to be backwards incompatible and hence major:
The version that a client intends to use is indicated in the path. Format is ‘X.Y.Z’ where ‘X’ is the major version, ‘Y’ is the minor version and ‘Z’ is a patch version. Versions are sequentially numbered. When a major version is incremented, the minor version is reset to zero.
The following table provides examples of API version compatibility:
| Client Version | Provider Version | Compatible? |
|---|---|---|
| 1.0.0 | 1.1.0 | Yes |
| 1.1.0 | 1.0.0 | Client would need to submit only 1.0.0 related payload. If 1.1.0 services, properties or parameters are supplied by the client, the provider will reject the request. |
| 2.0.0 | 1.0.0 | No |
| 1.0.0 | 2.0.0 | No |
The mobile money API applies common validation to all amount properties. The following rules are applied during validation:
Amount validation examples are shown below.
| Value | Permitted? |
|---|---|
| 5 | Yes |
| 5.0 | Yes |
| 5. | No |
| 5.00 | Yes |
| 5.5 | Yes |
| 5.50 | Yes |
| 5.5555 | Yes |
| 5.55555 | No |
| 555555555555555555 | Yes |
| 5555555555555555555 | No |
| -5.5 | No |
| 0.5 | Yes |
| .5 | No |
| 00.5 | No |
| 0 | Yes |
| 00.00 | No |
| 0.00 | Yes |
| 0000001.32 | No |
The Mobile Money API manages API state and exception handling in a harmonised manner:
The responses object enables clients to request a missing API response.
API behaviour is governed by the following factors:
Asynchronous flows involve a callback mechanism or a polling mechanism to enable the client to determine the final state of the request. Both mechanisms involve the use of the Request State object as per below:
Callback. A request is initiated via a HTTP POST or PATCH request with an intermediate response represented by a Request State object. Once the request has been completed, the provider will initiate a PUT request to the URL specified by the client in the X-Callback-URL request header. The callback will provide the client with one of the following:
Polling. A request is initiated via a HTTP POST or PATCH request with an intermediate response provided in the form of the Request State object. A HTTP GET is then issued against /requeststate by the client at intervals until the final resource state and resource reference is returned.
The object definition for RequestState is described below.
| RequestState Object Properties | |||||
|---|---|---|---|---|---|
| Name | Type | Description | Reference | Validation | |
| serverCorrelationId | string | A unique identifier issued by the provider to enable the client to identify the RequestState resource on subsequent polling requests. | → NA ← M | UUID format | |
| objectReference | string | Provides a reference to the subject resource, e.g. transaction reference. | → NA ← O | ||
| status | string | Indicates the status of the request. | → NA ← M | Enumeration = pending, completed, failed | |
| notificationMethod | date-time | Indicates whether a callback will be issued or whether the client will need to poll. | → NA ← M | Enumeration = callback, polling | |
| pendingReason | string | A textual description that can be provided to describe the reason for a pending status. | → NA ← O | ||
| expiryTime | date-time | Indicates the time by which the provider will fail the request if completion criteria have not been met. For an example, a debit party failing to authorise within the allowed time period. | → NA ← O | ||
| pollLimit | integer | Indicates the number of poll attempts for the given requeststate resource that will be allowed by the provider. | → NA ← O | ||
| errorReference | object | If the asynchronous processing failed, details of the error will be returned here. | → NA ← O | Errors Object |
Figures 1 to 7 illustrate the standard flows for the Mobile Money API. The green flows represent a success path and red flows represent a failure path.
Figure 1 : Mobile Money API Generic Sequence Diagram for Read Requests
Figure 2 : Mobile Money API Synchronous Diagram for Create Requests
Figure 3 : Mobile Money API Asynchronous Callback Diagram for Create Requests
Figure 4 : Mobile Money API Asynchronous Polling Diagram for Create Requests
Figure 5 : Mobile Money API Synchronous Diagram for Update Requests
Figure 6 : Mobile Money API Asynchronous Callback Diagram for Update Requests
Figure 7 : Mobile Money API Asynchronous Polling Diagram for Update Requests
The following HTTP response codes are returned for the listed methods:
| Method | Success | Intermediate | Client Error | Server Error |
|---|---|---|---|---|
| GET | 200 | N/A | 400, 401, 404 | 500, 503 |
| POST | 201 | 202 | 400, 401, 404 | 500, 503 |
TIP
Note that the ‘intermediate’ column in the table above relates to the HTTP response for the first leg of an asynchronous request.
| Error Category | Description | HTTP Response Code |
|---|---|---|
| BusinessRule | The resource could not be successfully completed due a violation of a business rule. Business rules include financial limit violations, duplicate requests, and invalid states. | 400 |
| Validation | Violation of a constraint that will prevent the resource from being processed. Examples include: - Invalid property length. - Failure to resolve regular expression. | 400 |
| Authorisation | It was not possible to authenticate or authorise the client or other party to perform the service. | 401 |
| Identification | The requested resource could not be matched on the system with the supplied identifier(s). | 404 |
| Internal | The request could not be completed due to non-client related issues that do not constitute complete system unavailability. Examples include software licence issues, unavailability of system configuration information. | 500 |
| Service Unavailable | The service is not currently available. This could be due to network issues, issues with individual components or complete systems outages. Regardless of the cause, the result means that the request cannot be performed. | 503 |
The mobile money API uses the errors object to provide error details to API clients. The following properties are included:
Error Category. All error codes must be associated with an appropriate category. This provides context and uniqueness to the error code.
Error Code. Provides the reason for the request failure. Error codes are generally granular, i.e. they provide a specific reason for failure. In some cases, granularity is neither possible nor desirable. Where this is the case, a generic code has been defined. Cases include:
Error Description. A textual description of the error code.
Error Parameters. Provides a construct to communicate supplementary information regarding the error in key/value pairs. The supplementary information is currently non-harmonised and can include:
With the errorParameters property, care should be taken regarding confidentially of information. Confidential parameter information should only be disclosed to trusted clients.
| Errors Object Properties | |||||
|---|---|---|---|---|---|
| Name | Type | Description | Reference | Validation | |
| errorCategory | string | The category grouping for the error. | → M ← M | Enumeration = Errors Categories | |
| errorCode | string | The harmonised error code identifying the reason for error. | → M ← M | Enumeration = Errors Codes | |
| errorDescription | string | A textual description of the error. | → O ← O | ||
| errorDateTime | date-time | The timestamp indicating when the error occurred. | → O ← O | ||
| errorParameters | array | Diagnostic information in the form of key/value pairs relating to the error. | → O ← O | Errors Parameters |
Allows error parameter properties to be specified in the form of key/value pairs. The number of key/value pairs is limited to 20.
| Error Parameters Object Properties | |||||
|---|---|---|---|---|---|
| Name | Type | Description | Reference | Validation | |
| key | string | Identifies the type of additional error parameter. | → M ← M | ||
| value | string | Identifies the value of the additional error parameter. | → M ← M |
| Error Category | Error Code | Error Code Description |
|---|---|---|
| BusinessRule | GenericError | A generic Error Code for the Rule Error Category. This is used in two scenarios: 1. The API Provider has generated an error that does not map to existing Rule error codes. 2. The API Provider wishes to avoid disclosure of confidential information regarding the resource or parties to the resource. |
| BusinessRule | DailyVolumeLimitExceeded | The party has exceeded their daily transacting volume limit - This can be a service limit or a limit that is specific to the party. |
| BusinessRule | DailyValueLimitExceeded | The party has exceeded their daily transacting value limit - This can be a service limit or a limit that is specific to the party. |
| BusinessRule | WeeklyVolumeLimitExceeded | The party has exceeded their weekly transacting volume limit - This can be a service limit or a limit that is specific to the party. |
| BusinessRule | WeeklyValueLimitExceeded | The party has exceeded their weekly transacting value limit - This can be a service limit or a limit that is specific to the party. |
| BusinessRule | MonthlyVolumeLimitExceeded | The party has exceeded their monthly transacting volume limit - This can be a service limit or a limit that is specific to the party. |
| BusinessRule | MonthlyValueLimitExceeded | The party has exceeded their monthly transacting value limit - This can be a service limit or a limit that is specific to the party. |
| BusinessRule | AccountMaxTotalValueExceeded | The party has exceeded their cumulative transacting value limit defined for the account. |
| BusinessRule | AccountMaxTotalVolumeExceeded | The party has exceeded their cumulative transacting volume limit defined for the account. |
| BusinessRule | LessThanTransactionMinValue | The amount specified for the transaction is less than the defined minimum for the service. |
| BusinessRule | GreaterThanTransactionMaxValue | The amount specified for the transaction is greater than the defined maximum for the service. |
| BusinessRule | MaxBalanceExceeded | The amount specified will cause the balance of the credit parties account to exceed the rule limit. |
| BusinessRule | SamePartiesError | The debit and credit parties are the same. |
| BusinessRule | DuplicateRequest | The request has previously been processed, i.e. this request is a duplicate and hence has been rejected. |
| BusinessRule | InsufficientFunds | Available funds are not sufficient to enable the party to be debited for the requested transaction. |
| BusinessRule | IncorrectState | The account is in a state that does not permit the requested service. |
| BusinessRule | UnderPaymentNotAllowed | The requested amount is less than the amount that needs to be supplied for this transaction |
| BusinessRule | OverPaymentNotAllowed | The requested amount is greater than the amount that needs to be supplied for this transaction |
| BusinessRule | RateLimitError | The client has submitted too many requests within a period of time. |
| Identification | IdentifierError | The requested resource could not be matched on the system with the supplied identifier(s). |
| Validation | GenericError | A generic Error Code for the Validation Error Category. This is used in where the API Provider has generated an error that does not map to existing Validation error codes. |
| Validation | LengthError | The specified property contents are greater than the maximum allowed length or less than the minimum allowed length. |
| Validation | FormatError | The specified property contents do not conform to the format required for this Property. |
| Validation | NegativeValue | The amount supplied is negative and this is not allowed for the given service. |
| Validation | CurrencyNotSupported | The currency supplied is not supported by the API Provider. |
| Validation | MandatoryValueNotSupplied | A mandatory value has not been provided in the header and/or JSON body. |
| Authorisation | ClientAuthorisationError | General Client Authentication failure. No further details provided to prevent leakage of security information. |
| Authorisation | RequestDeclined | The debit party did not approve the request. |
| Authorisation | RequestingPartyAuthorisationError | The party requesting the service has not provided the right credentials and/or does not have permission to perform this service. |
| Internal | GenericError | The request could not be completed due to a non-client related issues that do not constitute complete system unavailability. Examples include software licence issues, unavailability of system configuration information. |
| Service Unavailable | GenericError | The service is not currently available. This could be due to network issues, issues with individual components or complete systems outages. Regardless of the cause, the result means that the request cannot be performed. |
The Heartbeat API is used for monitoring purposes and establishes whether the system of an API provider is in a state that enables a client to submit a request for processing within established SLAs. There are three states that can be returned by the API provider in response to a heartbeat request:
The Heartbeat can be requested using the following path:
Only synchronous API Heartbeat requests are supported. The HTTP response contains the following properties.
| Heartbeat Response Properties | |||||
|---|---|---|---|---|---|
| Name | Type | Description | Reference | Validation | |
| serviceStatus | string | Provides the status of the requested service. | → NA ← M | Enumeration = available, unavailable, degraded | |
| delay | number | The anticipated processing delay in milliseconds. | → NA ← O | serviceStatus property must be set to degraded. | |
| plannedRestorationTime | date-time | Where the planned restoration time is known (e.g. scheduled maintenance), it can be provided in this property. | → NA ← O |
In some circumstances, the client may not have received the final representation of the resource for which it attempted to create. For example, a proxy server issue may have resulted in a HTTP 5xx response but the provider may have actually successfully completed the request. The /responses API allows a client to identify and retrieve the final representation of the resource assuming that the resource was created. In order to get a representation, the client issues a GET /Responses/{clientCorrelationId}. The provider will then match the client correlation id to the appropriate resource and return a link to that resource. If the resource is not found for the given correlation id then a HTTP 404 will be returned.
The response object for /responses is detailed below.
| Responses Response Properties | |||||
|---|---|---|---|---|---|
| Name | Type | Description | Reference | Validation | |
| link | string | Provides a URL to the resource associated with the given correlation ID. | → NA ← M |