Create Account Key

POST /v1/account/keys

Create an account key for your active account: an API key that belongs to the account, not to a person, for CI and other automation. It acts only in this account, with exactly the role you give it, and keeps working when you leave the account.

The full key is in the response and is never shown again: store it the moment you receive it, for example as a CI secret. Send it in the X-API-KEY header, like any API key.

Who can create one

The members:write permission on the active account, from a dashboard session or with your own API key (ngk_). You can't give a key more access than you have: a role with a permission you don't hold is refused. The account owner can give any role.

An account key can't create keys (403, account_key_not_allowed), and neither can an OAuth session such as the MCP server's browser sign-in. The account's plan must include account keys and allow one more active key.

Request body

name string Req
1-100 characters: letters, numbers, spaces and . ' - _ ( ) ! ? : , + &, for example "GitHub Actions deploy". Shown in the list and in the audit log.
role_uuid string (uuid) Req
One of the active account's roles, from GET /v1/account/roles. A custom role needs custom roles on the plan. To deploy apps (the GitHub Action, ngris deploy), the role needs endpoints read and write.
expires_in_days int
Optional. Days until the key stops working, 1-3650. The dashboard suggests 90.
expires_at datetime
Optional. When the key stops working, RFC 3339 (for example "2027-06-30T23:59:59Z"): in the future, at most 10 years ahead. Send expires_in_days or expires_at, not both. Without either the key never expires.
allowed_ips string
Optional. IPv4 or IPv6 addresses and CIDR ranges the key may be used from, separated by commas, spaces or new lines ("203.0.113.10, 198.51.100.0/24"). A request from any other address answers 401. Empty: any address.

Expiry and the allowed IPs can't be changed later, and neither can the role: create a new key, then revoke the old one. Unknown fields are refused.

Response (201 Created)

key string
The full key, shown once. nak_ followed by 40 characters (letters, digits, _ and -).
account_key object
The new key as GET /v1/account/keys lists it (uuid, name, role, hint, created_at, created_by, last_used_at, expires_at, allowed_ips, status).
notice string
A reminder to copy the key now.

Creating a key is recorded in the account's audit log under your name: Account key <name> created with role <role>.

Errors

400 Bad Request
A missing or too long name, or one with other characters, a missing or malformed role_uuid, both expiry fields, an expiry out of range, an address that isn't an IP or CIDR range, or an unknown field. Field errors carry fields, for example {"error": "expires_in_days must be 1-3650", "fields": {"expires_in_days": "Use 1-3650 days."}}.
401 Unauthorized
Missing or invalid auth.
403 Forbidden
The caller lacks members:write; the role has a permission you don't hold (permission_ceiling); the plan doesn't include account keys, or custom roles for a custom role (entitlement_required); the account has as many active keys as its plan allows (limit_reached); the request uses an account key (account_key_not_allowed) or an OAuth session; the account is suspended (account_suspended).
404 Not Found
role not found: no such role in the active account.
Request
curl -X POST "https://api.ngris.com/v1/account/keys" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "name": "GitHub Actions deploy", "role_uuid": "019a3f4c-77ab-7e10-b2d4-6c1e9f0a8d23", "expires_in_days": 90 }'
Response — 201 Created
{ "account_key": { "uuid": "019a4e2f-6c1d-7b3a-9e52-3f8d1c7a2b40", "name": "GitHub Actions deploy", "role": { "uuid": "019a3f4c-77ab-7e10-b2d4-6c1e9f0a8d23", "name": "CI deploy" }, "hint": "nak_…7Qx2", "created_at": "2026-11-02T14:58:40Z", "created_by": { "uuid": "019a52c2-ca1e-78ba-ab5c-50362cc29134", "name": "Maria Example" }, "last_used_at": null, "expires_at": "2027-01-31T14:58:40Z", "allowed_ips": "", "status": "active" }, "key": "nak_XmCJcYSSlOAdprvxObx4WpVthF2O6Ov1h0oL7Qx2", "notice": "Copy this key now. It won't be shown again." }
Error — 403 Forbidden (a role above yours)
{ "code": "permission_ceiling", "error": "You can't give a key more access than you have (billing:read)" }
Was this helpful?
On this page
Create Account Key
Was this helpful?