> This page is for Unified.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# /custom-object-classes/{source_class_id}/custom-objects/{source_object_id}/associations/{target_class_id}/{target_object_id}/{association_type_id}

PUT https://api.merge.dev/api/crm/v1/custom-object-classes/{source_class_id}/custom-objects/{source_object_id}/associations/{target_class_id}/{target_object_id}/{association_type_id}

Creates an Association between `source_object_id` and `target_object_id` of type `association_type_id`.

Reference: https://docs.merge.dev/merge-unified/crm/custom-objects/associations/custom-object-classes-custom-objects-associations-update

## Authentication

- `Authorization` header (bearer token, required) — Token-based authentication with required prefix "Bearer"

## Servers

- `https://api.merge.dev/api` (Production, default)
- `https://api-eu.merge.dev/api` (ProductionEU)
- `https://api-ap.merge.dev/api` (ProductionAPSE1)

## Request

### Path parameters

- `association_type_id` (string, required)
- `source_class_id` (string, required)
- `source_object_id` (string, required)
- `target_class_id` (string, required)
- `target_object_id` (string, required)

### Query parameters

- `is_debug_mode` (boolean, optional) — Whether to include debug fields (such as log file links) in the response.
- `run_async` (boolean, optional) — Whether or not third-party updates should be run asynchronously.

### Headers

- `X-Account-Token` (string, required) — Token identifying the end user.

## Response

### 200

- `created_at` (datetime, optional) — The datetime that this object was created by Merge.
- `modified_at` (datetime, optional) — The datetime that this object was modified by Merge.
- `source_object` (string, optional)
- `target_object` (string, optional)
- `association_type` (string, optional, nullable) — The association type the association belongs to.

## Examples

**Response**

```json
{
  "created_at": "2021-09-15T00:00:00Z",
  "modified_at": "2021-10-16T00:00:00Z",
  "source_object": "a8f5d29f-4e50-473f-8f12-27128ffcd37a",
  "target_object": "da0b1963-be70-469c-9f8c-06a81d0fe759",
  "association_type": "88a71b5c-a3cc-4bce-84ff-d18b049a4081"
}
```

**SDK Code**

```python
import requests

url = "https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id"

headers = {
    "X-Account-Token": "X-Account-Token",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id';
const options = {
  method: 'PUT',
  headers: {'X-Account-Token': 'X-Account-Token', Authorization: 'Bearer <token>'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("X-Account-Token", "X-Account-Token")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Account-Token"] = 'X-Account-Token'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id")
  .header("X-Account-Token", "X-Account-Token")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Account-Token' => 'X-Account-Token',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Account-Token", "X-Account-Token");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Token": "X-Account-Token",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.merge.dev/api/crm/v1/custom-object-classes/source_class_id/custom-objects/source_object_id/associations/target_class_id/target_object_id/association_type_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```