API Reference
Authentication
The switch API uses Bearer token authentication. Every request must include
your API token in the Authorization header.
#Header
1Authorization: Bearer YOUR_API_TOKEN
The token is resolved to your account, and that account's providers are the only ones used to route the request.
#Example
1curl -X POST https://your-domain.com/api/v1/payment/request \
2 -H "Authorization: Bearer YOUR_API_TOKEN" \
3 -H "Content-Type: application/json" \
4 -H "Accept: application/json" \
5 -d '{
6 "amount": 50.00,
7 "account_number": "0976000000",
8 "country": "ZM"
9 }'
#Authentication errors
| Status | message |
Cause |
|---|---|---|
401 |
Unauthorized |
No Authorization: Bearer token was sent. |
401 |
Invalid API token |
The token does not match any account. |
Both follow the standard error envelope:
1{
2 "status": "error",
3 "message": "Invalid API token",
4 "data": []
5}
Always send
Accept: application/jsonso validation and error responses are returned as JSON rather than a redirect.