dots.v2.insights.query.byRegion().spans.search.post()

Generated on 5 Nov 2026 from DoTs version v1.23.0

Usage

client.v2.insights.query.byRegion(region).spans.search.post(body: Spans_search_request, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | Spans_search_response>

Description

To search spans in a region, send a POST request to /v2/insights/query/{region}/spans/search with a JSON body describing the time range, optional filter, ordering, and pagination. The time range must not exceed 7 days. pagination.limit defaults to 100 and must be between 1 and 1000. Results are ordered by start_time descending by default. Cursor-based pagination is not yet supported; pagination.has_more indicates whether additional spans matched beyond the returned page.

Parameters

Path Parameters

region string required

Example: nyc3

The datacenter region slug for the query.

Request Body

timeRange object required

An inclusive query time window. The window must not exceed 7 days.

Show child properties
from object required

A single time bound. Exactly one of relative or absolute is set.

Show child properties
relative string optional

Example: 1h

A relative time. Use now for the current time, a bare duration such as 1h or 7d to look back from now, or an offset such as now-15m or now+30m. Supported units are s, m, h, d, and w.

absolute string optional

Example: 2026-09-30T00:00:00Z

An absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, milliseconds, microseconds, or nanoseconds) encoded as a decimal string.

to object required

A single time bound. Exactly one of relative or absolute is set.

Show child properties
relative string optional

Example: 1h

A relative time. Use now for the current time, a bare duration such as 1h or 7d to look back from now, or an offset such as now-15m or now+30m. Supported units are s, m, h, d, and w.

absolute string optional

Example: 2026-09-30T00:00:00Z

An absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, milliseconds, microseconds, or nanoseconds) encoded as a decimal string.

filter object optional

A boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.

Show child properties
condition object optional

A single field comparison in a spans filter expression.

Show child properties
field object required

A reference to a searchable span field.

Show child properties
name string required

Example: service.name

The field name. Well-known span fields include trace_id, span_id, parent_span_id, start_time, end_time, duration_ns, name, service_name, kind, status_code, and status_message. Any other value is treated as a span or resource attribute key.

scope string optional

Optional attribute scope, matched case-insensitively. Use FIELD_SCOPE_RESOURCE to match a resource attribute or FIELD_SCOPE_ATTRIBUTES to match a span attribute. The aliases resource and resource.attributes are accepted for resource attributes; attribute, attributes, and span.attributes are accepted for span attributes. Omit for well-known fields or to search both attribute maps.

One of: FIELD_SCOPE_RESOURCE, FIELD_SCOPE_ATTRIBUTES, resource, resource.attributes, attribute, attributes, span.attributes

operator string required

The comparison operator.

One of: FILTER_OPERATOR_EQ, FILTER_OPERATOR_NEQ, FILTER_OPERATOR_IN, FILTER_OPERATOR_EXISTS, FILTER_OPERATOR_GTE, FILTER_OPERATOR_LTE

value object optional

A typed literal or list value for a spans filter condition. Exactly one kind is set per message.

Show child properties
stringValue string optional

Example: api-gateway

numberValue number optional

Example: 42

stringArrayValue object optional

Additional nested properties are not shown.

numberArrayValue object optional

Additional nested properties are not shown.

and object optional
Show child properties
expressions array of objects required

Additional nested properties are not shown.

or object optional
Show child properties
expressions array of objects required

Additional nested properties are not shown.

not object optional

A boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.

Additional nested properties are not shown.

textSearch object optional

A substring search across the span name, service name, and status message.

Show child properties
query string required

Example: timeout

The search string. Leading and trailing whitespace is trimmed, and the remaining string must not be empty.

Min length: 1

Max length: 256

orderBy array of objects optional

Sort clauses applied to the result set. Defaults to start_time descending when omitted.

Show child properties
field object required

A reference to a searchable span field.

Show child properties
name string required

Example: service.name

The field name. Well-known span fields include trace_id, span_id, parent_span_id, start_time, end_time, duration_ns, name, service_name, kind, status_code, and status_message. Any other value is treated as a span or resource attribute key.

scope string optional

Optional attribute scope, matched case-insensitively. Use FIELD_SCOPE_RESOURCE to match a resource attribute or FIELD_SCOPE_ATTRIBUTES to match a span attribute. The aliases resource and resource.attributes are accepted for resource attributes; attribute, attributes, and span.attributes are accepted for span attributes. Omit for well-known fields or to search both attribute maps.

One of: FIELD_SCOPE_RESOURCE, FIELD_SCOPE_ATTRIBUTES, resource, resource.attributes, attribute, attributes, span.attributes

direction string optional

The sort direction, matched case-insensitively. Omit to use the server default.

One of: asc, desc

pagination object optional

Limits the number of spans returned.

Show child properties
limit integer optional

Example: 100

Maximum number of spans to return. Defaults to 100 and must be between 1 and 1000.

Default: 100

Min: 1

Max: 1000

Request Sample

Show Request Sample
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.insights.query
    .byRegion("nyc3").spans.search.post({
    timeRange: {
        from: {
            relative: "1h",
            absolute: "2026-09-30T00:00:00Z",
        },
        to: {
            relative: "1h",
            absolute: "2026-09-30T00:00:00Z",
        },
    },
    orderBy: [
        {
            direction: "desc",
        },
    ],
    pagination: {
        limit: 100,
    },
});

Response Example

Show Response Example
{
  "data": [
    {
      "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
      "span_id": "00f067aa0ba902b7",
      "parent_span_id": "00f067aa0ba902b6",
      "start_time": "2026-09-30T00:00:00Z",
      "end_time": "2026-09-30T00:00:01Z",
      "duration_ns": 1000000,
      "name": "GET /v2/droplets",
      "kind": "Server",
      "status_code": "Ok",
      "status_message": "connection reset by peer",
      "service_name": "api-gateway",
      "resource": {
        "service.name": "api-gateway",
        "service.version": "1.4.2"
      },
      "attributes": {
        "http.method": "GET",
        "http.status_code": "200"
      },
      "region": "nyc3"
    }
  ],
  "pagination": {
    "has_more": true
  }
}

More Information

See /v2/insights/query/{region}/spans/search in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.