curl --request POST \
--url https://{host}/api/llm-gateway/admin/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_email": "<string>",
"scopes": [
"<string>"
],
"group_name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://{host}/api/llm-gateway/admin/api-keys"
payload = {
"name": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_email": "<string>",
"scopes": ["<string>"],
"group_name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
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>',
user_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
user_email: '<string>',
scopes: ['<string>'],
group_name: '<string>',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://{host}/api/llm-gateway/admin/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://{host}/api/llm-gateway/admin/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>',
'user_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'user_email' => '<string>',
'scopes' => [
'<string>'
],
'group_name' => '<string>',
'expires_at' => '2023-11-07T05:31:56Z'
]),
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://{host}/api/llm-gateway/admin/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"user_email\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"group_name\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\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://{host}/api/llm-gateway/admin/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"user_email\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"group_name\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/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 \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"user_email\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"group_name\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"key_prefix": "<string>",
"key": "bd-abcd1234ef56...",
"scopes": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"group_name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}{
"error": "BadRequest",
"message": "request_timeout_secs must be between 1 and 3600"
}Create an Org API Key
Creates a new bd-... gateway API key. The raw key is returned in
this response and never again — copy it immediately. Either assign
the key to a user_id or bind it to a group_name; not both.
curl --request POST \
--url https://{host}/api/llm-gateway/admin/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_email": "<string>",
"scopes": [
"<string>"
],
"group_name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://{host}/api/llm-gateway/admin/api-keys"
payload = {
"name": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_email": "<string>",
"scopes": ["<string>"],
"group_name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
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>',
user_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
user_email: '<string>',
scopes: ['<string>'],
group_name: '<string>',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://{host}/api/llm-gateway/admin/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://{host}/api/llm-gateway/admin/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>',
'user_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'user_email' => '<string>',
'scopes' => [
'<string>'
],
'group_name' => '<string>',
'expires_at' => '2023-11-07T05:31:56Z'
]),
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://{host}/api/llm-gateway/admin/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"user_email\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"group_name\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\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://{host}/api/llm-gateway/admin/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"user_email\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"group_name\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/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 \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"user_email\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"group_name\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"key_prefix": "<string>",
"key": "bd-abcd1234ef56...",
"scopes": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"group_name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}{
"error": "BadRequest",
"message": "request_timeout_secs must be between 1 and 3600"
}bd-… API key for the LLM Gateway runtime
(/v1/chat/completions, /v1/messages, /v1/embeddings, etc.).
- per-user/per-group token budgets
- per-user/per-group rate limits
- per-user/per-group model access policies
Example: a CI service-account key
curl -X POST https://app.barndoor.ai/api/llm-gateway/admin/api-keys \
-H "Authorization: Bearer $BARNDOOR_JWT" \
-H "Content-Type: application/json" \
-d '{
"name": "GitHub Actions runner",
"group_name": "ci",
"expires_at": "2026-12-31T23:59:59Z"
}'
key. From that point on, callers can use it as:
curl https://app.barndoor.ai/api/llm-gateway/v1/chat/completions \
-H "Authorization: Bearer bd-..." \
-H "Content-Type: application/json" \
-d '{ "model": "gpt-4o-mini", "messages": [...] }'
DELETE /admin/api-keys/{id}.Authorizations
JWT obtained through Barndoor's authentication flow. Pass the token
verbatim in Authorization: Bearer <token>. Use the Barndoor SDK's
loginInteractive() helper to obtain a token in scripts and notebooks.
Body
Assign the key to a specific user. Mutually exclusive with group_name.
Optional override for the email recorded on the key
Bind the key to an IdP group. Members of the group share the
group-scoped budgets, rate limits, and access policies.
Mutually exclusive with user_id.
Response
The newly created key (only response that contains the raw key)
The raw API key. Returned only at creation time and never stored
in plaintext — copy it immediately. Use this value as
Authorization: Bearer <key> (or x-api-key: <key>) on requests
to /v1/chat/completions, /v1/messages, and friends.
"bd-abcd1234ef56..."