Search API for Tickets returns unexpected 400 error code in API.

Currently I’m working on an integration and migration product known as OpsHub Integration Manager. Where I’m syncing the HubSpot’s Ticket entity type to the another instance of HubSpot to corresponding Contact entity type.
Here I recently encountered with an unsusual condition. Where when I make the below mentioned search API call
1. Method Type : POST

2. Request URL: https://api.hubapi.com/crm/v3/objects/tickets/search
3. Request Body:
{“filterGroups”:[{“filters”:[{“propertyName”:“hs_lastmodifieddate”,“operator”:“GTE”,“value”:“1763599368155”,“values”:null}]}],“sorts”:[{“propertyName”:“hs_lastmodifieddate”,“direction”:“DESCENDING”}],“limit”:1,“after”:“0”,“properties”:[“closed_date”,“content”,“create_by”,“created_by”,“createdate”,“first_agent_reply_date”,“hs_added_to_waitlist_at”,“hs_all_accessible_team_ids”,“hs_all_associated_contact_companies”,“hs_all_associated_contact_emails”,“hs_all_associated_contact_firstnames”,“hs_all_associated_contact_lastnames”,“hs_all_associated_contact_mobilephones”,“hs_all_associated_contact_phones”,“hs_all_conversation_mentions”,“hs_all_owner_ids”,“hs_all_team_ids”,“hs_applied_sla_rule_config_at”,“hs_applied_sla_rule_config_id”,“hs_applied_sla_schedule_at”,“hs_applied_sla_schedule_id”,“hs_assigned_team_ids”,“hs_assignment_method”,“hs_auto_generated_from_thread_id”,“hs_conversations_originating_message_id”,“hs_conversations_originating_thread_id”,“hs_copied_at”,“hs_copied_by_user”,“hs_copied_from_ticket”,“hs_copied_ticket_source”,“hs_created_by_user_id”,“hs_createdate”,“hs_custom_inbox”,“hs_customer_agent_escalated_time”,“hs_customer_agent_ticket_status”,“hs_date_entered_1”,“hs_date_entered_2”,“hs_date_entered_3”,“hs_date_entered_4”,“hs_date_exited_1”,“hs_date_exited_2”,“hs_date_exited_3”,“hs_date_exited_4”,“hs_draft_user_ids”,“hs_email_subject”,“hs_external_object_ids”,“hs_feedback_last_ces_follow_up”,“hs_feedback_last_ces_rating”,“hs_feedback_last_survey_date”,“hs_file_upload”,“hs_first_agent_message_sent_at”,“hs_first_agent_message_sent_by”,“hs_first_assignee_type”,“hs_first_visitor_message_sentiment”,“hs_first_visitor_message_sentiment_score”,“hs_form_id”,“hs_form_submission_conversion_id”,“hs_help_desk_onboarding_ticket”,“hs_helpdesk_sort_timestamp”,“hs_in_helpdesk”,“hs_in_waitlist”,“hs_inbox_id”,“hs_is_closed”,“hs_is_closed_in_time_to_close_sla_count”,“hs_is_closed_in_time_to_first_response_sla_count”,“hs_is_latest_message_failed”,“hs_is_latest_message_hidden_from_all”,“hs_is_one_touch_ticket”,“hs_is_visible_in_help_desk”,“hs_last_closed_date”,“hs_last_email_activity”,“hs_last_email_date”,“hs_last_email_details”,“hs_last_email_type”,“hs_last_message_from_visitor”,“hs_last_message_received_at”,“hs_last_message_sent_at”,“hs_last_visitor_message_sentiment”,“hs_last_visitor_message_sentiment_score”,“hs_lastactivitydate”,“hs_lastcontacted”,“hs_lastmodifieddate”,“hs_latest_message_attachment_types”,“hs_latest_message_is_forwarded_email”,“hs_latest_message_is_thread_comment”,“hs_latest_message_seen_by_agent_ids”,“hs_latest_message_visible_to_visitor”,“hs_latest_message_visible_to_visitor_sent_at”,“hs_mentioned_note_user_ids”,“hs_mentions_user_ids”,“hs_merged_object_ids”,“hs_most_relevant_sla_status”,“hs_most_relevant_sla_type”,“hs_msteams_message_id”,“hs_nextactivitydate”,“hs_notes_last_activity”,“hs_notes_next_activity”,“hs_notes_next_activity_type”,“hs_num_associated_companies”,“hs_num_associated_conversations”,“hs_num_times_contacted”,“hs_number_of_touches”,“hs_object_id”,“hs_object_source”,“hs_object_source_detail_1”,“hs_object_source_detail_2”,“hs_object_source_detail_3”,“hs_object_source_id”,“hs_object_source_label”,“hs_object_source_user_id”,“hs_originating_channel_instance_id”,“hs_originating_email_engagement_id”,“hs_originating_generic_channel_id”,“hs_outbound_ticket”,“hs_overall_visitor_messages_sentiment”,“hs_overall_visitor_messages_sentiment_score”,“hs_owning_teams”,“hs_pinned_engagement_id”,“hs_pipeline”,“hs_pipeline_stage”,“hs_primary_company”,“hs_primary_company_id”,“hs_primary_company_name”,“hs_read_only”,“hs_resolution”,“hs_retroactive_sla_update_at”,“hs_sales_email_last_replied”,“hs_seen_by_agent_ids”,“hs_shared_team_ids”,“hs_shared_user_ids”,“hs_sla_operating_hours”,“hs_sla_pause_status”,“hs_snoozed_by_user_ids”,“hs_source_object_id”,“hs_source_url”,“hs_tag_ids”,“hs_thread_ids_to_restore”,“hs_ticket_category”,“hs_ticket_id”,“hs_ticket_language_ai_tag”,“hs_ticket_priority”,“hs_ticket_reopened_at”,“hs_time_in_1”,“hs_time_in_2”,“hs_time_in_3”,“hs_time_in_4”,“hs_time_to_close_in_operating_hours”,“hs_time_to_close_sla_at”,“hs_time_to_close_sla_status”,“hs_time_to_first_assign”,“hs_time_to_first_rep_assignment”,“hs_time_to_first_response_in_operating_hours”,“hs_time_to_first_response_sla_at”,“hs_time_to_first_response_sla_status”,“hs_time_to_next_response_sla_at”,“hs_time_to_next_response_sla_status”,“hs_unique_creation_key”,“hs_updated_by_user_id”,“hs_user_ids_of_all_notification_followers”,“hs_user_ids_of_all_notification_unfollowers”,“hs_v2_cumulative_time_in_1”,“hs_v2_cumulative_time_in_2”,“hs_v2_cumulative_time_in_3”,“hs_v2_cumulative_time_in_4”,“hs_v2_date_entered_1”,“hs_v2_date_entered_2”,“hs_v2_date_entered_3”,“hs_v2_date_entered_4”,“hs_v2_date_exited_1”,“hs_v2_date_exited_2”,“hs_v2_date_exited_3”,“hs_v2_date_exited_4”,“hs_v2_latest_time_in_1”,“hs_v2_latest_time_in_2”,“hs_v2_latest_time_in_3”,“hs_v2_latest_time_in_4”,“hs_waitlist_routing_targets”,“hs_waitlist_sort_value”,“hs_was_imported”,“hubspot_owner_assigneddate”,“hubspot_owner_id”,“hubspot_team_id”,“last_engagement_date”,“last_reply_date”,“notes_last_contacted”,“notes_last_updated”,“notes_next_activity_date”,“nps_follow_up_answer”,“nps_follow_up_question_version”,“nps_score”,“num_contacted_notes”,“num_notes”,“oh_created_by”,“oh_last_update”,“oh_updated_by”,“remote_id”,“remote_link”,“source_ref”,“source_thread_id”,“source_type”,“subject”,“tags”,“time_to_close”,“time_to_first_agent_reply”,“update_by”]}
The response I received was:

