Skip to content

Pagination

List endpoints return results a page at a time using cursors. Cursors stay stable while items are added, so you never see the same item twice or skip one because the list changed between requests.

The list object

200 OK
{
  "object": "list",
  "data": [
    {
      "object": "keyword",
      "id": "cm8kw0001",
      "phrase": "espresso grind size",
      …
    }
  ],
  "hasMore": true,
  "nextCursor": "cm8kw0001"
}
FieldDescription
dataThe items on this page, in the endpoint's documented order.
hasMoretrue when another page exists.
nextCursorPass it as cursor to get the next page; null on the last page.

Parameters

Query parameterDescription
limitItems per page, 1–100. Default 25.
cursorThe nextCursor of the previous page. Omit it for the first page.

Filters (for example status or search) must stay the same while you page through results.

curl https://semanticson.com/api/v1/projects/PROJECT_ID/keywords?limit=100&cursor=NEXT_CURSOR \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Treat cursors as opaque strings. They are valid as long as the item they point to exists; if it was deleted, start again from the first page.

Fetching every page

async function listAll(path) {
  const items = [];
  let cursor = null;
  do {
    const url = new URL(`https://semanticson.com/api/v1${path}`);
    url.searchParams.set("limit", "100");
    if (cursor) url.searchParams.set("cursor", cursor);
    const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.SEMANTICSON_API_KEY}` } });
    const page = await res.json();
    if (!res.ok) throw new Error(`${page.error.code}: ${page.error.message}`);
    items.push(...page.data);
    cursor = page.hasMore ? page.nextCursor : null;
  } while (cursor);
  return items;
}

const keywords = await listAll("/projects/PROJECT_ID/keywords");

A few lists are short by nature and return everything at once with hasMore: false (for example GET /tools and audit schedules). The same loop handles them.

Paginated endpoints

EndpointSummary
GET /projectsList projects
GET /projects/{projectId}/topical-mapsList topical maps
GET /projects/{projectId}/keywordsList keywords
GET /projects/{projectId}/clustersList keyword clusters
GET /projects/{projectId}/briefsList content briefs
GET /projects/{projectId}/documentsList documents
GET /documents/{documentId}/versionsList saved versions
GET /projects/{projectId}/entitiesList entities
GET /executionsList tool runs
GET /projects/{projectId}/auditsList audits for a project
GET /audits/{auditId}/issuesList issues in an audit
GET /projects/{projectId}/reportsList reports
GET /sitesList connected sites
GET /sites/{siteId}/pagesList synced pages
GET /sites/{siteId}/redirectsList synced redirects
GET /sites/{siteId}/termsList synced categories, tags and other terms
GET /sites/{siteId}/mediaList synced media
GET /sites/{siteId}/changesList changes for a site
GET /webhooks/{webhookId}/deliveriesList deliveries