Error while create contact note

I am trying to create a note for a contact using a API request but it gives following response

{
 "status": "error",
 "message": "invalid from object type 0-46 for associations to be created. expected: 0-1",
 "correlationId": "da755ba0-b9e5-40e7-b3ef-97c870f7018e",
 "category": "VALIDATION_ERROR"
} 

this is how my request look like

{
"properties": {
 "hs_timestamp": "2023-02-12T15:48:22Z",
 "hs_note_body": "test note body"
},
 "associations": [
 {
 "to": {
 "id": 123 // customer id
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 201
 } ]
 }
 ]
}

any idea about what’s going wrong here

I have exactly the same issue.

When making a request to https://api.hubapi.com/crm/v4/associations/contact/note/labels, I get the following response.

{
 "results": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 201,
 "label": null
 }
 ]
}

So, I have used 201 as the association type ID like you. Still, I am getting this validation error.

Any chance we can get some help on this?

Hey I was able to find the solution for this.

You need to use association typeId as 201 instead of 202

using `“associationTypeId”: 201` didn’t work for me either, even though that’s the `typeId` returned from

`GET https://api.hubapi.com/crm/v4/associations/contact/note/labels\`.

But when I set it to `“associationTypeId”: 202` it randomly worked… :person_shrugging: no idea why as `202` is NOT correct; I just randomly tried that number :person_facepalming:

I figured out why `“associationTypeId”: 202` worked:

The Associations url needs to be specified correctly; the `{fromObjectType}` and `{toObjectType}` parts needs to be in the correct order. Since we’re associating a note to a contactthe URL to find the correct ID is (notice that `/note` comes before `/contact`:disappointed_face:

`GET https://api.hubapi.com/crm/v4/associations/note/contact/labels\`.

This returns:

{
 "results": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 202,
 "label": null
 }
 ]
}

So in order to get the failed POST request to create a note on a contact you have to do the following:

{
 "properties": {
 "hs_timestamp": "2023-02-12T15:48:22Z",
 "hs_note_body": "test note body"
 },
 "associations": [
 {
 "to": {
 "id": 123 // customer id
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 202 // note to contact typeId
 }
 ]
 }
 ]
}

This put me on the right track for a very similar problem, thank you!

The error is still there even after setting the ‘associationTypeId’ to 201. Any solution on this?