Check authorization for an action
curl --request POST \
--url https://api.aion.xyz/api/v1/authorize/{proxy+} \
--header 'Authorization: Bearer <token>' \
--header 'X-Account-ID: <x-account-id>' \
--header 'X-Action: <x-action>' \
--header 'X-User-ID: <x-user-id>'import requests
url = "https://api.aion.xyz/api/v1/authorize/{proxy+}"
headers = {
"X-User-ID": "<x-user-id>",
"X-Account-ID": "<x-account-id>",
"X-Action": "<x-action>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-User-ID': '<x-user-id>',
'X-Account-ID': '<x-account-id>',
'X-Action': '<x-action>',
Authorization: 'Bearer <token>'
}
};
fetch('https://api.aion.xyz/api/v1/authorize/{proxy+}', 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.aion.xyz/api/v1/authorize/{proxy+}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Account-ID: <x-account-id>",
"X-Action: <x-action>",
"X-User-ID: <x-user-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aion.xyz/api/v1/authorize/{proxy+}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-User-ID", "<x-user-id>")
req.Header.Add("X-Account-ID", "<x-account-id>")
req.Header.Add("X-Action", "<x-action>")
req.Header.Add("Authorization", "Bearer <token>")
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.aion.xyz/api/v1/authorize/{proxy+}")
.header("X-User-ID", "<x-user-id>")
.header("X-Account-ID", "<x-account-id>")
.header("X-Action", "<x-action>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aion.xyz/api/v1/authorize/{proxy+}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-User-ID"] = '<x-user-id>'
request["X-Account-ID"] = '<x-account-id>'
request["X-Action"] = '<x-action>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"allowed": true,
"reason": "User has project_admin role"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Invalid request parameters",
"details": [
"accountId must be a valid identifier"
]
}
}{
"allowed": false,
"reason": "User does not have permission to perform this action"
}IAM
Check Authorization for an Action
Evaluate whether a user is authorized to perform a specific action on a resource. The proxy path represents the original request path being authorized.
POST
/
api
/
v1
/
authorize
/
{proxy+}
Check authorization for an action
curl --request POST \
--url https://api.aion.xyz/api/v1/authorize/{proxy+} \
--header 'Authorization: Bearer <token>' \
--header 'X-Account-ID: <x-account-id>' \
--header 'X-Action: <x-action>' \
--header 'X-User-ID: <x-user-id>'import requests
url = "https://api.aion.xyz/api/v1/authorize/{proxy+}"
headers = {
"X-User-ID": "<x-user-id>",
"X-Account-ID": "<x-account-id>",
"X-Action": "<x-action>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-User-ID': '<x-user-id>',
'X-Account-ID': '<x-account-id>',
'X-Action': '<x-action>',
Authorization: 'Bearer <token>'
}
};
fetch('https://api.aion.xyz/api/v1/authorize/{proxy+}', 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.aion.xyz/api/v1/authorize/{proxy+}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Account-ID: <x-account-id>",
"X-Action: <x-action>",
"X-User-ID: <x-user-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aion.xyz/api/v1/authorize/{proxy+}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-User-ID", "<x-user-id>")
req.Header.Add("X-Account-ID", "<x-account-id>")
req.Header.Add("X-Action", "<x-action>")
req.Header.Add("Authorization", "Bearer <token>")
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.aion.xyz/api/v1/authorize/{proxy+}")
.header("X-User-ID", "<x-user-id>")
.header("X-Account-ID", "<x-account-id>")
.header("X-Action", "<x-action>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aion.xyz/api/v1/authorize/{proxy+}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-User-ID"] = '<x-user-id>'
request["X-Account-ID"] = '<x-account-id>'
request["X-Action"] = '<x-action>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"allowed": true,
"reason": "User has project_admin role"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Invalid request parameters",
"details": [
"accountId must be a valid identifier"
]
}
}{
"allowed": false,
"reason": "User does not have permission to perform this action"
}Authorizations
JWT Bearer token authentication
Headers
The user identifier making the request
Example:
"john.doe"
The account identifier for the request context
Example:
"my-company-account"
The action being performed (e.g., "account:user:read", "project:instance:create")
Example:
"project:instance:create"
Path Parameters
The original request path being authorized (e.g., "projects/my-project/instances")
Example:
"projects/my-project/instances"
