Skip to main content
All list endpoints in the CDP API use cursor-based pagination. Instead of page numbers, each response returns a nextPageToken that you pass back to fetch the next page. This approach is stable across inserts and deletes and scales to arbitrarily large result sets.

Request parameters

List endpoints accept two query parameters:
ParameterTypeDefaultDescription
pageSizeinteger20Number of resources to return per page. Most endpoints cap at 100.
pageTokenstring(none)Opaque cursor returned by the previous response. Omit on the first request.

Response field

Every paginated response includes a top-level nextPageToken:
{
  "transfers": [
    { "transferId": "transfer_..." },
    { "transferId": "transfer_..." }
  ],
  "nextPageToken": "eyJsYXN0X2lkIjogImFiYzEyMyIsICJ0aW1lc3RhbXAiOiAxNzA3ODIzNzAxfQ=="
}
When you reach the end of the result set, nextPageToken is omitted or returned as an empty string. That is the signal to stop iterating.
The collection field name is resource-specific, not a generic data. For example, GET /v2/transfers returns transfers, GET /v2/accounts returns accounts, and GET /v2/deposit-destinations returns depositDestinations. Check the endpoint’s response schema for the exact field name.
Treat nextPageToken as an opaque string. Don’t try to decode, parse, or construct it — the format is internal and may change.

Example: fetch the first page

GET /v2/transfers?pageSize=25

Example: fetch the next page

GET /v2/transfers?pageSize=25&pageToken=eyJsYXN0X2lkIjogImFiYzEyMyJ9

Iterating through all results

A typical pattern: keep calling the endpoint with the previous response’s nextPageToken until it stops coming back.
async function listAllTransfers() {
  const results = [];
  let pageToken: string | undefined;

  do {
    const url = new URL("https://api.cdp.coinbase.com/platform/v2/transfers");
    url.searchParams.set("pageSize", "100");
    if (pageToken) url.searchParams.set("pageToken", pageToken);

    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${jwt}` },
    });
    const body = await res.json();

    results.push(...body.transfers);
    pageToken = body.nextPageToken || undefined;
  } while (pageToken);

  return results;
}

Best practices

  • Use the largest pageSize your workload can handle to reduce the number of round-trips. For bulk reads, prefer 100 over the default 20.
  • Persist the nextPageToken if you need to resume iteration across processes or sessions.
  • Don’t reorder results between requests. Cursors encode the result set’s ordering at the time of the first request; sorting client-side after each page is safe, but changing query filters mid-iteration is not.
  • Stop on missing or empty nextPageToken — that’s the end-of-results signal, not an error.
  • Combine with rate limits in mind: pull pages serially rather than in parallel.

Conventions

Shared formatting standards (IDs, amounts, timestamps)

Rate limits

Per-window limits and backoff guidance