---
title: "Get a list of spans"
method: GET
path: "/api/v2/spans/events"
tags: ["Spans"]
---

# Get a list of spans

`GET /api/v2/spans/events`

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

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

[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api

## Query parameters

- `filter[query]` string
- `filter[from]` string
- `filter[to]` string
- `sort` 'timestamp' | '-timestamp' — Sort parameters when querying spans.
- `page[cursor]` string
- `page[limit]` integer

## Response `200`

OK

- SpansListResponse — Response object with all spans matching the request and pagination information.
  - `data` Span[] — Array of spans matching the request.
    - `attributes` SpansAttributes — JSON object containing all span attributes and their associated values.
      - `attributes` object — JSON object of attributes from your span.
      - `custom` object — JSON object of custom spans data.
      - `end_timestamp` string, date-time — End timestamp of your span.
      - `env` string — Name of the environment from where the spans are being sent.
      - `host` string — Name of the machine from where the spans are being sent.
      - `ingestion_reason` string — The reason why the span was ingested.
      - `parent_id` string — Id of the span that's parent of this span.
      - `resource_hash` string — Unique identifier of the resource.
      - `resource_name` string — The name of the resource.
      - `retained_by` string — The reason why the span was indexed.
      - `service` string — The name of the application or service generating the span events. It is used to switch from APM to Logs, so make sure you define the same value when you use both products.
      - `single_span` boolean — Whether or not the span was collected as a stand-alone span. Always associated to "single_span" ingestion_reason if true.
      - `span_id` string — Id of the span.
      - `start_timestamp` string, date-time — Start timestamp of your span.
      - `tags` string[] — Array of tags associated with your span.
      - `trace_id` string — Id of the trace to which the span belongs.
      - `type` string — The type of the span.
    - `id` string — Unique ID of the Span.
    - `type` 'spans' — Type of the span.
  - `links` SpansListResponseLinks — Links attributes.
    - `next` string — Link for the next set of results. Note that the request can also be made using the POST endpoint.
  - `meta` SpansListResponseMetadata — The metadata associated with a request.
    - `elapsed` integer — The time elapsed in milliseconds.
    - `page` SpansResponseMetadataPage — Paging attributes.
      - `after` string — The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of the `page[cursor]`.
    - `request_id` string — The identifier of the request.
    - `status` 'done' | 'timeout' — The status of the response.
    - `warnings` SpansWarning[] — A list of warnings (non fatal errors) encountered, partial results might be returned if warnings are present in the response.
      - `code` string — A unique code for this type of warning.
      - `detail` string — A detailed explanation of this specific warning.
      - `title` string — A short human-readable summary of the warning.

## Other responses

- `400` — Bad Request.
- `403` — Forbidden: Access denied.
- `422` — Unprocessable Entity.
- `429` — Too many requests: The rate limit set by the API has been exceeded.

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
