Getting started

Base URL, authentication, responses, errors, pagination and limits.

The Morzepay API lets you collect mobile money, send payouts, run wallets for your own customers, and create invoices and checkout pages from your own code. It is a REST API: you send JSON over HTTPS, and every answer is JSON.

Base URL#

Base URL
https://morzepay.com/v1

The same URL serves test and live. Your API key decides which one a request uses.

Authentication#

Every request needs an API key, sent as a bearer token:

Header
Authorization: Bearer mp_test_3f9a1c0b2e7d_9b1c...

Create keys under Developers in the dashboard. See Create an API key. A key belongs to one business and works only on its test side (mp_test_…) or its live side (mp_live_…). Keys made before the rename start with tp_; they keep working.

Anyone who has a key can use it. Keep keys on your server. Never put one in a website, a mobile app, a public repository or a forum post. If a key leaks, revoke it in the dashboard at once.

Permissions#

Each key can only do what you allowed when you created it. A request without the needed permission returns 403 INSUFFICIENT_SCOPE.

PermissionAllows
wallets:readList wallets, see balances, quote fees
wallets:writeCreate sub-wallets
deposits:writeCollect payments
payouts:writeSend payouts
transfers:writeMove money between wallets
transactions:readSee transactions and receipts
msisdn:validateLook up the name on a phone number
invoices:read, invoices:writeSee invoices; create, send and change them
checkout:read, checkout:writeSee checkout sessions; create and expire them

Requests#

Send POST bodies as JSON, with this header:

Header
Content-Type: application/json

Amounts are whole Ugandan shillings as numbers: 5000, not "5000" or 5000.5. Phone numbers can be written +256771234567, 256771234567 or 0771234567; we always return them as +256….

Responses#

A successful answer:

Success
{
  "success": true,
  "data": {
    "id": "wal_Zq4Hn8YtV2kPm6RbX3cLw9",
    "balance": "48500.00",
    "…": "…"
  }
}

An error:

Error
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_FUNDS",
    "message": "The wallet cannot cover the payout plus the estimated mobile money fee.",
    "details": {
      "available": "3000.00",
      "required": "5800.00"
    }
  },
  "request_id": "req_6f1d0c2b9a8e7d6c5b4a"
}
FieldTypeInMeaning
successbooleanbothtrue or false.
dataobjectsuccessThe result: one object, or a list (see Pagination).
error.codestringerrorWhat went wrong. Codes don’t change, so match on them.
error.messagestringerrorA sentence for people. It can change; don’t match on it.
error.detailsobjecterrorExtra facts, such as field for a validation error.
request_idstringerrorSend it to support when you report a problem. Every response also has it in the X-Request-Id header.

Money is returned as text with two decimals, such as "10363.00", because network fees can include fractions. Dates are ISO 8601 in East Africa Time, such as 2026-10-04T14:20:11+03:00. Every object has livemode.

Errors#

StatusCodeMeaning
400INVALID_JSONThe body isn’t valid JSON, or isn’t a JSON object.
401UNAUTHENTICATED, KEY_REVOKEDThe key is missing, wrong, revoked or expired.
402INSUFFICIENT_FUNDSThe wallet can’t cover the amount and fees. Nothing was sent.
403INSUFFICIENT_SCOPEThe key doesn’t have the permission this needs.
403IP_NOT_ALLOWEDThe request came from an address not on the key’s allowlist.
403LIVE_NOT_ENABLEDYour business isn’t verified for live payments yet.
403BUSINESS_SUSPENDEDThe business account is suspended. Contact support.
403WEEKLY_LIMIT_REACHEDThe payout would go over your 7-day limit. details.remaining shows what’s left.
404NOT_FOUND, WALLET_NOT_FOUNDIt doesn’t exist, or this key can’t see it.
409DUPLICATE_REFERENCEYou already used this reference. The existing transaction_id is in details.
409WALLET_NOT_ACTIVEThe wallet is frozen.
409IDEMPOTENCY_IN_PROGRESSA request with the same Idempotency-Key is still running. Wait and retry.
422VALIDATION_ERRORA field is missing or wrong. details.field names it.
422MODE_MISMATCHYou mixed test and live, such as a live key and a test wallet.
422IDEMPOTENCY_MISMATCH, INVALID_IDEMPOTENCY_KEYThe Idempotency-Key was used with a different body, or isn’t 8–80 letters, digits, - or _.
429RATE_LIMITED, MSISDN_RATE_LIMITEDToo many requests. Wait details.retry_after_seconds.
500SERVER_ERRORSomething failed on our side. Retry with the same Idempotency-Key.

Pagination#

List endpoints return a page of results, newest first:

A list
{
  "success": true,
  "data": {
    "items": [
      "…"
    ],
    "has_more": true
  }
}
ParameterTypeMeaning
limitintegerHow many items a page holds, 1 to 100. The default is 25 (50 for wallets).
starting_afterstringThe id of the last item you have. You get the items after it.

To get every page, repeat the request with starting_after set to the last item’s id while has_more is true.

Idempotency#

Networks fail. To retry a POST safely, send an Idempotency-Key header:

Header
Idempotency-Key: order-77812
  • Use a new value, 8 to 80 letters, digits, - or _, for each thing you want to do. Your order id works well.
  • If you send the same key and body again, you get the first answer back with an Idempotent-Replayed: true header. Money is never moved twice.
  • The same key with a different body returns 422 IDEMPOTENCY_MISMATCH.
  • Keys are remembered for 24 hours. Errors from our side (5xx) and 429 aren’t stored, so you can retry them.

Money-moving requests also need your own unique reference, 8 to 36 characters. A second request with the same reference returns 409 DUPLICATE_REFERENCE, which protects you even without an idempotency key.

Rate limits#

Each API key can make 120 requests a minute. Past that, the API answers 429 RATE_LIMITED with a Retry-After header.

Separately, the mobile networks allow at most 5 payment requests per phone number every 10 minutes. A sixth returns 429 MSISDN_RATE_LIMITED with details.retry_after_seconds. Show your customer when they can try again, rather than retrying in a loop. Phone number lookups are limited to 30 a minute per key.

Versioning#

The API version is v1, and it is part of every path. We may add endpoints, fields and webhook events to v1 without notice, so ignore fields you don’t know. A change that could break your code comes in a new version, announced in the changelog, and v1 keeps working for a period we state in the announcement.