# search by custom property

**URL:** <https://community.hubspot.com/t/search-by-custom-property/96589>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [December 21, 2023, 8:31am UTC](https://community.hubspot.com/t/search-by-custom-property/96589 "2023-12-21T08:31:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skharatyan](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@skharatyan](https://community.hubspot.com/u/skharatyan)\
**Post date:** [December 21, 2023, 8:31am UTC](https://community.hubspot.com/t/search-by-custom-property/96589/1 "2023-12-21T08:31:40Z")

</div>

i am trying to filter contact by custom property $api\_url = “[https://api.hubapi.com/crm/v3/objects/contacts/search](https://api.hubapi.com/crm/v3/objects/contacts/search)”; $data = array( “filterGroups” =\> array( array( “filters” =\> array( array( “propertyName” =\> “HASH”, “operator” =\> “EQ”, “value” =\> $hash ) ) ) ) ); $ch = curl\_init($api\_url); curl\_setopt($ch, CURLOPT\_USERAGENT, ‘Mozilla/4.0’); curl\_setopt($ch, CURLOPT\_HEADER, false); curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true); curl\_setopt($ch, CURLOPT\_FOLLOWLOCATION, 1); curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, false); curl\_setopt($ch, CURLOPT\_CONNECTTIMEOUT, 3); curl\_setopt($ch, CURLOPT\_TIMEOUT, 3); curl\_setopt($ch, CURLOPT\_HTTPHEADER, array\_merge(self::getHeaders(), array(‘Content-Type: application/json’))); curl\_setopt($ch, CURLOPT\_POST, 1); curl\_setopt($ch, CURLOPT\_POSTFIELDS, json\_encode($data)); $response = curl\_exec($ch); curl\_close($ch); but i am getting an error “”"

## HTTP ERROR 400

Reason:

` Bad Request`

---

<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:** [December 21, 2023, 7:14pm UTC](https://community.hubspot.com/t/search-by-custom-property/96589/2 "2023-12-21T19:14:41Z")

</div>

Hi, @skharatyan 👋 Thanks for your question! Dealing with 400 errors can be a bit of a challenge to investigate.

The simplest way to test your request is to use Postman to make the same request. This can allow you to verify your internal property names and other details are correct. If Postman can return a successful response, then we can move on to your PHP.

- Have you tried printing out the response body to get further information about what’s going wrong?
- Make sure that the data you’re sending is correctly encoded as JSON. Try printing the JSON-encoded $data before sending the request to check its format
- Double-check that `"HASH"` is the correct internal name of the custom property

I am not a PHP user and I found some debugging examples if that is helpful:

```lia-code-sample
if (!isset($hash) || empty($hash)) {
 // Handle error: Hash value is not set or is empty
 echo "Hash value is not set or is empty";
}

```

```lia-code-sample
if (gettype($hash) !== 'string') {
 // Handle error: Hash value is not a string
 echo "Hash value is not a string";
}

```

```lia-code-sample
echo "Hash value: " . $hash;

```

I hope this helps get you moving forward! — Jaycee
