Create an API key
Make a key for your server and limit what it can do.
An API key lets your server act for one business, on its test side or its live side. You choose what each key may do, which wallets it may touch and, optionally, which server addresses may use it. Owners, admins and developers can create keys.
- Choose test or live
In the dashboard, set the toggle at the top to Test or Live. The key you create belongs to that side:
mp_test_…ormp_live_…. Live keys are available once your business is verified. - Open Developers
Go to Developers and click Create API key.
- Name it
In Name, say where the key will be used, such as
POS production serverorstaging. You’ll thank yourself when you need to revoke one. - Choose what it can do
Tick only the permissions this server needs. A shop that only takes payments needs Request payments and See transactions, not Send payouts. See the list of permissions.
- Limit it, if you can
Under Limit to wallets, pick the wallets the key may use. Choosing a main wallet includes its sub-wallets. Leave it empty for every wallet. Other wallets look as if they don’t exist to this key.
Under Allowed server IPs, list your servers’ addresses, one per line. Ranges such as
41.210.0.0/24work too. This is required for live keys that send payouts. - Confirm and copy
Confirm with your two-factor code or password and click Create API key.
The key is shown only now. Copy it into your server’s environment variables or a secret store before you close the window. If you lose it, create a new one.
Check that the key works#
Put the key in an environment variable and list your wallets:
export MORZEPAY_KEY="mp_test_..."
curl "https://morzepay.com/v1/wallets" \
-H "Authorization: Bearer $MORZEPAY_KEY"The answer starts with "success": true. If you get 401 UNAUTHENTICATED, check that you copied the whole key. A 403 INSUFFICIENT_SCOPE means the key works but lacks wallets:read.
Revoke a key#
Under Developers → API keys, click Revoke on the key’s row. Requests with it are refused from then on with 401 KEY_REVOKED. The table also shows when and from which address each key was last used, which helps you spot a key you no longer need.
Keys for AI apps#
AI apps you connect with the sign-in window appear in the same list, marked AI app, with Disconnect instead of Revoke. See Use with AI.
Good habits#
- One key per server or service, so you can revoke one without touching the others.
- Separate test and live keys in separate environments, so test code can never move real money.
- Never put a key in code that runs in a browser or a mobile app. Anyone can read it there.