Pagination

Lists of resources come in pages, with a pagination object in the response body. To go through every page, request the URL in pagination.next until it's null. To get a specific page, pass the page query parameter.

Query parameters

Parameter Type Value
page Integer The page number to return, starting with 1.
per_page Integer Number of results per page. Defaults to 50, maximum 250, unless the endpoint says otherwise.

Response

Attribute Type Value
pagination.first String The URL of the first page.
pagination.last String The URL of the last page.
pagination.prev String or null The URL of the previous page, or null on the first page.
pagination.next String or null The URL of the next page, or null on the last page.

Examples

Example cURL to list monitors
curl --request GET \
  --url "https://incidents.betterstack.com/api/v2/monitors?per_page=20&page=3" \
  --header "Authorization: Bearer $TOKEN"


Example response body listing monitors
{
  "data": [
    {
      "id": "41",
      "type": "monitor",
      "attributes": {
        monitor's attributes omitted...
      }
    },
    {
      "id": "42",
      "type": "monitor",
      "attributes": {
        monitor's attributes omitted...
      }
    }
  ],
  "pagination": {
    "first": "https://incidents.betterstack.com/api/v2/monitors?per_page=20&page=1",
    "last": "https://incidents.betterstack.com/api/v2/monitors?per_page=20&page=3",
    "prev": "https://incidents.betterstack.com/api/v2/monitors?per_page=20&page=2",
    "next": null
  }
}