{“status”:“error”,“message”:“Invalid JSON input: a request body was expected, but none found”,“correlationId”:“e2767f73-af7a-4509-987d-951b16a39a12”,“category”:“VALIDATION_ERROR”}
I have validated this from my logs that while making this API call I have sent the above mentioned request body, but then as well, it returned the 400 status code with the validation error.
So anyone knows why this issue is occuring.

400 + the response you got means that HubSpot has decided that the request is malformed.
A few questions:

  • The request body - is that copied from the application sending the request, or the actual request as captured by HubSpot (e.g. from the logs)?
  • Can you replicate the error using postman so that you can verify that your request body is being sent correctly?
  • Have you sent this or a similar request to this endpoint before and received a 2XX response? It might be helpful to see this.

Other troubleshooting:
Try simplyfying your request body to see if the issue is in the filters or the sorts object. e.g.

{“filterGroups”:[{“filters”:[{“propertyName”:“hs_lastmodifieddate”,“operator”:“GTE”,“value”:“1763599368155”,“values”:null}]}],“sorts”:[{“propertyName”:“hs_lastmodifieddate”,“direction”:“DESCENDING”}],“limit”:1,“after”:“0”,“properties”:[“create_by”]}

Moderator note: While this solution may not address the original poster’s specific situation, it could be helpful for other community members facing similar challenges.

