Skip to main content
GET
/
api
/
v1
/
keys
/
{id}
/
effective-routing
Inspect a Key's Effective Routing
curl --request GET \
  --url https://api.example.com/api/v1/keys/{id}/effective-routing
import requests

url = "https://api.example.com/api/v1/keys/{id}/effective-routing"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://api.example.com/api/v1/keys/{id}/effective-routing', 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/v1/keys/{id}/effective-routing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/api/v1/keys/{id}/effective-routing"

req, _ := http.NewRequest("GET", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/keys/{id}/effective-routing")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/keys/{id}/effective-routing")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
Returns the Routing Studio snapshot that will actually drive completions for the given key, plus a source enum so the dashboard can tell the customer where it came from. The four sources mirror the resolution cascade:
  • key — per-key rules (either the hidden preference or a shared preference explicitly bound to this key).
  • org_default — no per-key binding; falling back to the active org’s default preference.
  • user_default — no per-key, no org default; falling back to the user’s personal default preference.
  • none — nothing applies; the routing engine runs unmodified.

Authentication

Requires a Bearer token with the billing API key scope and access to the key.

Request Examples

curl https://www.hitheo.ai/api/v1/keys/{id}/effective-routing \
  -H "Authorization: Bearer $THEO_API_KEY"
const eff = await theo.routingRules.effective(keyId);
console.log(eff.source);             // "key" | "org_default" | "user_default" | "none"
console.log(eff.preference_name);    // "This key's rules" | "ACME Legal Default" | null

Response

{
  "key_id": "key_abc",
  "source": "key",
  "is_per_key": true,
  "preference_id": "1f4f2c1a-22ce-4b07-9c0b-9c4f4b9b1d2e",
  "preference_name": "This key's rules",
  "rules": [
    {
      "id": "r_a4b8c01x9y",
      "pattern": "\\b(clause|provision|indemnity|warranty)\\b",
      "target_mode": "think",
      "confidence": 0.92,
      "description": "Contract terms get the analytical engine."
    }
  ],
  "examples": [{ "prompt": "Look at this clause", "expected_mode": "think" }],
  "confidence_floor_overrides": { "think": 0.65 }
}
  • is_per_key: true — the active source is the hidden per-key preference (i.e. rules saved via /api/v1/keys/{id}/routing-rules).
  • preference_name — friendly label. Hidden per-key preferences render as "This key's rules" so the __key: marker never leaks into customer-facing surfaces.
  • When source is "none", preference_id and preference_name are null and the rule/example arrays are empty.

Errors

  • 404 not_found — Key doesn’t exist, is revoked, or isn’t accessible to the caller.