# Private app - Cant create asociations in task

**URL:** <https://community.hubspot.com/t/private-app-cant-create-asociations-in-task/77324>\
**Category:** APIs & Integrations\
**Tags:** php\
**Created:** [March 16, 2023, 11:30am UTC](https://community.hubspot.com/t/private-app-cant-create-asociations-in-task/77324 "2023-03-16T11:30:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfrubiod](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@jfrubiod](https://community.hubspot.com/u/jfrubiod)\
**Post date:** [March 16, 2023, 11:30am UTC](https://community.hubspot.com/t/private-app-cant-create-asociations-in-task/77324/1 "2023-03-16T11:30:36Z")

</div>

Hi.

Im creating one task in PHP and I need to setup an associtaion with a company using V3 CRM connection.

There is no problem with the task but the association was not stablished. I use this data for create.

Where I could find a definition to know wich is de code that I need for “copany” in “associationTypeId” field.

Thanks

```lia-code-sample
	$simplePublicObjectInputForCreate = [
		'properties' => [
				 "hs_timestamp" => $date,
				 "hs_task_body" => $cuerpo,
				 "hubspot_owner_id" => $owner,
				 "hs_task_subject" => $titulo,
				 "hs_task_status" => "WAITING",
				 "hs_task_priority" => "HIGH"
			],
		'asociations' => [
				"to" => [
					"id" => $company,
					"types" => [
						"associationCategory" => "HUBSPOT_DEFINED",
						"associationTypeId" => 2
					]
				]
			]
	];

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [March 16, 2023, 9:01pm UTC](https://community.hubspot.com/t/private-app-cant-create-asociations-in-task/77324/2 "2023-03-16T21:01:51Z")

</div>

Hi, @jfrubiod 👋 Thanks for the question. This one always feels a bit mysterious until you know where to look 😊  
You can find this information between two objects by using this endpoint — [Retrieve association types](https://developers.hubspot.com/docs/api/crm/associations#:~:text=Retrieve%20association%20types).

- `GET /crm/v4/associations/{fromObjectType}/{toObjectType}/labels`

Here’s an example:

- my request  
`GET https://api.hubapi.com/crm/v4/associations/task/company/labels​`

- the response

You could do the same Task \> Contact, for example, to get the typeId. Each ID is one-way, please verify you specify the correct objects and association direction.

Best,

Jaycee
