POST /v1/donations
Record a donation
Submits one bank-confirmed donation. On success the donation is accepted and queued (202); it is written on-chain
asynchronously, so poll GET /v1/donations/{id} for progress.
Processing order: authentication, body validation (including that bankCode is a known bank), same-platform lookup
(idempotent repeat or REFERENCE_CONFLICT), cross-platform lookup (DUPLICATE), recipient check, platform on-chain
check, create rate limit, daily cap, insert. An idempotent repeat is answered before the recipient check, the rate limit
and the cap.
The recipient (recipientWallet) must be a verified recipient in Amanah Registry and registered on-chain, and must not be
in the process of being suspended; otherwise 422 RECIPIENT_NOT_VERIFIED.
Parameters
| Name | In | Required | Description |
|---|---|---|---|
X-Key-Id | header | yes | Your API key id. length 0..128 |
X-Timestamp | header | yes | Current Unix time in whole seconds. Must be within 300 seconds of server time. pattern ^[0-9]{1,12}$ |
X-Nonce | header | yes | A unique value per request (a replay returns pattern ^[A-Za-z0-9_-]{16,64}$ |
X-Signature | header | yes | Lowercase hex HMAC-SHA256 of pattern ^[0-9a-f]{64}$ |
Request body (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
platformReference | string | yes | Your own reference (at most 128 characters, counted as UTF-16 code units by the server) for this donation. Unique per platform: reusing it for a different bank transaction is length 1..128 |
bankCode | string | yes | Code of the bank that confirmed the payment. Must be one of the banks Amanah Ledger supports, otherwise pattern ^[A-Z0-9]{1,11}$ |
bankReference | string | yes | The bank's reference for the transaction. Must not be empty after normalisation (trim ASCII whitespace, upper-case ASCII
letters). Stored and proven in normalised form. Together with length 0..128 |
amountMinor | string | yes | Amount in minor units (for example sen) as a decimal string, 1 to 18446744073709551615 (2^64-1). A JSON number is rejected. pattern ^[1-9][0-9]{0,19}$ |
currency | string | yes | Three upper-case letters. pattern ^[A-Z]{3}$ |
recipientWallet | string | yes | Solana address (base58, 32 bytes, canonical form) of a verified recipient. |
paidAt | string | yes | When the donor paid, RFC 3339 with an explicit offset ( pattern ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$ |
category | integer | no | Optional category code, 0 to 65535. Omitted means 0. 0..65535; default 0 |
metadataHash | string | no | Optional 32-byte hash (64 hex characters) of your own metadata for this donation. Stored as bytes; the metadata itself is not sent. pattern ^[0-9a-fA-F]{64}$ |
{
"platformReference": "INV-2026-000123",
"bankCode": "MBBEMYKL",
"bankReference": "ib-20261122-7788",
"amountMinor": "50000",
"currency": "MYR",
"recipientWallet": "7tBntpS9MYMo4koekTWqHXyewJFUkPzyL5finB2GMtjU",
"paidAt": "2026-11-22T11:58:30+08:00",
"category": 0
}Responses
202
Accepted and queued. Also the answer to an idempotent repeat, with the original
donationId.{ "donationId": "0b6c2f3e-8d4a-4b8e-9c1e-5a7f1d2e3c4b", "status": "RECEIVED" }400
VALIDATION_FAILED: the body is not valid JSON, has an unknown field, or a field is invalid. The message lists the field names (for exampleInvalid request: amountMinor, paidAt), never the values.{ "error": { "code": "VALIDATION_FAILED", "message": "Invalid request: amountMinor" } }401
AUTH_BAD_SIGNATURE: missing or malformed auth headers, unknown or revoked key, or wrong signature (all identical).AUTH_STALE: timestamp more than 300 seconds from server time.AUTH_REPLAY: nonce already used.{ "error": { "code": "AUTH_BAD_SIGNATURE", "message": "Authentication failed" } }{ "error": { "code": "AUTH_STALE", "message": "Timestamp outside the allowed window" } }{ "error": { "code": "AUTH_REPLAY", "message": "Nonce already used" } }403
Returned only for a valid signature.
KEY_DISABLED: the key is disabled.KEY_EXPIRED: the key has expired.PLATFORM_INACTIVE: the platform is deactivated.IP_NOT_ALLOWED: your platform has an IP allowlist and the source address is not on it.{ "error": { "code": "KEY_DISABLED", "message": "API key is disabled" } }409
REFERENCE_CONFLICT: the same bank transaction was already recorded by your platform with different details (amount, recipient, currency, paidAt, category, metadataHash or platformReference), or yourplatformReferencewas already used for a different bank transaction.DUPLICATE: another platform already recorded this bank transaction (no identifiers are returned).{ "error": { "code": "REFERENCE_CONFLICT", "message": "platformReference or bank transaction already used with different details" } }{ "error": { "code": "DUPLICATE", "message": "This bank transaction has already been recorded" } }413
The body is larger than 16 KiB. Answered before authentication. (Above 64 KiB the edge answers first, with a non-JSON
413.){ "error": { "code": "PAYLOAD_TOO_LARGE", "message": "Request body too large" } }415
The content type is not
application/json. Answered before authentication.{ "error": { "code": "UNSUPPORTED_MEDIA_TYPE", "message": "Content-Type must be application/json" } }422
RECIPIENT_NOT_VERIFIED: the recipient wallet is unknown, not verified, not registered on-chain, or is being suspended.PLATFORM_NOT_ONCHAIN: your platform is not active on-chain.{ "error": { "code": "RECIPIENT_NOT_VERIFIED", "message": "Recipient is not verified" } }{ "error": { "code": "PLATFORM_NOT_ONCHAIN", "message": "Platform is not active on-chain" } }429
RATE_LIMITED(front-door or create limit) orDAILY_CAP_EXCEEDED(your platform's daily cap of new donations for the platform-local day). NoRetry-Afterheader is sent.{ "error": { "code": "RATE_LIMITED", "message": "Rate limit exceeded" } }{ "error": { "code": "DAILY_CAP_EXCEEDED", "message": "Daily donation cap reached" } }500
Unexpected server error. The body is generic; retry later with a new nonce and contact the Amanah Ledger team if it persists.
{ "error": { "code": "INTERNAL", "message": "Internal server error" } }