Create an API key
POST
/v1/api-keys
const url = 'https://api.staging.heliumid.io/v1/api-keys';const options = { method: 'POST', headers: { cookie: 'hl.session_token=<hl.session_token>', 'Content-Type': 'application/json' }, body: '{"name":"Backoffice server","role":"operator","expiresInDays":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.staging.heliumid.io/v1/api-keys \ --header 'Content-Type: application/json' \ --cookie hl.session_token=<hl.session_token> \ --data '{ "name": "Backoffice server", "role": "operator", "expiresInDays": 1 }'Signed-in people only. The key is in the response and never shown again. Its role can’t allow more than yours.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
string
Example
Backoffice serverrole
required
string
expiresInDays
integer
Responses
Section titled “Responses”The new key (shown once)
Media typeapplication/json
object
apiKey
required
object
id
required
string
name
required
string
prefix
required
string
role
required
string
environment
required
string
status
required
string
createdAt
required
string
lastUsedAt
required
string | null
expiresAt
required
string | null
revokedAt
required
string | null
key
required
string
Example
{ "apiKey": { "role": "operator", "environment": "test", "status": "active" }}Invalid request
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
correlationId
required
string
Example generated
{ "error": { "code": "example", "message": "example", "correlationId": "example" }}Not authenticated
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
correlationId
required
string
Example generated
{ "error": { "code": "example", "message": "example", "correlationId": "example" }}Not allowed (needs a signed-in person with api_key.manage)
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
correlationId
required
string
Example generated
{ "error": { "code": "example", "message": "example", "correlationId": "example" }}Too many active keys
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
correlationId
required
string
Example generated
{ "error": { "code": "example", "message": "example", "correlationId": "example" }}