Payezydevelopers
Sandbox

API reference / Identity and access

Create an API key

POST/v1/orgs/{orgId}/api-keys

Create a key in this environment from a signed-in member (api_keys:manage, AAL2). An API key cannot create, roll or revoke keys. Staging and local mint pz_test_ keys. Production mints pz_live_ keys and requires the staff production-API grant on this organization. The secret is returned once. Omitting allowlist means any IP.

When to use it

From a signed-in member session, usually on the Developer page. Name the key after the system that will hold it. Omit scopes for a read-only key.

Before you call it

  • Permissionapi_keys:manage
  • Second factorRequired for browser sessions. An API key with the scope replaces it.
  • NoteA signed-in member; API keys cannot create keys.

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.

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 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
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.

invalid_scope422scope is not allowed on a customer API key:
invalid_cidr422
allowlist_too_long422an API key can list at most 20 networks
invalid_expiry422expiry must be within the next year
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.