curl --request POST \
--url https://{host}/api/llm-gateway/admin/routing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"name": "<string>",
"deny_slots": [
123
],
"enabled": true,
"floor_slot": 123
}
'import requests
url = "https://{host}/api/llm-gateway/admin/routing-rules"
payload = {
"description": "<string>",
"name": "<string>",
"deny_slots": [123],
"enabled": True,
"floor_slot": 123
}
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({
description: '<string>',
name: '<string>',
deny_slots: [123],
enabled: true,
floor_slot: 123
})
};
fetch('https://{host}/api/llm-gateway/admin/routing-rules', 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/routing-rules",
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>',
'name' => '<string>',
'deny_slots' => [
123
],
'enabled' => true,
'floor_slot' => 123
]),
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/routing-rules"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"deny_slots\": [\n 123\n ],\n \"enabled\": true,\n \"floor_slot\": 123\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/routing-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"deny_slots\": [\n 123\n ],\n \"enabled\": true,\n \"floor_slot\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/routing-rules")
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 \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"deny_slots\": [\n 123\n ],\n \"enabled\": true,\n \"floor_slot\": 123\n}"
response = http.request(request)
puts response.read_body{
"deny_slots": [
123
],
"description": "<string>",
"enabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conflicts": [
{
"conflicts_with": "<string>",
"detail": "<string>",
"rule": "<string>"
}
],
"floor_slot": 123
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}Create a routing rule
Adds a rule to a routing policy. A rule is a plain-English description of the requests it applies to, with a minimum slot (floor_slot), slots it forbids (deny_slots), or both. Slot numbers are 0-based positions in the policy’s slots list.
Conflicts with the policy’s other rules are reported in the response but do not block the save. When a floor and a ban cannot both be honored, the ban wins.
curl --request POST \
--url https://{host}/api/llm-gateway/admin/routing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"name": "<string>",
"deny_slots": [
123
],
"enabled": true,
"floor_slot": 123
}
'import requests
url = "https://{host}/api/llm-gateway/admin/routing-rules"
payload = {
"description": "<string>",
"name": "<string>",
"deny_slots": [123],
"enabled": True,
"floor_slot": 123
}
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({
description: '<string>',
name: '<string>',
deny_slots: [123],
enabled: true,
floor_slot: 123
})
};
fetch('https://{host}/api/llm-gateway/admin/routing-rules', 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/routing-rules",
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>',
'name' => '<string>',
'deny_slots' => [
123
],
'enabled' => true,
'floor_slot' => 123
]),
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/routing-rules"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"deny_slots\": [\n 123\n ],\n \"enabled\": true,\n \"floor_slot\": 123\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/routing-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"deny_slots\": [\n 123\n ],\n \"enabled\": true,\n \"floor_slot\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/routing-rules")
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 \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"deny_slots\": [\n 123\n ],\n \"enabled\": true,\n \"floor_slot\": 123\n}"
response = http.request(request)
puts response.read_body{
"deny_slots": [
123
],
"description": "<string>",
"enabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conflicts": [
{
"conflicts_with": "<string>",
"detail": "<string>",
"rule": "<string>"
}
],
"floor_slot": 123
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}Authorizations
An access token from Barndoor's identity provider, sent as Authorization: Bearer <token>. Use a service-account token from the OAuth 2.0 client-credentials grant for scripts and CI, or a signed-in user's token. The caller needs the admin role in the organization. Gateway API keys (bd-...) are not accepted here.
Query Parameters
ID of the routing policy the rules belong to.
Body
A routing rule to create, or the full replacement for an existing one. Set floor_slot, deny_slots, or both.
Plain-English description of the requests the rule applies to, up to 2,000 characters.
Rule name, unique within the policy, up to 120 characters.
Slots a matching request may not use.
Lowest slot a matching request may use.
Response
The created rule, with any conflicts it introduces
The saved rule and any conflicts it now has with the policy's other rules.
Slots this rule forbids. A ban wins over a floor when both cannot be honored.
Plain-English description of the requests the rule applies to. The router reads it to decide whether a request matches.
Conflicts with the policy's other rules. Advisory: the rule was saved.
Show child attributes
Show child attributes
Lowest slot a matching request may use. Null means no floor.