Create API key

Creates a new API key for the authenticated workspace. The plaintext key is only returned in this creation response โ€” store it before navigating away. An existing API key can mint additional keys, matching common SaaS patterns; the very first key must be created via the dashboard since no API key exists yet.
https://api.unipost.dev
POST/v1/api-keys
Authorization
In header ยท Bearer <token>
Request Body
string

Authorization

AuthorizationBearer <token>In header
Workspace API key, or a Clerk session JWT for dashboard callers.

Request Body

namestring
Human-readable label for the key.
environment?"production" | "test"
Defaults to "production" when omitted.
expires_at?string
Optional RFC3339 expiration timestamp.

Response Body

201
idstring
API key record ID.
namestring
Human-readable key label.
keystring
Full plaintext API key. Returned only once at creation time.
prefixstring
Safe prefix for future display.
environmentstring
"production" or "test".
created_atstring
Creation timestamp.
request_idstring
Request identifier for debugging and support.
401
error.codestring
Usually "VALIDATION_ERROR" or "UNAUTHORIZED".
error.normalized_codestring
Lowercase alias such as "validation_error".
error.messagestring
Human-readable error message.
request_idstring
Request identifier for debugging and support.
422
error.codestring
Usually "VALIDATION_ERROR" or "UNAUTHORIZED".
error.normalized_codestring
Lowercase alias such as "validation_error".
error.messagestring
Human-readable error message.
request_idstring
Request identifier for debugging and support.
500
error.codestring
Usually "VALIDATION_ERROR" or "UNAUTHORIZED".
error.normalized_codestring
Lowercase alias such as "validation_error".
error.messagestring
Human-readable error message.
request_idstring
Request identifier for debugging and support.