# How to paginate with cursor?

**URL:** <https://community.hubspot.com/t/how-to-paginate-with-cursor/38489>\
**Category:** APIs & Integrations\
**Tags:** developer-tools, professional, contacts, timeline-and-extensions-apis\
**Created:** [June 7, 2021, 3:07pm UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489 "2021-06-07T15:07:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxsterben](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/foxsterben/32/89259_2.png) [@foxsterben](https://community.hubspot.com/u/foxsterben)\
**Post date:** [June 7, 2021, 3:07pm UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/1 "2021-06-07T15:07:17Z")

</div>

When I make a GET call the response returns something like:

“paging”: {  
“next”: {  
“after”: “1601”,  
“link”: “[https://api.hubapi.com/crm/v3/objects/contacts?after=1601](https://api.hubapi.com/crm/v3/objects/contacts?id=1&after=1601)”  
}  
}

however, since I have a large number (\>476k) of contact when doing the hubsepot paging it returns an error. I have searched in the forum how to filter the GET call but Hubspot workers mention that to filter you must use POST which returns me something like.

“paging”: {  
“next”: {  
“after”: “10”  
}  
}

for paging I use Azure Data Factory, as follows $.paging.next.link

But with POST I get back a cursor, and if I use $.paging.next.after I get an error.

The authentication is done with oauth2.

---

<div class="post-metadata">

**Author:** ![natsumimori](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/natsumimori/32/39807_2.png) [@natsumimori](https://community.hubspot.com/u/natsumimori)\
**Post date:** [June 8, 2021, 6:06am UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/2 "2021-06-08T06:06:36Z")

</div>

Hi @foxsterben , thank you for your post!

@dannio and @himanshurauthan , would you mind sharing your advice for @foxsterben ?

---

<div class="post-metadata">

**Author:** ![dannio](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dannio/32/95715_2.png) [@dannio](https://community.hubspot.com/u/dannio)\
**Post date:** [June 9, 2021, 7:32am UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/3 "2021-06-09T07:32:47Z")

</div>

So after checking the docs " [CRM API | Contacts - HubSpot docs](https://developers.hubspot.com/docs/api-reference/legacy/crm/objects/contacts/guide) " and looking at the link you’ve posted on here, there are a few things wrong:

1. There shouldn’t be an **id** parameter in the query
2. The **after** parameter should be what you get from the previous call.

i.e:

```lia-code-sample
"paging": {
 "next": {
 "link": "?after=NTI1Cg%3D%3D",
 "after": "NTI1Cg%3D%3D"
 }
 }

```

In this example, the **after** value should be **NTI1Cg%3D%3D** so the link you use should be:

[https://api.hubapi.com/crm/v3/objects/contacts?after=NTI1Cg%3D%3D](https://api.hubapi.com/crm/v3/objects/contacts?after=NTI1Cg%3D%3D)

Edit:

Apologies, re-read the question and it seems you’re already using what you got from the response as the call. As for filtering, can’t you just limit the results using the **limit** param or restrict the amount of data being sent by defining the **properties** property?

---

<div class="post-metadata">

**Author:** ![foxsterben](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/foxsterben/32/89259_2.png) [@foxsterben](https://community.hubspot.com/u/foxsterben)\
**Post date:** [June 9, 2021, 10:15pm UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/4 "2021-06-09T22:15:35Z")

</div>

Yes, the “id” should not be there, I corrected it. According to the documentation, POST is used for filtering, however, the problem with this is that in the response it only gives me a cursor (i.e after=10), it does not give me a link to make the following call compared to GET  
In login I have my authentication oauth2

 ![foxsterben_0-1623263174992.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/5/f53bd3bc601f92adc2d60eabf61e2700eb456fe4.png)

If I try with POST, with pagintation as follows $.paging.next.after

 ![foxsterben_1-1623263347856.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/c/6c1948f63c66c7f3167beb7b2875b4c107f4c33f.png)

Obviously get this error:  
Operation on target Ingest\_REST\_Data failed: Failure happened on ‘Source’ side. ErrorCode=RestSourceCallFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The HttpStatusCode 404 indicates failure. Request URL: [https://api.hubapi.com/90](https://api.hubapi.com/90) Response payload:\<!DOCTYPE html\>\<html lang=“en”\>\</html\>\<head\>\<meta charset=“utf-8”/\>\<title\>Error\</title\>\<link rel=“icon” href=“data:;base64,=”\>\<script\>function refreshFunc() { window.location.reload(true);

Also I tried this

$.concat(‘crm/v3/objects/contacts/search?after=’,$.paging.next.after)

 ![foxsterben_2-1623275148546.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/a/7af587db43f4503a86b4c32e6acf50fd0530008a.png)

and return this error

Operation on target Ingest\_REST\_Data failed: Failure happened on ‘Source’ side. ErrorCode=UserErrorFailToReadFromRestResource,‘Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Path ended with an open string.,Source=Microsoft.DataTransfer.ClientLibrary,’‘Type=Newtonsoft.Json.JsonException,Message=Path ended with an open string.,Source=Newtonsoft.Json,’

It is in the paging where the error occurs, I would appreciate your help to solve this problem.

---

<div class="post-metadata">

**Author:** ![dannio](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dannio/32/95715_2.png) [@dannio](https://community.hubspot.com/u/dannio)\
**Post date:** [June 10, 2021, 1:38am UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/5 "2021-06-10T01:38:37Z")

</div>

@foxsterben not sure what’s going on with you being told you need a POST call? How did you describe your issue to support?

The POST call is for the **Search** API call, which has an option to filter.

Or the **Read a batch of contacts by internal ID, or unique property values** API call:

[https://api.hubapi.com/crm/v3/objects/contacts/batch](https://api.hubapi.com/crm/v3/objects/contacts/batch)

If you’re using the standard contact **List** API, then it’s only GET:

[https://api.hubapi.com/crm/v3/objects/contacts](https://api.hubapi.com/crm/v3/objects/contacts)

What do you mean when you want to filter?

---

<div class="post-metadata">

**Author:** ![foxsterben](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/foxsterben/32/89259_2.png) [@foxsterben](https://community.hubspot.com/u/foxsterben)\
**Post date:** [June 11, 2021, 3:55pm UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/6 "2021-06-11T15:55:08Z")

</div>

@dannio

I was using POST because with GET I was getting an error indicating that the limit had been exceeded (I don’t have it at the moment), there are 476k contacts, so I assumed that this was it, that’s why I intended to use POST to filter the results so that they were not so many.

However, I found that actually the error using GET was due to the limits in the amount of requests per second.

> **[API usage guidelines and limits - HubSpot docs](https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines)**
>
> Learn about the different API and developer feature limits in HubSpot.

So I limited the amount of requests so as not to exceed the limits but now I am getting this error

 ![foxsterben_0-1623426804950.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/a/a621aab84fa454f6585e3b18eb1edf9a5f70cd52.png)

 ![foxsterben_0-1623427195627.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/b/4bfb8c3da746a7fbb7a89d9122b850a79acc4f9b.png)

What happens? if it is 502 it is a problem on your side.

---

<div class="post-metadata">

**Author:** ![dannio](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dannio/32/95715_2.png) [@dannio](https://community.hubspot.com/u/dannio)\
**Post date:** [June 15, 2021, 8:23am UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/7 "2021-06-15T08:23:33Z")

</div>

@foxsterben the **limit** param doesn’t limit the number of requests you send, it limits the number of results coming in.

If you want to control the number of requests on your server side, that’s something that needs to be done on your end. It’s best you check out how to throttle requests on your application and try again.

If you reach the daily alloted limit for API calls, you will need to wait till it resets until you try again.

---

<div class="post-metadata">

**Author:** ![foxsterben](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/foxsterben/32/89259_2.png) [@foxsterben](https://community.hubspot.com/u/foxsterben)\
**Post date:** [June 15, 2021, 3:59pm UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/8 "2021-06-15T15:59:32Z")

</div>

Hi everyone! 👋

Just adding a quick update for anyone coming across this thread.

HubSpot continues to support cursor-based pagination using `paging.next.after`.

For **GET requests** , pass the returned cursor as the `after` query parameter. For **POST search requests** , include it in the JSON request body as `after`, while keeping your search filters.

If you’re using Azure Data Factory, make sure your pagination configuration handles the cursor correctly, as POST search responses don’t necessarily provide a next-page URL.

Also, the API key authentication shown in an older example is no longer supported. Current integrations should use OAuth or another supported access-token authentication method.

You can find the latest details in the [HubSpot API documentation](https://developers.hubspot.com/docs/api-reference/latest/overview).

Hope this helps!

* * *

I am already checking with technical support, and indeed the error is on their side. It should be noted that if the limit of requests is reached, the response returned would be different.

_Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 23, 2026. Thank you for your contributions to the HubSpot Community!_

---

<div class="post-metadata">

**Author:** ![GBobrowski](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@GBobrowski](https://community.hubspot.com/u/GBobrowski)\
**Post date:** [February 17, 2022, 6:29pm UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/9 "2022-02-17T18:29:38Z")

</div>

I am sending various numbers appended to , like 4,7,154 , neverthe less I am getting always the same 10 records, no advancement , no change in the size of returned set.

Question 1: Is there a way to simply get all? I have only 2000 records.

Question 2: Could it be that I have a problem because I am using a demo version of HubSpot?

`&limit=10&offset=10`

You can use OAuth or private app authentication using `Authorization: Bearer <access_token>`. API key authentication is no longer supported.

_Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 23, 2026. Thank you for your contributions to the HubSpot Community!_

---

<div class="post-metadata">

**Author:** ![dannio](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dannio/32/95715_2.png) [@dannio](https://community.hubspot.com/u/dannio)\
**Post date:** [February 18, 2022, 1:58am UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/10 "2022-02-18T01:58:13Z")

</div>

There seems to be an extra “&” in your query:

```lia-code-sample
updatedAt&&language

```

I suggest removing that and try again.

---

<div class="post-metadata">

**Author:** ![chandrareddy1](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chandrareddy1](https://community.hubspot.com/u/chandrareddy1)\
**Post date:** [August 10, 2023, 4:53am UTC](https://community.hubspot.com/t/how-to-paginate-with-cursor/38489/11 "2023-08-10T04:53:29Z")

</div>

Is this resolved ? , i’m also experincing the same issue
