Track an event (legacy path)
import requests
url = "https://app.langwatch.ai/api/track_event"
payload = {
"event_type": "<string>",
"metrics": {},
"trace_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({event_type: '<string>', metrics: {}, trace_id: '<string>'})
};
fetch('https://app.langwatch.ai/api/track_event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/track_event \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"event_type": "<string>",
"metrics": {},
"trace_id": "<string>"
}
'{
"message": "<string>"
}{
"message": "<string>",
"error": "<string>"
}{
"message": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}Events
Track an event (legacy path)
Record a customer event against a trace or thread. Identical to POST /api/events/track, which is the path to use in new integrations; this one stays for callers written against it. Supply event_id yourself to make the call idempotent.
POST
/
api
/
track_event
Track an event (legacy path)
import requests
url = "https://app.langwatch.ai/api/track_event"
payload = {
"event_type": "<string>",
"metrics": {},
"trace_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({event_type: '<string>', metrics: {}, trace_id: '<string>'})
};
fetch('https://app.langwatch.ai/api/track_event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/track_event \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"event_type": "<string>",
"metrics": {},
"trace_id": "<string>"
}
'{
"message": "<string>"
}{
"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
Response
The event was accepted
Human-readable confirmation
Was this page helpful?
⌘I