Skip to Content
CoworkingView Docs
Public API

Pagination

Pages, page size, sort orders and how to keep a random order stable across pages in the CoworkingView API.

List endpoints such as GET /v1/properties are paginated. Everything you need is in the response meta.

Request parameters

ParameterValuesDefault
page1 to 5001
pageSize1 to 5020
sortByrandom, date-desc, date-asc, distance, price-ascrandom
seedinteger, 0 to 2147483647generated for you

distance needs a position (lat and lng, see Properties). A value outside the ranges above is answered with a VALIDATION_FAILED error.

The response

meta of a list response
{
  "data": [ /* up to pageSize items */ ],
  "meta": {
    "contractVersion": "1.0.0",
    "pagination": { "page": 2, "pageSize": 20, "total": 143, "pageCount": 8 },
    "seed": 1234567
  }
}
FieldMeaning
pagination.pageThe page you got.
pagination.pageSizeThe page size applied.
pagination.totalHow many items match in total, across all pages (not the length of data).
pagination.pageCountHow many pages there are for this pageSize.
seedThe seed used for sortBy=random. Echoed so you can reuse it.

To walk all pages, request page=1 and go on until page equals pageCount. An empty result has total: 0 and an empty data.

Random order and the seed

The default order is random, so that no listing is always first. A random order that is re-shuffled on every request would repeat some items and skip others while you page through it. To prevent that, the API gives you a seed:

  1. On the first page, don't send a seed. The response contains meta.seed.
  2. On every following page, send that same value as seed, with the same filters and sortBy.
Your app
API
  1. 1.GET /v1/properties?locale=en&page=1
  2. 2.data (page 1) · meta.seed = 1234567
  3. 3.Keep the seed
  4. 4.GET /v1/properties?locale=en&page=2&seed=1234567
  5. 5.data (page 2), same order · meta.seed = 1234567
Pin the seed you got on page 1 and every page continues the same order.

The other sort orders (date-desc, date-asc, distance, price-asc) are deterministic and don't need a seed.

Walk every page in a stable order
const base = 'https://api.coworkingview.com/v1/properties?locale=en&city=berlin&pageSize=50';
let page = 1, seed: number | undefined, all: unknown[] = [];
for (;;) {
  const url = `${base}&page=${page}${seed ? `&seed=${seed}` : ''}`;
  const { data, meta } = await (await fetch(url)).json();
  all.push(...data);
  seed = meta.seed;
  if (page >= meta.pagination.pageCount) break;
  page += 1;
}

Paging through the whole catalogue to copy it is not what the API is for: see Attribution and licences. Use filters to fetch what your product needs.

The map endpoint is not paginated

GET /v1/properties/map takes the same filters but returns every matching space as a light list of coordinates and titles, in one response. It ignores page and pageSize, and its meta.pagination always describes one page that holds everything.

The set it returns has a ceiling. When the ceiling cuts the result, meta.truncated is true. Don't present such a result as complete: narrow the filters (a city, a zone) and ask again. truncated is also true, with an empty list, if the map data was briefly unavailable.

On this page