Pagination
Many endpoints return paginated data. This means not all records are returned at once, but in subsets. You can recognize this by the meta.pagination field in the response.
Pagination metadata
Pagination contains information about the total result set and how data is split:
{
"meta": {
"pagination": {
"total": 150,
"count": 20,
"perPage": 20,
"currentPage": 1,
"totalPages": 8
}
}
}
| Field | Description |
|---|---|
total | Total number of records |
count | Number of records on this page |
perPage | Records per page |
currentPage | Current page (starts at 1) |
totalPages | Total number of pages |
Query parameters
Control pagination with these parameters:
page— page number (default: 1)limit— records per page (default: 10)
Example:
GET /api/v1/subscribers?page=2&limit=50
This returns page 2 with 50 records per page.
Navigate through pages
To fetch all data, iterate through all pages:
# Page 1
curl "https://YOUR_SERVER-api.mail2many.de/api/v1/subscribers?page=1&limit=50" \
--user 'mail2many:YOUR_API_KEY' \
-H "Content-Type: application/json" \
-H "Accept: application/json"
# Page 2
curl "https://YOUR_SERVER-api.mail2many.de/api/v1/subscribers?page=2&limit=50" \
--user 'mail2many:YOUR_API_KEY' \
-H "Content-Type: application/json" \
-H "Accept: application/json"
# Continue until totalPages is reached
Stop when currentPage equals totalPages.
Best practices
- Use a reasonable
limit(e.g. 50–100) for better performance - Cache data across pages to avoid redundant requests
- For very large datasets, consider the Large Data Volumes documentation
- Watch for
429on heavy paging and follow Rate Limiting