Thanks @OJ_ONT , for your response, the response body is taken from the application logs not from the HubSpot API logs.
From the postman using the same request body I’m getting the values with 200 OK Status code.

Also, in the HubSpot’s API logs, no request body is captured for this API request.

Here is your simplified Request body:

{

“filterGroups”: [

{

“filters”: [

{

“propertyName”: “hs_lastmodifieddate”,

“operator”: “GTE”,

“value”: “1763599368155”,

“values”: null

}

]

}

],

“sorts”: [

{

“propertyName”: “hs_lastmodifieddate”,

“direction”: “DESCENDING”

}

],

“limit”: 1,

“after”: “0”,

“properties”: [

“closed_date”,

“content”,

“create_by”,

“created_by”,

“createdate”,

“first_agent_reply_date”,

“hs_added_to_waitlist_at”,

“hs_all_accessible_team_ids”,

“hs_all_associated_contact_companies”,

“hs_all_associated_contact_emails”,

“hs_all_associated_contact_firstnames”,

“hs_all_associated_contact_lastnames”,

“hs_all_associated_contact_mobilephones”,

“hs_all_associated_contact_phones”,

“hs_all_conversation_mentions”,

“hs_all_owner_ids”,

“hs_all_team_ids”,

“hs_applied_sla_rule_config_at”,

“hs_applied_sla_rule_config_id”,

“hs_applied_sla_schedule_at”,

“hs_applied_sla_schedule_id”,

“hs_assigned_team_ids”,

“hs_assignment_method”,

“hs_auto_generated_from_thread_id”,

“hs_conversations_originating_message_id”,

“hs_conversations_originating_thread_id”,

“hs_copied_at”,

“hs_copied_by_user”,

“hs_copied_from_ticket”,

“hs_copied_ticket_source”,

“hs_created_by_user_id”,

“hs_createdate”,

“hs_custom_inbox”,

“hs_customer_agent_escalated_time”,

“hs_customer_agent_ticket_status”,

“hs_date_entered_1”,

“hs_date_entered_2”,

“hs_date_entered_3”,

“hs_date_entered_4”,

“hs_date_exited_1”,

“hs_date_exited_2”,

“hs_date_exited_3”,

“hs_date_exited_4”,

“hs_draft_user_ids”,

“hs_email_subject”,

“hs_external_object_ids”,

“hs_feedback_last_ces_follow_up”,

“hs_feedback_last_ces_rating”,

“hs_feedback_last_survey_date”,

“hs_file_upload”,

“hs_first_agent_message_sent_at”,

“hs_first_agent_message_sent_by”,

“hs_first_assignee_type”,

“hs_first_visitor_message_sentiment”,

“hs_first_visitor_message_sentiment_score”,

“hs_form_id”,

“hs_form_submission_conversion_id”,

“hs_help_desk_onboarding_ticket”,

“hs_helpdesk_sort_timestamp”,

“hs_in_helpdesk”,

“hs_in_waitlist”,

“hs_inbox_id”,

“hs_is_closed”,

“hs_is_closed_in_time_to_close_sla_count”,

“hs_is_closed_in_time_to_first_response_sla_count”,

“hs_is_latest_message_failed”,

“hs_is_latest_message_hidden_from_all”,

“hs_is_one_touch_ticket”,

“hs_is_visible_in_help_desk”,

“hs_last_closed_date”,

“hs_last_email_activity”,

“hs_last_email_date”,

“hs_last_email_details”,

“hs_last_email_type”,

“hs_last_message_from_visitor”,

“hs_last_message_received_at”,

“hs_last_message_sent_at”,

“hs_last_visitor_message_sentiment”,

“hs_last_visitor_message_sentiment_score”,

“hs_lastactivitydate”,

“hs_lastcontacted”,

“hs_lastmodifieddate”,

“hs_latest_message_attachment_types”,

“hs_latest_message_is_forwarded_email”,

“hs_latest_message_is_thread_comment”,

“hs_latest_message_seen_by_agent_ids”,

“hs_latest_message_visible_to_visitor”,

“hs_latest_message_visible_to_visitor_sent_at”,

“hs_mentioned_note_user_ids”,

“hs_mentions_user_ids”,

“hs_merged_object_ids”,

“hs_most_relevant_sla_status”,

“hs_most_relevant_sla_type”,

“hs_msteams_message_id”,

“hs_nextactivitydate”,

“hs_notes_last_activity”,

“hs_notes_next_activity”,

“hs_notes_next_activity_type”,

“hs_num_associated_companies”,

“hs_num_associated_conversations”,

“hs_num_times_contacted”,

“hs_number_of_touches”,

“hs_object_id”,

“hs_object_source”,

“hs_object_source_detail_1”,

“hs_object_source_detail_2”,

“hs_object_source_detail_3”,

“hs_object_source_id”,

“hs_object_source_label”,

“hs_object_source_user_id”,

“hs_originating_channel_instance_id”,

“hs_originating_email_engagement_id”,

“hs_originating_generic_channel_id”,

“hs_outbound_ticket”,

“hs_overall_visitor_messages_sentiment”,

“hs_overall_visitor_messages_sentiment_score”,

“hs_owning_teams”,

“hs_pinned_engagement_id”,

“hs_pipeline”,

“hs_pipeline_stage”,

“hs_primary_company”,

“hs_primary_company_id”,

“hs_primary_company_name”,

“hs_read_only”,

“hs_resolution”,

“hs_retroactive_sla_update_at”,

“hs_sales_email_last_replied”,

“hs_seen_by_agent_ids”,

“hs_shared_team_ids”,

“hs_shared_user_ids”,

“hs_sla_operating_hours”,

“hs_sla_pause_status”,

“hs_snoozed_by_user_ids”,

“hs_source_object_id”,

“hs_source_url”,

“hs_tag_ids”,

“hs_thread_ids_to_restore”,

“hs_ticket_category”,

“hs_ticket_id”,

“hs_ticket_language_ai_tag”,

“hs_ticket_priority”,

“hs_ticket_reopened_at”,

“hs_time_in_1”,

“hs_time_in_2”,

“hs_time_in_3”,

“hs_time_in_4”,

“hs_time_to_close_in_operating_hours”,

“hs_time_to_close_sla_at”,

“hs_time_to_close_sla_status”,

“hs_time_to_first_assign”,

“hs_time_to_first_rep_assignment”,

“hs_time_to_first_response_in_operating_hours”,

“hs_time_to_first_response_sla_at”,

“hs_time_to_first_response_sla_status”,

“hs_time_to_next_response_sla_at”,

“hs_time_to_next_response_sla_status”,

“hs_unique_creation_key”,

“hs_updated_by_user_id”,

“hs_user_ids_of_all_notification_followers”,

“hs_user_ids_of_all_notification_unfollowers”,

“hs_v2_cumulative_time_in_1”,

“hs_v2_cumulative_time_in_2”,

“hs_v2_cumulative_time_in_3”,

“hs_v2_cumulative_time_in_4”,

“hs_v2_date_entered_1”,

“hs_v2_date_entered_2”,

“hs_v2_date_entered_3”,

“hs_v2_date_entered_4”,

“hs_v2_date_exited_1”,

“hs_v2_date_exited_2”,

“hs_v2_date_exited_3”,

“hs_v2_date_exited_4”,

“hs_v2_latest_time_in_1”,

“hs_v2_latest_time_in_2”,

“hs_v2_latest_time_in_3”,

“hs_v2_latest_time_in_4”,

“hs_waitlist_routing_targets”,

“hs_waitlist_sort_value”,

“hs_was_imported”,

“hubspot_owner_assigneddate”,

“hubspot_owner_id”,

“hubspot_team_id”,

“last_engagement_date”,

“last_reply_date”,

“notes_last_contacted”,

“notes_last_updated”,

“notes_next_activity_date”,

“nps_follow_up_answer”,

“nps_follow_up_question_version”,

“nps_score”,

“num_contacted_notes”,

“num_notes”,

“oh_created_by”,

“oh_last_update”,

“oh_updated_by”,

“remote_id”,

“remote_link”,

“source_ref”,

“source_thread_id”,

“source_type”,

“subject”,

“tags”,

“time_to_close”,

“time_to_first_agent_reply”,

“update_by”

]

}

