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
- Permission
api_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
| Parameter | What it does |
|---|---|
orgIdpath, uuidrequired | The 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
| Field | What it does |
|---|---|
namestringrequired | No 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
| Field | What it does |
|---|---|
idstring (uuid)required | No description in the spec yet. |
public_idstringrequired | No description in the spec yet. |
modeenumrequired | No description in the spec yet. One of |
namestringrequired | No description in the spec yet. |
scopesstring[]required | No description in the spec yet. |
allowliststring[]required | No description in the spec yet. |
expires_atstring (date-time)required | No 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)required | No 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. |
secretstringrequired | Shown once. Store it now. |
Errors to handle
| Code | What it means and what to do |
|---|---|
scope_not_held403 | The 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_scope422 | scope is not allowed on a customer API key: |
invalid_cidr422 | |
allowlist_too_long422 | an API key can list at most 20 networks |
invalid_expiry422 | expiry must be within the next year |
api_access_revoked403 | Production 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.