curl --request POST \
--url https://api.example.com/api/keys/bootstrap \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"user_id": "<string>",
"bootstrap_token": ""
}
'import requests
url = "https://api.example.com/api/keys/bootstrap"
payload = {
"description": "<string>",
"user_id": "<string>",
"bootstrap_token": ""
}
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({description: '<string>', user_id: '<string>', bootstrap_token: ''})
};
fetch('https://api.example.com/api/keys/bootstrap', 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.example.com/api/keys/bootstrap",
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([
'description' => '<string>',
'user_id' => '<string>',
'bootstrap_token' => ''
]),
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.example.com/api/keys/bootstrap"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"user_id\": \"<string>\",\n \"bootstrap_token\": \"\"\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.example.com/api/keys/bootstrap")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"user_id\": \"<string>\",\n \"bootstrap_token\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/keys/bootstrap")
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 \"description\": \"<string>\",\n \"user_id\": \"<string>\",\n \"bootstrap_token\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"token": "<string>",
"user_id": "<string>"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Mint the first admin api key
Mint the first admin api key behind the secure-by-default token gate.
Only meaningful on an access-controlled install: with the gate OFF there is nothing to
protect, so the door refuses loudly with a 501 rather than minting. The per-IP backoff
is consulted BEFORE the token, so a wrong-token flood escalates a lockout that turns
further attempts away without ever comparing; a wrong/absent token is a generic 403 (no
oracle for the initialized state). The existence-check-and-mint runs under one mutex, so
two concurrent bootstraps can never both mint — the loser gets a 409. On a passing gate
a condition-free ["*"] admin key — the is_admin_policy discriminator — is minted
through the shared mint and returned ONCE.
Response mirrors the login result wire shape: {"data": {"token": <raw key>, "user_id": ...}}.
curl --request POST \
--url https://api.example.com/api/keys/bootstrap \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"user_id": "<string>",
"bootstrap_token": ""
}
'import requests
url = "https://api.example.com/api/keys/bootstrap"
payload = {
"description": "<string>",
"user_id": "<string>",
"bootstrap_token": ""
}
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({description: '<string>', user_id: '<string>', bootstrap_token: ''})
};
fetch('https://api.example.com/api/keys/bootstrap', 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.example.com/api/keys/bootstrap",
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([
'description' => '<string>',
'user_id' => '<string>',
'bootstrap_token' => ''
]),
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.example.com/api/keys/bootstrap"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"user_id\": \"<string>\",\n \"bootstrap_token\": \"\"\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.example.com/api/keys/bootstrap")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"user_id\": \"<string>\",\n \"bootstrap_token\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/keys/bootstrap")
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 \"description\": \"<string>\",\n \"user_id\": \"<string>\",\n \"bootstrap_token\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"token": "<string>",
"user_id": "<string>"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Body
Response
Success.
The one-time bootstrap result: the raw sk-… admin key and its user id.
Show child attributes
Show child attributes