I’m not accepting this as solution, as this has not provided me the answer to my query.
So request to please reopen this ticket.

Hi @ASuthar and thank you so much for reaching out and sharing your situation.

I understand that you’re still looking for the right solution, and I appreciate your patience as we work through this.

While the suggestion below may not perfectly fit your case, I hope it proves helpful for others in the community who might be facing similar challenges.

Thank you again for your understanding and for being part of our community!
Bérangère

Ok - interesting that it works fine from postman.
If postman is ok, my next thought is that there must be an issue with how your app is generating or sending the request. So you need capture it and inspect it in order to rule this out.
Can you have your app push the request to an endpoint you control, or have it print the request body to a log, so that you can see it?

Have already uploaded the API request and its corresponding Request body, which was sent by the Application to the HubSpot. Where the same request body being tested on Postman runs perfectly, while the Same API and the Request body returns the 400 error code.
Actually this behavior is not a constant behavior, it has occured recently since the implementation around 6 months ago.

ah, ok, yes I see that now. Can you see any difference in the requests that might identify why the inconsistency occurs?
Otherwise build your documentation of the issue and submit it to HubSpot support to look into it. I can’t see why this would cause an issue.

No difference is there in the request bodies, @BérangèreL it would be great if you can look into this issue.
Thanks @OJ_ONT for your help.

