Buy Airtime
DashboardGet API Keys →
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}}
FieldTypeDescription
access_tokenstringBearer token sent in the Authorization header.
issued_atnumberToken issue time.
expires_innumberToken lifetime in seconds.

Using the token

HTTP
Authorization: Bearer {{access_token}}

All API requests should use HTTPS. Unauthenticated requests will be rejected.