Appearance
List payouts
Lists the payouts your platform made from one account, newest first. It does not include payouts the seller made themselves, another platform's payouts, or payouts refused when you created them.
Endpoint
GET /v1/payments/merchant/accounts/{id}/payouts| Auth | Secret key |
| Scope | payouts:write or accounts:read (either one) |
| Platform | Your organisation must be switched on as a platform, and the call must come from an allowed address if MOOKHPay set a list |
| Switched on | Per deployment (PLATFORM_PAYOUTS_ENABLED). Where it is off, the route answers 404 |
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer mkp_… |
Parameters
Path
| Name | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | One of your account ids |
Query. Unknown parameters are refused.
| Name | Type | Required | Constraints |
|---|---|---|---|
limit | integer | No | 1 to 100. Default 20 |
starting_after | string | No | The last payout_id of the previous page. Must be a payout of this account made by your platform |
To page through every payout, pass the last payout_id of each page as starting_after until has_more is false. Payouts made while you page appear at the top and are not in the pages that follow. See Pagination.
Example request
sh
curl "https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts/acct_ke_9c2f41b07e5d38a6c1f0b294/payouts?limit=50" \
-H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
export async function allPayouts(accountId) {
const payouts = [];
let after;
for (;;) {
const query = new URLSearchParams({ limit: "100" });
if (after) query.set("starting_after", after);
const res = await fetch(`${BASE}/accounts/${accountId}/payouts?${query}`, {
headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
});
const answer = await res.json();
if (!answer.ok) throw new Error(`${res.status} ${answer.code}: ${answer.description}`);
payouts.push(...answer.data.payouts);
if (!answer.data.has_more) return payouts;
after = answer.data.payouts.at(-1).payout_id;
}
}
console.log((await allPayouts("acct_ke_9c2f41b07e5d38a6c1f0b294")).length);python
import os
import requests
BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"
def all_payouts(account_id):
payouts, after = [], None
while True:
params = {"limit": 100}
if after:
params["starting_after"] = after
res = requests.get(
f"{BASE}/accounts/{account_id}/payouts",
params=params,
headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
timeout=30,
)
answer = res.json()
if not answer["ok"]:
raise RuntimeError(f"{res.status_code} {answer['code']}: {answer['description']}")
payouts.extend(answer["data"]["payouts"])
if not answer["data"]["has_more"]:
return payouts
after = answer["data"]["payouts"][-1]["payout_id"]
print(len(all_payouts("acct_ke_9c2f41b07e5d38a6c1f0b294")))php
<?php
function all_payouts(string $accountId): array
{
$base = 'https://payments-ke-staging.mookhpay.co/v1/payments/merchant';
$payouts = [];
$after = null;
while (true) {
$query = ['limit' => 100];
if ($after !== null) {
$query['starting_after'] = $after;
}
$ch = curl_init("{$base}/accounts/{$accountId}/payouts?" . http_build_query($query));
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('MOOKHPAY_SECRET_KEY')],
]);
$answer = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (!$answer['ok']) {
throw new RuntimeException("{$status} {$answer['code']}: {$answer['description']}");
}
array_push($payouts, ...$answer['data']['payouts']);
if (!$answer['data']['has_more']) {
return $payouts;
}
$after = end($answer['data']['payouts'])['payout_id'];
}
}
echo count(all_payouts('acct_ke_9c2f41b07e5d38a6c1f0b294')), PHP_EOL;Response
200 OK with description Payouts.
json
{
"ok": true,
"description": "Payouts",
"data": {
"payouts": [
{
"payout_id": "po_ke_6b1f0e9a2c7d48e3a5b2c810",
"account": "acct_ke_9c2f41b07e5d38a6c1f0b294",
"status": "paid",
"amount": 500000,
"fee": 0,
"total": 500000,
"currency": "KES",
"remarks": "Week 47 sales",
"destination": { "rail": "mpesa", "phone_masked": "+254 7•• ••• 678" },
"approval_id": null,
"failure": null,
"created_at": "2026-11-20T10:00:04.000Z"
}
],
"has_more": false
}
}Response fields
| Field | Type | Meaning |
|---|---|---|
payouts | array | Up to limit payout objects, newest first |
has_more | boolean | true when there is at least one more payout after the last one here |
Errors
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | An unknown query parameter, or limit outside 1 to 100 (limit is 1 to 100) | Fix the query |
400 | 3012 | PLATFORM_CURSOR_INVALID | starting_after is not a payout of this account made by your platform | Pass a payout_id from the previous page of this account |
400 | 3014 | IDENTITY_HEADER_REFUSED | The request carries a session or identity header | Remove it |
401 | 2781 | API_KEY_INVALID | Missing, malformed, unknown or revoked key | Check the key |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key has neither payouts:write nor accounts:read | Issue a key with one of them |
403 | 3042 | API_KEY_IP_NOT_ALLOWED | The account has allowed addresses and the call came from another address | Call from a listed address |
403 | 2942 | PLATFORM_NOT_ENABLED | Your organisation is not a platform, or its platform is suspended | Talk to MOOKHPay |
403 | 3013 | PLATFORM_IP_NOT_ALLOWED | The call came from an address not on your platform's allow-list | Call from a listed address |
404 | 2943 | PLATFORM_ACCOUNT_NOT_FOUND | The account is unknown, another platform's, revoked or malformed | Check the id |
409 | 3061 | PLATFORM_ACCOUNT_DISCONNECTED | Where pockets are on: the person disconnected your platform, or their account closed | Stop calling for the account until they link again |
429 | 1804 | RATE_LIMIT_EXCEEDED | Over the rate limit, or your platform reached its limit of unknown account ids | Wait Retry-After seconds |
503 | 2782 | AUTHN_UNAVAILABLE | The key could not be checked | Retry |
503 | 3016 | PLATFORM_ACCOUNTS_UNAVAILABLE | The account could not be read | Retry |
Rate limit
120 requests a minute, shared by every account, balance, transaction, payout read, account link and business account request route your platform calls. Over it: 429, code 1804, with Retry-After and data.retryAfter in seconds.