Search API empty response

Hi guys, I’m using the search api to retrieve some info. The thing here is that I need to send an array of values and I want to get the ones that exist in my hubspot account. For some reason, the API search is not working with the property I’m trying to retrieve.

This is my filter:

{

“filterGroups”: [

{

  "filters": \[

    {

      "values": \["7Y087XErdLsi8hsb3", "76f3gdtsXErdLsi8hsb3"],

      "propertyName": "customproperty",

      "operator": "IN"

    }

  ]

}

],

“properties”: [“customproperty”]

}

Endpoint: https://api.hubapi.com/crm/v3/objects/id/search

Also, I have another custom property that contains emails, if I search those the API search works, but it doesn’t when search for especific values like this: 7Y087XErdLsi8hsb3 or 76f3gdtsXErdLsi8hsb3

Hey, @ACarr3 :waving_hand: Thanks for the great question. I set up a test like yours and got the same result, a 200 response and an empty array. Challenging and not a lot to work with.

Here’s the issue — the IN search operator only accepts values in lowercase (even if the value is mixed-case on the object record, like your examples). It’s mentioned in the documentation, but should be bolded or flagged explicitly. From the documentation — “This operator is case-sensitive, so inputted values must be in lowercase”.

Here’s what I did using your example and my test portal:

Request

POST https://api.hubapi.com/crm/v3/objects/contacts/search

Body

{
 "properties": [
 "customproperty"
 ],
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "customproperty",
 "operator": "IN",
 "values": ["7y087xerdlsi8hsb3","76f3gdtsxerdlsi8hsb3"]
 }
 ]
 }
 ]
}

Response

{
 "total": 4,
 "results": [
 {
 "id": "801",
 "properties": {
 "createdate": "2022-11-03T21:42:31.255Z",
 "customproperty": "7Y087XErdLsi8hsb3",
 "hs_object_id": "801",
 "lastmodifieddate": "2023-04-05T17:40:19.990Z"
 },
 "createdAt": "2022-11-03T21:42:31.255Z",
 "updatedAt": "2023-04-05T17:40:19.990Z",
 "archived": false
 },
 {
 "id": "901",
 "properties": {
 "createdate": "2022-11-03T21:42:31.255Z",
 "customproperty": "7Y087XErdLsi8hsb3",
 "hs_object_id": "901",
 "lastmodifieddate": "2023-04-05T17:39:40.188Z"
 },
 "createdAt": "2022-11-03T21:42:31.255Z",
 "updatedAt": "2023-04-05T17:39:40.188Z",
 "archived": false
 },
 {
 "id": "951",
 "properties": {
 "createdate": "2022-11-03T21:42:31.255Z",
 "customproperty": "76f3gdtsXErdLsi8hsb3",
 "hs_object_id": "951",
 "lastmodifieddate": "2023-04-05T17:41:04.990Z"
 },
 "createdAt": "2022-11-03T21:42:31.255Z",
 "updatedAt": "2023-04-05T17:41:04.990Z",
 "archived": false
 },
 {
 "id": "1001",
 "properties": {
 "createdate": "2022-11-03T21:42:31.255Z",
 "customproperty": "76f3gdtsXErdLsi8hsb3",
 "hs_object_id": "1001",
 "lastmodifieddate": "2023-04-05T17:41:31.949Z"
 },
 "createdAt": "2022-11-03T21:42:31.255Z",
 "updatedAt": "2023-04-05T17:41:31.949Z",
 "archived": false
 }
 ]
}

Which matches what I see in-app:

I hope this helps get you moving forward. Have fun building! — Jaycee

Thanks so much for your help, thanks to you I’ll be able to find good sleep today :wink: