Create API key
Creates an API key.
POST/v1/workspaces/{regionId}/api-keys
Body
labelstringRequiredHuman-readable label, e.g. "Billing agent - prod".
procurementRole"administrator" | "read-only" | "contracts-and-suppliers" | "relationships" | "requisitions" | "finance"Buyer keys only (ignored for a supplier key): what the key may do, by the same procurement roles people have. Defaults to read-only. For example, requisitions can create and edit purchase orders, and finance can work invoices. Whatever the role, a key never approves, rejects, records a payment (except through RecordPayments, with the payments:record scope), or changes approval flows, autonomy or automation rules.
scopesArray<"invoices:feed" | "payments:record">Only from an administrator, each for one side. invoices:feed (supplier keys) lets the key submit invoices through SubmitFeedInvoice; payments:record (buyer keys) lets it record payments through RecordPayments. Omit for a key without scopes.
Returns
201 Created with the object shown in the response.
More details
Mints a new API key scoped to the caller's own role in this workspace - a supplier can't mint a buyer-scoped key, and vice versa. The plaintext key is returned only in this response; only its HMAC digest is ever stored. Only an administrator can mint a key: on the Buyer side anyone else gets 403 ("Only an administrator of this workspace can manage its API keys."), and on the Supplier side 403 ("Only a supplier administrator can create API keys for this workspace."). A buyer key acts with the procurementRole it is minted with, read-only unless you choose another. A supplier administrator can add the invoices:feed scope, which lets the key call SubmitFeedInvoice on top of everything a supplier key already does; a buyer administrator can add the payments:record scope, which lets the key call RecordPayments and needs a procurementRole that can edit invoices (otherwise 400 API_KEY_SCOPE_ROLE_MISMATCH). A non-administrator asking for a scope gets 403 API_KEY_SCOPE_FORBIDDEN, and the other side's scope is 400 API_KEY_SCOPE_INVALID.
Requires a human Cognito session (Bearer token) - an existing API key can never mint or revoke another key. Only an administrator of the workspace can mint, list or revoke its keys.
Response fields
apiKeystringThe plaintext credential, formatted "<keyId>.<secret>" - pass it verbatim as the X-Api-Key header. Shown only once; it cannot be retrieved again.
Errors
- 403 Forbidden - The caller authenticated with an API key rather than a human Bearer token ("This action requires a logged-in user session, not an API key"), or, for Supplier callers, isn't a supplier administrator of this workspace ("Only a supplier administrator can create API keys for this workspace.").
- 403 Forbidden - The caller's Bearer token or API key doesn't grant access to this workspace (regionId), or lacks the required role.
curl -X POST "$PLEAXY_API_BASE_URL/v1/workspaces/reg_01k5x8p9j3q7vn2mhb4tzc6rde.supplier/api-keys" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "label": "Billing agent - prod" }'{
"apiKey": "5b1c2e90-....-9a3f.9f2c7a1e8b6d4c0a2f1e3d5b7a9c8e6f",
"keyId": "5b1c2e90-....-9a3f",
"regionId": "reg_01k5x8p9j3q7vn2mhb4tzc6rde",
"role": "supplier",
"label": "Billing agent - prod",
"createdAt": "2026-02-03T09:00:00.000Z",
"revoked": false
}