プロジェクト API キーを作成
Management key required. プロジェクトに紐付くモデル API キーを作成します。キーは一度だけ返されます。
URL の api_key_id は、モデル API キーの作成(POST /public/v1/api-keys)のレスポンスに含まれる id(ak_... 形式)です。 無効化、削除、利用上限の設定、使用量の照会に使うため保存してください。レスポンスの key(apikey-...)はモデル呼び出し用です。管理操作の認証ヘッダーには引き続き mgmt-... を指定します。
Management key required. Use a Management API Key (mgmt-...) for your Team, created by a Team Owner.
Create a model API key (apikey-...) bound to the specified active project. This returns a model key, not another management key. The model key owner is the current Team Owner. Existing account, project and member spending rules apply; this endpoint does not set an additional key-level allowance.
Save both fields from the successful creation response: id is the stable ak_... identifier to use as {api_key_id} in the disable, delete, allowance and usage URLs. The JSON field is named id. The key field is the apikey-... secret for model calls and is returned only once. Management calls continue to use mgmt-... in the authorization header.
For example, an id of ak_0123456789ABCDEFGHIJKL gives the usage URL /public/v1/api-keys/ak_0123456789ABCDEFGHIJKL/usage. The Public API currently has no key list endpoint; save id when creating the key.
Key names must be unique among non-deleted keys in the account. Retrying with the same name returns 409 and does not recover the original secret. There is currently no fixed per-account or per-project key count limit. Request rate limits still apply.
Authorization
ManagementKeyBearer Management key required. Send Authorization: Bearer mgmt-....
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/public/v1/api-keys" \ -H "Content-Type: application/json" \ -d '{ "name": "customer-123-primary", "project_id": "019a6eab-7c00-7000-8000-000000000123" }'{ "object": "api_key", "id": "ak_0123456789ABCDEFGHIJKL", "name": "customer-123-primary", "project_id": "019a6eab-7c00-7000-8000-000000000123", "key": "apikey-REPLACE_WITH_SECRET_RETURNED_ONCE", "redacted": "apikey-xxxx********xxxx", "enabled": true, "created_at": "2026-11-11T00:00:00Z", "expires_at": null, "request_id": "req_example"}Last updated on