curl --request POST \
--url https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"group_name": "<string>",
"fixed_lifetime": true,
"max_lifetime_days": 123,
"require_expiry": true
}
'import requests
url = "https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups"
payload = {
"group_name": "<string>",
"fixed_lifetime": True,
"max_lifetime_days": 123,
"require_expiry": True
}
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({
group_name: '<string>',
fixed_lifetime: true,
max_lifetime_days: 123,
require_expiry: true
})
};
fetch('https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups', 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-key-lifetime-policies/groups",
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([
'group_name' => '<string>',
'fixed_lifetime' => true,
'max_lifetime_days' => 123,
'require_expiry' => true
]),
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-key-lifetime-policies/groups"
payload := strings.NewReader("{\n \"group_name\": \"<string>\",\n \"fixed_lifetime\": true,\n \"max_lifetime_days\": 123,\n \"require_expiry\": true\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-key-lifetime-policies/groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"group_name\": \"<string>\",\n \"fixed_lifetime\": true,\n \"max_lifetime_days\": 123,\n \"require_expiry\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups")
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 \"group_name\": \"<string>\",\n \"fixed_lifetime\": true,\n \"max_lifetime_days\": 123,\n \"require_expiry\": true\n}"
response = http.request(request)
puts response.read_body{
"fixed_lifetime": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"require_expiry": true,
"updated_at": "2023-11-07T05:31:56Z",
"group_name": "<string>",
"max_lifetime_days": 123,
"updated_by_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Create a group API key lifetime override
Override the default for members of one IdP group. An override replaces the default for its members, so one with neither field set exempts the group. A user in several overridden groups gets the strictest: the shortest maximum, and an expiry required if any requires one.
curl --request POST \
--url https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"group_name": "<string>",
"fixed_lifetime": true,
"max_lifetime_days": 123,
"require_expiry": true
}
'import requests
url = "https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups"
payload = {
"group_name": "<string>",
"fixed_lifetime": True,
"max_lifetime_days": 123,
"require_expiry": True
}
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({
group_name: '<string>',
fixed_lifetime: true,
max_lifetime_days: 123,
require_expiry: true
})
};
fetch('https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups', 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-key-lifetime-policies/groups",
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([
'group_name' => '<string>',
'fixed_lifetime' => true,
'max_lifetime_days' => 123,
'require_expiry' => true
]),
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-key-lifetime-policies/groups"
payload := strings.NewReader("{\n \"group_name\": \"<string>\",\n \"fixed_lifetime\": true,\n \"max_lifetime_days\": 123,\n \"require_expiry\": true\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-key-lifetime-policies/groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"group_name\": \"<string>\",\n \"fixed_lifetime\": true,\n \"max_lifetime_days\": 123,\n \"require_expiry\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/api-key-lifetime-policies/groups")
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 \"group_name\": \"<string>\",\n \"fixed_lifetime\": true,\n \"max_lifetime_days\": 123,\n \"require_expiry\": true\n}"
response = http.request(request)
puts response.read_body{
"fixed_lifetime": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"require_expiry": true,
"updated_at": "2023-11-07T05:31:56Z",
"group_name": "<string>",
"max_lifetime_days": 123,
"updated_by_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Authorizations
A Barndoor API key, sent as Authorization: Bearer <key>. Keys are prefixed bdai_ and are opaque — do not attempt to decode one. Interchangeable with an OAuth 2.0 access token.
Body
Response
The created record
One stored row: the org default (group_name: None) or a group override.
Every key gets exactly max_lifetime_days and the user doesn't choose
(BCP-5229). Requires max_lifetime_days.
The key must have an expiry, even when there is no maximum.
None for the org default; otherwise the IdP group this overrides it for.
Longest a key may live, in days from when it is created or rotated.
None = no maximum. A maximum also rules out a never-expiring key.