Question: Why is the typeId value 1 used for both my custom association label ("Referred By") and a built-in one ("Primary")? Shouldn’t typeId values be unique across all labels?
I believe this is related to what @Sachavskyi was pointing towards when they noted they must provide bothassociationCategory and associationTypeId in the request to create a new association between two records using a specific label.
Talk soon! Jaycee
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Hey @Jaycee_Lewis. Sorry, maybe I'm not fully understanding what you mean. I don’t have any issues creating specific associations. The issue is identifying which label corresponds to which association configuration when they both share the same typeId. For example, in my app, I want to display how many associations a user can create for a specific label.
The typeId for association labels in HubSpot isn’t globally unique. It can be the same number for both custom (USER_DEFINED) and built-in (HUBSPOT_DEFINED) labels. That’s why you see typeId 1 for both your “Referred By” label and the “Primary” label.
To avoid confusion, always check both the category and typeId when working with association labels. This is how HubSpot’s API is designed, so it’s expected behavior.
Glad I could help. Solving HubSpot puzzles is what we do. Ernesto // GiantFocal Found this answer helpful? Marking it as the solution helps both the community and me - thanks in advance!
@GiantFocal Thank you for your response! I have one more question. I'm retrieving the association configuration (specifically, I want to know maxToObjectIds) using the /crm/v3/schemas/0-1 endpoint. In the response, I see two associations with the same ID (it's ok as you explained to me):
Notice: we don't have category field here. The next step: I want to know labels for this associations and I sent a request to retrieve all association labels between Contact and Company:
GET https://api.hubapi.com/crm/v4/associations/0-1/0-2/labels HTTP/1.1
Basically, the `typeId` field isn’t unique across all labels. Instead, it’s only unique within each category (`USER_DEFINED` or `HUBSPOT_DEFINED`). That’s why you can have `typeId: 1` for both your custom label (“Referred By”) and the built-in label (“Primary”).
Unfortunately, HubSpot’s API doesn’t give you a straightforward way to link a label directly to a specific association configuration when they share the same `typeId`. The only way to tell them apart is by looking at both the `typeId` and the `category` fields together.
So, whenever you’re working with association labels, always check both fields (`typeId` and `category`) to make sure you’re referencing the right label. If you need to map these labels to specific associations in your system, you’ll probably need to keep track of that mapping yourself.
Hope that clears things up!
Glad I could help. Solving HubSpot puzzles is what we do. Ernesto // GiantFocal Found this answer helpful? Marking it as the solution helps both the community and me - thanks in advance!