Skip to main content
DELETE
https://api.respan.ai
/
api
/
traces
/
{trace_unique_id}
Delete trace
curl --request DELETE \
  --url https://api.respan.ai/api/traces/{trace_unique_id}/ \
  --header 'Authorization: Bearer <token>'
{
  "success": "Successfully deleted trace trace_abc123"
}
Deletes a single trace and all its spans by trace_unique_id. Removes data from both raw span storage and the aggregated trace table.
ClickHouse uses lightweight deletes (async mutations), so the API cannot confirm whether the trace actually existed. The endpoint always returns 200 whether the trace was found or not.

Path Parameters

trace_unique_id
string
required
Unique identifier of the trace to delete.

Query Parameters

start_time
string
ISO 8601 start of time range for efficient lookup. Defaults to end_time minus 1 hour.
"start_time": "2024-01-15T00:00:00Z"
end_time
string
ISO 8601 end of time range for efficient lookup. Defaults to current time.
"end_time": "2024-01-15T23:59:59Z"
Providing start_time and end_time is recommended for performance. These constrain the ClickHouse scan to the relevant time partition. If omitted, the API defaults to the last hour from the current time.

Examples

import requests

trace_id = "trace_abc123"
url = f"https://api.respan.ai/api/traces/{trace_id}/"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {
    "start_time": "2024-01-15T00:00:00Z",
    "end_time": "2024-01-15T23:59:59Z"
}

response = requests.delete(url, headers=headers, params=params)
print(response.json())

Response

{
  "success": "Successfully deleted trace trace_abc123"
}

Error Responses

401 Unauthorized
{ "detail": "Your API key is invalid or expired, please check your API key at https://platform.respan.ai/platform/api/api-keys" }