curl --request POST \
--url https://haico.gr/api/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": "read,write",
"expires_in_days": 1825
}
'import requests
url = "https://haico.gr/api/keys"
payload = {
"name": "<string>",
"scopes": "read,write",
"expires_in_days": 1825
}
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: '<string>', scopes: 'read,write', expires_in_days: 1825})
};
fetch('https://haico.gr/api/keys', 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://haico.gr/api/keys",
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' => 'read,write',
'expires_in_days' => 1825
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://haico.gr/api/keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": \"read,write\",\n \"expires_in_days\": 1825\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://haico.gr/api/keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": \"read,write\",\n \"expires_in_days\": 1825\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://haico.gr/api/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": \"read,write\",\n \"expires_in_days\": 1825\n}"
response = http.request(request)
puts response.read_body{
"key": {
"id": 123,
"name": "<string>",
"key_prefix": "<string>",
"last_four": "<string>",
"scopes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"active": true,
"last_used_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
},
"plaintext": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Key
Mint a personal access token and return its plaintext once.
The plaintext is not stored, so this response is the only opportunity to capture it. A caller who loses it must revoke the key and mint another.
Raises: HTTPException 400: If the requested scopes are not recognised. HTTPException 409: If the caller already holds the maximum active keys.
curl --request POST \
--url https://haico.gr/api/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": "read,write",
"expires_in_days": 1825
}
'import requests
url = "https://haico.gr/api/keys"
payload = {
"name": "<string>",
"scopes": "read,write",
"expires_in_days": 1825
}
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: '<string>', scopes: 'read,write', expires_in_days: 1825})
};
fetch('https://haico.gr/api/keys', 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://haico.gr/api/keys",
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' => 'read,write',
'expires_in_days' => 1825
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://haico.gr/api/keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": \"read,write\",\n \"expires_in_days\": 1825\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://haico.gr/api/keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": \"read,write\",\n \"expires_in_days\": 1825\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://haico.gr/api/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": \"read,write\",\n \"expires_in_days\": 1825\n}"
response = http.request(request)
puts response.read_body{
"key": {
"id": 123,
"name": "<string>",
"key_prefix": "<string>",
"last_four": "<string>",
"scopes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"active": true,
"last_used_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
},
"plaintext": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
A personal access token (haico_pat_...), created under Profile → API keys. Send it as Authorization: Bearer <key>. The browser session JWT is also accepted but is an internal mechanism and is not part of the public contract.
Body
Request to mint a new personal access token.
Label to recognise this key by, e.g. 'analysis laptop'
1 - 100'read' for safe methods only, 'read,write' for full access
read, read,write Lifetime in days. Omit for the default (90); 0 never expires.
0 <= x <= 3650Response
Successful Response
Response to key creation: the only time the plaintext is ever returned.
It is not stored anywhere, so a caller who loses it must revoke the key and mint another.