Lists on both APIs are paginated the same way: page and limit in the query, data and meta in the response. Search is the one exception. Previous: Errors | Next: Rate Limits

Reference - This guide is a tutorial. For exhaustive, always-current signatures and field lists, see the auto-generated reference:

Prerequisites

Query parameters

Bash
curl "https://api.lynkow.com/storefront/a779c43c-430e-45d1-8749-2144d7f60a0f/contents?page=2&limit=10&locale=en"

Parameter

Default

Maximum

page

1

limit

20

100

Pages count from 1. A page past the last one returns an empty data array. Keep limit at 100 or below: depending on the list, a larger value returns 422 or is lowered to the maximum.

Two Storefront routes built to fetch a whole catalog in one call default to 500 items and accept up to 500: a category with its posts (/categories/{slug}, categories.getBySlug() in the SDK) and path resolution (/resolve).

The Admin API (/v1) uses the same parameters, defaults and maximum.

The meta object

JSON
{
  "data": [ ... ],
  "meta": {
    "total": 42,
    "perPage": 10,
    "currentPage": 2,
    "lastPage": 5,
    "firstPage": 1,
    "firstPageUrl": "/?page=1",
    "lastPageUrl": "/?page=5",
    "nextPageUrl": "/?page=3",
    "previousPageUrl": "/?page=1"
  }
}
  • total: items matching the query, across all pages.

  • perPage: the page size applied.

  • currentPage and lastPage: where you are, and the last page number. lastPage is 1 when nothing matches.

  • firstPage: always 1.

  • The ...Url fields hold a query string only, without the endpoint path or your other parameters. nextPageUrl is null on the last page. Build the next request from currentPage instead.

There is another page while currentPage < lastPage.

With the SDK

List methods take page and limit and return { data, meta }:

TypeScript
import { lynkow } from '@/lib/lynkow'

const { data, meta } = await lynkow.contents.list({ page: 2, limit: 10 })
const hasNext = meta.currentPage < meta.lastPage

To read a whole list, loop until the last page:

TypeScript
import type { ContentSummary } from 'lynkow'
import { lynkow } from '@/lib/lynkow'

export async function allPosts(): Promise<ContentSummary[]> {
  const posts: ContentSummary[] = []
  let page = 1
  let lastPage = 1
  do {
    const { data, meta } = await lynkow.contents.list({ page, limit: 100 })
    posts.push(...data)
    lastPage = meta.lastPage
    page++
  } while (page <= lastPage)
  return posts
}

The SDK's PaginationMeta type also declares hasMorePages and hasPreviousPages. The API never sends them, so they are always undefined: compare currentPage with lastPage and with 1.

Search results

Search endpoints (/search and /search/{profileSlug}, search.search() in the SDK) return a different meta:

JSON
{
  "data": [ ... ],
  "meta": {
    "total": 37,
    "page": 1,
    "totalPages": 4,
    "perPage": 10,
    "query": "pricing",
    "processingTimeMs": 3,
    "profile": "default"
  }
}
  • page and totalPages replace currentPage and lastPage. totalPages is 0 when nothing matches.

  • total is an estimate.

  • The default and maximum limit come from the search profile's settings.

TypeScript
const results = await lynkow.search.search('pricing', { page: 1, limit: 10 })
const hasNext = results.meta.page < results.meta.totalPages

Instant Search builds a search page on top of it.

Reference

Next Steps