List spend events
import requests
url = "https://app.langwatch.ai/api/gateway/v1/spend-events"
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/gateway/v1/spend-events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/gateway/v1/spend-events \
--header 'X-Auth-Token: <api-key>'{
"data": [
{
"id": "<string>",
"type": "<string>",
"created": "<string>",
"schema_version": "<string>",
"data": {
"event_id": "<string>",
"event_type": "<string>",
"gateway_request_id": "<string>",
"occurred_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_read_input_tokens": 123,
"cache_creation_input_tokens": 123,
"reasoning_tokens": 123
},
"cost": {
"total_usd": "<string>",
"nano_usd": 123
},
"status": "<string>",
"needs_reconciliation": true,
"settle_reason": "<string>",
"error": {
"class": "<string>",
"http_status": 123
},
"duration_ms": 123,
"labels": [
"<string>"
],
"metadata": {}
}
}
],
"next_cursor": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}Gateway: Spend
List spend events
Cursor-paged pull over the per-request spend record, ascending by insert order so rows folded late are never skipped by an in-flight cursor. Events are the same canonical objects webhook deliveries carry. Retention is a fixed 13 months, which bounds reconciliation and replay. When feeding a downstream biller, mind its dedup window (Metronome 34 days, Stripe meters 24h+): re-pulling older ranges into a biller past its window can double-bill.
GET
/
api
/
gateway
/
v1
/
spend-events
List spend events
import requests
url = "https://app.langwatch.ai/api/gateway/v1/spend-events"
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/gateway/v1/spend-events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/gateway/v1/spend-events \
--header 'X-Auth-Token: <api-key>'{
"data": [
{
"id": "<string>",
"type": "<string>",
"created": "<string>",
"schema_version": "<string>",
"data": {
"event_id": "<string>",
"event_type": "<string>",
"gateway_request_id": "<string>",
"occurred_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_read_input_tokens": 123,
"cache_creation_input_tokens": 123,
"reasoning_tokens": 123
},
"cost": {
"total_usd": "<string>",
"nano_usd": 123
},
"status": "<string>",
"needs_reconciliation": true,
"settle_reason": "<string>",
"error": {
"class": "<string>",
"http_status": 123
},
"duration_ms": 123,
"labels": [
"<string>"
],
"metadata": {}
}
}
],
"next_cursor": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<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
Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Maximum string length:
500Required range:
x <= 200Required string length:
1 - 100Required string length:
1 - 256Required string length:
1 - 100Required string length:
1 - 200Available options:
success, error, admitted, confirmed, failed, settled Was this page helpful?
⌘I