Your two kinds of key
test keys only touch test data. live keys move real money. A test key can’t see live data, and a live key can’t see test data.
Modem Pay stores only a hash of each secret key. You see the full key once, when you create it. Save it somewhere safe, like your server’s environment variables. If you lose it, roll the key to get a new one.
Make a request
Send the secret key as a bearer token:Full-access and restricted keys
A full-access key can call every endpoint. That’s convenient, but risky: if it leaks, someone could send payouts from your balance. A restricted key can only do what you allow. Give each system its own restricted key with just the permissions it needs. For example, your website’s checkout only needs to create payments. It never needs to send money. When you create a restricted key in the dashboard you can set:Permissions
Pick exactly which resources it can read or change.
Expiry
1 day, 7 days, 30 days, 90 days, 1 year, never, or a date you choose.
Allowed IP addresses
Up to 20 IP addresses or ranges. Requests from anywhere else are refused.
Payout limits
A maximum per payout and per day, for keys that can send money.
Permissions
Each permission is a resource and an access level, likepayments:write. A write permission includes read for the same resource.
Ready-made sets
The dashboard offers three starting points:Payout limits
On a key that can send money, you can set:per_transfer: the most a single payout can be.daily: the most the key can send in total each day.
per_transfer_limit_exceeded or daily_transfer_limit_exceeded, and nothing is sent.
IP allowlists
There are two levels:- Per key: set when you create the key. Applies to that key only.
- Per account: set in the dashboard. Applies to every key on that account and mode.
203.0.113.0/24.
Roll a key
Rolling replaces a key with a new one. You choose how long the old key keeps working, from 0 hours up to 7 days (24 hours by default), so you can update your servers without downtime. The new key keeps the old key’s permissions. Roll a key straight away if:- it was committed to a code repository or shared in chat;
- someone who had it leaves your team;
- you see requests you don’t recognise in the audit log.
When a key is refused
Errors from key checks include acode you can act on:
