Getting Started
Authorization
Exchange your API credentials for a short-lived bearer token used on every authenticated request.
Keep credentials private
Never place API keys, secrets or bearer tokens in browser-side code, public repositories or client applications.
Token request
Use HTTP Basic Auth to exchange your Consumer UUID and API key for a bearer token.
cURL
curl -X POST https://api.buyairtime.co.ke/v1/token \
-H "Authorization: Basic {{base64(consumer_uuid:api_key)}}"Response
JSON
{{"access_token":"...","issued_at":1234567890,"expires_in":3600}}| Field | Type | Description |
|---|---|---|
| access_token | string | Bearer token sent in the Authorization header. |
| issued_at | number | Token issue time. |
| expires_in | number | Token lifetime in seconds. |
Using the token
HTTP
Authorization: Bearer {{access_token}}All API requests should use HTTPS. Unauthenticated requests will be rejected.