v1

latestOpenAPI 3.0.02026-07-141,4077,1665.2 MB
Spans

Get a list of spans

List endpoint returns spans that match a span search query. Results are paginated.

Use this endpoint to see your latest spans. This endpoint is rate limited to 300 requests per hour.

get/api/v2/spans/events

Query parameters

filter[query]string

Search query following spans syntax.

filter[from]string

Minimum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds).

filter[to]string

Maximum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds).

sort'timestamp' | '-timestamp'

Sort parameters when querying spans.

Order of spans in results.

page[cursor]string

List following results with a cursor provided in the previous query.

page[limit]integer

Maximum number of spans in the response.

Response

OK

Example response

{
  "data": [
    {
      "attributes": {
        "attributes": {
          "customAttribute": 123,
          "duration": 2345
        },
        "end_timestamp": "2023-01-02T09:42:36.420Z",
        "env": "prod",
        "host": "i-0123",
        "ingestion_reason": "rule",
        "parent_id": "0",
        "resource_hash": "a12345678b91c23d",
        "resource_name": "agent",
        "retained_by": "retention_filter",
        "service": "agent",
        "single_span": true,
        "span_id": "1234567890987654321",
        "start_timestamp": "2023-01-02T09:42:36.320Z",
        "tags": [
          "team:A"
        ],
        "trace_id": "1234567890987654321",
        "type": "web"
      },
      "id": "AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA",
      "type": "spans"
    }
  ],
  "links": {
    "next": "https://app.datadoghq.com/api/v2/spans/event?filter[query]=foo&page[cursor]=eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="
  },
  "meta": {
    "elapsed": 132,
    "page": {
      "after": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="
    },
    "request_id": "MWlFUjVaWGZTTTZPYzM0VXp1OXU2d3xLSVpEMjZKQ0VKUTI0dEYtM3RSOFVR",
    "status": "done",
    "warnings": [
      {
        "code": "unknown_index",
        "detail": "indexes: foo, bar",
        "title": "One or several indexes are missing or invalid, results hold data from the other indexes"
      }
    ]
  }
}