Pagination

Cursor-based pagination for every list endpoint.

Every list endpoint in the VideoGen API uses the same cursor-based pagination contract. Responses include the items array you already expect, plus two fields that tell you whether more pages exist and how to fetch them.

Query parameters

ParameterTypeDefaultDescription
limitinteger50Maximum items per page. Minimum 1, maximum 200.
cursorstring(omit)Opaque cursor from a previous response’s nextCursor. Omit on the first request.

Response fields

Every paginated response includes:

FieldTypeDescription
hasMorebooleanWhen true, another page is available.
nextCursorstring | nullPass this value as cursor on the next request. null when hasMore is false.

The items array field name depends on the endpoint (projects, files, avatarPresenters, ttsVoices, endpoints, and so on).

Paginated endpoints

MethodPathItems field
GET/v1/projectsprojects
GET/v1/filesfiles
GET/v1/resources/avatar-presentersavatarPresenters
GET/v1/resources/tts-voicesttsVoices
GET/v1/webhooks/endpointsendpoints

GET /v1/projects and GET /v1/files return results most recently updated first.

Fetching every page

1import { VideoGenClient } from "@videogen/sdk";
2
3const client = new VideoGenClient({ token: process.env.VIDEOGEN_API_KEY });
4
5const allFiles = [];
6let cursor: string | undefined;
7
8do {
9 const page = await client.files.getFiles({ limit: 100, cursor });
10 allFiles.push(...page.files);
11 cursor = page.hasMore ? page.nextCursor ?? undefined : undefined;
12} while (cursor != null);

Rules

  • Cursors are opaque. Treat them as strings. Do not parse or construct them yourself.
  • Cursors are endpoint-specific. A cursor from GET /v1/files only works on GET /v1/files. Using one with a different endpoint returns 400.
  • Pass cursors unmodified. Copy nextCursor exactly into the cursor query param.
  • Cache static catalogues. Avatar presenters and TTS voices change infrequently. Fetch once and cache for hours rather than listing on every request.