> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enginy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create associations

> Link contacts to companies in your CRM

<Card title="Your Implementation Required" icon="triangle-exclamation" color="#f59e0b">
  This endpoint must be implemented on **your server**
</Card>

Enginy calls this endpoint to create relationships between contacts and companies after both have been created or synced.

## Request

<ParamField body="associations" type="array" required>
  Array of contact-company pairs to link
</ParamField>

### Association Object

<ParamField body="contactCRMId" type="string" required>
  The CRM ID of the contact (returned from create/sync)
</ParamField>

<ParamField body="companyCRMId" type="string" required>
  The CRM ID of the company (returned from create/sync)
</ParamField>

<RequestExample>
  ```json theme={null}
  {
    "associations": [
      {
        "contactCRMId": "contact_8f3k2j",
        "companyCRMId": "account_4k8j2m"
      },
      {
        "contactCRMId": "contact_9x7m4n",
        "companyCRMId": "account_4k8j2m"
      }
    ]
  }
  ```
</RequestExample>

## Response

<ResponseField name="success" type="boolean" required>
  Whether the operation succeeded
</ResponseField>

<ResponseField name="created" type="number">
  Number of associations created
</ResponseField>

<ResponseField name="errors" type="array">
  Array of failed associations (if any)
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "created": 2
  }
  ```
</ResponseExample>

### Partial Success

```json theme={null}
{
  "success": true,
  "created": 1,
  "errors": [
    {
      "contactCRMId": "contact_invalid",
      "companyCRMId": "account_4k8j2m",
      "error": "Contact not found"
    }
  ]
}
```

<Tip>Use upsert logic to handle duplicate associations gracefully (ignore if already exists).</Tip>
