# Developer Guide

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.&#x20;

## Authentication

To interact with the Sarafa API, you will utilize API keys for authentication.&#x20;

* **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`.

```bash
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):

```
{
  "status": "success",
  "data": {
        "account_number": "9020260000001",
        "wallets": [
            {
                "balance": 1009.19,
                "currency": "USD",
                "meta": null
            },
            ...
        ]
    }
}
```

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sarafa.live/api-reference/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
