CRM

APetak
Participant

Getting all Associations and Pipelines

SOLVE

I have DealAssociations, CompanyAssociations and ContactAssociations. All of them have columns: Id, AssociationId, Type, TypeId, TypeName. Is there a way to extract all of the rows that I have but only columns Id and AssociationId? Currently I'm trying different endpoints and can't get any results. I don't want associations for specific Id, but want all the data.
Also, I don't know which endpoint gets DealPipelines and DealPipelineStages.

2 Accepted solutions
Markestac
Solution
Participant | Gold Partner
Participant | Gold Partner

Getting all Associations and Pipelines

SOLVE

Hi @APetak 

 

To extract all the rows from Deal Associations, Company Associations, and Contact Associations in HubSpot while only retrieving the Id and AssociationId columns, you need to use the appropriate API endpoints for associations. Here's how you can approach the problem:

1. Extracting all Association Data (Deal Associations, Company Associations, Contact Associations):
HubSpot offers different endpoints to manage associations between records like Deals, Contacts, and Companies. You want to extract associations, but only with specific columns (Id and Association Id). Here's how to get all the association data:

A. Get All Associations for Deals:To get all associations for Deals, you would generally use the GET /crm/v3/objects/deals/{dealId}/associations/{toObjectType} endpoint. But since you want all associations (not specific ones), you might want to use the Search API for getting associations.
Example API to get Deal Associations:
GET /crm/v3/objects/deals/associations/contacts
This would return all contacts associated with the deals. You can also specify the type (e.g., contacts, companies) in the URL.

B. Get All Associations for Contacts:
Similarly, for Contact Associations, you would use:
GET /crm/v3/objects/contacts/associations/deals

C. Get All Associations for Companies:For Company Associations:
GET /crm/v3/objects/companies/associations/deals

2. Filter only the necessary fields (Id and Association Id):You will likely need to use pagination to handle large data sets if you have many associations. Since you only need the Id and AssociationId, you can either:
  • Retrieve all the association data first and then process/filter it on your end.
  • Use the properties parameter in your request to specify the columns you want, though HubSpot's API for associations might not let you directly limit only to Id and AssociationId.
The properties parameter typically allows you to specify which properties to return for each record, though for association data, you might get a more complex response, and then you'll need to filter out the unwanted fields.
For example:
GET /crm/v3/objects/deals/associations/contacts?properties=id,associationId

If the API does not allow you to directly filter, retrieve all the data and then parse it to extract only the Id and AssociationId.

3. Deal Pipelines and Deal Pipeline Stages:To get the Deal Pipelines and Deal Pipeline Stages, HubSpot provides the following endpoints:
A. Get Deal Pipelines:
bash

GET /crm/v3/pipelines/deals

This will return all deal pipelines, including details such as the pipeline ID and its name.

B. Get Deal Stages for a Pipeline:
For each pipeline, you can get its stages:
GET /crm/v3/pipelines/deals/{pipelineId}/stages

This will provide you with the stages associated with a particular deal pipeline.

Summary of the API Endpoints You Need:
  1. Get all Deal Associations:
    • GET /crm/v3/objects/deals/associations/contacts
    • GET /crm/v3/objects/deals/associations/companies
  2. Get all Contact Associations:
    • GET /crm/v3/objects/contacts/associations/deals
    • GET /crm/v3/objects/contacts/associations/companies
  3. Get all Company Associations:
    • GET /crm/v3/objects/companies/associations/deals
    • GET /crm/v3/objects/companies/associations/contacts
  4. Deal Pipelines:
    • GET /crm/v3/pipelines/deals
  5. Deal Pipeline Stages:
    • GET /crm/v3/pipelines/deals/{pipelineId}/stages
Let me now if you have any questions.

Talk to Our HubSpot Expert

Marketing Automation Agency | RevOps & CRM Consultant

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
Markestac
Solution
Participant | Gold Partner
Participant | Gold Partner

Getting all Associations and Pipelines

SOLVE
Thank you for your reply! I understand the challenge you're facing when trying to filter contacts created in the past 7 days and include their associations at the same time.

Unfortunately, as you've observed, the GET /crm/v3/objects/contacts endpoint with associations doesn’t support filtering by creation date directly. On the other hand, the POST /crm/v3/objects/contacts/search endpoint allows filtering but doesn't return the associated records (like companies or deals).

Here are a few possible solutions for you:
1. Combine Two API Calls
  • Step 1: Use POST /crm/v3/objects/contacts/search to filter contacts created in the last 7 days. This will give you the contact IDs.
  • Step 2: Once you have the list of contact IDs, use GET /crm/v3/objects/contacts/{contactId}?associations=companies,deals to retrieve the associations for each contact. You'll need to make individual calls for each contact.
While this requires multiple requests, it allows you to filter by creation date and still retrieve associations.

Talk to Our HubSpot Expert

Marketing Automation Agency | RevOps & CRM Consultant

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

5 Replies 5
Lucila-Andimol
Thought Leader | Platinum Partner
Thought Leader | Platinum Partner

Getting all Associations and Pipelines

SOLVE

Hi @APetak 

for any information about the API usage

I'd suggest you visit the devolpers page

where you'll find the information.

Hope this helps

María Lucila Abal
COO Andimol | Platinum Accredited Partner
HubSpot Expert, Top Community Champion | Hall of Fame IN23&IN24
Certified Trainer (12+ years) | SuperAdmins Bootcamp Instructor

