Pagination, filtering and sorting
The two APIs use different pagination schemes. Check which one applies to the endpoint you are calling.
Cohorts API — token-based pagination
Cohort lists use token-based pagination. On the first request you set limit; to walk to the next or previous page you send the opaque pageToken returned by the previous response. There is no public offset parameter — the offset is baked into the token.
sort and order apply to the cohort list only — the other lists are not sortable. Those lists still take their own filters: the members and authors lists accept a query (name search), and the completion-status list accepts enrollment_status.
| Parameter | Rules |
|---|---|
limit | 1–300. Sets the page size on the first request. |
pageToken | Opaque cursor from a prior response (paging.tokens.next / paging.tokens.previous). When set it must be the only query parameter — limit, filters and sort are already encoded in the token. Sending it alongside anything else returns 422 (page_token_not_exclusive); a malformed token returns 422 (page_token_invalid). |
sort | Cohort list only. created_at or updated_at. Default created_at. |
order | Cohort list only. asc or desc. Default desc. |
Walking the pages (cohorts)
- First page — send
limitplus any filters/sort you want. - The response carries
paging.tokens.next(andpaging.tokens.previouswhere applicable). - Next page — send only
pageToken=<that token>. Do not re-sendlimit, filters, or sort; they are carried inside the token.
Cohort list filters
role—member,author,creator, orinvited.status—activeorinactive.mandatory—trueorfalse.query— substring match on the cohort name.
Communities API — offset-based pagination
All community list endpoints use offset-based pagination with a plain numeric offset.
| Parameter | Rules |
|---|---|
limit | Page size. A platform default applies when omitted. |
offset | Zero-based starting position. Defaults to 0. |
The response envelope includes:
{
"data": [...],
"total": 120,
"limit": 20,
"offset": 0
}
Walking the pages (communities)
- First page —
GET /v1/communities?limit=20&offset=0. - Next page —
GET /v1/communities?limit=20&offset=20. - Continue incrementing
offsetbylimituntiloffset >= total.
Filters (status, visibility, q, role, etc.) can be combined freely with limit and offset on every request.