Filter notes

Hello,
I’m having a strange behavior with the notes search endpoint .
My request : POST
url : https://api.hubapi.com/crm/v3/objects/notes/search
body :

{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "my_external_id",
 "operator": "EQ",
 "value": "69405"
 }
 ]
 }
 ],
 "properties": [
 "my_external_id"
 ]
}

I keep getting :

{
 "total": 0,
 "results": []
}

Even though I know ( by fetching all notes that there is a note record with this exact external id value), and when filtering by the hs_note_body I got results.
Any thoughts plz on what might be the prb here ?

Thanks in advance!

Hello @YouAssa95

It’s possible that the my_external_id property is not a searchable property in the notes object in HubSpot. The hs_note_body property might be searchable, which is why you are getting results when you filter by that property.

To check if my_external_id is searchable, you can go to the HubSpot API documentation and check the list of searchable properties for the notes object.

If my_external_id is not searchable, you can try using the metadata endpoint to get the HubSpot internal ID for the note with the external ID you’re searching for, and then use that internal ID in your subsequent API calls.

Here’s an example of how to get the HubSpot internal ID for a note with a specific external ID using the metadata endpoint:

GET https://api.hubapi.com/crm/v3/objects/notes/metadata?includePropertyVersions=true&property=my_external_id

This should return metadata for the my_external_id property, including the HubSpot internal ID for the note object. You can then use that internal ID in your subsequent API calls to retrieve or update the note.

Hello ,
Thank you for your answer.
Indeed by fetching the note shcemas my_external_id property doesn’t appear in the searchable properties. However using another Operator like HAS_PROPERTY works just fine.
And I just did another test with other values and apparently the search endpoint works ( except for one value right now).
I didn’t quite get your answer’s second part, do you have a link for a documentation about it plz ? ( I’m referring to : https://api.hubapi.com/crm/v3/objects/notes/metadata?includePropertyVersions=true&property=my_external_id

).
Thanks!

@himanshurauthan