Tokens
Authorize token for resource access
Verify a token header and validate it against a requested access scope.
POST
/
v1
/
tokens
/
authorize
Authorize token for resource access
curl --request POST \
--url https://api.machines.dev/v1/tokens/authorize \
--header 'Content-Type: application/json' \
--data '
{
"access": {
"action": "<unknown>",
"app_feature": "<string>",
"app_name": "<string>",
"command": [
"<string>"
],
"machine_feature": "<string>",
"machine_id": "<string>",
"mutation": "<string>",
"org_feature": "<string>",
"org_slug": "<string>",
"source_machine": "<string>",
"storage_object": "<string>",
"volume_id": "<string>"
},
"header": "<string>"
}
'import requests
url = "https://api.machines.dev/v1/tokens/authorize"
payload = {
"access": {
"action": "<unknown>",
"app_feature": "<string>",
"app_name": "<string>",
"command": ["<string>"],
"machine_feature": "<string>",
"machine_id": "<string>",
"mutation": "<string>",
"org_feature": "<string>",
"org_slug": "<string>",
"source_machine": "<string>",
"storage_object": "<string>",
"volume_id": "<string>"
},
"header": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
access: {
action: '<unknown>',
app_feature: '<string>',
app_name: '<string>',
command: ['<string>'],
machine_feature: '<string>',
machine_id: '<string>',
mutation: '<string>',
org_feature: '<string>',
org_slug: '<string>',
source_machine: '<string>',
storage_object: '<string>',
volume_id: '<string>'
},
header: '<string>'
})
};
fetch('https://api.machines.dev/v1/tokens/authorize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.machines.dev/v1/tokens/authorize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'access' => [
'action' => '<unknown>',
'app_feature' => '<string>',
'app_name' => '<string>',
'command' => [
'<string>'
],
'machine_feature' => '<string>',
'machine_id' => '<string>',
'mutation' => '<string>',
'org_feature' => '<string>',
'org_slug' => '<string>',
'source_machine' => '<string>',
'storage_object' => '<string>',
'volume_id' => '<string>'
],
'header' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.machines.dev/v1/tokens/authorize"
payload := strings.NewReader("{\n \"access\": {\n \"action\": \"<unknown>\",\n \"app_feature\": \"<string>\",\n \"app_name\": \"<string>\",\n \"command\": [\n \"<string>\"\n ],\n \"machine_feature\": \"<string>\",\n \"machine_id\": \"<string>\",\n \"mutation\": \"<string>\",\n \"org_feature\": \"<string>\",\n \"org_slug\": \"<string>\",\n \"source_machine\": \"<string>\",\n \"storage_object\": \"<string>\",\n \"volume_id\": \"<string>\"\n },\n \"header\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.machines.dev/v1/tokens/authorize")
.header("Content-Type", "application/json")
.body("{\n \"access\": {\n \"action\": \"<unknown>\",\n \"app_feature\": \"<string>\",\n \"app_name\": \"<string>\",\n \"command\": [\n \"<string>\"\n ],\n \"machine_feature\": \"<string>\",\n \"machine_id\": \"<string>\",\n \"mutation\": \"<string>\",\n \"org_feature\": \"<string>\",\n \"org_slug\": \"<string>\",\n \"source_machine\": \"<string>\",\n \"storage_object\": \"<string>\",\n \"volume_id\": \"<string>\"\n },\n \"header\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/tokens/authorize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"access\": {\n \"action\": \"<unknown>\",\n \"app_feature\": \"<string>\",\n \"app_name\": \"<string>\",\n \"command\": [\n \"<string>\"\n ],\n \"machine_feature\": \"<string>\",\n \"machine_id\": \"<string>\",\n \"mutation\": \"<string>\",\n \"org_feature\": \"<string>\",\n \"org_slug\": \"<string>\",\n \"source_machine\": \"<string>\",\n \"storage_object\": \"<string>\",\n \"volume_id\": \"<string>\"\n },\n \"header\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"access": {
"action": 1,
"app_feature": "<string>",
"appid": 123,
"cluster": "<string>",
"command": [
"<string>"
],
"feature": "<string>",
"machine": "<string>",
"machine_feature": "<string>",
"mutation": "<string>",
"orgid": 123,
"sourceApp": "<string>",
"sourceMachine": "<string>",
"sourceOrganization": "<string>",
"storage_object": "<string>",
"volume": "<string>"
},
"verified_token": {
"caveats": {
"caveats": [
{}
]
},
"header": "<string>",
"nonce": {
"kid": [
123
],
"proof": true,
"rnd": [
123
]
},
"permission_token": [
123
]
}
}{
"details": {},
"error": "<string>",
"status": "unknown"
}{
"details": {},
"error": "<string>",
"status": "unknown"
}⌘I
Authorize token for resource access
curl --request POST \
--url https://api.machines.dev/v1/tokens/authorize \
--header 'Content-Type: application/json' \
--data '
{
"access": {
"action": "<unknown>",
"app_feature": "<string>",
"app_name": "<string>",
"command": [
"<string>"
],
"machine_feature": "<string>",
"machine_id": "<string>",
"mutation": "<string>",
"org_feature": "<string>",
"org_slug": "<string>",
"source_machine": "<string>",
"storage_object": "<string>",
"volume_id": "<string>"
},
"header": "<string>"
}
'import requests
url = "https://api.machines.dev/v1/tokens/authorize"
payload = {
"access": {
"action": "<unknown>",
"app_feature": "<string>",
"app_name": "<string>",
"command": ["<string>"],
"machine_feature": "<string>",
"machine_id": "<string>",
"mutation": "<string>",
"org_feature": "<string>",
"org_slug": "<string>",
"source_machine": "<string>",
"storage_object": "<string>",
"volume_id": "<string>"
},
"header": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
access: {
action: '<unknown>',
app_feature: '<string>',
app_name: '<string>',
command: ['<string>'],
machine_feature: '<string>',
machine_id: '<string>',
mutation: '<string>',
org_feature: '<string>',
org_slug: '<string>',
source_machine: '<string>',
storage_object: '<string>',
volume_id: '<string>'
},
header: '<string>'
})
};
fetch('https://api.machines.dev/v1/tokens/authorize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.machines.dev/v1/tokens/authorize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'access' => [
'action' => '<unknown>',
'app_feature' => '<string>',
'app_name' => '<string>',
'command' => [
'<string>'
],
'machine_feature' => '<string>',
'machine_id' => '<string>',
'mutation' => '<string>',
'org_feature' => '<string>',
'org_slug' => '<string>',
'source_machine' => '<string>',
'storage_object' => '<string>',
'volume_id' => '<string>'
],
'header' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.machines.dev/v1/tokens/authorize"
payload := strings.NewReader("{\n \"access\": {\n \"action\": \"<unknown>\",\n \"app_feature\": \"<string>\",\n \"app_name\": \"<string>\",\n \"command\": [\n \"<string>\"\n ],\n \"machine_feature\": \"<string>\",\n \"machine_id\": \"<string>\",\n \"mutation\": \"<string>\",\n \"org_feature\": \"<string>\",\n \"org_slug\": \"<string>\",\n \"source_machine\": \"<string>\",\n \"storage_object\": \"<string>\",\n \"volume_id\": \"<string>\"\n },\n \"header\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.machines.dev/v1/tokens/authorize")
.header("Content-Type", "application/json")
.body("{\n \"access\": {\n \"action\": \"<unknown>\",\n \"app_feature\": \"<string>\",\n \"app_name\": \"<string>\",\n \"command\": [\n \"<string>\"\n ],\n \"machine_feature\": \"<string>\",\n \"machine_id\": \"<string>\",\n \"mutation\": \"<string>\",\n \"org_feature\": \"<string>\",\n \"org_slug\": \"<string>\",\n \"source_machine\": \"<string>\",\n \"storage_object\": \"<string>\",\n \"volume_id\": \"<string>\"\n },\n \"header\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/tokens/authorize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"access\": {\n \"action\": \"<unknown>\",\n \"app_feature\": \"<string>\",\n \"app_name\": \"<string>\",\n \"command\": [\n \"<string>\"\n ],\n \"machine_feature\": \"<string>\",\n \"machine_id\": \"<string>\",\n \"mutation\": \"<string>\",\n \"org_feature\": \"<string>\",\n \"org_slug\": \"<string>\",\n \"source_machine\": \"<string>\",\n \"storage_object\": \"<string>\",\n \"volume_id\": \"<string>\"\n },\n \"header\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"access": {
"action": 1,
"app_feature": "<string>",
"appid": 123,
"cluster": "<string>",
"command": [
"<string>"
],
"feature": "<string>",
"machine": "<string>",
"machine_feature": "<string>",
"mutation": "<string>",
"orgid": 123,
"sourceApp": "<string>",
"sourceMachine": "<string>",
"sourceOrganization": "<string>",
"storage_object": "<string>",
"volume": "<string>"
},
"verified_token": {
"caveats": {
"caveats": [
{}
]
},
"header": "<string>",
"nonce": {
"kid": [
123
],
"proof": true,
"rnd": [
123
]
},
"permission_token": [
123
]
}
}{
"details": {},
"error": "<string>",
"status": "unknown"
}{
"details": {},
"error": "<string>",
"status": "unknown"
}