Pagination

Paginate VPSBG API list results using page controls, links, and metadata.

1 min read

Paginated list endpoints return a data array together with links and meta objects.

Control the pageCopy link

Use page to select a page:

GET /servers?page=2

Endpoints that expose per_page accept values from 1 to 50:

GET /servers?page=2&per_page=25

Not every paginated endpoint exposes per_page, and defaults can differ. Check the endpoint reference for its supported parameters and default page size.

Response shapeCopy link

The following is an abridged response:

{
  "data": [
    {
      "id": 42
    }
  ],
  "links": {
    "first": "https://api.vpsbg.eu/v1/servers?page=1",
    "last": "https://api.vpsbg.eu/v1/servers?page=4",
    "prev": "https://api.vpsbg.eu/v1/servers?page=1",
    "next": "https://api.vpsbg.eu/v1/servers?page=3"
  },
  "meta": {
    "current_page": 2,
    "from": 26,
    "last_page": 4,
    "path": "https://api.vpsbg.eu/v1/servers",
    "per_page": 25,
    "to": 50,
    "total": 82
  }
}

dataCopy link

The resources for the current page.

URLs for the first, last, previous, and next pages. prev or next is null when that page does not exist. Follow these URLs instead of constructing page URLs from meta values.

metaCopy link

Information about the current page and the complete result set:

FieldMeaning
current_pageCurrent page number.
fromOne-based position of the first returned item.
last_pageLast available page number.
pathBase URL for the collection.
per_pageNumber of items requested per page.
toOne-based position of the last returned item.
totalTotal number of matching items.

Some responses also include a meta.links array for rendering numbered page controls. Integrations should normally use the top-level links object.

On this page