Bad Request - There was a problem with the request

Hi,

I hit the wall configurintg the proper JSON format for my body request.

I’m using this code in c#, POST request.

var client = new RestClient("https://api.hubapi.com");
 var restRequest = new RestRequest("/crm/v3/objects/contacts/search", Method.Post);
 restRequest.AddHeader("accept", "application/json");
 restRequest.AddHeader("content-type", "application/json");
 restRequest.AddHeader("authorization", "Bearer YOUR_ACCESS_TOKEN");
 restRequest.AddParameter("application/json", "{\"filterGroups\": [{\"filters\": [{\"value\": \"Total Energies\",\"propertyName\": \"associations.company\",\"operator\": \"EQ\"}]}]}", ParameterType.RequestBody);

Hello @PGraça,
It looks like the JSON payload in your request body is not formatted correctly. Here’s an example of a correctly formatted JSON payload for the HubSpot CRM v3 Contacts Search API:

{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "associations.company",
 "operator": "EQ",
 "value": "Total Energies"
 }
 ]
 }
 ]
}

Make sure that the property names, operators, and values in your payload match the available options for the Contacts Search API. Also, make sure that the payload is properly formatted with curly braces, square brackets, and commas as needed.

If you continue to receive a “Bad Request” error after verifying your payload, check that your access token is valid and that you have the correct permissions to access the Contacts Search API.