Appearance
Attach a document to a business account request
Uploads one document to a business account request that is a draft or was declined. One call takes one file. Documents cannot be replaced or removed through the API: send the right file the first time.
Endpoint
POST /v1/payments/merchant/accounts/{id}/org-requests/{request_id}/documents| Auth | Secret key |
| Scope | accounts:write |
| 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 | With the platform API on that deployment |
The key is checked with authn on every call, with no 60-second cache.
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer mkp_… |
Content-Type | Yes | multipart/form-data with its boundary. Your HTTP library sets it when you send form data |
No Idempotency-Key. A retry after a lost answer attaches the file again; read the request first to see whether documents already holds it.
Parameters
Path
| Name | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | The seller's account id |
request_id | string | Yes | orq_ and 24 hex characters, a request of this account |
Body: multipart/form-data with exactly two fields, each once. Any other field, a field sent twice, a missing field, or another content type is refused.
| Field | Type | Required | Constraints |
|---|---|---|---|
type | text | Yes | registration_certificate, incorporation_certificate, tax_pin or cr12, and one the request's kind needs: registration_certificate and tax_pin for sole_prop; incorporation_certificate, tax_pin and cr12 for company |
file | file | Yes | One PDF, JPEG or PNG, not empty, at most 10 MB. The part's own content type must be application/pdf, image/jpeg or image/png, and must match what the bytes are: a PNG labelled application/pdf is refused |
A request holds at most 10 documents.
Example request
sh
curl -X POST https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts/acct_ke_9c2f41b07e5d38a6c1f0b294/org-requests/orq_3c8e1a9f4b7d20e6c5a1b902/documents \
-H "Authorization: Bearer $MOOKHPAY_SECRET_KEY" \
-F "type=registration_certificate" \
-F "[email protected];type=application/pdf"js
import { readFile } from "node:fs/promises";
const account = "acct_ke_9c2f41b07e5d38a6c1f0b294";
const requestId = "orq_3c8e1a9f4b7d20e6c5a1b902";
const form = new FormData();
form.append("type", "registration_certificate");
form.append(
"file",
new Blob([await readFile("registration-certificate.pdf")], { type: "application/pdf" }),
"registration-certificate.pdf",
);
const res = await fetch(
`https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts/${account}/org-requests/${requestId}/documents`,
{
method: "POST",
headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
body: form,
},
);
const answer = await res.json();
if (!answer.ok) throw new Error(`${res.status} ${answer.code}: ${answer.description}`);
console.log(answer.data.document.id);python
import os
import requests
account = "acct_ke_9c2f41b07e5d38a6c1f0b294"
request_id = "orq_3c8e1a9f4b7d20e6c5a1b902"
with open("registration-certificate.pdf", "rb") as f:
res = requests.post(
f"https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts/{account}"
f"/org-requests/{request_id}/documents",
headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
data={"type": "registration_certificate"},
files={"file": ("registration-certificate.pdf", f, "application/pdf")},
timeout=60,
)
answer = res.json()
if not answer["ok"]:
raise RuntimeError(f"{res.status_code} {answer['code']}: {answer['description']} {answer['data']}")
print(answer["data"]["document"]["id"])php
<?php
$account = 'acct_ke_9c2f41b07e5d38a6c1f0b294';
$requestId = 'orq_3c8e1a9f4b7d20e6c5a1b902';
$ch = curl_init("https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts/{$account}/org-requests/{$requestId}/documents");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'type' => 'registration_certificate',
'file' => new CURLFile('registration-certificate.pdf', 'application/pdf', 'registration-certificate.pdf'),
],
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']}");
}
echo $answer['data']['document']['id'], PHP_EOL;Do not set Content-Type yourself in Node, Python or PHP: the library writes it with the boundary. In curl, ;type=application/pdf sets the file part's content type; without it curl guesses from the file name.
Response
201 Created with description Document attached.
json
{
"ok": true,
"description": "Document attached",
"data": {
"document": {
"id": "orqd_7a1c3e5f9b2d4068e1a3c5b7",
"type": "registration_certificate",
"file_name": "registration-certificate.pdf",
"content_type": "application/pdf",
"size": 284113,
"uploaded_at": "2026-11-20T09:04:12.000Z"
}
}
}Response fields
| Field | Type | Meaning |
|---|---|---|
document.id | string | The document's id |
document.type | string | The type you sent, in lower case |
document.file_name | string | The file name you sent, up to 255 characters, or document if there was none |
document.content_type | string | application/pdf, image/jpeg or image/png |
document.size | integer | Bytes |
document.uploaded_at | string | ISO 8601, UTC |
The file itself is never returned. Documents are private and only MOOKHPay staff and the seller can open them.
Errors
| HTTP | Code | Name | When | What to do |
|---|---|---|---|---|
400 | 1701 | INVALID_REQUEST_DATA | The body is not multipart/form-data, or does not have exactly the fields type and file once each | Send the two fields and nothing else |
400 | 3014 | IDENTITY_HEADER_REFUSED | The request carries a session or identity header | Remove it |
400 | 3034 | ORG_REQUEST_DOCUMENT_REJECTED | The file was not taken. data.reason says why: type (an unknown type, or a file that is not a PDF, JPEG or PNG, or whose bytes do not match its content type), not_for_this_kind (a type this kind does not need), empty, missing, unreadable or too_many (the request already has 10) | Fix the file or the type |
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 | 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 |
404 | 3028 | ORG_REQUEST_NOT_FOUND | The request is unknown, malformed, or not this account's | Check request_id |
409 | 3033 | ORG_REQUEST_WRONG_STATE | The request is not a draft or declined: it was sent, approved or withdrawn | Documents can be added only before sending, or after a decline |
413 | 1701 | INVALID_REQUEST_DATA | The whole body is over about 10.06 MB | Send a smaller file |
413 | 3034 | ORG_REQUEST_DOCUMENT_REJECTED | The file is over 10 MB. data.reason is size | Send a smaller file |
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 document could not be stored | Read the request, then retry if the document is not there |
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.