Read one end user's spend
import requests
url = "https://app.langwatch.ai/api/gateway/v1/end-users/{id}/spend"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/end-users/{id}/spend', 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/end-users/{id}/spend \
--header 'Authorization: Bearer <token>'{
"data": {
"end_user_id": "<string>",
"window": "<string>",
"from": "<string>",
"to": "<string>",
"cost": {
"total_usd": "<string>",
"nano_usd": 0
},
"request_count": 0,
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"reasoning_tokens": 0,
"input_image_tokens": 0,
"output_image_tokens": 0,
"image_count": 0
},
"caps": [
{
"budget_id": "<string>",
"anchor_id": "<string>",
"window": "<string>",
"on_breach": "block",
"limit_usd": "<string>",
"spent_usd": "<string>",
"period_started_at": "<string>"
}
]
}
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}Gateway: Spend
Read one end user's spend
Windowed spend rollup for one external end user across the organization (the /customer/info-style read a rebilling integration polls). caps lists every attributed-user budget that applies to this end user, each with its limit and the spend against it. It is an empty array until such a budget template applies, never null.
GET
/
api
/
gateway
/
v1
/
end-users
/
{id}
/
spend
Read one end user's spend
import requests
url = "https://app.langwatch.ai/api/gateway/v1/end-users/{id}/spend"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/end-users/{id}/spend', 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/end-users/{id}/spend \
--header 'Authorization: Bearer <token>'{
"data": {
"end_user_id": "<string>",
"window": "<string>",
"from": "<string>",
"to": "<string>",
"cost": {
"total_usd": "<string>",
"nano_usd": 0
},
"request_count": 0,
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"reasoning_tokens": 0,
"input_image_tokens": 0,
"output_image_tokens": 0,
"image_count": 0
},
"caps": [
{
"budget_id": "<string>",
"anchor_id": "<string>",
"window": "<string>",
"on_breach": "block",
"limit_usd": "<string>",
"spent_usd": "<string>",
"period_started_at": "<string>"
}
]
}
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}Authorizations
Admin API key for organization-level operations (managing projects, API keys). Create one in Settings > API Keys or via POST /api/api-keys. Format: sk-lw-{id}_{secret}.
Path Parameters
Minimum string length:
1Query Parameters
Available options:
day, week, month Required range:
x <= 9007199254740991Required range:
x <= 9007199254740991Required string length:
1 - 100Response
Success
Show child attributes
Show child attributes
Last modified on August 5, 2026
Was this page helpful?