Have questions? Get answers:

Get Premium Support

Did my post help answer your question? Mark this as a solution.

0 Upvotes
APetak
Participant

Getting all Associations and Pipelines

SOLVE

Hi, I'm aware of that page, but still couldn't get it to work.

0 Upvotes
Markestac
Solution
Participant | Gold Partner
Participant | Gold Partner

Getting all Associations and Pipelines

SOLVE

Hi @APetak 

 

To extract all the rows from Deal Associations, Company Associations, and Contact Associations in HubSpot while only retrieving the Id and AssociationId columns, you need to use the appropriate API endpoints for associations. Here's how you can approach the problem:

1. Extracting all Association Data (Deal Associations, Company Associations, Contact Associations):
HubSpot offers different endpoints to manage associations between records like Deals, Contacts, and Companies. You want to extract associations, but only with specific columns (Id and Association Id). Here's how to get all the association data:

A. Get All Associations for Deals:To get all associations for Deals, you would generally use the GET /crm/v3/objects/deals/{dealId}/associations/{toObjectType} endpoint. But since you want all associations (not specific ones), you might want to use the Search API for getting associations.
Example API to get Deal Associations:
GET /crm/v3/objects/deals/associations/contacts
This would return all contacts associated with the deals. You can also specify the type (e.g., contacts, companies) in the URL.

B. Get All Associations for Contacts:
Similarly, for Contact Associations, you would use:
GET /crm/v3/objects/contacts/associations/deals

C. Get All Associations for Companies:For Company Associations:
GET /crm/v3/objects/companies/associations/deals

2. Filter only the necessary fields (Id and Association Id):You will likely need to use pagination to handle large data sets if you have many associations. Since you only need the Id and AssociationId, you can either:
  • Retrieve all the association data first and then process/filter it on your end.
  • Use the properties parameter in your request to specify the columns you want, though HubSpot's API for associations might not let you directly limit only to Id and AssociationId.
The properties parameter typically allows you to specify which properties to return for each record, though for association data, you might get a more complex response, and then you'll need to filter out the unwanted fields.
For example:
GET /crm/v3/objects/deals/associations/contacts?properties=id,associationId

If the API does not allow you to directly filter, retrieve all the data and then parse it to extract only the Id and AssociationId.

3. Deal Pipelines and Deal Pipeline Stages:To get the Deal Pipelines and Deal Pipeline Stages, HubSpot provides the following endpoints:
A. Get Deal Pipelines:
bash

GET /crm/v3/pipelines/deals

This will return all deal pipelines, including details such as the pipeline ID and its name.

B. Get Deal Stages for a Pipeline:
For each pipeline, you can get its stages:
GET /crm/v3/pipelines/deals/{pipelineId}/stages

This will provide you with the stages associated with a particular deal pipeline.

Summary of the API Endpoints You Need:
  1. Get all Deal Associations:
    • GET /crm/v3/objects/deals/associations/contacts
    • GET /crm/v3/objects/deals/associations/companies
  2. Get all Contact Associations:
    • GET /crm/v3/objects/contacts/associations/deals
    • GET /crm/v3/objects/contacts/associations/companies
  3. Get all Company Associations:
    • GET /crm/v3/objects/companies/associations/deals
    • GET /crm/v3/objects/companies/associations/contacts
  4. Deal Pipelines:
    • GET /crm/v3/pipelines/deals
  5. Deal Pipeline Stages:
    • GET /crm/v3/pipelines/deals/{pipelineId}/stages
Let me now if you have any questions.

Talk to Our HubSpot Expert

Marketing Automation Agency | RevOps & CRM Consultant

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
APetak
Participant

Getting all Associations and Pipelines

SOLVE

Hi, thanks for you reply, but those endpoints just show null for me.
I have tried using GET /crm/v3/objects/contacts?associations=companies,deals and I can get all contacts with its associations. But the problem is, that I want to get the contacts only created in past 7 days, for which i need to use POST /crm/v3/objects/contacts/search. This means that I can get only one of that, there is no way to use GET and filter or use POST and get associations. Any possible solutions for that?

0 Upvotes
Markestac
Solution
Participant | Gold Partner
Participant | Gold Partner

Getting all Associations and Pipelines

SOLVE
Thank you for your reply! I understand the challenge you're facing when trying to filter contacts created in the past 7 days and include their associations at the same time.

Unfortunately, as you've observed, the GET /crm/v3/objects/contacts endpoint with associations doesn’t support filtering by creation date directly. On the other hand, the POST /crm/v3/objects/contacts/search endpoint allows filtering but doesn't return the associated records (like companies or deals).

Here are a few possible solutions for you:
1. Combine Two API Calls
  • Step 1: Use POST /crm/v3/objects/contacts/search to filter contacts created in the last 7 days. This will give you the contact IDs.
  • Step 2: Once you have the list of contact IDs, use GET /crm/v3/objects/contacts/{contactId}?associations=companies,deals to retrieve the associations for each contact. You'll need to make individual calls for each contact.
While this requires multiple requests, it allows you to filter by creation date and still retrieve associations.

Talk to Our HubSpot Expert

Marketing Automation Agency | RevOps & CRM Consultant

Did my post help answer your query? Help the community by marking it as a solution.