v1

latestOpenAPI 3.0.02026-07-141,4077,1665.2 MB
LLM Observability

Search LLM Observability spans

Search LLM Observability spans using structured filters in the request body.

post/api/v2/llm-obs/v1/spans/events/search

Request body

Example request

{
  "data": {
    "attributes": {
      "filter": {
        "from": "now-900s",
        "ml_app": "my-llm-app",
        "query": "@session_id:abc123def456",
        "span_id": "abc123def456",
        "span_kind": "llm",
        "span_name": "llm_call",
        "to": "now",
        "trace_id": "trace-9a8b7c6d5e4f"
      },
      "options": {
        "include_attachments": true
      },
      "page": {
        "cursor": "eyJzdGFydCI6MTAwfQ==",
        "limit": 10
      },
      "sort": "-start_ns"
    },
    "type": "spans"
  }
}

Response

OK

Example response

{
  "data": [
    {
      "attributes": {
        "duration": 1500000000,
        "ml_app": "my-llm-app",
        "model_name": "gpt-4o",
        "model_provider": "openai",
        "name": "llm_call",
        "span_id": "abc123def456",
        "span_kind": "llm",
        "start_ns": 1705314600000000000,
        "status": "ok",
        "trace_id": "trace-9a8b7c6d5e4f"
      },
      "id": "abc123def456",
      "type": "span"
    }
  ],
  "links": {
    "next": "https://api.datadoghq.com/api/v2/llm-obs/v1/spans/events?page[cursor]=eyJzdGFydCI6MTAwfQ=="
  },
  "meta": {
    "elapsed": 132,
    "page": {
      "after": "eyJzdGFydCI6MTAwfQ=="
    },
    "request_id": "req-abc123",
    "status": "done"
  }
}