# api v3 associations: are constants defined for "fromObjectType" and "toObjectType"?

**URL:** <https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286>\
**Category:** APIs & Integrations\
**Tags:** php\
**Created:** [March 22, 2021, 6:29pm UTC](https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286 "2021-03-22T18:29:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danhammari](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/danhammari/32/11850_2.png) [@danhammari](https://community.hubspot.com/u/danhammari)\
**Post date:** [March 22, 2021, 6:29pm UTC](https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286/1 "2021-03-22T18:29:29Z")

</div>

I have been searching through the API v3 documentation but have not been able to find a list of valid strings that would satisfy the

fromObjectType

or

toObjectType

parameters of the HubSpot CRM Associations API.

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

**POST**

/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/read

I am also interested in using the HubSpot CRM Companies API to fetch deals associated with a given company.

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

**GET**

/crm/v3/objects/companies/{companyId}/associations/{toObjectType}

I am using the Hubspot API library in PHP to query the v3 endpoints, but the PHP library also does not provide a definitions list or set of constants. All of the

to\_object\_type

and

from\_object\_type

parameters are simply defined as string variables without a closed list of options or reference to allowed constants.

language: PHP

namespace: HubSpot\Client\Crm\Companies\Api

class: AssociationsApi

method: getAll

Could someone point me to where I can find a list of allowed association values? I am unsure of whether to use “deal” or “deals” or “company” or “companies” and would rather not have to guess my way through trial and error to determine which association values are valid.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 23, 2021, 4:12pm UTC](https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286/2 "2021-03-23T16:12:52Z")

</div>

Hey @danhammari ,

I am going to throw a bunch of folks at this for you

[@quentin\_lamamy](https://community.hubspot.com/t5/user/viewprofilepage/user-id/148828) , @philx , @AndrewFisher , @twnk , [@ph\_alti\_trading](https://community.hubspot.com/t5/user/viewprofilepage/user-id/137533) could any of you all help out here?

---

<div class="post-metadata">

**Author:** ![ph\_alti\_trading](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ph_alti_trading/32/191450_2.png) [@ph\_alti\_trading](https://community.hubspot.com/u/ph_alti_trading)\
**Post date:** [March 23, 2021, 4:35pm UTC](https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286/3 "2021-03-23T16:35:50Z")

</div>

Hey @dennisedson ,  
Sorry to disappoint you but I’m not using the V3 of the API. On my side I’m still using the legacy API. 😜  
@danhammari  
If you are using the new API V3 I \*guess\* it’s one of the “string” described in this reference file :

> <https://github.com/HubSpot/hubspot-api-php/blob/master/lib/Crm/ObjectType.php>

If you are using the legacy API it’s probably an integer as described in this reference file :  
[https://github.com/HubSpot/hubspot-php/blob/master/src/Resources/CrmAssociations.php](https://github.com/HubSpot/hubspot-php/blob/master/src/Resources/CrmAssociations.php)  
$hubspot-\>CrmAssociations()-\>get( {an object id}, {a from2object type id} );  
Hope this help. 😃

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 23, 2021, 4:37pm UTC](https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286/4 "2021-03-23T16:37:29Z")

</div>

I forgive you [@ph\_alti\_trading](https://community.hubspot.com/t5/user/viewprofilepage/user-id/137533) :wink

---

<div class="post-metadata">

**Author:** ![danhammari](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/danhammari/32/11850_2.png) [@danhammari](https://community.hubspot.com/u/danhammari)\
**Post date:** [March 23, 2021, 7:40pm UTC](https://community.hubspot.com/t/api-v3-associations-are-constants-defined-for-fromobjecttype-and-toobjecttype/34286/5 "2021-03-23T19:40:04Z")

</div>

Hi ph\_alti\_trading,

Thanks for pointing out the ObjectType.php file. I tested using both the plural and singular versions of each term (e.g. company/companies, deal/deals) and found that the API was able to treat the singular and plural variants of each entity without distinction. I guess the API designers thought through the possibility that users would provide either term and allowed the API to handle them without error.

Meanwhile, I will use the ObjectType.php file as the source of my constants when I am scripting my association queries:

namespace: HubSpot\Crm

class: ObjectType

example:

$hubspot\_api\_company\_helper-\>associationsApi()-\>getAll( $hubspot\_company\_id,

\HubSpot\Crm\ObjectType::_DEALS_ );
