Skip to main content
Most list endpoints across the Integration and Admin APIs share a common pagination contract. This page documents the shape so you can build a single helper and reuse it everywhere.

Query parameters

ParameterTypeDefaultNotes
limitinteger10Maximum number of items to return. Upper bound is typically 100.
skipinteger0Number of items to skip before returning the page.
searchstringCase-insensitive substring match on the entity’s primary text fields.
sortstringendpoint-specificA sort directive (e.g. -createdAt for descending). Not every list endpoint supports arbitrary sort keys — check the endpoint’s schema.
Date-range filters use the conventions fromDate / toDate on most endpoints. A few older endpoints use startDate / endDate — check the endpoint page for the canonical parameter names.

Response shape

Most paginated endpoints return an envelope:
{
  "totalCount": 142,
  "edges": [
    { /* entity */ },
    { /* entity */ }
  ]
}
FieldDescription
totalCountTotal number of matching entities, ignoring limit and skip. Use this to drive pagination UI.
edgesArray of entities for the current page. Array length is at most limit.
A handful of older list endpoints return { items } or a bare array instead of { totalCount, edges }. The endpoint page will reflect the actual schema — always prefer the per-endpoint schema over assumptions.

Requesting a page

curl -X GET "https://{subdomain}.nudj.cx/api/v2/admin/challenges?limit=20&skip=40" \
  -H "Authorization: Bearer $NUDJ_API_TOKEN" \
  -H "Content-Type: application/json"

Paginating through every page

async function* paginateAll(path, pageSize = 100) {
  let skip = 0;
  while (true) {
    const page = await nudjRequest(`${path}?limit=${pageSize}&skip=${skip}`);
    for (const edge of page.edges) yield edge;
    skip += page.edges.length;
    if (skip >= page.totalCount || page.edges.length === 0) return;
  }
}

for await (const challenge of paginateAll('/api/v2/admin/challenges')) {
  // …
}

Common errors

StatusCauseFix
400 BAD_REQUESTlimit must be a positive integerNon-integer or negative limitUse a positive integer, capped at 100
400 BAD_REQUESTskip must be non-negativeNegative skipUse 0 or a positive integer
400 BAD_REQUEST — Invalid sort keyEndpoint doesn’t support the requested sortCheck the endpoint’s schema for supported sort values
See Errors for the full envelope.

Errors

Error envelope and common status codes.

Internationalization

Translating response bodies with x-language.