How to fetch more than 100 objects when using the HubSpot v2 API

I am trying to fetch data for all my pages using the v2 API but it limits the objects to 100 when I try to do the same. How to get all the results or see the next set of results using the API?

Here’s the API I’m using: https://api.hubapi.com/content/api/v2/pages?hapikey=******

Hey, @Vedant :waving_hand: Thanks for reaching out! Have you tried using the offset param? I am going to assume this is common knowledge, and I’ll list it out anyway :blush:

Definition:

offset = The offset set to start returning rows from. Defaults to 0.

  • Let’s assume you have 500 pages
  • Because it begins at 0 (zero) we can use this call to get the first 100 (0-99)
    GET https://api.hubapi.com/content/api/v2/pages?limit=100​
  • Then we can get the second 100 (100-199) by adding an offset of 100
    GET https://api.hubapi.com/content/api/v2/pages?limit=100&offset=100​

You can do a simplified test by:

  • making a request using the param ?limit=3 to get pages 1-3 (0-2)
  • then a second request using the param ?limit=3&offset=3 to get pages 4-6 (3-5)

Have fun building! — Jaycee