Search companies by phone number returns unexpected results

LianYiFei
Member

Hi there,

 

I've encountered an API issue, when search companies by phone number via search API, some of them with specific format are not in the results. For example, when query with "*7207159789", only #1/2/3 are returned, and #4/5 are not

  1. +17207159789
  2. 17207159789
  3. 7207159789
  4. +1 (720) 7159-789
  5. (720) 7159-789

The API we use is 

 

curl --location 'https://api.hubapi.com/crm/v3/objects/company/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "query": "*7207159789"
}'

 

By the way, using the same query for contacts, all of the above phone numbers can be identified.

 

I wonder if this is a known issue, or if we can make it respond the same way as the Contact API.

 

Thanks.

1 Accepted solution
GRajput
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Hi @LianYiFei 

 

Here is the curl for company search API

curl --location 'https://api.hubapi.com/crm/v3/objects/contacts/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer pat-na1-8783b435-676a-4dc0-ad65-7d1a2fbdcb7c' \
--data '{
  "filterGroups": [
    {
      "filters": [
        {
            "propertyName": "phone",
            "operator": "EQ",
            "value": ""
        }
      ]
    }
  ]
}'

 

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


View solution in original post

0 Upvotes
3 Replies 3
GRajput
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Hi @LianYiFei 

 

Here is the curl for company search API

curl --location 'https://api.hubapi.com/crm/v3/objects/contacts/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer pat-na1-8783b435-676a-4dc0-ad65-7d1a2fbdcb7c' \
--data '{
  "filterGroups": [
    {
      "filters": [
        {
            "propertyName": "phone",
            "operator": "EQ",
            "value": ""
        }
      ]
    }
  ]
}'

 

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


0 Upvotes
LianYiFei
Member

Thanks, but it doesn't work, with the "filterGroup", the results respond even less then the "query" search way

0 Upvotes
HMir
Member

@LianYiFei wrote:

Hi there,

 

I've encountered an API issue, when search companies by phone number via search API, some of them with specific format are not in the results. For example, when query with "*7207159789", only #1/2/3 are returned, and #4/5 are not

  1. +17207159789
  2. 17207159789
  3. 7207159789
  4. +1 (720) 7159-789
  5. (720) 7159-789

The API we use is 

 

 

 

curl --location 'https://api.hubapi.com/crm/v3/objects/company/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "query": "*7207159789"
}'

 

 

 

By the way, using the same query for contacts, all of the above phone numbers can be identified.

 

I wonder if this is a known issue, or if we can make it respond the same way as the Contact API.

 

Thanks.


It could be due to how phone numbers are processed and normalized by the API. The Contacts API seems to handle different phone number formats, such as with or without country codes, parentheses, or spaces, more flexibly. However, the Company Search API may not normalize phone numbers in the same way, leading to inconsistencies in search results. Additionally, the wildcard search query you're using ("*7207159789") might not be interpreted consistently across all formats. As a result, certain phone number formats may not return the expected results. This issue could be resolved by adjusting the search query or ensuring phone numbers are consistently formatted before querying.

0 Upvotes