Pagination

Working with paginated results

Some endpoints return paginated results. We use offset-based pagination.

Request

To list all items, you can use the offset and limit query parameters:

parametersdescriptiondefault value
offsetThe number of items to skip.0
limitThe maximum number of items to return.10

Example:

fetch("https://api.excalidraw.com/api/v1/scenes?offset=0&limit=10", {
  method: "GET",
  headers: {
    Authorization: "Bearer sk-...7qd",
  },
});

Response

A paginated response will return an array of items along with pagination metadata:

fielddescription
dataArray of returned data items.
offsetThe number of items skipped in the response.
limitThe maximum number of items returned in the response.
hasNextPageWhether there are more items to be fetched.

Example response:

{
  "data": [
    // array of returned data
  ],
  "offset": 0,
  "limit": 10,
  "hasNextPage": true
}

On this page