# Contact Search API V3 400 Error

**URL:** <https://community.hubspot.com/t/contact-search-api-v3-400-error/43550>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [September 8, 2021, 9:58pm UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550 "2021-09-08T21:58:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zgod89](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zgod89/32/102945_2.png) [@zgod89](https://community.hubspot.com/u/zgod89)\
**Post date:** [September 8, 2021, 9:58pm UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/1 "2021-09-08T21:58:19Z")

</div>

Since a recent update to the beta endpoints this endpoint has stopped working. In postman I can run this:

```lia-code-sample
import hubspot
from pprint import pprint
from hubspot.crm.contacts import PublicObjectSearchRequest, ApiException
client = hubspot.Client.create(api_key="MY API KEY")
public_object_search_request = PublicObjectSearchRequest(filter_groups={"filters":[{"value":"1630047583930","propertyName":"lastmodifieddate","operator":"GT"}]}, sorts="lastmodifieddate", properties=["email","lastname"], limit=100, after=0)
try:
 api_response = client.crm.contacts.search_api.do_search(public_object_search_request=public_object_search_request)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling search_api->do_search: %s\n" % e)

```

Moving this code to python yields this error:

```lia-code-sample
Exception when calling search_api->do_search: (400)
Reason: Bad Request

HTTP response body: {"status":"error","message":"Invalid input JSON on line 1, column 18: Cannot deserialize instance of `java.util.HashSet` out of START_OBJECT token","correlationId":"10e2f094-6cf0-4470-b006-202883cc687e"}

```

Any help would be appreciated.

Cheers,

Zack

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [September 9, 2021, 9:12pm UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/2 "2021-09-09T21:12:03Z")

</div>

@taran42 , anything suspicious here?

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [September 10, 2021, 5:25pm UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/3 "2021-09-10T17:25:19Z")

</div>

I don’t see anything that jumps out at me. Maybe there’s something wrong in the JSON that Postman isn’t picking up, but the Hubspot API is?

---

<div class="post-metadata">

**Author:** ![DomiVoglmaier](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/domivoglmaier/32/97852_2.png) [@DomiVoglmaier](https://community.hubspot.com/u/DomiVoglmaier)\
**Post date:** [October 8, 2021, 7:56am UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/4 "2021-10-08T07:56:40Z")

</div>

Hey, I’m facing the same error using the search API endpoint. Can you confirm that the error message is correctly pointing at the JSON?

I tried several variations of JSON input. Every time with the same error. Unfortunately, the API description is not clear to me. Can you please share a valid JSON example that responses something?

---

<div class="post-metadata">

**Author:** ![DomiVoglmaier](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/domivoglmaier/32/97852_2.png) [@DomiVoglmaier](https://community.hubspot.com/u/DomiVoglmaier)\
**Post date:** [October 21, 2021, 6:41am UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/5 "2021-10-21T06:41:26Z")

</div>

Hi @dennisedson , hi @taran42 ,

any update on this topic?

Can you provide me an JSON example that works with the Search Endpoint? Thanks a lot!

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [October 21, 2021, 6:44pm UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/6 "2021-10-21T18:44:40Z")

</div>

Hi @DomiVoglmaier . I do not have a solution to this particular issue. I will have to defer to someone who is more knowledgeable at Python than I.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [October 21, 2021, 7:07pm UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/7 "2021-10-21T19:07:16Z")

</div>

@DomiVoglmaier , I looked at the docs and have the same python output as @zgod89 did.

From a valid JSON perspective that is not formatted for python, it would look like this

```lia-code-sample
{
 "filterGroups": [
 {
 "filters": [
 {
 "value": "1630047583930",
 "propertyName": "lastmodifieddate",
 "operator": "GT"
 }
 ]
 }
 ],
 "sorts": [
 "lastmodifieddate"
 ],
 "properties": [
 "email",
 "lastname"
 ],
 "limit": 100,
 "after": 0
}

```

I am unclear what the beta endpoints being used are, though 🤔

---

<div class="post-metadata">

**Author:** ![DomiVoglmaier](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/domivoglmaier/32/97852_2.png) [@DomiVoglmaier](https://community.hubspot.com/u/DomiVoglmaier)\
**Post date:** [November 4, 2021, 9:46am UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/8 "2021-11-04T09:46:11Z")

</div>

@dennisedsonNow it works for me. Thanks!

@zgod89If you don’t mind, try with additional brackets around filter\_groups=[{}] to make it an array. That worked in my python.

`public_object_search_request = PublicObjectSearchRequest(filter_groups=[{"filters":[{"value":"1630047583930","propertyName":"lastmodifieddate","operator":"GT"}]}], sorts="lastmodifieddate", properties=["email","lastname"], limit=100, after=0)`

---

<div class="post-metadata">

**Author:** ![Anonymous\_e6035976def9121b487eb234f02ea450](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Anonymous\_e6035976def9121b487eb234f02ea450](https://community.hubspot.com/u/Anonymous_e6035976def9121b487eb234f02ea450)\
**Post date:** [August 2, 2022, 2:45am UTC](https://community.hubspot.com/t/contact-search-api-v3-400-error/43550/9 "2022-08-02T02:45:08Z")

</div>

Hello.

I am having the same problem with PHP.

`<?phpuse HubSpot\Factory;use HubSpot\Client\Crm\Contacts\ApiException;$client = Factory::createWithAccessToken("pat-na1-2bf25c1d-2f5d-4103-af29-xxxxxxxx");$PublicObjectSearchRequest = new PublicObjectSearchRequest(['filter_groups' => [{"filters":[{"value":"foo@gmail.com","values":[],"propertyName":"email","operator":"EQ"}]}], 'sorts' => ["email"], 'properties' => ["email"], 'limit' => 1, 'after' => 0]);try {$apiResponse = $client->crm()->contacts()->searchApi()->doSearch($PublicObjectSearchRequest);var_dump($apiResponse);} catch (ApiException $e) {echo "Exception when calling search_api->do_search: ", $e->getMessage();}`

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fcrm-contacts-v3%2Fguide)**

I get the same error with the code copied from the above site.

I would like to have a working PHP code.

---

yoshida
