MolnPayDocs
API reference

API keys

GET/v1/api_keys

Never the secret — key_id and last4 are all that is stored. created_by: molnpay_staff marks a key our support minted for you. limit_per_kind and default_scopes are what a create call is measured against.

AuthorizationBearer <token>

Authorization: Bearer mp<64 hex> for live, mptest<64 hex> for test.

The token is the prefix plus 64 lowercase hex characters (32 CSPRNG bytes) and nothing else — no separators, no embedded fields — so nothing in it needs quoting, escaping or encoding. Send it in the Authorization header and nowhere else. Never put it in a query string: URLs reach access logs, proxy logs, browser history and Referer headers, and a key that lands in any of those is a leaked key. A key's KIND (checkout, payout or wallet) is a property of the key, not of the string: it is chosen at creation, returned by GET /v1/ping, and decides which routes the key may reach.

The full key is shown exactly once, at creation. No endpoint can return it afterwards. Moving funds additionally requires signing to be enabled globally, for your project, and for that key — so a read-only key is a supported configuration.

In: header

Query Parameters

include_revoked?string
Default"0"

Value in

  • "0"
  • "1"

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/api_keys"
{  "object": "list",  "has_more": true,  "next_cursor": "string",  "data": [    {      "object": "api_key",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "key_id": "mp3f9c1a77",      "env": "live",      "kind": "checkout",      "name": "string",      "last4": "string",      "scopes": [        "string"      ],      "ip_allowlist": [        "string"      ],      "signing_enabled": true,      "created_by": "merchant",      "rotated_from": "c5500ae4-3bf4-4b9d-9292-5dcc0d464d8b",      "expires_at": "2019-08-24T14:15:22Z",      "revoked_at": "2019-08-24T14:15:22Z",      "last_used_at": "2019-08-24T14:15:22Z",      "use_count": "string",      "created_at": "2019-08-24T14:15:22Z"    }  ],  "limit_per_kind": 0,  "default_scopes": {    "property1": [      "string"    ],    "property2": [      "string"    ]  }}
POST/v1/api_keys

The response carries tokenthe only time it is ever shown. We store a peppered hash; nothing can return it later. A lost key is rolled, never recovered.

The key's mode follows the project: a live project mints mp…, a test project mptest….

scopes defaults to the kind's read+write set (see default_scopes on the list). payouts:create is never a default. signing_enabled is the third factor a payout key needs to move funds, on top of kind and scope.

ip_allowlist: exact IPs or CIDR blocks, v4 or v6, up to 32. Empty means any source. The address judged is the one your server presents to us. Leave it empty on serverless platforms.

Five enabled keys per kind.

AuthorizationBearer <token>

Authorization: Bearer mp<64 hex> for live, mptest<64 hex> for test.

The token is the prefix plus 64 lowercase hex characters (32 CSPRNG bytes) and nothing else — no separators, no embedded fields — so nothing in it needs quoting, escaping or encoding. Send it in the Authorization header and nowhere else. Never put it in a query string: URLs reach access logs, proxy logs, browser history and Referer headers, and a key that lands in any of those is a leaked key. A key's KIND (checkout, payout or wallet) is a property of the key, not of the string: it is chosen at creation, returned by GET /v1/ping, and decides which routes the key may reach.

The full key is shown exactly once, at creation. No endpoint can return it afterwards. Moving funds additionally requires signing to be enabled globally, for your project, and for that key — so a read-only key is a supported configuration.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/api_keys" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "kind": "checkout"  }'
{  "object": "api_key",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "key_id": "mp3f9c1a77",  "env": "live",  "kind": "checkout",  "name": "string",  "last4": "string",  "scopes": [    "string"  ],  "ip_allowlist": [    "string"  ],  "signing_enabled": true,  "created_by": "merchant",  "rotated_from": "c5500ae4-3bf4-4b9d-9292-5dcc0d464d8b",  "expires_at": "2019-08-24T14:15:22Z",  "revoked_at": "2019-08-24T14:15:22Z",  "last_used_at": "2019-08-24T14:15:22Z",  "use_count": "string",  "created_at": "2019-08-24T14:15:22Z",  "token": "string"}
GET/v1/api_keys/{id}
AuthorizationBearer <token>

Authorization: Bearer mp<64 hex> for live, mptest<64 hex> for test.

The token is the prefix plus 64 lowercase hex characters (32 CSPRNG bytes) and nothing else — no separators, no embedded fields — so nothing in it needs quoting, escaping or encoding. Send it in the Authorization header and nowhere else. Never put it in a query string: URLs reach access logs, proxy logs, browser history and Referer headers, and a key that lands in any of those is a leaked key. A key's KIND (checkout, payout or wallet) is a property of the key, not of the string: it is chosen at creation, returned by GET /v1/ping, and decides which routes the key may reach.

The full key is shown exactly once, at creation. No endpoint can return it afterwards. Moving funds additionally requires signing to be enabled globally, for your project, and for that key — so a read-only key is a supported configuration.

In: header

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/api_keys/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{  "object": "api_key",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "key_id": "mp3f9c1a77",  "env": "live",  "kind": "checkout",  "name": "string",  "last4": "string",  "scopes": [    "string"  ],  "ip_allowlist": [    "string"  ],  "signing_enabled": true,  "created_by": "merchant",  "rotated_from": "c5500ae4-3bf4-4b9d-9292-5dcc0d464d8b",  "expires_at": "2019-08-24T14:15:22Z",  "revoked_at": "2019-08-24T14:15:22Z",  "last_used_at": "2019-08-24T14:15:22Z",  "use_count": "string",  "created_at": "2019-08-24T14:15:22Z"}
PATCH/v1/api_keys/{id}

