Developer Guide

Learn more about documenting APIs in GitBook.

The Sarafa API (Application Programming Interface) provides a powerful and versatile way for your business to programmatically interact with the Sarafa platform. By leveraging the API, you can seamlessly integrate Sarafa’s financial functionalities into your existing applications, workflows, and systems, unlocking new levels of automation and efficiency. To begin utilizing the Sarafa API, you will need to generate an API key.

Authentication

To interact with the Sarafa API, you will utilize API keys for authentication.

  • Format: Secret keys follow the UUID version 4 (Universally Unique Identifier) format.

    xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

    Example: a1b2c3d4-e5f6-4789-9012-34567890abcd

Base URL

All API requests to Sarafa should be directed to the following base URL for the production environment:

  • https://api.sarafa.live/v1

  • https://api.sarafa.ss/v1

API Usage

You will need to include your API key in the header of every API request for authentication. The key should be passed in a header with the name api-key.

curl -X GET \
     https://api.sarafa.live/v2/wallets \
     -H 'api-key: your_secret_key_here'

All responses from the Sarafa API will be formatted in JSON.Example JSON Response (Success - HTTP 200 OK):

Error Handling The Sarafa API uses standard HTTP status codes to indicate the outcome of your requests.200 OK: This status code indicates that your request was successful and you are properly authenticated with a valid API key. The response body will contain the requested data in JSON format (as shown in the example above).401 Unauthorized: This status code indicates that your API key is invalid, missing, or has expired. Ensure you are including a valid API key in the api-key header of your request.When integrating with the Sarafa API, it’s crucial to handle these HTTP status codes appropriately to ensure your application functions correctly and provides informative feedback. Always store your secret keys securely and only use public keys in client-side code.

Last updated