API tokens
List every API token
curl
curl -X GET "https://appliance.example.com/api/v1/apiTokens" \
-H "Authorization: Bearer $TOKEN"
PHP
<?php
$url = 'https://appliance.example.com/api/v1/apiTokens';
$headers = [
'Authorization: Bearer ' . $token,
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests
headers = {"Authorization": f"Bearer {token}"}
response = requests.get("https://appliance.example.com/api/v1/apiTokens", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/apiTokens', {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
},
});
const data = await response.json();
Bruno
meta {
name: List every API token
type: http
seq: 1
}
get {
url: https://{{node-0}}:{{port}}/api/v1/apiTokens
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
Response
{
"status": "success",
"message": "Personal Access Tokens",
"data": []
}
Current token
curl
curl -X GET "https://appliance.example.com/api/v1/apiTokens/current" \
-H "Authorization: Bearer $TOKEN"
PHP
<?php
$url = 'https://appliance.example.com/api/v1/apiTokens/current';
$headers = [
'Authorization: Bearer ' . $token,
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests
headers = {"Authorization": f"Bearer {token}"}
response = requests.get("https://appliance.example.com/api/v1/apiTokens/current", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/apiTokens/current', {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
},
});
const data = await response.json();
Bruno
meta {
name: List your own API tokens
type: http
seq: 1
}
get {
url: https://{{node-0}}:{{port}}/api/v1/apiTokens/current
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
Response
{
"status": "success",
"message": "Your Personal Access Tokens",
"data": []
}
curl
curl -X POST "https://appliance.example.com/api/v1/apiTokens/current" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "<description>",
"expiryDays": 0,
"scope": [
"<scope>"
]
}'
PHP
<?php
$url = 'https://appliance.example.com/api/v1/apiTokens/current';
$headers = [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
];
$payload = [
'description' => '<description>',
'expiryDays' => 0,
'scope' => [
'<scope>',
],
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests
headers = {"Authorization": f"Bearer {token}"}
payload = {
"description": "<description>",
"expiryDays": 0,
"scope": [
"<scope>"
]
}
response = requests.post("https://appliance.example.com/api/v1/apiTokens/current", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/apiTokens/current', {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"description": "<description>",
"expiryDays": 0,
"scope": [
"<scope>"
]
}),
});
const data = await response.json();
Bruno
meta {
name: Create an API token for yourself
type: http
seq: 1
}
post {
url: https://{{node-0}}:{{port}}/api/v1/apiTokens/current
body: json
auth: bearer
}
headers {
Content-Type: application/json
}
auth:bearer {
token: {{token}}
}
body:json {
{
"description": "<description>",
"expiryDays": 0,
"scope": [
"<scope>"
]
}
}
Response
{
"status": "success",
"message": "Personal Access Token created",
"data": {
"id": "<id>",
"token": "<token>"
}
}
Revoke one of your own API tokens
curl
curl -X DELETE "https://appliance.example.com/api/v1/apiTokens/current/{id}" \
-H "Authorization: Bearer $TOKEN"
PHP
<?php
$url = 'https://appliance.example.com/api/v1/apiTokens/current/{id}';
$headers = [
'Authorization: Bearer ' . $token,
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests
headers = {"Authorization": f"Bearer {token}"}
response = requests.delete("https://appliance.example.com/api/v1/apiTokens/current/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/apiTokens/current/{id}', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${token}`,
},
});
const data = await response.json();
Bruno
meta {
name: Revoke one of your own API tokens
type: http
seq: 1
}
delete {
url: https://{{node-0}}:{{port}}/api/v1/apiTokens/current/{id}
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
Response
{
"status": "success",
"message": "Personal Access Token revoked",
"data": []
}
List the API tokens of a user
curl
curl -X GET "https://appliance.example.com/api/v1/apiTokens/user/{userId}" \
-H "Authorization: Bearer $TOKEN"
PHP
<?php
$url = 'https://appliance.example.com/api/v1/apiTokens/user/{userId}';
$headers = [
'Authorization: Bearer ' . $token,
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests
headers = {"Authorization": f"Bearer {token}"}
response = requests.get("https://appliance.example.com/api/v1/apiTokens/user/{userId}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/apiTokens/user/{userId}', {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
},
});
const data = await response.json();
Bruno
meta {
name: List the API tokens of a user
type: http
seq: 1
}
get {
url: https://{{node-0}}:{{port}}/api/v1/apiTokens/user/{userId}
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
Response
{
"status": "success",
"message": "Personal Access Tokens",
"data": []
}
Revoke an API token
curl
curl -X DELETE "https://appliance.example.com/api/v1/apiTokens/{id}" \
-H "Authorization: Bearer $TOKEN"
PHP
<?php
$url = 'https://appliance.example.com/api/v1/apiTokens/{id}';
$headers = [
'Authorization: Bearer ' . $token,
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests
headers = {"Authorization": f"Bearer {token}"}
response = requests.delete("https://appliance.example.com/api/v1/apiTokens/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/apiTokens/{id}', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${token}`,
},
});
const data = await response.json();
Bruno
meta {
name: Revoke an API token
type: http
seq: 1
}
delete {
url: https://{{node-0}}:{{port}}/api/v1/apiTokens/{id}
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
Response
{
"status": "success",
"message": "Personal Access Token revoked",
"data": []
}