# Associations API returning incorrect next links for paging

**URL:** <https://community.hubspot.com/t/associations-api-returning-incorrect-next-links-for-paging/121777>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [December 3, 2024, 10:29am UTC](https://community.hubspot.com/t/associations-api-returning-incorrect-next-links-for-paging/121777 "2024-12-03T10:29:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skerdi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/skerdi/32/34870_2.png) [@skerdi](https://community.hubspot.com/u/skerdi)\
**Post date:** [December 3, 2024, 10:29am UTC](https://community.hubspot.com/t/associations-api-returning-incorrect-next-links-for-paging/121777/1 "2024-12-03T10:29:37Z")

</div>

On November 26, HubSpot started returning incorrect next links for paging when querying the Associations API. I’m issuing the following request:

`GET https://api.hubapi.com/crm/v4/objects/companies?limit=1&associations=deals&archived=false`

I get the following response:

```lia-code-sample
{
 "results": [
 {
 "id": "21350299152",
 "properties": {...},
 "createdAt": "2024-06-10T08:08:35.227Z",
 "updatedAt": "2024-10-28T15:50:09.488Z",
 "archived": false,
 "associations": {
 "deals": {
 "results": [...],
 "paging": {
 "next": {
 "after": "MC02LTIzMjI0NjY2MDA1",
 "link": "https://api-na1.hubapi.com/crm/v3/objects/0-2/21350299151/associations/0-3?portalId=xxxxxxx&after=MC02LTIzMjI0NjY2MDA1"
 }
 }
 }
 }
 }
 ],
 "paging": {
 "next": {
 "after": "21350299152",
 "link": "https://api.hubapi.com/crm/v4/objects/companies?associations=deals&archived=false&limit=1&after=21350299152"
 }
 }
}

```

As can be seen from the response, the next link for the paging of deals associtations is incorrect as it is from the V3 API:

`https://api-na1.hubapi.com/crm/v3/objects/0-2/21350299151/associations/0-3?portalId=xxxxxxx&after=MC02LTIzMjI0NjY2MDA1`

Another minor issue is that HubSpot is returning region-specific hosts while in [this blog post](https://product.hubspot.com/blog/routing-api-traffic) they claim that the data center should be resolved internally. This issue is also happening when working with the V3 API.

While the general next link for paging is returned just fine with the

_[api.hubapi.com](http://api.hubapi.com)_ host.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [December 3, 2024, 9:07pm UTC](https://community.hubspot.com/t/associations-api-returning-incorrect-next-links-for-paging/121777/2 "2024-12-03T21:07:12Z")

</div>

Hey, @skerdi 👋 Thanks for your post. For your second issue, will you make a submission to the form linked here, please? [https://community.hubspot.com/t5/Developer-Announcements/️Announcing-the-new-Developer-Feedback-Tool-Available-Now/td-p/1064751](https://community.hubspot.com/t5/Developer-Announcements/%EF%B8%8FAnnouncing-the-new-Developer-Feedback-Tool-Available-Now/td-p/1064751)  
For Q1, I can’t reproduce this behaviour using my test portal. I also wasn’t able to find any support tickets for this issue. What happens if you make the same request using Postman? Here’s my test using Postman:

Request

`GET https://api.hubapi.com/crm/v4/objects/companies?limit=1&associations=deals&archived=false `

Response

```lia-code-sample
{
 "results": [
 {
 "id": "9291675216",
 "properties": {
 "createdate": "2022-08-02T17:49:46.873Z",
 "domain": null,
 "hs_lastmodifieddate": "2024-10-26T09:53:35.766Z",
 "hs_object_id": "9291675216",
 "name": "My Cat Circus"
 },
 "createdAt": "2022-08-02T17:49:46.873Z",
 "updatedAt": "2024-10-26T09:53:35.766Z",
 "archived": false,
 "associations": {
 "deals": {
 "results": [
 {
 "id": "9786091184",
 "type": "company_to_deal_unlabeled"
 }
 ]
 }
 }
 }
 ],
 "paging": {
 "next": {
 "after": "9291675217",
 "link": "https://api.hubapi.com/crm/v4/objects/companies?associations=deals&archived=false&limit=1&after=9291675217"
 }
 }
}

```

Which returns the expected format for paging with the v4 endpoint.

Thanks for the additional information! — Jaycee

---

<div class="post-metadata">

**Author:** ![skerdi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/skerdi/32/34870_2.png) [@skerdi](https://community.hubspot.com/u/skerdi)\
**Post date:** [December 4, 2024, 9:31am UTC](https://community.hubspot.com/t/associations-api-returning-incorrect-next-links-for-paging/121777/3 "2024-12-04T09:31:20Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074),

The issue pertains to Association pagination, where the pagination link appears inside the _ **associations/\<CRM object\>** _ object. I noticed your response contains only one association between Companies and Deals. More associations are needed to trigger the pagination mechanism. For example:

**Request:**

[https://api.hubapi.com/crm/v4/objects/companies?limit=100&associations=contacts%2Ctickets%2Cdeals%2Cquotes%2Ctasks%2Cnotes%2Cmeetings%2Cemails%2Ccalls&archived=false](https://api.hubapi.com/crm/v4/objects/companies?limit=100&associations=contacts%2Ctickets%2Cdeals%2Cquotes%2Ctasks%2Cnotes%2Cmeetings%2Cemails%2Ccalls&archived=false)

**Response:**

```auto
{
 "results": [
 {
 "id": "22855278340",
 "properties": {
 "createdate": "2024-09-10T09:11:20.051Z",
 "domain": "test.com",
 "hs_lastmodifieddate": "2024-11-27T16:50:34.883Z",
 "hs_object_id": "22855278340",
 "name": null
 },
 "createdAt": "2024-09-10T09:11:20.051Z",
 "updatedAt": "2024-11-27T16:50:34.883Z",
 "archived": false,
 "associations": {
 "deals": {
 "results": [...],
 "paging": {
 "next": {
 "after": "MC0zNDItMTk5MzM1NDk5MDQ%3D",
 "link": "https://api-na1.hubapi.com/crm/v3/objects/0-2/22855278340/associations/0-3?portalId=45482352&after=MC0zNDItMTk5MzM1NDk5MDQ%3D"
 }
 }
 }
 }
 }
 ],
 "paging": {
 "next": {
 "after": "xxx",
 "link": "xxx"
 }
 }
}

```

If you examine the next link retrieved from:

`/results/associations/deals/paging/next/link`

The link is:

`https://api-na1.hubapi.com/crm/v3/objects/0-2/22855278340/associations/0-3?portalId=45482352&after=MC0zNDItMTk5MzM1NDk5MDQ%3D`

This points to a v3 endpoint instead of v4. These tests were conducted using Postman. Could you please clarify if this behavior is expected? Should I report this issue in the Developer Feedback Tool as well?
