Create an API key
POST/apis/:id/keys
Creates a new API key scoped to a single environment. Keys are shown in full exactly once — store the returned
rawKey immediately.Authentication
All requests to the Relay API must include a workspace-level access token in the Authorization header. This endpoint cannot be called with a scoped API key — only a workspace owner or admin token.
Note — the response's
rawKey field is only ever returned on creation. Relay does not store or display full key values afterward.Path Parameters
idrequired
integer
The ID of the API you are creating this key for.
Body Parameters
namerequired
string
A human-readable label for this key, e.g. "CI pipeline".
environment
string
Defaults to
production. One of production, staging, development.Response
Returns the created key object, including the plaintext secret (shown once).