# Find obsolete associations

**URL:** <https://community.hubspot.com/t/find-obsolete-associations/100644>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [February 21, 2024, 1:52pm UTC](https://community.hubspot.com/t/find-obsolete-associations/100644 "2024-02-21T13:52:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Verakso](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/verakso/32/27810_2.png) [@Verakso](https://community.hubspot.com/u/Verakso)\
**Post date:** [February 21, 2024, 1:52pm UTC](https://community.hubspot.com/t/find-obsolete-associations/100644/1 "2024-02-21T13:52:21Z")

</div>

Hi  
I am fairly new to HubSpot, but I am already beginning to get a good understanding of Objects and Custom Objects, reading, creating, deleting, merge and updating records.  
One thing I am struggling with is associations.

I am in the process of cleaning out some old code, that unfortunately create multiple copies of the same company. What I am missing now, is the cleaning of the associations and relationships between objects.  
What I can read from the documentation, then a relationship between objects is not deleted if one of the objects is deleted.

That would mean, that I have a bunch of orphaned objects now.

Like I can get a list of all my Companies, and all entries in my custom object Employees, I simply can’t figure out, how to get all the relations between these two objects.

It seems to me, in order to get that I would have to ask for each Company ID (batch) but that would only give me the active relations.

How can I get all the relation objects ids in an association, so I can verify the ones that are still valid, and change/delete the ones that that are wrong?

**Br** **(****ツ****)**

Thomas

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [February 22, 2024, 8:00am UTC](https://community.hubspot.com/t/find-obsolete-associations/100644/2 "2024-02-22T08:00:17Z")

</div>

Hi @Verakso

I hope the attached curl will resolve your query-

```lia-code-sample
curl --request GET \
 --url 'https://api.hubapi.com/crm/v3/objects/companies?limit=10&associations=employees&archived=false' \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

```

I am also attaching a HubSpot Knowledge base link for more reference and clarity.

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fcrm-companies-v3%2Fguide)**

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.

Thanks!

---

<div class="post-metadata">

**Author:** ![Verakso](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/verakso/32/27810_2.png) [@Verakso](https://community.hubspot.com/u/Verakso)\
**Post date:** [February 22, 2024, 8:50am UTC](https://community.hubspot.com/t/find-obsolete-associations/100644/3 "2024-02-22T08:50:33Z")

</div>

That seems to be exactly what I was loooking for.

I might be doing things a litle bit backwards, but I like to extract the data, and then do some validation my self, and this snippet certainly helped.  
Thanks!
