Hello I tried your solution but
I’ve checked your suggested solution in the documentation, but I couldn’t find the associations parameter in the Search API.
I’ve also tested it both via an HTTP request and using the JavaScript SDK.
Here’s the code:
async function search1() {
const client = new Client({ accessToken });
const body = {
"filterGroups": [{
"filters": [{
"propertyName": "hs_object_id",
"operator": "EQ",
"value": "43230655641"
}]
}],
"properties": ["dealname", "amount", "closedate"],
"associations": ["contacts", "companies"],
"limit": 100
}
const resp = await client.crm.deals.searchApi.doSearch(body);
const { results, paging, ...rest } = resp
console.log(results)
}
async function search2() {
const url = 'https://api.hubapi.com/crm/v3/objects/0-3/search';
const options = {
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"filterGroups": [{
"filters": [{
"propertyName": "hs_object_id",
"operator": "EQ",
"value": "43230655641"
}]
}],
"properties": ["dealname", "amount", "closedate"],
"associations": ["contacts", "companies", "line_items"],
"limit": 200
})
};
const response = await fetch(url, options);
const { results, paging, ...rest } = await response.json();
console.log(results)
}
async function works() {
const client = new Client({ accessToken});
const resp = await client.crm.deals.basicApi.getById(43230655641, [],[], ["contacts", "companies", "line_items"]);
console.log(resp)
}
search1() //sdk search api no assoc
// [
// SimplePublicObject {
// createdAt: 2025-09-01T11:41:53.093Z,
// archived: false,
// id: '43230655641',
// properties: {
// amount: '6572.81',
// closedate: '2025-11-30T11:38:12.791Z',
// createdate: '2025-09-01T11:41:53.093Z',
// dealname: 'Intimus International ⭐ Renewal',
// hs_lastmodifieddate: '2025-11-13T10:00:49.886Z',
// hs_object_id: '43230655641'
// },
// updatedAt: 2025-11-13T10:00:49.886Z
// }
// ]
search2() //http search api no assoc
// [
// {
// id: '43230655641',
// properties: {
// amount: '6572.81',
// closedate: '2025-11-30T11:38:12.791Z',
// createdate: '2025-09-01T11:41:53.093Z',
// dealname: 'Intimus International ⭐ Renewal',
// hs_lastmodifieddate: '2025-11-13T10:00:49.886Z',
// hs_object_id: '43230655641'
// },
// createdAt: '2025-09-01T11:41:53.093Z',
// updatedAt: '2025-11-13T10:00:49.886Z',
// archived: false,
// url: 'https://app.hubspot.com/contacts/9471187/record/0-3/43230655641'
// }
// ]
works() // basci api get with assoc
// SimplePublicObjectWithAssociations {
// associations: {
// companies: CollectionResponseAssociatedId { results: [Array] },
// 'line items': CollectionResponseAssociatedId { results: [Array] },
// contacts: CollectionResponseAssociatedId { results: [Array] }
// },
// createdAt: 2025-09-01T11:41:53.093Z,
// archived: false,
// id: '43230655641',
// properties: {
// amount: '6572.81',
// closedate: '2025-11-30T11:38:12.791Z',
// createdate: '2025-09-01T11:41:53.093Z',
// dealname: 'Intimus International ⭐ Renewal',
// dealstage: '44299820',
// hs_lastmodifieddate: '2025-11-13T10:00:49.886Z',
// hs_object_id: '43230655641',
// pipeline: '17469980'
// },
// updatedAt: 2025-11-13T10:00:49.886Z
// }
The are something wrong in te assoc param?
I’ve considered using webhooks, but I can’t receive the full deal information when a property is modified — I have to select each property individually.
Also, it’s not possible to trigger a webhook when the last modified date of a HubSpot deal is updated.
On the other hand, I tested the webhook for deal deletion, and the body we receive is empty.
When running the test webhook it works fine, but in the actual environment it fails.
thanx