import { Textql } from "@textql/sdk";
const textql = new Textql({
apiKey: process.env["TEXTQL_API_KEY"] ?? "",
});
async function run() {
const result = await textql.ontology.getUsageSummary({
body: {},
});
console.log(result);
}
run();import os
from textql_sdk import Textql
with Textql(
api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:
res = textql.ontology.get_usage_summary()
# Handle response
print(res)curl --request POST \
--url https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--header 'tql_api_key: <api-key>' \
--data '
{
"observationPeriod": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
tql_api_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({observationPeriod: '<string>'})
};
fetch('https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary', 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://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary",
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([
'observationPeriod' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json",
"tql_api_key: <api-key>"
],
]);
$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://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary"
payload := strings.NewReader("{\n \"observationPeriod\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("tql_api_key", "<api-key>")
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://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("tql_api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"observationPeriod\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["tql_api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"observationPeriod\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"totalFiles": 123,
"pulledFiles": 123,
"deadFiles": 123,
"avgHitRate": 123,
"errorFiles": 123,
"reclaimableTokens": 123,
"tqlPulledFiles": 123,
"avgDocCitedRate": 123,
"docPulledFiles": 123,
"docCitationsEnabled": true
}{
"code": "not_found",
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "<string>",
"debug": {}
}
]
}Get Ontology Usage Summary
import { Textql } from "@textql/sdk";
const textql = new Textql({
apiKey: process.env["TEXTQL_API_KEY"] ?? "",
});
async function run() {
const result = await textql.ontology.getUsageSummary({
body: {},
});
console.log(result);
}
run();import os
from textql_sdk import Textql
with Textql(
api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:
res = textql.ontology.get_usage_summary()
# Handle response
print(res)curl --request POST \
--url https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--header 'tql_api_key: <api-key>' \
--data '
{
"observationPeriod": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
tql_api_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({observationPeriod: '<string>'})
};
fetch('https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary', 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://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary",
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([
'observationPeriod' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json",
"tql_api_key: <api-key>"
],
]);
$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://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary"
payload := strings.NewReader("{\n \"observationPeriod\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("tql_api_key", "<api-key>")
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://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("tql_api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"observationPeriod\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetOntologyUsageSummary")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["tql_api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"observationPeriod\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"totalFiles": 123,
"pulledFiles": 123,
"deadFiles": 123,
"avgHitRate": 123,
"errorFiles": 123,
"reclaimableTokens": 123,
"tqlPulledFiles": 123,
"avgDocCitedRate": 123,
"docPulledFiles": 123,
"docCitationsEnabled": true
}{
"code": "not_found",
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "<string>",
"debug": {}
}
]
}Authorizations
Headers
Define the version of the Connect protocol
1 Define the timeout, in ms
Body
default 7d
Response
Success
Aggregate ontology-usage health for the window — the roll-ups the Ontology Health hero needs without paging every file to the client. pulled_files, avg_hit_rate, and error_files are Postgres aggregates over the pull/run data; total_files, dead_files, and reclaimable_tokens come from the current git tree diffed against the set of pulled paths (a dead file is one present in the ontology but never pulled in the window).
0..1, averaged over pulled .tql files with chat-attributed pulls
files with at least one errored pull in the window
estimated tokens held by dead files (~size/4)
.tql files behind avg_hit_rate; 0 = rate has no signal
0..1 cited-when-pulled over pulled docs (excludes .tql and config-managed .playbook/.dashboard)
docs behind avg_doc_cited_rate; 0 = rate has no signal
source attribution active for this org (traces enabled)