Install Jentic One Beta
Jentic One is a self-hosted execution layer for AI agents. It lets your agent call the Safaricom M-Pesa Daraja API, or any other public or private API you need. You set the rules, the agent never sees your credentials, and every call is logged.
Two steps, two machines. Install the instance in a safe environment, then register your agent from wherever it runs.
Step 1: Jentic One Host machine
# On the machine that will host your Jentic One instance:
curl -fsSL "https://jentic.com/install.sh?src=apis&api=%2Fapis%2Fsafaricom.co.ke%2Fsafaricom" | shStep 2: Agent machine
# On the machine where your agent runs (keep this separate from the instance):
curl -fsSL "https://jentic.com/install.sh?src=apis&api=%2Fapis%2Fsafaricom.co.ke%2Fsafaricom" | sh
jentic register # connects your agent to your Jentic One instanceJentic One is in public beta. The setup above keeps your agent separate from the instance, which is what you want before using real credentials: an agent running as the same OS user as Jentic One can read its stored keys directly. Just evaluating? A single local install is fine to start. See the secure deployment guide for the tiers.
What an agent can do with Safaricom M-Pesa Daraja API.
Prompt a customer to pay with M-Pesa Express (STK Push) using CustomerPayBillOnline or CustomerBuyGoodsOnline
Check whether an STK Push payment completed using its CheckoutRequestID
Register C2B ConfirmationURL and ValidationURL endpoints for a paybill or till ShortCode
Send B2C payouts to customer phones with SalaryPayment, BusinessPayment, or PromotionPayment
GET STARTED
Pay another business shortcode with a B2B payment request
Query the status of a transaction by TransactionID and check the organisation's account balance
Reverse a completed M-Pesa transaction and receive the result at a ResultURL
Patterns agents use Safaricom M-Pesa Daraja API for, with concrete tasks.
★ Checkout agent that collects M-Pesa payments through Jentic
A Kenyan online shop wants its assistant to take payment inside the chat. Through Jentic the agent searches for 'request an M-Pesa payment', receives the Daraja operation with its input schema, and calls POST /mpesa/stkpush/v1/processrequest with BusinessShortCode, Password, Timestamp, TransactionType, Amount, PartyA, PartyB, PhoneNumber, CallBackURL, AccountReference, and TransactionDesc. It then calls POST /mpesa/stkpushquery/v1/query with the CheckoutRequestID to confirm the customer approved.
Call POST /mpesa/stkpush/v1/processrequest with BusinessShortCode '174379', TransactionType 'CustomerPayBillOnline', Amount '500', PartyA and PhoneNumber '254712345678', PartyB '174379', AccountReference 'INV001', TransactionDesc 'Payment', and a CallBackURL, then query POST /mpesa/stkpushquery/v1/query with the returned CheckoutRequestID
Paybill and till payment confirmations
Businesses that receive paybill or till payments want each one confirmed in their system. POST /mpesa/c2b/v1/registerurl registers a ConfirmationURL and ValidationURL for a ShortCode with a ResponseType, after which M-Pesa calls those URLs as customers pay. In the sandbox, POST /mpesa/c2b/v1/simulate sends a test payment with an Msisdn and BillRefNumber to check the flow.
Call POST /mpesa/c2b/v1/registerurl with ShortCode '600000', ResponseType 'Completed', and the ConfirmationURL and ValidationURL, then call POST /mpesa/c2b/v1/simulate in the sandbox with Msisdn '254708374149' and BillRefNumber 'TEST01'
Payouts to customers and suppliers
Platforms paying out winnings, refunds, or wages use B2C. POST /mpesa/b2c/v1/paymentrequest takes InitiatorName, SecurityCredential, a CommandID such as SalaryPayment or BusinessPayment, Amount, PartyA, PartyB, Remarks, QueueTimeOutURL, and ResultURL. Supplier payments go through POST /mpesa/b2b/v1/paymentrequest, which also needs sender and receiver identifier types and an AccountReference.
Call POST /mpesa/b2c/v1/paymentrequest with CommandID 'BusinessPayment', Amount '1000', PartyA '600000', PartyB '254712345678', Remarks 'Refund', and the InitiatorName, SecurityCredential, QueueTimeOutURL, and ResultURL
Reconciliation and reversals
Finance teams need to confirm what happened to a payment and undo mistakes. POST /mpesa/transactionstatus/v1/query looks up a TransactionID, POST /mpesa/accountbalance/v1/query reports the organisation's balance, and POST /mpesa/reversal/v1/request reverses a transaction to a ReceiverParty. All three return results asynchronously to the ResultURL provided.
Call POST /mpesa/transactionstatus/v1/query for TransactionID 'OEI2AK4Q16' with the initiator details and ResultURL, and if it was sent in error call POST /mpesa/reversal/v1/request for the same TransactionID and Amount
10 endpoints — jentic publishes the only available openapi specification for safaricom m-pesa daraja api, keeping it validated and agent-ready.
METHOD
PATH
DESCRIPTION
/oauth/v1/generate
Generate an OAuth access token
/mpesa/stkpush/v1/processrequest
Initiate an STK Push payment
/mpesa/stkpushquery/v1/query
Query STK Push status
/mpesa/c2b/v1/registerurl
Register C2B URLs
/mpesa/b2c/v1/paymentrequest
Initiate a B2C payment
/mpesa/transactionstatus/v1/query
Query transaction status
/mpesa/reversal/v1/request
Reverse a transaction
/oauth/v1/generate
Generate an OAuth access token
/mpesa/stkpush/v1/processrequest
Initiate an STK Push payment
/mpesa/stkpushquery/v1/query
Query STK Push status
/mpesa/c2b/v1/registerurl
Register C2B URLs
/mpesa/b2c/v1/paymentrequest
Initiate a B2C payment
/mpesa/transactionstatus/v1/query
Query transaction status
/mpesa/reversal/v1/request
Reverse a transaction
What agents get from Jentic-routed access to this vendor.
Setup
Wiring Daraja by hand means exchanging your consumer key and secret over basic auth for a short-lived bearer token, building the base64 Password from shortcode, passkey, and timestamp, and hosting callback URLs for asynchronous results. Through Jentic you install once, import M-Pesa Daraja from the API Directory, store the credential once, and your agent calls it.
Permission scoping
Daraja carries the shortcode, phone number, and amount inside the request body, so rules bound which operations your agent may call, not which shortcode or phone it pays. You choose the operations it may call, so payouts and reversals like B2C payments or transaction reversal are not included unless you add them.
Credential isolation
Your Daraja consumer key and secret are stored once, encrypted, by your own Jentic One instance and injected at execution time. They never enter the agent's prompt, logs, or context.
Intent-based discovery
Agents search Jentic by intent such as 'request an M-Pesa payment' or 'check M-Pesa transaction status', and Jentic returns the matching Daraja operation with its input schema so the agent calls the right endpoint without reading the portal docs.
Alternatives and complements available in the Jentic catalogue.
Specific to using Safaricom M-Pesa Daraja API through Jentic.
Why is there no official OpenAPI spec for Safaricom M-Pesa Daraja API?
Safaricom does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Safaricom M-Pesa Daraja API via structured tooling. It is validated against the live API and kept up to date. To run it on your own infrastructure, install Jentic One from its GitHub repo.
What authentication does the M-Pesa Daraja API use?
The spec declares two schemes. GET /oauth/v1/generate uses HTTP basic auth (basicAuth) with your Consumer Key as username and Consumer Secret as password and returns an access token. The payment and query operations use a bearer token (bearerAuth) sent as `Authorization: Bearer` with that access token. B2C, B2B, status, balance, and reversal requests also carry an encrypted SecurityCredential in the body. Through Jentic these credentials are held by your own Jentic One instance.
Can I test M-Pesa payments without moving real money?
Yes. The spec lists a separate sandbox server alongside the production server, both on safaricom.co.ke. In the sandbox, POST /mpesa/c2b/v1/simulate simulates a C2B payment with ShortCode, CommandID, Amount, Msisdn, and BillRefNumber.
What are the rate limits for the M-Pesa Daraja API?
The OpenAPI spec does not specify rate limits. Check the Safaricom developer portal at https://developer.safaricom.co.ke/ for current limits on your app.
How do I request an M-Pesa payment through Jentic?
Search Jentic for 'request an M-Pesa payment', load POST /mpesa/stkpush/v1/processrequest, and execute it with BusinessShortCode, the base64 Password, Timestamp, TransactionType, Amount, PartyA, PartyB, PhoneNumber, CallBackURL, AccountReference, and TransactionDesc. Then call POST /mpesa/stkpushquery/v1/query with the CheckoutRequestID to check the result.
Is there an M-Pesa MCP server?
You don't need an MCP server to give your agent M-Pesa Daraja. Jentic connects it directly from the API Directory: import it, store your credential once, and your agent finds the STK Push, payout, and query operations it needs on demand, without loading extra tool definitions into its context.
Can I limit what my agent is allowed to do with the M-Pesa Daraja API?
Yes. For a checkout assistant, write a rule that allows only POST /mpesa/stkpush/v1/processrequest and POST /mpesa/stkpushquery/v1/query. The agent can ask customers to pay and check the result but cannot send B2C or B2B payouts or reverse transactions, and each call it makes is logged.
Know of an official OpenAPI document? Contribute it →
For Agents
Prompt a customer's phone for an M-Pesa payment with STK Push, check its status, send B2C and B2B payments, query balances and transaction status, and reverse transactions.
Use for: Send an M-Pesa payment prompt to 254712345678 for 500 shillings, Check whether the customer approved the STK Push payment, I need to pay salaries to employees over M-Pesa, Register my paybill confirmation and validation URLs
Not supported: Does not process card payments, issue invoices, or handle mobile money outside Safaricom M-Pesa. Use for M-Pesa collections, payouts, and transaction queries only.
Jentic publishes the only available OpenAPI specification for Safaricom M-Pesa Daraja API, keeping it validated and agent-ready. The Safaricom M-Pesa Daraja API connects a business to M-Pesa, Kenya's mobile money platform, so it can collect payments from customers and send money out. M-Pesa Express (STK Push) prompts a customer's phone to approve a payment, C2B registers the URLs that validate and confirm paybill and till payments, and B2C and B2B send funds to customers and other businesses. Supporting operations query transaction status and account balance and reverse a transaction, with results delivered asynchronously to callback URLs.
This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.
Base layer of spec validity and structural soundness.
Aggregated quality score from linter diagnostics, weighted by severity.
Percentage of `$ref` references that resolve successfully.
Checks whether the API description parses successfully and conforms to its declared specification (e.g., OpenAPI).
Structural correctness score based on schema issues using logarithmic dampening.
Clarity, completeness, and ingestion readiness for developers and tooling.
How richly the API is illustrated with examples.
Percentage of examples that conform to their schemas.
Percentage of operations with complete response definitions (success, client error, server error).
Health of API ingestion, bundling, and resolution within Jentic pipelines.
Semantic breadth, depth, and agent comprehension for AI systems.
Coverage of descriptions across API elements.
Coverage of RFC 9457 Problem Details for error responses.
Coverage, uniqueness, and casing consistency of operationIds for AI inference.
Coverage of summaries across operations/tags/info.
Functional utility, complexity comfort, and AI orchestration readiness.
Agent comfort level based on API operational and structural complexity.
Trust, risk posture, and security compliance.
Average quality of security schemes based on authentication method strength (weakest link for OAuth2).
Findability, semantic richness, and reasoning readiness.
Clarity and depth of descriptions across API elements.
Score it yourself
Every API in the directory is allowlisted, so you can re-score it with no key required.
npx @jentic/api-scorecard-cli score <openapi-url>