Scoped API keys
A scoped API key is an additional API key of your account. It reaches only the scopes that you select when you create it. Use a scoped key when a system needs only part of your account, for example a service that only creates and reads payments.
Your default API key (pk_live_ or pk_test_) does not change. It keeps full access to your account.
| Key | Prefix | Access | How many |
|---|---|---|---|
| Default API key | pk_live_, pk_test_ | Full access to your account | One |
| Scoped API key | mk_live_, mk_test_ | Only the scopes you select | Up to 20 active keys |
Create a scoped API key
Only a user with the Admin role can see, create and revoke scoped API keys. Your account must be able to get an API key: the same rules apply as for the default API key.
- Go to MONEI Dashboard → Settings → API Access and select Live or Test.
- In Scoped API keys, click Create scoped API key.
- Enter a name for the key, for example the name of the system that uses it.
- Select the scopes the key needs.
- Click Create. In live mode, verify your identity as you would for the default key. In test mode, the dashboard creates the key without asking you to verify.
- Copy the Secret key (
mk_live_…ormk_test_…) and its Signing secret (mksec_…). Keep both values in a safe place.
MONEI shows the secret key and the signing secret only once. MONEI cannot show them again. If you lose them, revoke the key and create a new one.
A key made in test mode starts with mk_test_ and works on your test account only. A key made in live mode starts with mk_live_. The list of keys shows each key as mk_live_…abcd (the last 4 characters).
Scopes
A scope is a permission, written as resource:action (for example payments:create or payments:read). The dashboard lists each scope that a key can get, with a label. A request outside the scopes of the key fails.
payments:create also charges a saved payment method: a payment with paymentToken or useDefaultPaymentMethod, a recurring payment and a payment confirmation. Give it only to a system that may charge your customers.
You cannot edit the scopes of a key. To change them, create a new key with the new scopes, move your system to it, then revoke the old key.
The following scopes have the label REST API only. They open REST routes that have no GraphQL operation.
| Scope | REST routes |
|---|---|
allowedPaymentMethods:read | GET /v1/allowed-payment-methods |
applePayDomains:write | POST /v1/apple-pay/domains |
pmsTokens:create | POST /v1/partner/tokens |
ucpTokens:create | POST /v1/ucp/tokenize (approved AI agent platform accounts only) |
What a scoped key can never do
No scope gives a scoped key these actions. Use the dashboard or the default API key for them.
- Read or change a bank account (IBAN). On GraphQL, IBANs are masked. On REST, a request that sends
ibanto a store fails, and the response masks the store IBAN. - Read the credentials of a payment processor.
- Change payment processors, webhooks or account settings.
- Manage users.
- Get a POS auth token for MONEI Pay.
- See, create or revoke API keys.
- Create a customer payout (transaction type
PAYOUT) on a live account. The request fails.
Use a scoped API key
Send the scoped key in the Authorization header, as you send the default API key. A scoped key works on the REST API and on the GraphQL API.
curl --request GET 'https://api.monei.com/v1/payments/<PAYMENT_ID>' \
--header 'Authorization: mk_live_<YOUR_SCOPED_API_KEY>' \
--header 'User-Agent: MONEI/<YOUR_APP>/<VERSION>'
| Case | REST API | GraphQL API |
|---|---|---|
| Unknown or revoked key | 401 Unauthorized | Unauthorized |
| Operation outside the scopes of the key | 403 Forbidden | Unauthorized with the message Not authorized: <permission> |
Request with a MONEI-Account-ID header | 403 Forbidden | Unauthorized |
A scoped key always acts on its own account. A MONEI Connect partner cannot send a scoped key with the MONEI-Account-ID header to act for a merchant account. Partners use their Partner API Key.
Your account does not need a default API key to use a scoped key. Read Callbacks and webhooks before you remove it.
Integrations that need the default API key
The Wix and BigCommerce integrations need the default API key. Do not give them a scoped key.
Keys of connected shop plugins
A WooCommerce, PrestaShop, Magento (Adobe Commerce) or Sylius plugin that you connect to MONEI gets its own scoped API key. The list of scoped keys shows the platform and the shop host of each such key, for example "WooCommerce: shop.example.com".
- The key has only the scopes that the plugin needs.
- The key works on the REST API only. A GraphQL request with it fails.
- If you connect the shop again, the plugin gets a new key. The old key stays valid until you revoke it.
The Medusa plugin does not connect. Create a scoped API key for it and set the key in your backend. See Medusa.
Callbacks and webhooks
MONEI signs callbacks and webhooks in the MONEI-Signature header. The v1 signature uses your account's default API key. This does not change for payments that a scoped key creates. To verify v1, see Verify signature.
A callback of a payment or a subscription that a scoped key creates also has a v2 signature. MONEI makes v2 with the signing secret (mksec_…) of that key. This applies also to the payments of a subscription: the activation payment, the renewals and the proration charges. Later actions on the payment or the subscription, for example a confirmation or a change in the dashboard, do not change the key that signs. When you revoke the key, MONEI deletes it and its signing secret: later callbacks of the payments and subscriptions that it created have no v2. Account webhooks use the signing secret of the endpoint, not the signing secret of a scoped key.
So a system that holds only a scoped key can verify its callbacks. Give the signing secret to the Node.js or PHP library, or verify v2 manually. See Verify v2 with a signing secret.
Sometimes a callback has no v2, for example when the key that created the payment is revoked, or when MONEI cannot read the signing secret when it signs the callback. To get a trusted status, read the payment (GET /v1/payments/{id}, scope payments:read) or the subscription (GET /v1/subscriptions/{id}, scope subscriptions:read) when a callback has no v2 that you can verify. Use a key that is still valid, not a revoked key: a revoked key gets 401. On an account with no default API key, such a callback has no signature. A payment callback with no signature holds only id, amount, currency, orderId, status and statusMessage. A subscription callback always holds the full subscription.
Revoke a scoped API key
- Go to MONEI Dashboard → Settings → API Access.
- In Scoped API keys, find the key and click Revoke.
- Confirm.
MONEI deletes the key and its signing secret. The key is no longer in the list. Requests with the key fail from that moment. A shop plugin that uses the key stops taking payments. Callbacks of the payments and subscriptions that the key created no longer have v2 (see Callbacks and webhooks). You cannot undo a revoke.
A scoped key does not expire. Only a revoke ends it. Revoke a key when you no longer use it, or when you think that someone else has it.