Takes effect within a minute everywhere. An empty ip_allowlist clears the restriction.

AuthorizationBearer <token>

Authorization: Bearer mp<64 hex> for live, mptest<64 hex> for test.

The token is the prefix plus 64 lowercase hex characters (32 CSPRNG bytes) and nothing else — no separators, no embedded fields — so nothing in it needs quoting, escaping or encoding. Send it in the Authorization header and nowhere else. Never put it in a query string: URLs reach access logs, proxy logs, browser history and Referer headers, and a key that lands in any of those is a leaked key. A key's KIND (checkout, payout or wallet) is a property of the key, not of the string: it is chosen at creation, returned by GET /v1/ping, and decides which routes the key may reach.

The full key is shown exactly once, at creation. No endpoint can return it afterwards. Moving funds additionally requires signing to be enabled globally, for your project, and for that key — so a read-only key is a supported configuration.

In: header

Path Parameters

id*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/api_keys/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{  "object": "api_key",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "key_id": "mp3f9c1a77",  "env": "live",  "kind": "checkout",  "name": "string",  "last4": "string",  "scopes": [    "string"  ],  "ip_allowlist": [    "string"  ],  "signing_enabled": true,  "created_by": "merchant",  "rotated_from": "c5500ae4-3bf4-4b9d-9292-5dcc0d464d8b",  "expires_at": "2019-08-24T14:15:22Z",  "revoked_at": "2019-08-24T14:15:22Z",  "last_used_at": "2019-08-24T14:15:22Z",  "use_count": "string",  "created_at": "2019-08-24T14:15:22Z"}
DELETE/v1/api_keys/{id}

Idempotent. The row stays, marked revoked_at, so the audit trail keeps its name.

AuthorizationBearer <token>

Authorization: Bearer mp<64 hex> for live, mptest<64 hex> for test.

The token is the prefix plus 64 lowercase hex characters (32 CSPRNG bytes) and nothing else — no separators, no embedded fields — so nothing in it needs quoting, escaping or encoding. Send it in the Authorization header and nowhere else. Never put it in a query string: URLs reach access logs, proxy logs, browser history and Referer headers, and a key that lands in any of those is a leaked key. A key's KIND (checkout, payout or wallet) is a property of the key, not of the string: it is chosen at creation, returned by GET /v1/ping, and decides which routes the key may reach.

The full key is shown exactly once, at creation. No endpoint can return it afterwards. Moving funds additionally requires signing to be enabled globally, for your project, and for that key — so a read-only key is a supported configuration.

In: header

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/v1/api_keys/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{  "object": "api_key",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "key_id": "mp3f9c1a77",  "env": "live",  "kind": "checkout",  "name": "string",  "last4": "string",  "scopes": [    "string"  ],  "ip_allowlist": [    "string"  ],  "signing_enabled": true,  "created_by": "merchant",  "rotated_from": "c5500ae4-3bf4-4b9d-9292-5dcc0d464d8b",  "expires_at": "2019-08-24T14:15:22Z",  "revoked_at": "2019-08-24T14:15:22Z",  "last_used_at": "2019-08-24T14:15:22Z",  "use_count": "string",  "created_at": "2019-08-24T14:15:22Z"}
POST/v1/api_keys/{id}/roll

Mints a new key with identical grants and gives the old one grace_hours (default 24, max 168) to live — both work until then, so deploy the new key before the old one dies. The new token is shown only in this response.

AuthorizationBearer <token>

Authorization: Bearer mp<64 hex> for live, mptest<64 hex> for test.

The token is the prefix plus 64 lowercase hex characters (32 CSPRNG bytes) and nothing else — no separators, no embedded fields — so nothing in it needs quoting, escaping or encoding. Send it in the Authorization header and nowhere else. Never put it in a query string: URLs reach access logs, proxy logs, browser history and Referer headers, and a key that lands in any of those is a leaked key. A key's KIND (checkout, payout or wallet) is a property of the key, not of the string: it is chosen at creation, returned by GET /v1/ping, and decides which routes the key may reach.

The full key is shown exactly once, at creation. No endpoint can return it afterwards. Moving funds additionally requires signing to be enabled globally, for your project, and for that key — so a read-only key is a supported configuration.

In: header

Path Parameters

id*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/api_keys/497f6eca-6276-4993-bfeb-53cbbbba6f08/roll" \  -H "Content-Type: application/json" \  -d '{}'
{  "object": "api_key",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "key_id": "mp3f9c1a77",  "env": "live",  "kind": "checkout",  "name": "string",  "last4": "string",  "scopes": [    "string"  ],  "ip_allowlist": [    "string"  ],  "signing_enabled": true,  "created_by": "merchant",  "rotated_from": "c5500ae4-3bf4-4b9d-9292-5dcc0d464d8b",  "expires_at": "2019-08-24T14:15:22Z",  "revoked_at": "2019-08-24T14:15:22Z",  "last_used_at": "2019-08-24T14:15:22Z",  "use_count": "string",  "created_at": "2019-08-24T14:15:22Z",  "token": "string",  "old_key_expires_at": "2019-08-24T14:15:22Z"}