Skip to main content
The Moonbase API uses cursor-based pagination for list endpoints that return multiple items. These endpoints return one page of results per API call. Each page contains up to 20 results by default.

Response structure

The API returns items in the data property of the response. Refer to the individual endpoints for the ordering of items since they vary based on the endpoint. Example: First page (with more results)
Example: Middle page (both prev and next)
The next cursor will not be present if there are no more pages to fetch. prev cursor appears when previous pages exist. Enables bidirectional navigation.
Do not pass both before and after in the same request. Cursors are opaque strings—do not parse or modify them—and should be URL-encoded when used in query parameters.

Pagination parameters

Control pagination using these query parameters:
  • limit: (Integer) — Maximum number of items to return per page. Must be between 1 and 100. Defaults to 20 if not specified.
  • after: (String) — Returns results starting immediately after the item identified by this cursor. Use the next cursor from a previous response to fetch the next page.
  • before: (String) — Returns results starting immediately before the item identified by this cursor. Use the prev cursor from a previous response to fetch the previous page.
Cursors do not expire and remain valid indefinitely. Using an invalid cursor will return a 400 Bad Request error.
Moonbase SDKs provide methods to automatically iterate through all items across all pages:

Single page requests

Request one page at a time:

Manual pagination with cURL

1

Make an initial API call to list items

For authentication details, see the Moonbase authentication guide.
2

Check for pagination cursors in the response

  • If meta.cursors.next is missing, all items have been retrieved
  • If the next cursor is present, use it with the after parameter to fetch the next page
  • If the prev cursor is present, use it with the before parameter to fetch the previous page
Fetch next page:
Fetch previous page:
3

Repeat until all required data is processed

Continue using the cursors from each response to navigate forward or backward through results.