Skip to Content
Launching the open-source gateway

Delete a trace

DELETEhttps://api.respan.ai/api/traces/{trace_unique_id}/

Use start_time and end_time to narrow deletion to the relevant time range. Deletion is asynchronous: the trace leaves List traces right away, but its spans can stay visible in List spans and Get a trace for several minutes. An unknown ID also returns 200.

Servers

https://api.respan.ai — Respan API Server

Authentication

RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: bearer; format: Respan API key.

Authorization: Bearer $RESPAN_API_KEY

Or:

DashboardJwt

Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

HTTP scheme: bearer; format: Dashboard JWT.

Authorization: Bearer $RESPAN_DASHBOARD_JWT

Path parameters

Parameter Type Required Description and constraints
trace_unique_id string Required
Unique trace identifier.

Query parameters

Parameter Type Required Description and constraints
start_time string Optional
Start of time range (ISO 8601). Defaults to one hour before end_time when omitted.
Format: date-time
Example: "2025-01-01T00:00:00Z"
end_time string Optional
End of time range (ISO 8601). Defaults to now when omitted.
Format: date-time
Example: "2025-01-31T23:59:59Z"

Responses

200

Trace delete issued successfully.

application/json

Field Type Requirement Description and constraints
$ object Body
—
message string Required in parent
Delete confirmation message.

OpenAPI response schema

{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Delete confirmation message."
    }
  },
  "required": [
    "message"
  ]
}
Example
{ "message": "Successfully deleted trace trace_abc123" }

403

The API key is missing, invalid or expired.

application/json

Field Type Requirement Description and constraints
$ object Body
—
detail string Required in parent
—

OpenAPI response schema

{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
Example
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }

500

Internal Server Error

application/json

Field Type Requirement Description and constraints
$ object Body
—
detail string Optional
Example: "Internal server error"

OpenAPI response schema

{
  "type": "object",
  "properties": {
    "detail": {
      "type": "string",
      "example": "Internal server error"
    }
  }
}

OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

OpenAPI operation

{
  "summary": "Delete a trace",
  "operationId": "deleteTrace",
  "tags": [
    "Traces"
  ],
  "description": "Use `start_time` and `end_time` to narrow deletion to the relevant time range. Deletion is asynchronous: the trace leaves List traces right away, but its spans can stay visible in List spans and Get a trace for several minutes. An unknown ID also returns 200.",
  "parameters": [
    {
      "name": "trace_unique_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Unique trace identifier."
    },
    {
      "name": "start_time",
      "in": "query",
      "schema": {
        "type": "string",
        "format": "date-time"
      },
      "description": "Start of time range (ISO 8601). Defaults to one hour before `end_time` when omitted.",
      "example": "2025-01-01T00:00:00Z"
    },
    {
      "name": "end_time",
      "in": "query",
      "schema": {
        "type": "string",
        "format": "date-time"
      },
      "description": "End of time range (ISO 8601). Defaults to now when omitted.",
      "example": "2025-01-31T23:59:59Z"
    }
  ],
  "responses": {
    "200": {
      "description": "Trace delete issued successfully.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Delete confirmation message."
              }
            },
            "required": [
              "message"
            ]
          },
          "example": {
            "message": "Successfully deleted trace trace_abc123"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    },
    "500": {
      "description": "Internal Server Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "detail": {
                "type": "string",
                "example": "Internal server error"
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "RespanApiKey": []
    },
    {
      "DashboardJwt": []
    }
  ]
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "DashboardJwt": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Dashboard JWT",
      "description": "Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.",
      "x-fern-bearer": {
        "name": "dashboardJwt",
        "env": "RESPAN_DASHBOARD_JWT"
      }
    },
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}