Payezydevelopers
Sandbox

API reference / Customer keys and view-as

Mint a customer API key

POST/v1/platforms/{orgId}/customers/{customerId}/api-keys

Mint an ordinary customer API key for a linked customer (platform:customer_keys). The secret is returned once and then calls the customer API on its own. Omitted scopes are the read-only customer set. platform:* and api_keys:manage cannot be granted. Money, team and approval scopes are opt-in. Staging mints pz_test_. Production mints pz_live_ only when that customer organization is active and holds the staff production-API grant.

When to use it

Your servers need to act for a linked customer - list their accounts, add recipients, send payments. Grant only the scopes you need; money, team and approval scopes are opt-in. The secret is returned once.

Before you call it

  • Organizationplatform (active)
  • Permissionplatform:customer_keys
  • NoteThe customer must be active for a live key.

Parameters

ParameterWhat it does
orgIdpath, uuidrequiredThe organization the call acts on. For platform calls, your platform's id; for customer calls, the customer's organization id. Get them from getMe or the customer list.
customerIdpath, uuidrequiredA customer organization linked to your platform.

Request body

FieldWhat it does
namestringrequiredNo description in the spec yet.
scopesstring[]No description in the spec yet.
allowliststring[]CIDR networks. Empty means any IP.
expires_atstring (date-time)No description in the spec yet.

Response 201

The new customer key, including its secret

FieldWhat it does
idstring (uuid)requiredNo description in the spec yet.
public_idstringrequiredNo description in the spec yet.
modeenumrequiredNo description in the spec yet.

One of test live

namestringrequiredNo description in the spec yet.
scopesstring[]requiredNo description in the spec yet.
allowliststring[]requiredNo description in the spec yet.
expires_atstring (date-time)requiredNo description in the spec yet.
overlap_untilstring (date-time)No description in the spec yet.
revoked_atstring (date-time)No description in the spec yet.
last_used_atstring (date-time)No description in the spec yet.
created_atstring (date-time)requiredNo description in the spec yet.
minted_by_platform_idstring (uuid)Set when a platform minted this key for the customer. Absent for keys created on the Developer page.
secretstringrequiredShown once. Store it now.

Errors to handle

CodeWhat it means and what to do
invalid_scope422scope is not allowed on a customer API key:
scope_not_held403The API key was created without the scope this operation needs, or you asked for a scope you do not hold.

Keys' scopes are frozen at creation. Create a new key that includes the scope; a key's scopes can only be a subset of its creator's permissions.

api_access_revoked403Production API access is not granted for this organization, or it was revoked, or the organization is not active.

Ask Payezy to grant production API access once the organization is active. Staging keys are unaffected.

Every error is a Problem document. Branch on code; quote request_id to support.

Usually next

Used in guided journeys