import requests
url = "https://app.langwatch.ai/api/gateway/v1/spend-events/replay"
payload = {
"from": 0,
"to": 0,
"endpoint_id": "<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({from: 0, to: 0, endpoint_id: '<string>'})
};
fetch('https://app.langwatch.ai/api/gateway/v1/spend-events/replay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/gateway/v1/spend-events/replay \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"from": 0,
"to": 0,
"endpoint_id": "<string>"
}
'{
"data": {
"endpoint_id": "<string>",
"replay_id": "<string>",
"replayed": 123,
"window": {
"from": "<string>",
"to": "<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>"
}
}Replay spend events to an endpoint
Re-delivers the window’s spend envelopes to ONE endpoint through the normal delivery path (per-endpoint stream, retry ladder, delivery log), honoring the endpoint’s event subscriptions. Envelope ids are UNCHANGED: your consumer’s event-id dedup decides what a redelivery means. Mind your downstream billing system’s finite dedup window (Metronome 34 days, Stripe 24h+): replaying older than that window can double-bill on your side, so prefer pull-and-diff for old ranges. The window is capped at 7 days and 10,000 envelopes per call; both caps are checked before any delivery is queued, so a refused replay ships nothing.
import requests
url = "https://app.langwatch.ai/api/gateway/v1/spend-events/replay"
payload = {
"from": 0,
"to": 0,
"endpoint_id": "<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({from: 0, to: 0, endpoint_id: '<string>'})
};
fetch('https://app.langwatch.ai/api/gateway/v1/spend-events/replay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/gateway/v1/spend-events/replay \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"from": 0,
"to": 0,
"endpoint_id": "<string>"
}
'{
"data": {
"endpoint_id": "<string>",
"replay_id": "<string>",
"replayed": 123,
"window": {
"from": "<string>",
"to": "<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.
Body
Response
Replay accepted
Show child attributes
Show child attributes
Was this page helpful?