How do I search HubSpot contacts with a filter group from a Make code step?
In HubSpot, create a private app (Settings, Integrations, Private Apps) with the crm.objects.contacts.read scope and copy the token. In Make, add the Execute Inline JavaScript module and put this JSON in its Input field, with the token and filter values mapped from earlier modules:
{
"token": "{{ mapped from a Make custom variable or data store }}",
"lifecycleStage": "lead",
"createdAfter": "2026-10-01T00:00:00Z",
"limit": 50
}
The code converts the ISO date to the millisecond timestamp HubSpot expects, runs the search, and flattens the response. Set Return Type to Array:
const data = typeof input === "string" ? JSON.parse(input) : input;
const body = {
filterGroups: [{
filters: [
{ propertyName: "lifecyclestage", operator: "EQ", value: data.lifecycleStage },
{ propertyName: "createdate", operator: "GTE",
value: String(new Date(data.createdAfter).getTime()) }
]
}],
properties: ["email", "firstname", "lastname", "company", "createdate"],
sorts: [{ propertyName: "createdate", direction: "DESCENDING" }],
limit: data.limit || 100
};
const res = await fetch("https://api.hubapi.com/crm/v3/objects/contacts/search", {
method: "POST",
headers: {
Authorization: `Bearer ${data.token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(body)
});
if (!res.ok) throw new Error(`HubSpot ${res.status}: ${await res.text()}`);
const json = await res.json();
return json.results.map(c => ({
id: c.id,
email: c.properties.email,
name: [c.properties.firstname, c.properties.lastname].filter(Boolean).join(" "),
company: c.properties.company,
createdAt: c.properties.createdate
}));
Output, as the next module sees it (an Iterator turns it into one bundle per contact):
[
{
"id": "151801",
"email": "[email protected]",
"name": "Maria Schulz",
"company": "Nordwind GmbH",
"createdAt": "2026-10-06T08:41:12.339Z"
},
{
"id": "151742",
"email": "[email protected]",
"name": "Tunde Okafor",
"company": "Brightline",
"createdAt": "2026-10-03T15:02:48.110Z"
}
]
The median inline script in our logs finishes in 121 ms; this one adds one round trip to api.hubapi.com, and the call is billed as 1 Make credit regardless. Endpoint and limits were checked against HubSpot's CRM search docs in October 2026: POST /crm/v3/objects/{object}/search, up to 5 filterGroups (OR between groups, AND inside), 18 filters total, operators including EQ, GTE, IN, CONTAINS_TOKEN and HAS_PROPERTY, 200 results per page, 10,000 per query, 5 requests per second per account. For more pages, loop on json.paging.next.after and send it as after, inside the 30 s (free) or 60 s (paid) timeout.
Prefer the official SDK? @hubspot/api-client is preinstalled on every CustomJS plan (npm package list). The same search:
const hubspot = require("@hubspot/api-client");
const client = new hubspot.Client({ accessToken: data.token });
const json = await client.crm.contacts.searchApi.doSearch(body);
return json.results;
HubSpot also publishes dated paths such as /crm/objects/2026-09/{object}/search. The v3 search page carried no deprecation notice in October 2026, and the SDK still targets v3.