Our web services consist of a collection of HTTP RESTful(ish) APIs utilizing JSON format, servers are listening on the following hosts offering secure TLS connections.

HostEnvironmentDescription
rest.prod.rafiki-api.comProductionThis is the actual live environment, It should only be utilized once your integration has been thoroughly tested in the sandbox environment.
rest.sandbox.rafiki-api.comSandboxYou can use this environment to safely test your integration code

Request

Requests employ standard HTTP methods, also known as verbs, including POST, GET, PUT, and DELETE, as outlined in RFC 7231, unless a specific endpoint specifies otherwise.

Every resource detailed in this document provides instructions on the required request structure, encompassing HTTP body, headers, and other essential components.

As a general guideline, any POST or PUT request that includes a body requires the appropriate Content-Type header, indicating the associated MIME serialization strategy (currently supporting only JSON). Without this header, our server will promptly reject the request, responding with an HTTP 400 error.

Response

Each response body will be serialized according to the high level structures outlined below :

βœ…

HTTP 2xx

PropertyTypeDescription
"data"array/objectEmployed to precisely depict the response data of resources. If a single entity is returned, the data is represented as an object. Conversely, when multiple records need to be listed, the data structure becomes an array.
"meta"objectRelevant metadata unique to the resource, such as pagination information and total record count.

❗️

HTTP >= 4xx

PropertyTypeDescription
"code"enumSpecific error message categorisation (See error codes)
"message"stringA human-readable description explaining the reason for the request failure.
"errors"objectAn object containing key/value pairs to provide a detailed and granular representation of the failure reason.

Status codes

Status codes play a pivotal role in crafting a polished HTTP API design. Irrespective of the architectural approach, responses must consistently align with the semantics of the selected status code.

While the HTTP standard already defines the meaning of each code, this particular section of our documentation aims to provide further clarity on their utilization within the context.

StatusDescription
200This indicates a generic β€œsuccess”, the server has successfully interpreted the request, executed its job, and responded back accordingly.
201Successful requests in a create context. E.g. a brand new record was inserted.
202Upon receiving the request, the server successfully acknowledges and accepts it. However, the actual execution of the work is deferred as it is pushed into a queue. The resource typically provides a dedicated endpoint for polling job update statuses. It is your responsibility to make periodic requests at specified intervals to check for updates.
400The server couldn't process the request accurately. This could be due to issues such as a malformed JSON object or a missing/mismatched Content-Type header.
401When attempting to access a protected resource with an API key that is invalid, expired, or blacklisted
402When trying to transfer money from a wallet that lacks the required balance.
403When the API key is valid but lacks the necessary permissions to access the resource, or is explicitly prohibited from performing the specified action.
404The requested resource at the provided URL cannot be found, or any referenced ID within an HTTP request body does not exist.
409When two or more requests are concurrently using the same idempotency key.
422Similarly with the 400 status code, the difference here lies in the reason for the error. In this case, the error is due to a validation issue. Although the JSON document's structure is syntactically correct, one or more of its properties may be invalid concerning the specific resource. For instance, it could be a phone number that doesn't adhere to the specified format.
500An issue occurred on our end. We will have logged the request to identify the root cause and resolve the problem.