# Extracting the latest notes

**URL:** <https://community.hubspot.com/t/extracting-the-latest-notes/129915>\
**Category:** APIs & Integrations\
**Tags:** sdk, object\
**Created:** [April 15, 2025, 7:42am UTC](https://community.hubspot.com/t/extracting-the-latest-notes/129915 "2025-04-15T07:42:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KKosny](https://avatars.discourse-cdn.com/v4/letter/k/b2d939/32.png) [@KKosny](https://community.hubspot.com/u/KKosny)\
**Post date:** [April 15, 2025, 7:42am UTC](https://community.hubspot.com/t/extracting-the-latest-notes/129915/1 "2025-04-15T07:42:01Z")

</div>

Hi,

Is there a way to extract the lastest note left on a deal?

The only option I can see is the for the number of notes left on a deal. I’d like to see the contents of the latest notes eft on the account.

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [April 15, 2025, 1:20pm UTC](https://community.hubspot.com/t/extracting-the-latest-notes/129915/2 "2025-04-15T13:20:57Z")

</div>

There are multiple ways to do this depending on how you want to go about it.

Easiest and most direct is to use the Notes API to search for notes using the deal association filter:

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fcrm-notes-v3%2Fguide)**

```lia-code-sample
{
 "limit": 1,
 "sorts": [
 {
 "propertyName": "hs_timestamp",
 "direction": "DESCENDING"
 }
 ],
 "properties": [
 "hs_object_id",
 "hs_engagement_type",
 "hs_note_body"
 ],
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "associations.deal",
 "value": "23141507859", // Deal ID
 "operator": "EQ"
 }
 ]
 }
 ]
}

```

If you’re pulling the Deal, you can include associations and it will provide you with the ID. So if your API request is:

[https://api.hubapi.com/crm/v3/objects/deals/XYZ?associations=notes](https://api.hubapi.com/crm/v3/objects/deals/XYZ?associations=notes)

It would return something like below with the Note IDs and then you can make a GET request for the Notes API with the ID.

```lia-code-sample
{
 "id": "11111111111111",
 "properties": {
 "hs_object_id": "11111111111111",
 "pipeline": "1"
 },
 "createdAt": "2024-10-10T15:27:44.024Z",
 "updatedAt": "2025-04-15T13:13:30.251Z",
 "archived": false,
 "associations": {
 "notes": {
 "results": [
 {
 "id": "22222222222",
 "type": "deal_to_note"
 },
 {
 "id": "33333333333",
 "type": "deal_to_note"
 }
 ]
 }
 }
}

```

Last alternative is to use GraphQL and you can make it a single request:

```lia-code-sample
query test {
 CRM {
 deal(uniqueIdentifier: "id", uniqueIdentifierValue: "11111111111") {
 hs_object_id
 associations {
 note_collection__deal_to_note(limit: 1, orderBy: hs_timestamp__desc) {
 items {
 hs_note_body
 }
 }
 }
 }
 }
}

```

---

<div class="post-metadata">

**Author:** ![nickdeckerdevs1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nickdeckerdevs1/32/5198_2.png) [@nickdeckerdevs1](https://community.hubspot.com/u/nickdeckerdevs1)\
**Post date:** [April 15, 2025, 6:13pm UTC](https://community.hubspot.com/t/extracting-the-latest-notes/129915/3 "2025-04-15T18:13:40Z")

</div>

great stuff here!

---

<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:** [April 17, 2025, 5:26pm UTC](https://community.hubspot.com/t/extracting-the-latest-notes/129915/4 "2025-04-17T17:26:37Z")

</div>

Thank you @MichaelMa 🙌 — Jaycee
