M-Pesa (Safaricom Daraja) · Authentication Profile

Mpesa Authentication

Authentication

M-Pesa (Safaricom Daraja) secures its APIs with http across 3 declared security schemes, as derived from its OpenAPI definitions.

Mobile MoneyPaymentsFintechKenyaAfricaM-PESA
Methods: http Schemes: 3 OAuth flows: API key in:

Security Schemes

basic_auth http
scheme: basic
bearer_token http
scheme: bearer
security_credential apiKey
· in: body ()

Source

Authentication Profile

Raw ↑
generated: '2026-07-17'
method: derived
source: openapi/mpesa-openapi.yml
summary:
  types:
  - http
notes: >-
  Two-step auth. (1) Mint an OAuth access token: GET /oauth/v1/generate?grant_type=client_credentials
  authenticated with HTTP Basic (consumer key as username, consumer secret as password). The
  response access_token (valid ~3599s) is then presented as a Bearer token on every other Daraja
  call. (2) Privileged funds-movement operations (B2C, B2B, Reversal, Account Balance,
  Transaction Status, Tax Remittance) additionally require a SecurityCredential field: the API
  initiator's password encrypted with Safaricom's M-Pesa public X.509 certificate (RSA), plus
  STK Push requires a Base64 Password = Base64(Shortcode + Passkey + Timestamp).
schemes:
- name: basic_auth
  type: http
  scheme: basic
  description: Consumer key/secret Basic auth used only against /oauth/v1/generate to obtain a token.
  sources:
  - openapi/mpesa-openapi.yml
- name: bearer_token
  type: http
  scheme: bearer
  bearerFormat: OAuth access token
  description: Short-lived OAuth access token presented on all M-Pesa product endpoints.
  sources:
  - openapi/mpesa-openapi.yml
- name: security_credential
  type: apiKey
  in: body
  description: >-
    Region-specific application-layer credential. Initiator password RSA-encrypted with the
    M-Pesa public certificate, sent in the SecurityCredential request field on privileged
    B2C/B2B/Reversal/Balance/Status operations.
  sources:
  - openapi/mpesa-openapi.yml

Work with this as data

Every security artifact here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for security posture

4 MCP tools reach this
  • find_securityBrowse and filter every security artifact in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This security artifact
curl "https://apis.io/api/v1/security/mpesa-authentication"
All security posture
curl "https://apis.io/api/v1/security?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.