Create Endpoint API Key
Mint a new client-facing API key on this endpoint. Visitors will present the returned plain_key (format: etk_ + 64 hex chars) to authenticate. The platform stores only a bcrypt hash — the plaintext is shown once in this response and cannot be retrieved later. If lost, delete the key and create a new one.
Maximum 50 keys per endpoint. Set rate_limit_rps to enforce a per-key throughput cap (independent of the endpoint's overall traffic policies). Set expires_in_days for keys that should auto-revoke after a fixed window — recommended for keys handed to third parties.
Path parameters
uuid string (uuid) Req
Endpoint UUID.
Request body
name string Req
Friendly label. Required, max 100 chars. Pick something identifying ("mobile-ios", "partner-acme").
rate_limit_rps int
Per-key requests-per-second cap.
0 (default) = no per-key limit.expires_in_days int
Optional. Days until the key auto-expires. Omit for non-expiring keys. Recommended for third-party integrations.
Response (201 Created)
key object
The key metadata, same shape as list entries.
plain_key string
The full secret. Format:
etk_ + 64 hex chars. Shown only once — store it now.Errors
400 Bad Request
Missing
name, name > 100 chars, exceeded 50-keys-per-endpoint limit, or invalid JSON.401 Unauthorized
Missing auth.
403 Forbidden
Endpoint doesn't exist or doesn't belong to you.
500
Crypto or database error. Safe to retry; a partial key may have been created (use list to verify).
Request
curl -X POST "https://api.ngris.com/v1/endpoints/<uuid>/api-keys" \
-H "X-API-KEY: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "mobile-ios",
"rate_limit_rps": 100,
"expires_in_days": 90
}'
Python
from ngris import Ngris
client = Ngris(api_key="<your_api_key>")
result = client._post_raw("/endpoints/<endpoint_uuid>/api-keys", {
"name": "mobile-ios",
"rate_limit_rps": 100,
"expires_in_days": 90,
})
print("Save this:", result["plain_key"])
Response — 201 Created
{
"key": {
"id": 11,
"uuid": "abc-123",
"name": "mobile-ios",
"key_prefix": "etk_a1b2c3",
"rate_limit_rps": 100,
"is_active": true,
"expires_at": "2026-07-28T13:00:00Z",
"created_at": "2026-04-29T13:00:00Z"
},
"plain_key": "etk_a1b2c3d4e5f6...64hexchars"
}