Pagination
The Companies Search endpoint (GET /api/companies/search) returns paginated results.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number (1-indexed) |
limit | integer | 20 | Items per page (max 100) |
Response Format
{
"results": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 156,
"totalPages": 8
}
}
Example
- cURL
- JavaScript
- Python
curl "https://api.veraenrich.com/companies/search?q=fintech&page=1&limit=20" \
-H "Authorization: Bearer $VERA_API_KEY"
const response = await fetch(
'https://api.veraenrich.com/companies/search?q=fintech&page=1&limit=20',
{ headers: { 'Authorization': `Bearer ${process.env.VERA_API_KEY}` } }
);
const { results, pagination } = await response.json();
console.log(`Page ${pagination.page} of ${pagination.totalPages}`);
import os, requests
response = requests.get(
'https://api.veraenrich.com/companies/search',
headers={'Authorization': f'Bearer {os.environ["VERA_API_KEY"]}'},
params={'q': 'fintech', 'page': 1, 'limit': 20}
)
data = response.json()
pagination = data['pagination']
print(f'Page {pagination["page"]} of {pagination["totalPages"]}')
Iterating All Pages
- JavaScript
- Python
async function processAllCompanies(query, processFunc) {
let page = 1;
while (true) {
const response = await fetch(
`https://api.veraenrich.com/companies/search?q=${query}&page=${page}&limit=100`,
{ headers: { 'Authorization': `Bearer ${process.env.VERA_API_KEY}` } }
);
const { results, pagination } = await response.json();
for (const company of results) {
await processFunc(company);
}
if (page >= pagination.totalPages) break;
page++;
await new Promise(r => setTimeout(r, 100)); // Rate limit courtesy
}
}
import os, time, requests
def process_all_companies(query, process_func):
page = 1
while True:
response = requests.get(
'https://api.veraenrich.com/companies/search',
headers={'Authorization': f'Bearer {os.environ["VERA_API_KEY"]}'},
params={'q': query, 'page': page, 'limit': 100}
)
data = response.json()
for company in data['results']:
process_func(company)
if page >= data['pagination']['totalPages']:
break
page += 1
time.sleep(0.1)
Best Practices
| Use Case | Recommended limit |
|---|---|
| User-facing UI | 10-25 |
| Data tables | 25-50 |
| Batch processing | 100 |