Create an API key
curl --request POST \
--url https://api.compute.anonalabs.com/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ci",
"preset": "create_and_use",
"expiresInDays": 90
}
'import requests
url = "https://api.compute.anonalabs.com/v1/api-keys"
payload = {
"name": "ci",
"preset": "create_and_use",
"expiresInDays": 90
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'ci', preset: 'create_and_use', expiresInDays: 90})
};
fetch('https://api.compute.anonalabs.com/v1/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"apiKey": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prefix": "<string>",
"preset": "read_only",
"scopes": [
"<string>"
],
"sandboxIds": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z"
},
"key": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}API keys
Create an API key
Creates an API key and returns its secret once. Dashboard sessions with the owner or admin role only.
POST
/
v1
/
api-keys
Create an API key
curl --request POST \
--url https://api.compute.anonalabs.com/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ci",
"preset": "create_and_use",
"expiresInDays": 90
}
'import requests
url = "https://api.compute.anonalabs.com/v1/api-keys"
payload = {
"name": "ci",
"preset": "create_and_use",
"expiresInDays": 90
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'ci', preset: 'create_and_use', expiresInDays: 90})
};
fetch('https://api.compute.anonalabs.com/v1/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"apiKey": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prefix": "<string>",
"preset": "read_only",
"scopes": [
"<string>"
],
"sandboxIds": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z"
},
"key": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}Authorizations
A dashboard session token (EdDSA JWT issued by app.compute.anonalabs.com). API keys are refused.
Body
application/json
Required string length:
1 - 64read_only: sandboxes:read, templates:read, usage:read.
use_existing: sandboxes:read, sandboxes:use.
create_and_use: sandboxes:read, use, create, delete; templates:read.
full_access: sandboxes:, templates:, usage:read, billing:read.
custom: the scopes you list.
Available options:
read_only, use_existing, create_and_use, full_access, custom Only with preset custom.
Available options:
sandboxes:read, sandboxes:use, sandboxes:create, sandboxes:delete, templates:read, templates:write, usage:read, billing:read, integrations:manage Limit the key to these sandbox IDs.
Omit or null for a key that never expires.
Available options:
7, 30, 90, 365