# Getting error in Deals Search API

**URL:** <https://community.hubspot.com/t/getting-error-in-deals-search-api/100335>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [February 16, 2024, 1:31pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335 "2024-02-16T13:31:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDas72](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@SDas72](https://community.hubspot.com/u/SDas72)\
**Post date:** [February 16, 2024, 1:31pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/1 "2024-02-16T13:31:14Z")

</div>

Hi

Using Deals search API to get records with filter hs\_lastmodifieddate.

But the following error stopped us from proceeding after certain records

400 Bad Request: {“status”:“error”,“message”:“There was a problem with the request.”,“correlationId”:“a5d7df6c-5b4a-4b3f-abad-73100a73e02a”}

How can I resolve the issue?

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 16, 2024, 1:50pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/2 "2024-02-16T13:50:48Z")

</div>

A 400 error simply means something is wrong with your request. This is a very generic error and for anyone to help you would need to provide more information about the api call you’re attempting to make.

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [February 17, 2024, 4:47pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/3 "2024-02-17T16:47:22Z")

</div>

Hi - I hope that you are Doing good !!

400 Bad Request happens when something is wrong with the request you are making to the HubSpot Deals search API. This perhaps due to invalid parameters, authentication issues or server problems – Please try again. to get this fixed

Thank you very much and have a fantastic day!

---

<div class="post-metadata">

**Author:** ![SDas72](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@SDas72](https://community.hubspot.com/u/SDas72)\
**Post date:** [February 19, 2024, 11:59am UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/4 "2024-02-19T11:59:18Z")

</div>

Here is the request parameter for the call

Data: {

- 16 Limit: 100,
- 17 Hs object: deal,
- 18 Filter groups: [
  - 19 {
    - 20 Filters: [
      - 21 {
        - 22 Property name: hs\_lastmodifieddate,
        - 23 Operator: GT,
        - 24 Value: 2024-01-04T15:14:36.872000+01:00  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;26]  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;27}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;28],

- 29 Sorts: [],
- 35 After: 10000,

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 19, 2024, 12:36pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/5 "2024-02-19T12:36:08Z")

</div>

Hmmm, a couple things I see:  
- Property Name in the filter should be propertyName  
- you don’t need to send deal in HS Object - the call is made to /crm/v3/objects/deals/search so you already know that  
- the final comma is not needed and may cause an issue  
- not sure why you have after set at 10000 - set to zero for first page of results (or leave out altogether I think)  
- add the properties parameter and provide a list of properties you want returned

---

<div class="post-metadata">

**Author:** ![SDas72](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@SDas72](https://community.hubspot.com/u/SDas72)\
**Post date:** [February 19, 2024, 12:50pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/6 "2024-02-19T12:50:27Z")

</div>

The same configuration works fine when the limit less than 10000, is that " After: 10000 " is causing the issue? The parameters look like this as I am using workato to ingest the data.

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 19, 2024, 12:53pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/7 "2024-02-19T12:53:38Z")

</div>

The search endpoints are rate limited to **four requests per second**. A query can contain a maximum of 3,000 characters. If the body of your request exceeds 3,000 characters, a 400 error will be returned. The search endpoints are limited to 10,000 total results for any given query. Attempting to page beyond 10,000 will result in a 400 error.

---

<div class="post-metadata">

**Author:** ![SDas72](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@SDas72](https://community.hubspot.com/u/SDas72)\
**Post date:** [February 19, 2024, 12:56pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/8 "2024-02-19T12:56:16Z")

</div>

So do you think here the issue is due to the same limitation?

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 19, 2024, 12:58pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/9 "2024-02-19T12:58:37Z")

</div>

Yes, 10000 is the limit - any attempt to go beyond that will give a 400 error.

---

<div class="post-metadata">

**Author:** ![SDas72](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@SDas72](https://community.hubspot.com/u/SDas72)\
**Post date:** [February 19, 2024, 1:53pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/10 "2024-02-19T13:53:45Z")

</div>

Could you please suggest if there are more than 10K records, how do I get the records from the API?

For example, if the search API returns 10,043, how to retrieve the last 43 records? Do you have any sample API requests for obtaining the last 43 records?

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 19, 2024, 1:57pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/11 "2024-02-19T13:57:16Z")

</div>

No, I don’t. I would suggest you change your query filter to gather up records with a date that returns less than 10000. You may have to add filter for returning less records by using a start and end date (gte one date while lte another date for example). Return more records by changing the start and end dates and perform multiple searches until you have what you need.

---

<div class="post-metadata">

**Author:** ![SDas72](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@SDas72](https://community.hubspot.com/u/SDas72)\
**Post date:** [February 21, 2024, 10:04am UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/12 "2024-02-21T10:04:18Z")

</div>

Can we add more filters in the search parameter like is\_closed, deal\_renewed etc, that may bring down the result numbers?

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 21, 2024, 2:04pm UTC](https://community.hubspot.com/t/getting-error-in-deals-search-api/100335/13 "2024-02-21T14:04:28Z")

</div>

Yes you can. Something like:  
“filters”: [  
{  
“propertyName”: “prop1\_name”,

“value”: "prop1\_value  
“operator”: ‘EQ’  
},  
{  
“propertyName”: “prop2\_name”,

“value”: "prop2\_value  
“operator”: ‘EQ’  
}  
]
