Skip to content
v1
Docs

REST API

Pagination

A list pages in one of two ways. Most lists are page lists: you ask for a page by its number. Four lists page by time, because their rows are a stream with no fixed pages: log search (GET /v1/logs), a custom metric’s raw samples, and a service’s scans and runs. Every list’s reference entry says which it is.

A page list answers the rows of one page and where that page sits:

{ "data": [ … ], "current_page": 1, "per_page": 25, "last_page": 4, "total": 87, "meta": { … } }
Parameter Meaning
page The page to read, from 1; 1 by default.
per_page Rows per page: 1 to 100, 25 by default. A metric source’s series and summary take 1 to 25 metrics and default to 25.
limit The same as per_page, kept for existing clients. When both are sent, per_page is used.
include_total Accepted and ignored: total is always present.
Field Meaning
current_page The page this answer holds.
per_page How many rows a page holds.
last_page The last page, at least 1.
total How many rows match the filters, across every page.

To read a whole list, ask for page 2, 3 and so on with the same filters while current_page is below last_page. A list with no rows answers current_page 1, last_page 1 and total 0. A page past the last answers no rows (data is empty) and the current_page you asked for. A page below 1, or a per_page outside its range, is 422 invalid_request.

The rows are counted when the page is read, so a list that changes between two calls can shift a row from one page to the next. A page list ignores a cursor: it answers the page named by page, or the first page.

Log search, a custom metric’s samples and a service’s scans and runs answer the rows and a cursor for the next page:

{ "data": [ … ], "next_cursor": "eyJ…", "total": null, "meta": { … } }
Parameter Meaning
per_page Rows per page. Log search takes 1 to 2,000 and defaults to 100; a custom metric’s samples take 1 to 10,000 and default to 1,000; a service’s scans and runs take 1 to 100 and default to 25.
limit The same as per_page.
cursor The next_cursor of the previous answer. Omit it for the first page.

next_cursor is null on the last page. To read the whole list, repeat the call with the cursor until it is null. page is not read here: it is ignored like any parameter an operation does not take.

  • A cursor belongs to the call that made it: with a different filter, or sent to another operation, it is refused with 422 invalid_request on cursor. Start again without it. A cursor stays valid when you change per_page.
  • Treat a cursor as opaque. Do not build or edit one.
  • total is null on log search and on a service’s runs, which are not counted. A service’s scans and a custom metric’s samples are counted once, on the first page, and the cursor carries that count to the later pages. A custom metric’s samples answer next_cursor and total inside data; see charting custom metrics.
  • meta appears only on operations that have facts about the whole answer, such as the counts of an alarm list.
  • Some lists keep the product’s own cap rather than paging past it: a domain’s scans and changes return the newest 20, a service’s checks the newest 50.
  • A query parameter an operation does not take is ignored, with no error: offset or page_size on any list, and page on a list that pages by time, change nothing. A misspelt filter is not applied, so a call that reads as filtered may answer every row: check the names against the reference.
  • The SDKs page in both ways for you. A copy of an SDK from before the page lists moved to page reads only the first page of a page list, without an error: upgrade it.

A filter that takes a list, such as status, health, connectivity, tag_uuids or security_health on servers, accepts the values in any of three forms. All three read the same, and the reference says so on each list parameter:

GET /v1/servers?health=warning&health=critical
GET /v1/servers?health=warning
GET /v1/servers?health[]=warning&health[]=critical
  • Repeat the parameter for several values, or send one value: a single value is a list of one. The bracket form (health[]=warning) is accepted too.
  • A value that is empty is dropped: health=&health=warning reads as health=warning, and a filter whose values are all empty is not applied.
  • An indexed form (health[0]=warning&health[1]=critical) is read as it is sent.
  • A value the operation does not know is refused with 422 invalid_request, on the value’s own position (health.0), and the message lists the values it accepts.
  • A parameter that is not a list takes the last value sent: per_page=1&per_page=2 reads as per_page=2.