WoyraDocs
Get an API key

Mint an API key

POST/v1/api_keys

API keys · Requires an API key

Returns the token **once**; it is stored hashed and cannot be shown again.

A key can never grant a scope the key minting it does not itself hold — otherwise the ability to mint keys would be an escalation path to every permission on the account.

Set expires_in_days to rotate with an overlap window: mint the replacement, expire the old key, and both work until the window closes.

Body

FieldTypeDescription
namerequiredstring
modestring
One of live, test.
scopesrequiredarray of Scope
allowed_cidrsarray of stringRestricts the key to these source blocks.
expires_in_daysinteger

Example

curl -X POST https://api.woyra.io/v1/api_keys \
  -H "Authorization: Bearer $WOYRA_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "<name>",
    "scopes": []
  }'

Response

201 The key, including its token.

FieldTypeDescription
object"api_key"
idstring
namestring
modestring
One of live, test.
prefixstringThe indexed, non-secret portion. Identifies a key in logs without being usable.
scopesarray of Scope
created_attimestamp
last_used_attimestamp
expires_attimestamp
revoked_attimestamp
tokenstringPresent only in the response to creation. Store it now; it cannot be shown again.

Errors

StatusCodes
400invalid_request, unsupported_version
403insufficient_scope, domain_not_verified, recipient_suppressed, sending_paused, mfa_required

Also in API keys