Overview
Use pagination when you need to retrieve large datasets in smaller batches. Dakota supports this throughmax_num (page size / limit) and offset (starting position) inside the filters object.
How offset and max_num work
Formula:
offset = (page_number - 1) * max_num
Response shape
List responses return an envelope:count_only responses return:
How to Use
- Optionally call with
count_only: trueto getrecord_count. - Request page 1 with
offset: 0and your chosenmax_num. - For the next page, set
offsetto the previous response’snext_offset(or addmax_numto the current offset). - Stop when
next_offsetis-1(last page, empty result, or past end). You can also stop whenrecords.length < max_num.
Empty and last-page behavior
Account Examples
First Page of Accounts
Next Page of Accounts
Paginate Accounts with a Filter
Count Accounts Before Paging
Contact Examples
First Page of Contacts
Next Page of Contacts
Paginate Contacts with a Date Filter
Count Contacts Before Paging
Best Practices
- Prefer
next_offset === -1as the primary stop condition for bulk jobs. - Always include
order_byso page results stay consistent across requests. - Use a
max_numbetween 20 and 50 for reliable bulk pulls. - Use
count_onlyfirst when you need the total record count before paging. - Apply the same
filterandorder_byon every page of a bulk job. max_numworks as either a number (50) or a string ("50").- Request fields use payload names (for example
sfid,lastname); responses may return mapped names (for exampleaccount_id/contact_id,last_name).
Token expiry
Access tokens expire after 18,000 seconds (5 hours). When pulling large datasets (for example hundreds of thousands of Account or Contact records), a long-running pagination script can exceed this window. If the token expires mid-run, later page requests will fail with an unauthorized / invalid token response. Recommendations:- Track elapsed time while paging.
- Refresh or re-authenticate and obtain a new token before the 5-hour limit if the job may run longer.
- Resume from the last successful
offset/next_offsetafter getting a new token so you do not restart from page 1.

