Skip to content

Pagination ​

List endpoints are paginated.

Parameters ​

ParameterTypeDefaultDescription
pageinteger1Page number
per_pageinteger25Items per page, between 1 and 100

Response structure ​

json
{
  "data": [
    { "id": 1, "email": "alice@example.com" },
    { "id": 2, "email": "bob@example.com" }
  ],
  "meta": {
    "current_page": 2,
    "last_page": 6,
    "per_page": 25,
    "total": 150
  },
  "links": {
    "first": "https://app.beeving.com/api/v1/contacts?page=1",
    "last": "https://app.beeving.com/api/v1/contacts?page=6",
    "prev": "https://app.beeving.com/api/v1/contacts?page=1",
    "next": "https://app.beeving.com/api/v1/contacts?page=3"
  }
}

meta.current_page, meta.last_page, meta.per_page and meta.total are present on every paginated list. Some endpoints add more keys to meta, such as from, to or count. Don't depend on keys that aren't listed here.

Some small collections are not paginated and return just { "data": [...] }:

  • pipeline stages
  • workspace members and invitations
  • a contact's timeline (the 50 most recent events)

Iterating over every page ​

js
async function getAll(path, token) {
  const items = []
  let page = 1

  while (true) {
    const res = await fetch(
      `https://app.beeving.com/api/v1${path}?page=${page}&per_page=100`,
      { headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' } }
    )
    const { data, meta } = await res.json()
    items.push(...data)

    if (page >= meta.last_page) break
    page++
  }

  return items
}

API v1.0