# Export data automatically under then constrain on offset

**URL:** <https://community.hubspot.com/t/export-data-automatically-under-then-constrain-on-offset/11360>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [November 9, 2018, 12:05am UTC](https://community.hubspot.com/t/export-data-automatically-under-then-constrain-on-offset/11360 "2018-11-09T00:05:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 9, 2018, 12:05am UTC](https://community.hubspot.com/t/export-data-automatically-under-then-constrain-on-offset/11360/1 "2018-11-09T00:05:28Z")

</div>

When I was trying to GET /contacts/v1/lists/all/contacts/all, there is offset issue, which prevented me from getting data automatically since I need to know VID first before getting next page data, any advice to make it more automated? Thank you

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [November 12, 2018, 2:49pm UTC](https://community.hubspot.com/t/export-data-automatically-under-then-constrain-on-offset/11360/2 "2018-11-12T14:49:25Z")

</div>

Hi, [@Xi\_Wang](https://community.hubspot.com/u/xi_wang),

Could you please describe your goal and issue in more detail?

The [Get all contacts](https://developers.hubspot.com/docs/methods/contacts/get_contacts) endpoint returns a JSON-formatted list of up to 100 contacts. The last two fields in the response are `has-more` and `vid-offset`.

If `has-more` is `true`, then `vid-offset` will contain the `vid` of the last contact returned. You then use this `vid-offset` value in your next request.

For example, if you query `https://api.hubapi.com/contacts/v1/lists/all/contacts/all?count=100&hapikey=your_key`, you will receive up to 100 contacts.

If there are more contacts in your account, `"has-more": true` will appear at the end of the payload followed by `"vid-offset": 1234`.

You can then use a loop to query the endpoint again, this time with the `vid-offset` in the request URL:

`https://api.hubapi.com/contacts/v1/lists/all/contacts/all?count=100&hapikey=your_key&&vidOffset=1234`. This will return the next 100 contacts.
