Create project API key

Creates a new API key for the specified project. API keys are used for authenticating requests to the API. This endpoint generates a new key with the provided name and returns the complete key details including the actual key value. Note that the full API key value is only returned once at creation time and cannot be retrieved later, so it should be securely stored immediately.

Path parameters

projectIdstringRequiredformat: "projectId"

Unique identifier (Nano ID) of the project to create an API key for

Headers

x-api-keystringRequired

Request

This endpoint expects an object.
namestringRequired

A user-friendly name to identify the API key’s purpose (e.g., “Production Server”, “Test Environment”)

Response

API key created successfully. The response includes the full API key value that should be stored securely, as it cannot be retrieved again later.

idstring

Database record identifier for the API key

namestring

Descriptive name assigned to help identify the key’s purpose

keystring

The API key string value that should be included in API requests. This value is only shown once at creation time.

created_atstringformat: "date-time"

UTC timestamp indicating when the API key was created

createdAtstringformat: "date-time"Deprecated

UTC timestamp indicating when the API key was created. DEPRECATED: Use created_at instead.

last_used_atstringOptionalformat: "date-time"

UTC timestamp indicating when the API key was last used for authentication. Will be null for newly created keys.