import requests
url = "https://app.langwatch.ai/api/traces/facets"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/traces/facets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/traces/facets \
--header 'X-Auth-Token: <api-key>'{
"facets": [
{
"key": "<string>",
"kind": "categorical",
"label": "<string>",
"group": "<string>"
}
],
"pending": true
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "trace_attribute_values_withheld",
"message": "<string>",
"trace": "<string>"
}{
"error": "validation_error",
"message": "<string>",
"target": "query",
"fields": [
"<string>"
],
"reasons": [
{
"code": "<string>",
"meta": {
"field": "<string>",
"type": "<string>",
"message": "<string>",
"received": "<string>",
"expected": [
"<string>"
]
}
}
],
"trace": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Discover what the trace filter fields hold
What the trace filter fields actually hold in THIS project, which the filter language’s own reference deliberately does not carry: values are tenant data, they move under you, and reading them all costs about thirty aggregate queries.
Two answers from one door. Without field you get the discovery payload: every facet this project has, each with its top values and counts, plus the range bounds for the numeric ones. With field you get one field’s values, paged, filtered by prefix.
The values are cached and refreshed in the background, so a cold project answers pending: true with the payload it has; call again shortly for the computed one.
Use it whenever you are unsure how a value is spelled. GET /api/v1/query/reference lists the fields and their fixed vocabularies; only this endpoint knows the open ones.
import requests
url = "https://app.langwatch.ai/api/traces/facets"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/traces/facets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/traces/facets \
--header 'X-Auth-Token: <api-key>'{
"facets": [
{
"key": "<string>",
"kind": "categorical",
"label": "<string>",
"group": "<string>"
}
],
"pending": true
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "trace_attribute_values_withheld",
"message": "<string>",
"trace": "<string>"
}{
"error": "validation_error",
"message": "<string>",
"target": "query",
"fields": [
"<string>"
],
"reasons": [
{
"code": "<string>",
"meta": {
"field": "<string>",
"type": "<string>",
"message": "<string>",
"received": "<string>",
"expected": [
"<string>"
]
}
}
],
"trace": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Query Parameters
1 - 5125121 <= x <= 1000x >= 0Response
Without field, every facet the project has with its top values and whether the payload is still being computed. With field, that field's values and counts plus the distinct total and whether more remain.
Was this page helpful?