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


Requires: organization platform (active); permission platform:customer_keys; The customer must be active for a live key.

## Request body

- `name` (string, required): 
- `scopes` (string[]): 
- `allowlist` (string[]): CIDR networks. Empty means any IP.
- `expires_at` (string (date-time)): 

```json
{
  "name": "Acme Robotics - payouts service",
  "scopes": [
    "accounts:view",
    "counterparties:view",
    "counterparties:manage",
    "payments:view",
    "payments:create"
  ]
}
```

Errors: invalid_scope, scope_not_held, api_access_revoked

```bash
curl -X POST "https://sandbox-api.payezy.io/v1/platforms/$ORG_ID/customers/$CUSTOMER_ID/api-keys" \
  -H "Authorization: Bearer $PAYEZY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme Robotics - payouts service",
  "scopes": [
    "accounts:view",
    "counterparties:view",
    "counterparties:manage",
    "payments:view",
    "payments:create"
  ]
}'
```
