curl --request POST \
--url https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens \
--header 'Content-Type: application/json' \
--cookie apsio_session= \
--data '
{
"name": "<string>",
"scopes": [],
"days": 90
}
'import requests
url = "https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens"
payload = {
"name": "<string>",
"scopes": [],
"days": 90
}
headers = {
"cookie": "apsio_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'apsio_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: [], days: 90})
};
fetch('https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens', 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.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens",
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([
'name' => '<string>',
'scopes' => [
],
'days' => 90
]),
CURLOPT_COOKIE => "apsio_session=",
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.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [],\n \"days\": 90\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "apsio_session=")
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.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens")
.header("cookie", "apsio_session=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [],\n \"days\": 90\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'apsio_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [],\n \"days\": 90\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"name": "<string>",
"scopes": [
"dashboards:write"
],
"created_by": "<string>",
"created_by_name": "<string>",
"created_at": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"token": "<string>"
}Create a project token
A token that reads this project, and writes only with the scopes chosen, for 7, 30, 90, 365 days (90 by default). Owners and admins, from a console session only. The token is in this answer only: Apsio keeps its id, never the token.
curl --request POST \
--url https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens \
--header 'Content-Type: application/json' \
--cookie apsio_session= \
--data '
{
"name": "<string>",
"scopes": [],
"days": 90
}
'import requests
url = "https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens"
payload = {
"name": "<string>",
"scopes": [],
"days": 90
}
headers = {
"cookie": "apsio_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'apsio_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: [], days: 90})
};
fetch('https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens', 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.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens",
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([
'name' => '<string>',
'scopes' => [
],
'days' => 90
]),
CURLOPT_COOKIE => "apsio_session=",
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.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [],\n \"days\": 90\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "apsio_session=")
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.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens")
.header("cookie", "apsio_session=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [],\n \"days\": 90\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apsio.io/v1/orgs/{orgId}/projects/{projectId}/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'apsio_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [],\n \"days\": 90\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"name": "<string>",
"scopes": [
"dashboards:write"
],
"created_by": "<string>",
"created_by_name": "<string>",
"created_at": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"token": "<string>"
}Authorizations
The console session, set by /v1/auth/callback (__Host-apsio_session when host-only).
Path Parameters
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"0192f3a4-0000-7000-8000-00000000a001"
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"0192f3a4-0000-7000-8000-00000000a001"
Body
1 - 1002A write scope besides reading: dashboards:write (create and edit dashboards, never delete) or issues:write (change issue states and assignees).
dashboards:write, issues:write How long the token lasts, in days.
7 Response
The token, once
The token's id (its jti); never the token.
Write scopes; empty: the token only reads.
A write scope besides reading: dashboards:write (create and edit dashboards, never delete) or issues:write (change issue states and assignees).
dashboards:write, issues:write Empty for a token Apsio staff made, or a user since erased.
Written at most every 5 minutes.
The token itself (apsio_pt_v0…), shown this once. Keep it as APSIO_TOKEN; Apsio cannot show it again.