SW SwiftWallet
Base URL https://swiftwallet.co.ke/v3

Authentication

Authorization: Bearer sk_test_...

Create keys on the API Keys page of your dashboard. sk_test_ keys simulate M-Pesa and never move wallet balances. sk_live_ keys move real money. Never put a live key in a browser or mobile app.

The key is shown once. SwiftWallet stores only a hash, so a lost key cannot be recovered; revoke it and create a new one.

Checks, in order

  1. API_KEY_NOT_IN_HEADER (401): a key was sent in the query string or body.
  2. INVALID_API_KEY (401): missing, unknown, inactive or revoked key.
  3. API_KEY_EXPIRED (401).
  4. USER_INACTIVE (403): the account is suspended.
  5. ACCOUNT_NOT_VERIFIED (403): verify your email first.
  6. IP_NOT_ALLOWED (403): the key's IP allowlist does not include the caller.
  7. RATE_LIMIT_EXCEEDED (429). The request counts against your limit from this point on.
  8. SERVICE_NOT_PERMITTED (403): the key lacks the route's scope. details.required_scope names it.

Scopes

ScopeEndpoints
stk_pushPOST /v3/stk-initiate POST /v3/lipa-na-mpesa
b2c_paymentsPOST /v3/pay-request POST /v3/reversals
b2pochi_paymentsPOST /v3/pochi POST /v3/reversals
b2b_paymentsPOST /v3/b2b-request-new POST /v3/reversals
account_apiGET /v3/wallet POST /v3/wallet GET /v3/wallet/status GET /v3/transactions GET /v3/channels POST /v3/channels GET /v3/account

Reversals accept any payout scope at the door, then require the scope of the original payment (b2c_payments also covers wallet withdrawals). Fees and service-status endpoints need a valid key but no scope.