# Create a note and attach to a ticket via api

**URL:** <https://community.hubspot.com/t/create-a-note-and-attach-to-a-ticket-via-api/77395>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [March 17, 2023, 2:54am UTC](https://community.hubspot.com/t/create-a-note-and-attach-to-a-ticket-via-api/77395 "2023-03-17T02:54:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravindasenarath](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ravindasenarath/32/71903_2.png) [@ravindasenarath](https://community.hubspot.com/u/ravindasenarath)\
**Post date:** [March 17, 2023, 2:54am UTC](https://community.hubspot.com/t/create-a-note-and-attach-to-a-ticket-via-api/77395/1 "2023-03-17T02:54:33Z")

</div>

I’m trying to create a note and attach it to a particular ticket via api. According to the documentation I’m making the following api call.

[api.hubapi.com/crm/v3/objects/notes](http://api.hubapi.com/crm/v3/objects/notes)

request body

{

“properties”: {

“hs\_attachment\_ids”: “106842206053”,

“hs\_note\_body”: “Test create note via api”,

“hs\_timestamp”: “2023-03-17T01:12:17.883Z”

},

“associations”: [

{

“to”: {

“id”: 1500392495

},

“types”: [

{

“associationCategory”: “HUBSPOT\_DEFINED”,

“associationTypeId”: 227

}

]

}

]

}

I got the association type by doing following api call

[api.hubapi.com/crm/v3/associations/Ticket/Note/types](http://api.hubapi.com/crm/v3/associations/Ticket/Note/types)

I get following error

{

“status”: “error”,

“message”: “invalid from object type 0-46 for associations to be created. expected: 0-5”,

“correlationId”: “7fcb3284-4c02-46dd-926a-0713762e2bcf”,

“category”: “VALIDATION\_ERROR”

}

What am I doing wrong 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:** [March 17, 2023, 6:56pm UTC](https://community.hubspot.com/t/create-a-note-and-attach-to-a-ticket-via-api/77395/2 "2023-03-17T18:56:39Z")

</div>

Hey, @ravindasenarath One thing to note about these labels is that they are _unidirectional_, or one-way.

Can you try making a request to the [label type endpoint](https://developers.hubspot.com/docs/api/crm/associations#:~:text=Retrieve%20association%20types) that looks like this, please?

`/crm/v4/associations/note/ticket/labels`

Which should return a response of:

```lia-code-sample
{
 "results": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 228,
 "label": null
 }
 ]
}

```

This is because the call you are making to the Notes endpoint is going _from_ Notes to Tickets and **not** Tickets to Notes.

Have fun building! — Jaycee

---

<div class="post-metadata">

**Author:** ![ravindasenarath](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ravindasenarath/32/71903_2.png) [@ravindasenarath](https://community.hubspot.com/u/ravindasenarath)\
**Post date:** [March 18, 2023, 7:17am UTC](https://community.hubspot.com/t/create-a-note-and-attach-to-a-ticket-via-api/77395/3 "2023-03-18T07:17:37Z")

</div>

Solves the problem. Thanks [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) 🤗
