Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview

Create an account key

Creates a key that acts as your account, with the roles you hold when the key is used. You must be logged in: a session or the key luna login made. The key is shown once.

POST/_luna/auth/keys
Authorization
AuthorizationBearer token · headerrequired

An account key (la_…), an API key (lt_…) or a session token (ls_…). The scopes listed are the permissions the operation needs.

Request body
requiredapplication/json
namestringrequired
accessstringrequired

read or write. A read key cannot change anything.

expiresIninteger<int64> | null

Seconds from now until the key expires. Leave it out for a key that does not expire.

min 0
Responses
200

The new key.

idstringrequired
keystringrequired

The key itself (la_…). Luna keeps only its hash.

expiresMsinteger<int64> | null

When the key expires, in milliseconds since the Unix epoch.

min 0
default

The request failed. The status says how and error.message says why.

errorErrorDetailrequired
Show properties
codestring | null

A code for programs to branch on, when the error has one.

messagestringrequired

What went wrong, in a sentence a person can read.

Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'https://luna.example.com/_luna/auth/keys' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "access": "string",
  "expiresIn": 0
}'
Response
{
  "id": "string",
  "key": "string",
  "expiresMs": 0
}

Was this page helpful?