Traces

Ingest spans (legacy)

Changed on

Accepts spans as a JSON array or an object whose data field contains the array. Each span uses the fields in Create a span, plus trace_unique_id, span_unique_id, and optional span_parent_id to build the trace tree. For new integrations, use Ingest traces (OTLP).

post/api/v1/traces/ingest

Request

  • Base URL
    https://api.respan.ai
  • URL
    https://api.respan.ai/api/v1/traces/ingest
  • Auth
    HTTP bearer

Request body

OR

Example request

[
  {
    "trace_unique_id": "trace_abc123",
    "span_unique_id": "span_001",
    "span_name": "llm_call",
    "span_workflow_name": "support_flow",
    "log_type": "chat",
    "input": "[{\"role\": \"user\", \"content\": \"Hello\"}]",
    "output": "{\"role\": \"assistant\", \"content\": \"Hi!\"}",
    "model": "gpt-4o",
    "usage": {
      "prompt_tokens": 10,
      "completion_tokens": 8,
      "total_tokens": 18
    },
    "cost": 0.001,
    "latency": 1.2,
    "status": "success",
    "timestamp": "2025-01-15T10:30:00Z",
    "start_time": "2025-01-15T10:29:59Z",
    "customer_identifier": "user_123",
    "metadata": {
      "env": "production"
    },
    "span_path": "joke_creation.store_joke",
    "encoding_format": "float",
    "provider_id": "openai",
    "prompt_tokens": 150,
    "completion_tokens": 80,
    "temperature": 0.7,
    "max_tokens": 1024
  }
]

Response

Trace spans processed successfully

messagestring required

Human-readable ingest summary.

Example response

{
  "message": "Processed 2 Vercel spans"
}

Changes

    • breaking

      request body became required

    • breaking

      removed from the request body oneOf list

    • info

      api operation id traces_createTraceLegacy removed and replaced with createTraceLegacy

    • info

      api tag Traces added

    • info

      api tag traces removed

    • info

      added subschema #1 subschema #2 to the request body oneOf list

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status