typeship APIAPI

Pagination

List endpoints page with a cursor. Ask for a limit, follow next_cursor until it is null.

List endpoints on the typeship API return one page at a time and a cursor for the next:

curl -s "https://typeship.dev/api/v1/projects?limit=20" \
  -H "Authorization: Bearer ak_..."
{
  "data": [ { "id": "prj_...", "object": "project", "...": "..." } ],
  "next_cursor": "MjAyNi0wOC0xOFQxMjowMDowMC4wMDBafHByal8..."
}

Pass next_cursor back as cursor for the following page. When next_cursor is null, you have everything.

ParameterMeaning
limitItems per page. Default 20, maximum 100.
cursorThe next_cursor from the previous page. Opaque.

Results are newest first. A cursor that was not issued by the API returns 400 with Malformed cursor.

Paginated operations: GET /v1/projects, GET /v1/api_keys, GET /v1/projects/{id}/generations, and GET /v1/projects/{id}/spec_versions.

In the typeship SDK

Paginated methods return a PagePromise. Iterate it to walk every item, or await it for one page:

for await (const project of client.projects.list()) {
  console.log(project.name);
}

const page = await client.projects.list({ limit: 50 });
if (page.ok) {
  page.data.items;
  page.data.hasNextPage();
  await page.data.getNextPage();
}

In the typeship CLI

--all walks every page and prints one item per line:

typeship projects list --all | jq -r '.id'

On this page