Searching through contacts with a custom field property

const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"apiKey":"YOUR_HUBSPOT_API_KEY"});

const PublicObjectSearchRequest = { filterGroups: [{"filters":[{"value":"InAppID","propertyName":"app_user_id","operator":"EQ"}]}] 
};

try {
 const apiResponse = await hubspotClient.crm.contacts.searchApi.doSearch(PublicObjectSearchRequest);
 console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
 e.message === 'HTTP request failed'
 ? console.error(JSON.stringify(e.response, null, 2))
 : console.error(e)
}

I’m trying to search contacts with a custom field I’ve added to contacts

I am not getting any results back after running this code. Am I missing something? Are custom fields not searchable?

Hi @RVu,

You can achieve this functionality by using this API -

[/crm/v3/objects/contacts/batch/read]

Just insert the property name in the requests body and then, after all the contacts will be fetched that contain that given specified property.

Hope this will help you out :slightly_smiling_face:

Regards,