# API Search - Return association field

**URL:** <https://community.hubspot.com/t/api-search-return-association-field/80305>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [April 29, 2023, 11:26pm UTC](https://community.hubspot.com/t/api-search-return-association-field/80305 "2023-04-29T23:26:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TGrandey](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tgrandey/32/198471_2.png) [@TGrandey](https://community.hubspot.com/u/TGrandey)\
**Post date:** [April 29, 2023, 11:26pm UTC](https://community.hubspot.com/t/api-search-return-association-field/80305/1 "2023-04-29T23:26:57Z")

</div>

I have a custom object that has an association to HubSpot’s company object. I’m wondering if there is a way to have the search api return a property of the company when searching the custom object.  
For example, I’m searching for all custom objects with the last name of “Smith” and I would like to return some of the properties of the custom object as well as the name of the company that the custom object is associated with.  
Search: last\_name EQ Smith  
Return:  
first\_name: Joe

last\_name: Smith

company.company\_name: Acme, Inc.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [May 1, 2023, 9:06am UTC](https://community.hubspot.com/t/api-search-return-association-field/80305/2 "2023-05-01T09:06:16Z")

</div>

Hello @TGrandey

use the Search API to return the associated company property when searching for custom objects in HubSpot. To achieve this, you’ll need to specify the “properties” parameter in your API request and include the name of the association property, followed by the name of the company property you wish to return.

Here’s an example of what the API request might look like:

```lia-code-sample
https://api.hubapi.com/crm/v3/objects/custom-objects/search?hapikey=<your_api_key>&properties=first_name,last_name,company.association_property_name.company_property_name&q=last_name:Smith

```

In this example, replace `<your_api_key>` with your HubSpot API key, `custom-objects` with the name of your custom object, `association_property_name` with the name of the association property that links the custom object to the company object, and `company_property_name` with the name of the company property you want to return.

With this API request, you should be able to retrieve custom objects with the last name of “Smith” and include the associated company’s name in the response. Note that you may need to adjust the parameter names and values to match your specific use case.

---

<div class="post-metadata">

**Author:** ![dca123](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@dca123](https://community.hubspot.com/u/dca123)\
**Post date:** [October 27, 2023, 2:22am UTC](https://community.hubspot.com/t/api-search-return-association-field/80305/3 "2023-10-27T02:22:18Z")

</div>

Hi,

Could you simplify this to explain how I can get the associated company name when the custom object is a deal ?

Thank you

---

<div class="post-metadata">

**Author:** ![SLane1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/slane1/32/93635_2.png) [@SLane1](https://community.hubspot.com/u/SLane1)\
**Post date:** [November 20, 2023, 8:51pm UTC](https://community.hubspot.com/t/api-search-return-association-field/80305/4 "2023-11-20T20:51:13Z")

</div>

Where would one find the ‘association\_property\_name’?
