Query analytics timeseries (legacy path)
import requests
url = "https://app.langwatch.ai/api/analytics"
payload = {
"startDate": 1,
"endDate": 1,
"series": [
{
"key": "<string>",
"subkey": "<string>",
"asPercent": True
}
],
"timeZone": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
startDate: 1,
endDate: 1,
series: [{key: '<string>', subkey: '<string>', asPercent: true}],
timeZone: '<string>'
})
};
fetch('https://app.langwatch.ai/api/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/analytics \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"startDate": 1,
"endDate": 1,
"series": [
{
"key": "<string>",
"subkey": "<string>",
"asPercent": true
}
],
"timeZone": "<string>"
}
'{
"currentPeriod": [
{}
],
"previousPeriod": [
{}
]
}{
"message": "<string>",
"error": "<string>"
}{
"message": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}Analytics
Query analytics timeseries (legacy path)
Query analytics timeseries with metrics, aggregations and filters. Identical to POST /api/analytics/timeseries, which is the path to use in new integrations; this one stays for callers written against it.
POST
/
api
/
analytics
Query analytics timeseries (legacy path)
import requests
url = "https://app.langwatch.ai/api/analytics"
payload = {
"startDate": 1,
"endDate": 1,
"series": [
{
"key": "<string>",
"subkey": "<string>",
"asPercent": True
}
],
"timeZone": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
startDate: 1,
endDate: 1,
series: [{key: '<string>', subkey: '<string>', asPercent: true}],
timeZone: '<string>'
})
};
fetch('https://app.langwatch.ai/api/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/analytics \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"startDate": 1,
"endDate": 1,
"series": [
{
"key": "<string>",
"subkey": "<string>",
"asPercent": true
}
],
"timeZone": "<string>"
}
'{
"currentPeriod": [
{}
],
"previousPeriod": [
{}
]
}{
"message": "<string>",
"error": "<string>"
}{
"message": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<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.
Body
application/json
Required range:
x > 0Required range:
x > 0Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
topics.topics, traces.trace_name, metadata.user_id, metadata.thread_id, metadata.customer_id, metadata.labels, metadata.model, metadata.span_type, sentiment.thumbs_up_down, events.event_type, evaluations.evaluation_passed, evaluations.evaluation_label, evaluations.evaluation_processing_state, error.has_error Available options:
full Was this page helpful?
⌘I