## Quickstart Guide

Get up and running with the Afriex Business API in three simple steps.

## Prerequisites

Before you begin, you’ll need:

- An Afriex Business account ( [Sign up here](https://business.afriex.com/))
- Your API key from the dashboard
- A tool for making HTTP requests (cURL, Postman, or your preferred HTTP client)

## Step 1: Get your API key

Obtain your API credentials

1. Log in to the [Afriex Dashboard](https://business.afriex.com/)
2. Navigate to **Settings** > **API Keys**
3. Generate a new API key for your integration
4. Copy and securely store your API key

The dashboard has a **Test / Live toggle** at the top. Make sure you are in **Test** mode while developing so you use sandbox credentials. Switch to **Live** mode only when you are ready to go to production. Each mode has different API keys.

Keep your API key secure and never expose it in client-side code or public repositories.

## Step 2: Make your first API call

Test the API with cURL

Create your first customer:

```
curl -X POST https://sandbox.api.afriex.com/api/v1/customer \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"fullName": "John Doe",
"email": "john.doe@example.com",
"phone": "+2348192837465",
"countryCode": "NG"
}'
```

Use the staging environment for testing. Switch to `https://api.afriex.com` for production.

Verify the response

A successful response will return the created customer:

```
{
  "data": {
    "customerId": "69516dd0464b2213bd74cfad",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "phone": "+2348192837465",
    "countryCode": "NG"
  }
}
```

## Step 3: Process your first transaction

Create a transaction

Once you have a customer and payment method set up, you can create a transaction:

```
curl -X POST https://sandbox.api.afriex.com/api/v1/transaction \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"customerId": "CUSTOMER_ID",
"type": "WITHDRAW",
"sourceAmount": "10",
"destinationAmount": 5000,
"sourceCurrency": "USD",
"destinationCurrency": "NGN",
"destinationId": "PAYMENT_METHOD_ID",
"meta": {
  "reference": "order-12345",
  "idempotencyKey": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}'
```

In **sandbox**, this transaction settles automatically within ~1-2 minutes so you can test the full flow. To test your failure handling, set `meta.reference` to a value containing `fail` and the transaction settles as `FAILED` (otherwise `SUCCESS`). See [Testing transaction outcomes in sandbox](https://docs.afriex.com/development#testing-transaction-outcomes-in-sandbox).

## Next Steps

Now that you’ve made your first API calls, explore these guides:

**Planning to use webhooks?** Allowlist these Afriex IP addresses on your server so webhook deliveries are not blocked:

- Sandbox: `34.234.189.210`
- Production: `34.197.33.100`

See [Webhook setup](https://docs.afriex.com/api-reference/endpoint/webhooks/introduction) for full details.

[**API Reference** \
\
Explore all available endpoints and their parameters.](https://docs.afriex.com/api-reference/introduction)

[**Customers** \
\
Learn how to manage customer profiles and KYC.](https://docs.afriex.com/api-reference/endpoint/customers/create)

[**Payment Methods** \
\
Set up bank accounts and mobile money wallets.](https://docs.afriex.com/api-reference/endpoint/payment-methods/create)

[**Webhooks** \
\
Receive real-time notifications for events.](https://docs.afriex.com/api-reference/endpoint/webhooks/introduction)

## Support

Need help? Contact us at [support@afriex.com](mailto:support@afriex.com).
