unPLUGDevelopers

Pagination

Read long lists, such as a member's activity or your orders, one page at a time. Every list endpoint uses the same cursor parameters and response shape.

Available at launch

Parameters#

ParameterDescription
limitintegerItems per page, 1 to 100. Default 25.
cursorstringThe next_cursor from the previous page. Leave it out for the first page.

Send the same filters with every page. A cursor continues the list it came from; changing type or from halfway through gives you a different list.

Response#

{
  "data": [ ... ],
  "has_more": true,
  "next_cursor": "eyJjIjoiMjAyNi0xMC0yMFQxNDozMTowMloifQ"
}
FieldDescription
dataarrayThe items on this page, in the endpoint's order. Activity and orders are newest first.
has_morebooleantrue when another page exists.
next_cursorstring or nullPass it as cursor to get the next page. null on the last page.

Treat the cursor as opaque. Don't decode it, build it, or store it for later; ask for the first page again instead.

Example#

The first page of Maya's activity:

GETRequest
curl "$UNPLUG_API/members/3f2b8c1e-6d0a-4e7b-9f3c-2a1d5e8b7c40/activity?limit=4" \
  -H "Authorization: Bearer $UNPLUG_KEY"

The response ends with "has_more": true and a next_cursor. Ask for the next page with it:

GETRequest
curl "$UNPLUG_API/members/3f2b8c1e-6d0a-4e7b-9f3c-2a1d5e8b7c40/activity?limit=4&cursor=eyJjIjoiMjAyNi0xMC0yMFQxNDozMTowMloifQ" \
  -H "Authorization: Bearer $UNPLUG_KEY"

Read every page#

A loop that reads all of a member's earn entries for October, 100 at a time:

JavaScript (Node 18+)
const API = "https://api.unplugdining.com/v1";

async function* listAll(path, params) {
  let cursor = null;
  do {
    const query = new URLSearchParams({ ...params, limit: "100" });
    if (cursor) query.set("cursor", cursor);

    const res = await fetch(`${API}${path}?${query}`, {
      headers: { Authorization: `Bearer ${process.env.UNPLUG_KEY}` },
    });
    if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`);

    const page = await res.json();
    yield* page.data;
    cursor = page.has_more ? page.next_cursor : null;
  } while (cursor);
}

const memberId = "3f2b8c1e-6d0a-4e7b-9f3c-2a1d5e8b7c40";
for await (const entry of listAll(`/members/${memberId}/activity`, {
  type: "earn",
  from: "2026-10-01T05:00:00Z",
  to: "2026-11-01T05:00:00Z",
})) {
  console.log(entry.created_at, entry.points, entry.description);
}

For a screen in your app, don't read every page up front. Load the first page, then the next one when the guest scrolls to the end.

Paging counts toward your rate limits. A loop over thousands of members should handle 429 like any other request.