# Confusing issue with a search request for contacts

**URL:** <https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [September 24, 2025, 5:32pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028 "2025-09-24T17:32:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SebTorres](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@SebTorres](https://community.hubspot.com/u/SebTorres)\
**Post date:** [September 24, 2025, 5:32pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/1 "2025-09-24T17:32:58Z")

</div>

Our cursor poller for contacts recently started failing, and the resulting message only tells us there was some issue, but doesn´t specify why.  
Here is the code that breaks:

```lia-code-sample
client = hubspot.Client.create(access_token=HUBSPOT_API_KEY)

 with open ('columns', 'rb') as fp:
 columns = pickle.load(fp)

 if ascending:
 public_object_search_request = PublicObjectSearchRequest(
 filter_groups=[
 {
 "filters": [
 {
 "propertyName": "lastmodifieddate",
 "operator": "GT",
 "value": cursor.datetime,
 }
 ]
 }
 ],
 sorts=[{"propertyName": "lastmodifieddate", "direction": "ASCENDING"}],
 properties=columns,
 limit=200 )
 else:
 public_object_search_request = PublicObjectSearchRequest(
 filter_groups=[
 {
 "filters": [
 {
 "propertyName": "lastmodifieddate",
 "operator": "LT",
 "value": cursor.datetime,
 }
 ]
 }
 ],
 sorts=[{"propertyName": "lastmodifieddate", "direction": "DESCENDING"}],
 properties=columns,
 limit=200)

 api_response = client.crm.contacts.search_api.do_search(public_object_search_request=public_object_search_request)

```

The search response is a status 400 with the following body

`{"status":"error","message":"There was a problem with the request.","correlationId":"e3997f3e-c69d-436d-b351-25eabd0b9235"}`

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 24, 2025, 5:46pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/2 "2025-09-24T17:46:46Z")

</div>

Hey, @SebTorres 👋 Thanks for including your details. Have you tried running a couple of simplified tests using Postman? Just to verify that the search endpoint works as expected outside your custom code? — Jaycee

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 24, 2025, 5:49pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/3 "2025-09-24T17:49:14Z")

</div>

Something simple like this:

Test 1

```lia-code-sample
Body:
{
 "properties": ["email", "firstname", "lastname", "lastmodifieddate"],
 "limit": 10
}

```

Test 2 (adding filter group)

```lia-code-sample
{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "lastmodifieddate",
 "operator": "GT",
 "value": "1640995200000"
 }
 ]
 }
 ],
 "properties": ["email", "firstname", "lastmodifieddate"],
 "sorts": [{"propertyName": "lastmodifieddate", "direction": "ASCENDING"}],
 "limit": 10
}

```

Talk soon! — Jaycee

---

<div class="post-metadata">

**Author:** ![SebTorres](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@SebTorres](https://community.hubspot.com/u/SebTorres)\
**Post date:** [September 24, 2025, 5:50pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/4 "2025-09-24T17:50:38Z")

</div>

Hi, Jaycee! I did try running a curl request independently, but using the same body formed by the PublicObjectSearchRequest. It went through, no problem

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 24, 2025, 7:31pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/5 "2025-09-24T19:31:07Z")

</div>

Thanks for the update. Hey @evaldas @MichaelMa do you have any other troubleshooting tips you can share? Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [September 24, 2025, 7:47pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/6 "2025-09-24T19:47:18Z")

</div>

You mentioned that you tested using the same body formed but is it the same body being sent to Hubspot? Since these requests are erroring out, you can pull the body from the API logs and verify if the data being sent is correct and matches what you’re testing with?

---

<div class="post-metadata">

**Author:** ![SebTorres](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@SebTorres](https://community.hubspot.com/u/SebTorres)\
**Post date:** [September 24, 2025, 8:08pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/7 "2025-09-24T20:08:24Z")

</div>

That is basically what I did. I sent the body to print, and copied all that into my curl request. That is what is most confusing of all

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [September 24, 2025, 8:16pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/8 "2025-09-24T20:16:40Z")

</div>

That is strange. Would you mind posting the payload for us to test ourselves?

The code looks fine and the only issue I could see is with the variables cursor.datetime and columns (whose data is outside the code you posted).

I guess a followup question, is it still happening? Could it have been just a hiccup with their API?

---

<div class="post-metadata">

**Author:** ![SebTorres](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@SebTorres](https://community.hubspot.com/u/SebTorres)\
**Post date:** [September 24, 2025, 9:00pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/9 "2025-09-24T21:00:14Z")

</div>

Found the issue! As you said, the value of cursor had a whitespace that the terminal was skipping, so the request worked there. Marking as solved. Thank you!

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 25, 2025, 2:24pm UTC](https://community.hubspot.com/t/confusing-issue-with-a-search-request-for-contacts/140028/10 "2025-09-25T14:24:30Z")

</div>

Amazing! Thank you very much for coming back and sharing the root cause 🙌 — Jaycee
