Skip to main content

Overview

List endpoints use cursor-based pagination for efficient traversal of large datasets.

Response Format

Paginated responses include a pagination object:
{
  "data": [...],
  "metadata": {
    "request_id": "req_abc123"
  },
  "pagination": {
    "cursor": "eyJ...",
    "has_next_page": true,
    "count": 20
  }
}
FieldDescription
cursorOpaque string to fetch the next page
has_next_pageWhether more results are available
countNumber of items in the current response

Fetching the Next Page

To fetch the next page, include the cursor value in your next request body:
curl -X POST https://api.village.do/v2/people/search \
  -H "Authorization: Bearer your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "software engineer",
    "cursor": "eyJ..."
  }'

Pagination Parameters

Most list endpoints accept these parameters:
ParameterTypeDefaultDescription
limitinteger20Number of results per page (max 100)
cursorstring-Cursor from previous response

Example: Iterating Through All Results

let cursor = null;
let allResults = [];

do {
  const response = await fetch('https://api.village.do/v2/people/search', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your_token',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      query: 'software engineer',
      limit: 50,
      cursor: cursor
    })
  });

  const data = await response.json();
  allResults.push(...data.data);
  cursor = data.pagination?.cursor;

} while (cursor && data.pagination?.has_next_page);