Skip to content
Lira APILira API

Mobile Money (M-Pesa)

Verify Kenyan M-Pesa paybill numbers, till numbers, and agents before sending money to them.

VerificationEndpointReturns
Lipa Na M-PesaPOST /verify/lipa-na-mpesaRegistered business name
M-Pesa AgentPOST /verify/mpesa-agentRegistered agent name

Prerequisites

You'll need an API key. See Quickstart or Authentication if you don't have one yet.

Note

Verification endpoints use an API key in the X-API-Key header, not a Bearer token. Verification POST requests also require an Idempotency-Key header.


Verify a paybill or till number

Terminal
curl -X POST https://api.lira.com/api/v1/verify/lipa-na-mpesa \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: YOUR_IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "identifier": "247247",
    "identifierType": "paybill"
  }'
FieldTypeRequiredDescription
identifierstringYesPaybill number or till number
identifierTypestringYes"paybill" or "till"
modestringNosync (default) or async
webhookUrlstringNoRequired when mode is async

Response

JSON
{
  "id": "a1b2c3d4-...-...-...-...",
  "status": "success",
  "verificationType": "LIPA_NA_MPESA",
  "identifier": "247247",
  "verifiedAt": "2026-03-09T10:05:00.000Z",
  "verified": true,
  "businessName": "Safaricom PLC"
}

businessName is the registered business name, or null if unavailable. verified is true when the number is registered and active.


Verify an M-Pesa agent

Terminal
curl -X POST https://api.lira.com/api/v1/verify/mpesa-agent \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: YOUR_IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentCode": "123456"
  }'
FieldTypeRequiredDescription
agentCodestringYesM-Pesa agent code
modestringNosync (default) or async
webhookUrlstringNoRequired when mode is async

Response

JSON
{
  "id": "a1b2c3d4-...-...-...-...",
  "status": "success",
  "verificationType": "MPESA_AGENT",
  "identifier": "123456",
  "verifiedAt": "2026-03-09T10:05:00.000Z",
  "verified": true,
  "agentName": "John Kamau"
}

agentName is the registered agent name, or null if unavailable. verified is true when the agent code is registered and active.


Error handling

Both endpoints share the same error codes:

error.codeCauseAction
ACCOUNT_NOT_FOUNDPaybill, till, or agent code not foundAsk the user to confirm the number
PROVIDER_ERRORUpstream M-Pesa system errorRetry with exponential backoff
PROVIDER_TIMEOUTUpstream system timed outRetry; transient error

Next steps