Get Route Health - Barndoor Documentation
Get route health
cURL
curl --request GET \
--url https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health \
--header 'Authorization: Bearer <token>'
Python
import requests
url = "https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [\
CURLOPT_URL => "https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health",\
CURLOPT_RETURNTRANSFER => true,\
CURLOPT_ENCODING => "",\
CURLOPT_MAXREDIRS => 10,\
CURLOPT_TIMEOUT => 30,\
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
CURLOPT_CUSTOMREQUEST => "GET",\
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;
}
?>
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health"
req, _ := http.NewRequest("GET", 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))
}
Unirest (Java)
HttpResponse<String> response = Unirest.get("https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health")
.header("Authorization", "Bearer <token>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://app.barndoor.ai/api/llm-gateway/admin/llm-gw/route-health")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body
Response Structure
{
"routes": [
{
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_name": "<string>",
"model_provider": "openai",
"upstream_model": "<string>",
"consecutive_failures": 123,
"multiplier": 123,
"eject_remaining_secs": 123,
"in_flight": 123,
"concurrency_cap": 123,
"recent_transitions": [
{
"from": "<string>",
"to": "<string>",
"reason": "<string>",
"window_secs": 123,
"age_secs": 123
}
]
}
]
}
Route states
| State | Meaning |
|---|---|
healthy |
The route is serving traffic normally. |
half_open |
The route was recently ejected; the gateway is letting a small probe of traffic through to test recovery. |
ejected |
The route has been temporarily removed from the failover loop. New traffic will skip it until eject_remaining_secs elapses. |
Cooldown Reason
cooldown_reason explains why a route is in cooldown:
rolling_failures— too many upstream errors in the rolling window.rate_limited— the upstream returned 429s faster than the route’s retry policy could absorb them.
Recovery
Routes recover automatically as cooldown windows expire and probe traffic succeeds. To force a route back to healthy immediately, call POST /admin/llm-gw/route-health/{provider_id}/reset.
Authorizations
Authorization string required in the header, 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.
Response Status
200 - application/json Route health snapshot
Routes
routes is an array of objects describing individual route health.