Skip to content

List accounts ​

Lists the accounts your platform reaches, created and linked, newest first, a page at a time.

An account whose owner disconnected your platform is not listed. Reading it by id answers 409 with code 3061 where pockets are available (Kenya), or 404 elsewhere. There is no filter: to find one seller, keep their account id, or their external_reference, on your side.

In pocket mode, the accounts in this list do not carry pocket. To see a pocket's status, read the account with Retrieve an account.

Endpoint ​

GET /v1/payments/merchant/accounts
AuthSecret key, Authorization: Bearer mkp_…
Scopeaccounts:read
PlatformThe key's organisation must be an active platform, and the call must come from an address on its allow-list if it has one
Feature flagRegistered only where the platform API is on

Headers ​

HeaderRequiredValue
AuthorizationYesBearer mkp_test_… or Bearer mkp_live_…

Parameters ​

Query ​

Unknown query parameters are refused with 400 and code 1701.

NameTypeRequiredConstraints and meaning
limitstring of digitsNo1 to 100, default 20
cursorstringNo1 to 400 characters. The next_cursor of the previous page. It is opaque and tied to your platform; an edited one, or one from another platform, is 400 and code 3012

Example request ​

Walk every page:

sh
curl "https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts?limit=100" \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"

# Next page: pass next_cursor back as cursor, URL-encoded
curl -G "https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts" \
  --data-urlencode "limit=100" \
  --data-urlencode "cursor=$NEXT_CURSOR" \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"
js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

const accounts = [];
let cursor = null;
do {
  const query = new URLSearchParams({ limit: "100" });
  if (cursor) query.set("cursor", cursor);
  const res = await fetch(`${BASE}/accounts?${query}`, {
    headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
  });
  const body = await res.json();
  if (!body.ok) throw new Error(`${res.status} ${body.code}: ${body.description}`);
  accounts.push(...body.data.accounts);
  cursor = body.data.next_cursor;
} while (cursor);

console.log(accounts.length, "accounts");
python
import os
import requests

BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"

accounts = []
cursor = None
while True:
    params = {"limit": "100"}
    if cursor:
        params["cursor"] = cursor
    res = requests.get(
        f"{BASE}/accounts",
        params=params,
        headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
        timeout=30,
    )
    body = res.json()
    if not body["ok"]:
        raise RuntimeError(f"{res.status_code} {body['code']}: {body['description']}")
    accounts.extend(body["data"]["accounts"])
    cursor = body["data"]["next_cursor"]
    if not cursor:
        break

print(len(accounts), "accounts")
php
<?php
$base = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

$accounts = [];
$cursor = null;
do {
    $params = ["limit" => "100"];
    if ($cursor !== null) {
        $params["cursor"] = $cursor;
    }
    $ch = curl_init("$base/accounts?" . http_build_query($params));
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY")],
    ]);
    $body = json_decode(curl_exec($ch), true);
    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
    curl_close($ch);
    if (!$body["ok"]) {
        throw new RuntimeException("$status {$body['code']}: {$body['description']}");
    }
    array_push($accounts, ...$body["data"]["accounts"]);
    $cursor = $body["data"]["next_cursor"];
} while ($cursor !== null);

echo count($accounts), " accounts", PHP_EOL;

Response ​

200 OK.

json
{
  "ok": true,
  "description": "Accounts",
  "data": {
    "accounts": [
      {
        "id": "acct_ke_9c2f41b07e5d38a6c1f0b294",
        "username": "joyotieno4821",
        "status": "active",
        "origin": "created",
        "external_reference": "seller-5521",
        "requirements": { "currently_due": ["identity"], "pending": [] },
        "capabilities": { "payments": true, "payouts": true },
        "created_at": "2026-11-20T09:00:00.000Z"
      },
      {
        "id": "acct_ke_1d7b30c5a9e24f8b6c0e3a71",
        "username": "wanjiku_prints",
        "status": "active",
        "origin": "linked",
        "external_reference": null,
        "requirements": { "currently_due": [], "pending": [] },
        "capabilities": { "payments": true, "payouts": true },
        "created_at": "2026-11-18T14:22:10.000Z"
      }
    ],
    "next_cursor": null
  }
}

Response fields ​

FieldTypeMeaning
accountsarrayUp to limit account objects, newest first by when your platform got the account. Never with pocket, even in pocket mode
next_cursorstring or nullPass it as cursor for the next page. null on the last page

See Pagination for how the cursors on the different lists behave.

Errors ​

HTTPCodeNameWhenWhat to do
4001701INVALID_REQUEST_DATAlimit outside 1 to 100, or an unknown parameterFix the query
4003012PLATFORM_CURSOR_INVALIDThe cursor was edited or came from another platformStart again without a cursor
4003014IDENTITY_HEADER_REFUSEDThe request carries a session or identity headerRemove the header
4012781API_KEY_INVALIDMissing, malformed, unknown or revoked keyCheck the key
4032941API_KEY_SCOPE_REQUIREDThe key lacks accounts:readIssue a key with the scope
4033042API_KEY_IP_NOT_ALLOWEDThe account has allowed addresses and the call came from another addressCall from a listed address
4032942PLATFORM_NOT_ENABLEDThe organisation is not an active platformAsk MOOKHPay
4033013PLATFORM_IP_NOT_ALLOWEDThe call came from an address not on your allow-listCall from a listed address
4291804RATE_LIMIT_EXCEEDEDOver the rate limitWait Retry-After seconds
5032782AUTHN_UNAVAILABLEKeys cannot be checkedRetry with backoff
5033016PLATFORM_ACCOUNTS_UNAVAILABLEThe account service did not answerRetry with backoff

Rate limit ​

120 requests a minute per platform, shared with every other account route. Over it: 429, code 1804, Retry-After in seconds.

Staging documentation. A checkout made with a secret key on staging charges a real phone. See Environments.