Get a list of spans

GET {{baseUrl}}/api/v2/spans/events

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.

Request Params

KeyDatatypeRequiredDescription
filter[query]stringSearch query following spans syntax.
filter[from]stringMinimum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds).
filter[to]stringMaximum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds).
sortstringOrder of spans in results.
page[cursor]stringList following results with a cursor provided in the previous query.
page[limit]numberMaximum number of spans in the response.

HEADERS

KeyDatatypeRequiredDescription
Acceptstring

RESPONSES

status: OK

{"data":[{"attributes":{"attributes":{"customAttribute":123,"duration":2345},"custom":{"sedcc5":{}},"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"},{"attributes":{"attributes":{"customAttribute":123,"duration":2345},"custom":{"irure_dca":{}},"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\u0026page[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"},{"code":"unknown_index","detail":"indexes: foo, bar","title":"One or several indexes are missing or invalid, results hold data from the other indexes"}]}}