Not able to import notes to a specific contact usin API.

https://api.hubspot.com/crm/v3/objects/notes

I followed the above link in order to import notes to a particular contact in HubSpot. To create a note, I have to make a POST request to /crm/v3/objects/notes but, I was not able to create the note via API, but if I manually add a note in a contact, then I was able to update, delete that note. For more refernce, please see the below images and if someone can help me to create a note via API.

Also, where I can get the “noteid” if there is no note in a contact.

Thank you :slightly_smiling_face:

Hi, @PSharma92 :waving_hand: Thanks for reaching out. When you say you are unable to create a note via the Notes API, are you getting back an error? Also, are you trying to create a note via the example? Or using Postman?

Here’s a quick test I did using the page example:
Create the Note

  • Endpoint —POST /crm/v3/objects/notes​

  • Request

    curl --request POST \
     --url https://api.hubapi.com/crm/v3/objects/notes \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'content-type: application/json' \
     --data '{
     "properties": {
     "hs_timestamp": "2022-10-30T03:30:17.883Z",
     "hs_note_body": "We need more cats, ASAP!",
     "hubspot_owner_id": "285256448"
     }
    }'​
    
  • Response

    HTTP 201
    
    {
     "id": "30232698237",
     "properties": {
     "hs_all_accessible_team_ids": "12073945",
     "hs_all_owner_ids": "285256448",
     "hs_all_team_ids": "12073945",
     "hs_body_preview": "We need more cats, ASAP!",
     "hs_body_preview_html": "<html>\n <head></head>\n <body>\n We need more cats, ASAP!\n </body>\n</html>",
     "hs_body_preview_is_truncated": "false",
     "hs_createdate": "2023-01-19T20:40:32.060Z",
     "hs_lastmodifieddate": "2023-01-19T20:40:32.060Z",
     "hs_note_body": "We need more cats, ASAP!",
     "hs_object_id": "30232698237",
     "hs_timestamp": "2022-10-30T03:30:17.883Z",
     "hs_user_ids_of_all_owners": "48685306",
     "hubspot_owner_assigneddate": "2023-01-19T20:40:32.060Z",
     "hubspot_owner_id": "285256448",
     "hubspot_team_id": "12073945"
     },
     "createdAt": "2023-01-19T20:40:32.060Z",
     "updatedAt": "2023-01-19T20:40:32.060Z",
     "archived": false
    }​
    

Associate to a Deal

  • Request
    PUT https://api.hubspot.com/crm/v3/objects/notes/30232698237/associations/deal/10937123156/214​

  • Response

    {
     "id": "30232698237",
     "properties": {
     "hs_createdate": "2023-01-19T20:40:32.060Z",
     "hs_lastmodifieddate": "2023-01-19T20:40:32.060Z",
     "hs_object_id": "30232698237"
     },
     "createdAt": "2023-01-19T20:40:32.060Z",
     "updatedAt": "2023-01-19T20:40:32.060Z",
     "archived": false,
     "associations": {
     "deals": {
     "results": [
     {
     "id": "10937123156",
     "type": "note_to_deal"
     }
     ]
     }
     }
    }​
    

Additionally, the documentation gives an example of how to create a note and set its associations to other objects in a single call — a Note > Company and Deal, for example. Create a note and associate it with a company and deal.

You can make this request to get all of your Notes, and the associated Contact IDs, for example:

GET /crm/v3/objects/notes?&properties=hs_note_body&associations=contact&archived=false

Part of the response from my test request:

{
 "results": [
 {
 "id": "23960621691",
 "properties": {
 "hs_createdate": "2022-07-26T17:15:34.601Z",
 "hs_lastmodifieddate": "2022-07-26T17:15:34.601Z",
 "hs_note_body": "....",
 "hs_object_id": "23960621691"
 },
 "createdAt": "2022-07-26T17:15:34.601Z",
 "updatedAt": "2022-07-26T17:15:34.601Z",
 "archived": false,
 "associations": {
 "contacts": {
 "results": [
 {
 "id": "301",
 "type": "note_to_contact"
 }
 ]
 }
 }
 },
 {
 "id": "24222024760",
 "properties": {
 "hs_createdate": "2022-08-02T22:26:34.262Z",
 "hs_lastmodifieddate": "2022-10-24T20:09:43.096Z",
 "hs_note_body": "<div style=\"white-space: pre-wrap;\" dir=\"auto\" data-top-level=\"true\"><p style=\"margin-bottom:0;\">This is a second note. Cats are awesome</p></div>",
 "hs_object_id": "24222024760"
 },
 "createdAt": "2022-08-02T22:26:34.262Z",
 "updatedAt": "2022-10-24T20:09:43.096Z",
 "archived": false,
 "associations": {
 "contacts": {
 "results": [
 {
 "id": "301",
 "type": "note_to_contact"
 }
 ]
 }
 }
 }
 }
}

Please share your example Note creation request and response here if you are still having issues. If you’re using the page example to make your request, you can just copy and paste it here.

Best,

Jaycee

Thank you for your response. :slightly_smiling_face:

Fortunately I was able to create a note in contacts via Postman.

Thank you and be safe.

Best,

Priyanka Sharma

Hi, @ClarenceRuggie :waving_hand: You are very welcome! — Jaycee