Generate API key
curl --request POST \
--url https://serva.servamind.com/keys \
--header 'Authorization: Bearer <token>'import requests
url = "https://serva.servamind.com/keys"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://serva.servamind.com/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://serva.servamind.com/keys",
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>"
],
]);
$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://serva.servamind.com/keys"
req, _ := http.NewRequest("POST", url, nil)
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://serva.servamind.com/keys")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://serva.servamind.com/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"key_id": "123e4567-e89b-12d3-a456-426614174001",
"key_prefix": "sk_live_ab12",
"raw_key": "sk_live_a1b2c3d4e5f6...",
"created_at": "2025-11-01T00:00:00Z"
}{
"detail": "Invalid or expired session token"
}{
"detail": "Invalid or expired session token"
}API keys
Generate API key
Generates a new Service API Key for programmatic access.
The raw_key is returned once only and never stored. Only the HMAC-SHA256 hash
is persisted in the database. Store the key immediately and securely.
POST
/
keys
Generate API key
curl --request POST \
--url https://serva.servamind.com/keys \
--header 'Authorization: Bearer <token>'import requests
url = "https://serva.servamind.com/keys"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://serva.servamind.com/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://serva.servamind.com/keys",
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>"
],
]);
$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://serva.servamind.com/keys"
req, _ := http.NewRequest("POST", url, nil)
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://serva.servamind.com/keys")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://serva.servamind.com/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"key_id": "123e4567-e89b-12d3-a456-426614174001",
"key_prefix": "sk_live_ab12",
"raw_key": "sk_live_a1b2c3d4e5f6...",
"created_at": "2025-11-01T00:00:00Z"
}{
"detail": "Invalid or expired session token"
}{
"detail": "Invalid or expired session token"
}Create a Service API key to authenticate programmatic requests. The raw key is shown once and never returned again.
Authorizations
Accepts one of three credential types (detected by format):
- Session token (
sess_...) — O(1) Redis lookup, 24h TTL. Preferred. - Google ID Token (JWT — three
.-separated base64 segments) — calls Google tokeninfo API per request. - Service API Key (
sk_live_...) — HMAC-SHA256 constant-time validation, never expires unless revoked.
Note: The web UI authenticates via a session httpOnly cookie (set during login).
The cookie is checked first; the Authorization header is the fallback for programmatic clients.
Response
API key created. Store raw_key immediately — it will not be shown again.