Hi @ASuthar and thanks for getting back to us!
Based on your description, the issue is that your application logs show the request body was sent, but HubSpot’s API logs show no request body was received.
This indicates the request body isn’t actually being transmitted to HubSpot’s servers, despite working in Postman.
I’d recommend to review your HTTP client implementation and compare it directly to the working Postman request configuration.
Also, here are some helpful documentation:
- CRM search
- Search for tickets
Now, let’s consult with our Top Experts: Hi @sylvain_tirreau, @Anton and @MichaelMa do you have other suggestions to help @ASuthar, please?
Thanks so much and have a great day!
Bérangère

Thanks @BérangèreL , for reopening the ticket, as per the request body and client implementation, as I have states earlier that this issue is not regularly occuring.
It is taking place once in 2-3 weeks, where such error code is being thrown. So this shows that the client implementation is correct.
There might be some issues at the HubSpot server while handling such request in handling it.

Hi @ASuthar and thanks for your patience!
It seems that the issue is most likely caused by the oversized JSON payload or the unsupported “values”: null" field.
Could you please remove the “values”: null" entry and test the request again using a much smaller body (for example, only one filter and a few properties).
If the smaller request works, then you can gradually add properties back until you’ll identify where the failure occurs.
I hope this helps!
Have a lovely day!
Bérangère

Hi @ASuthar , when HubSpot logs show “a request body was expected, but none found” while your application logs show a full JSON payload, that usually means the issue happens in transit, not in the JSON itself.

HubSpot only returns this specific 400 when it literally receives an empty body at the network layer. The tricky part is that it can happen inconsistently, which aligns with what you’re seeing every few weeks (Search the CRM - HubSpot docs )

A couple of patterns tend to cause that intermittent behavior. One is the client reusing an HTTP connection where the body isn’t being re-sent correctly under load. Another is a proxy or gateway stripping the body on some POST requests when the headers don’t include an explicit Content-Length.

You can rule that out by enabling full wire-level logging on your HTTP client or pointing the same payload at a temporary capture endpoint and comparing the successful vs failing requests. If the bad ones show a missing or truncated body, that confirms it before you escalate with HubSpot.

It’s also worth removing fields like “values”: null entirely so the serializer can’t omit parts of the structure depending on internal optimizations. Once you have a minimal reproducible request leaving your integration every time, the 400s tend to disappear. When you’re running migrations between HubSpot portals at scale, Stacksync absorbs these inconsistencies by handling retries and payload validation so sync cycles don’t break on a single malformed request.