Skip to main content
GET
/
api
/
public
/
v2
/
traces
/
{trace_id}
Get Trace
curl --request GET \
  --url https://api.promptlayer.com/api/public/v2/traces/{trace_id} \
  --header 'X-API-KEY: <x-api-key>'
{
  "success": true,
  "spans": [
    {
      "id": 123,
      "name": "<string>",
      "trace_id": "<string>",
      "span_id": "<string>",
      "parent_id": "<string>",
      "start": "<string>",
      "end": "<string>",
      "attributes": {},
      "resource": {},
      "context": {},
      "kind": "<string>",
      "status": {},
      "events": "<array>",
      "links": "<array>",
      "request_log_id": 123
    }
  ]
}
Retrieve all spans for a given trace ID. Each span includes its metadata and, if it generated a request log, the associated request_log_id. This is useful for:
  • Trace inspection: View the full execution flow of a traced operation
  • Linking spans to requests: Find which spans generated PromptLayer request logs
  • Debugging: Follow the execution path across multiple LLM calls

Authentication

This endpoint requires API key authentication via the X-API-KEY header.

Example

curl -H "X-API-KEY: your_api_key" \
  https://api.promptlayer.com/api/public/v2/traces/a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
  • Get Request - Retrieve a single request (includes trace_id)
  • Traces - PromptLayer SDK tracing with @traceable
  • OpenTelemetry - Send traces from any OTEL SDK

Headers

X-API-KEY
string
required

API key for authentication.

Path Parameters

trace_id
string
required

The trace ID to retrieve spans for.

Response

Successfully retrieved trace spans.

success
boolean

Indicates the request was successful.

spans
object[]

List of spans belonging to this trace.