Appearance
Create an account
Creates a full MOOKHPay account, with a wallet, for one of your sellers, and puts it under your platform. The account has no PIN: the seller claims it later with their phone. MOOKHPay texts the seller that your platform opened an account for them.
It does not reach a person who already has MOOKHPay. A phone that already has an account is refused and nothing is created; link that account instead. Accounts created on staging are real accounts: there is no test mode for accounts.
Endpoint
POST /v1/payments/merchant/accounts| Auth | Secret key, Authorization: Bearer mkp_…, checked with no cache on every call |
| Scope | accounts:write |
| Platform | The 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 flag | Registered only where the platform API is on (PLATFORM_API_ENABLED) |
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer mkp_test_… or Bearer mkp_live_… |
Idempotency-Key | Yes | 1 to 128 characters. The same key and body answer the same account (200). The same key with a different body is 422 and code 3015. A key whose create was refused can be used again |
Content-Type | Yes | application/json |
Parameters
Body
Unknown fields are refused with 400 and code 1701, including platform_id, user_id, status, scopes and kyc_status.
| Name | Type | Required | Constraints and meaning |
|---|---|---|---|
phone | string | Yes | The seller's own mobile number in E.164: +254 and 9 digits, or +256 and 9 digits, in the host's country. A number from the other country is 400, 1701, phone must be a number in this cluster's country |
first_name | string | Yes | 1 to 100 characters, at least one non-space. Trimmed |
last_name | string | Yes | 1 to 100 characters, at least one non-space. Trimmed |
email | string | No | At most 254 characters, name@domain.tld shape |
username | string | No | 3 to 50 characters of a-z, 0-9 and _. Without one, MOOKHPay makes one from the name and digits |
external_reference | string | Yes | Your own id for this seller, 1 to 100 printable ASCII characters with no spaces. Unique among your platform's accounts |
terms | object | Yes | { accepted_at, version }: your record that the seller accepted MOOKHPay's terms on your platform |
terms.accepted_at | string | Yes | ISO 8601 with a time zone, for example 2026-11-20T08:55:00Z. Not more than 5 minutes in the future |
terms.version | string | Yes | 1 to 40 characters of A-Z, a-z, 0-9, ., _ and - |
MOOKHPay keeps the terms record with the account, with the IP address your request came from.
external_reference is a second guard against duplicates. A create with an external_reference you already used and the same phone, first name and last name answers that account with 200. With a different phone or name it is 409 and code 2945.
Example request
sh
curl -X POST https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts \
-H "Authorization: Bearer $MOOKHPAY_SECRET_KEY" \
-H "Idempotency-Key: seller-5521" \
-H "Content-Type: application/json" \
-d '{
"phone": "+254712345678",
"first_name": "Joy",
"last_name": "Otieno",
"email": "joy@example.com",
"external_reference": "seller-5521",
"terms": { "accepted_at": "2026-11-20T08:55:00Z", "version": "2026-10" }
}'js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
const res = await fetch(`${BASE}/accounts`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}`,
"Idempotency-Key": "seller-5521",
"Content-Type": "application/json",
},
body: JSON.stringify({
phone: "+254712345678",
first_name: "Joy",
last_name: "Otieno",
email: "joy@example.com",
external_reference: "seller-5521",
terms: { accepted_at: "2026-11-20T08:55:00Z", version: "2026-10" },
}),
});
const body = await res.json();
if (res.status === 409 && body.code === 2944) {
console.log("This phone already has MOOKHPay. Ask the seller to link it.");
} else if (!body.ok) {
throw new Error(`${res.status} ${body.code}: ${body.description}`);
} else {
console.log("Account", body.data.id);
}python
import os
import requests
BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"
res = requests.post(
f"{BASE}/accounts",
headers={
"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}",
"Idempotency-Key": "seller-5521",
},
json={
"phone": "+254712345678",
"first_name": "Joy",
"last_name": "Otieno",
"email": "joy@example.com",
"external_reference": "seller-5521",
"terms": {"accepted_at": "2026-11-20T08:55:00Z", "version": "2026-10"},
},
timeout=30,
)
body = res.json()
if res.status_code == 409 and body["code"] == 2944:
print("This phone already has MOOKHPay. Ask the seller to link it.")
elif not body["ok"]:
raise RuntimeError(f"{res.status_code} {body['code']}: {body['description']}")
else:
print("Account", body["data"]["id"])php
<?php
$base = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
$ch = curl_init("$base/accounts");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY"),
"Idempotency-Key: seller-5521",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"phone" => "+254712345678",
"first_name" => "Joy",
"last_name" => "Otieno",
"email" => "joy@example.com",
"external_reference" => "seller-5521",
"terms" => ["accepted_at" => "2026-11-20T08:55:00Z", "version" => "2026-10"],
]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status === 409 && $body["code"] === 2944) {
echo "This phone already has MOOKHPay. Ask the seller to link it.", PHP_EOL;
} elseif (!$body["ok"]) {
throw new RuntimeException("$status {$body['code']}: {$body['description']}");
} else {
echo "Account ", $body["data"]["id"], PHP_EOL;
}Response
201 Created for a new account, with description Account created. 200 OK for a repeat of the same key and body, or the same external_reference, phone and name, with description Account already created. account.created is sent to your endpoints only on the 201.
json
{
"ok": true,
"description": "Account created",
"data": {
"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"
}
}Response fields
data is the account object.
| Field | Type | Meaning |
|---|---|---|
id | string | acct_<country>_<24 hex>. Your platform's id for the account. Store it against your seller |
username | string | The seller's MOOKHPay ID, as sent or as made up |
requirements.currently_due | array | ["identity"] until the seller passes MOOKHPay's identity check |
The wallet is set up just after the account is made. A payment for the seller in the first moments can answer 409 and code 2709; retry after a few seconds.
Errors
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | Body not valid JSON, a field breaks its constraint, an unknown field, a missing Idempotency-Key, a phone outside the host's country, or terms.accepted_at in the future | Fix the request |
400 | 3014 | IDENTITY_HEADER_REFUSED | The request carries a session or identity header | Remove the header |
401 | 2781 | API_KEY_INVALID | Missing, malformed, unknown or revoked key | Check the key |
403 | 2941 | API_KEY_SCOPE_REQUIRED | The key lacks accounts:write | Issue a key with the scope |
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 | The organisation is not an active platform | Ask MOOKHPay to switch your platform on |
403 | 3013 | PLATFORM_IP_NOT_ALLOWED | The call came from an address not on your allow-list | Call from a listed address |
409 | 2944 | PLATFORM_ACCOUNT_EXISTS | The phone already has a MOOKHPay account. Nothing was created and you get no access | Link the account instead |
409 | 2945 | PLATFORM_REFERENCE_TAKEN | external_reference already names another of your accounts with a different phone or name | Use the right reference, or the account it names |
409 | 3011 | PLATFORM_USERNAME_TAKEN | The username you sent is taken | Send another, or none |
422 | 3015 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was used before with a different body | Use a new key |
429 | 2950 | PLATFORM_DAILY_ACCOUNTS_REACHED | Your platform made as many accounts today as MOOKHPay allows, counted on East Africa Time | Wait until tomorrow, or ask MOOKHPay for a higher cap |
429 | 1804 | RATE_LIMIT_EXCEEDED | Over the rate limit | Wait Retry-After seconds |
503 | 2782 | AUTHN_UNAVAILABLE | Keys cannot be checked | Retry with the same key and body |
503 | 3016 | PLATFORM_ACCOUNTS_UNAVAILABLE | The account service did not answer, or answered with something unexpected | Retry with the same key and body |
Rate limit
120 requests a minute per platform, one bucket shared with every other account route: retrieve, list, balance, transactions, the feed, account links, business account requests and payout reads. Over it: 429, code 1804, Retry-After and data.retryAfter in seconds. The daily account cap above is separate.