Skip to content

Airtime ​

Send airtime to Kenyan mobile numbers using your Galatext airtime balance. These endpoints require a bearer JWT; an API key alone is not accepted.

MethodPathPurpose
GET/api/airtime/networksList available network IDs and names
GET/api/airtime/balanceGet your airtime balance
GET/api/airtime/transactionsGet recent airtime transactions
POST/api/airtime/purchaseTop up one or more recipients

Check networks and balance ​

js
const networks = await client.airtime.networks();
const { balance } = await client.airtime.balance();

The current network IDs are safaricom, airtel, telkom, and faiba. Use the network list returned by the API when building a selector. Each purchase specifies one network.

Send airtime ​

js
const result = await client.airtime.purchase({
  network: 'safaricom',
  recipients: [
    { recipient: '254712345678', amount: 100 },
    { recipient: '254798765432', amount: 50 },
  ],
});

For a single recipient, the endpoint also accepts:

json
{
  "network": "safaricom",
  "phone_number": "254712345678",
  "amount": 100
}

Amounts are in KES. A purchase sends actual airtime and consumes your airtime balance. Review the result for each recipient; do not treat HTTP 200 alone as confirmation of every top-up. After a timeout, check transactions before repeating a purchase because this endpoint does not accept an idempotency key.

Fund the airtime balance ​

Purchasing airtime credit and topping up a phone are separate operations:

js
// This account method uses the developer API key.
const payment = await client.account.buyCredits('airtime', null, 1000);
// Complete checkout at payment.authorizationUrl, then verify the payment.
await client.account.verifyPayment(payment.reference);

// This method uses the bearer token.
const transactions = await client.airtime.transactions();

Pass both credentials when one client needs to fund the balance and send airtime. Verify only after checkout has completed.

Powered by Galatext Software