> This page is for Developer Documentation.

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

# Update Connection

PATCH https://{tenant_name}.benchling.com/api/v3/connection/{connection_id}
Content-Type: application/json

Update a connection, or archive or unarchive it.

Omitted fields are left unchanged. Setting `associatedEquipmentIds` or `automationTemplateIds` replaces the connection's equipment or automation template associations.

To archive a connection, set `archived` to `true` and provide an `archiveReason`. To unarchive a connection, set `archived` to `false` and omit `archiveReason`. A connection can't be unarchived while any of its equipment is associated with another unarchived connection.

Archiving or unarchiving a connection also archives or unarchives it in the service that runs connections on their gateways, which also stores its adapter fields and enabled state.

Reference: https://docs.benchling.com/docs/api/benchling-api/connection/update

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `connection_id` (string, required) — ID of the Connection.

### Headers

- `EARLY-ACCESS` (string, optional) — Set to true to access beta operations via /api/v3.

### Body (application/json)

This endpoint expects an UpdateConnectionInput.

- `adapterFields` (map from string to string, optional) — Values for the adapter's configuration fields, keyed by field ID. Fields that aren't included are left unchanged, and a field set to `null` is cleared.
- `archiveReason` (string, optional) — Why it is being archived. Required when `archived` is `true`, and not allowed when unarchiving.
- `archived` (boolean, optional) — Set to `true` to archive or `false` to unarchive it. Archiving requires `archiveReason`.
- `associatedEquipmentIds` (list of string, optional) — The API IDs of the equipment entities the connection is for. Each equipment entity can be associated with at most one unarchived connection.
- `automationTemplateIds` (list of string, optional) — The API IDs of the automation templates run on files synced by the connection. Each template must have no data frame variables and exactly one config variable, keyed `fileId` or `fileIds`.
- `dataCatalogFolderId` (string, optional) — The API ID of the folder that files synced by the connection are saved to.
- `isEnabled` (boolean, optional) — Whether the connection is enabled. A disabled connection doesn't run on its gateway.
- `name` (string, optional) — The name of the connection. Cannot be blank.

## Response

### 200

OK

- `__typename` (string, optional)
- `adapterId` (string, optional) — The Adapter type this Connection uses, e.g. "chromeleon-adapter". Cannot be changed after creation.
- `archiveReason` (string, optional, nullable)
- `archived` (boolean, optional)
- `associatedEquipment` (string, optional) — Equipment entities associated with the Connection, such as the instrument it communicates with.
- `createdAt` (string, optional)
- `creator` (PrincipalRef, optional, nullable) — User who created the Connection.
- `dataCatalogFolder` (FolderRef, optional, nullable) — Folder where data catalog items synced by this Connection are created. Null if not configured.
- `filesToSync` (integer, optional, nullable) — Number of files the Adapter has identified to sync for this Connection. Null if the Adapter has not reported this value or the Instruments Service could not be reached.
- `gatewayId` (string, optional, nullable) — ID of the Gateway this Connection runs on, e.g. "gtw_8MSOq4Gf". Cannot be changed after creation. Null if the Gateway couldn't be loaded.
- `id` (string, optional)
- `isFileBrowsing` (boolean, optional, nullable) — Whether the Connection's Adapter supports browsing instrument files. If false, the Connection requests data directly through run fields instead. Null if the Instruments Service could not be reached.
- `isFileSyncing` (boolean, optional, nullable) — Whether the Connection automatically copies instrument data into Benchling. If false, files are only copied when a user requests them. Null if the Instruments Service could not be reached.
- `modifiedAt` (string, optional)
- `name` (string, optional)
- `owner` (OwnerRef, optional) — User or Organization that owns the Connection.
- `status` (enum, optional) — Current runtime status of the Connection, as reported by the Instruments Service. Null if the Instruments Service has not reported a status or could not be reached.
  - Allowed values: `AVAILABLE`, `COMMUNICATION_ERROR`, `DISABLED`, `INSTRUMENT_ERROR`, `PENDING`, `RUNNING`

## Errors

### 400 Bad Request Error

Bad Request

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 403 Forbidden Error

Forbidden

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 404 Not Found Error

Not Found

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 409 Conflict Error

Conflict

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 429 Too Many Requests Error

Too Many Requests

- `detail` (TooManyRequestsErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 500 Internal Server Error

Internal Server Error

- `detail` (InternalServerErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `errorId` (string, optional)

## Types

### PrincipalRef

- `__typename` (string, optional)
- `id` (string, optional)

### FolderRef

- `__typename` (string, optional)
- `id` (string, optional)

### OwnerRef

- `__typename` (string, optional)
- `id` (string, optional)

### GeneralErrorDetail

- string
- map from string to any

### TooManyRequestsErrorDetail

- string
- map from string to any

### InternalServerErrorDetail

- string
- map from string to any

## Examples

**Request**

```json
{
  "adapterFields": {
    "host": "10.0.0.13",
    "port": null
  },
  "associatedEquipmentIds": [
    "bfi_jdf8BV24"
  ],
  "automationTemplateIds": [
    "anatmpl_Xk2pQ9cZ"
  ],
  "dataCatalogFolderId": "lib_o2thOLlq",
  "isEnabled": true,
  "name": "HPLC 1 Chromeleon"
}
```

**Response**

```json
{
  "__typename": "string",
  "adapterId": "string",
  "archiveReason": null,
  "archived": true,
  "associatedEquipment": "string",
  "createdAt": "string",
  "creator": {
    "__typename": "string",
    "id": "string"
  },
  "dataCatalogFolder": {
    "__typename": "string",
    "id": "string"
  },
  "filesToSync": null,
  "gatewayId": null,
  "id": "string",
  "isFileBrowsing": null,
  "isFileSyncing": null,
  "modifiedAt": "string",
  "name": "string",
  "owner": {
    "__typename": "string",
    "id": "string"
  },
  "status": null
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v3/connection/connection_id"

payload = {
    "adapterFields": {
        "host": "10.0.0.13",
        "port": None
    },
    "associatedEquipmentIds": ["bfi_jdf8BV24"],
    "automationTemplateIds": ["anatmpl_Xk2pQ9cZ"],
    "dataCatalogFolderId": "lib_o2thOLlq",
    "isEnabled": True,
    "name": "HPLC 1 Chromeleon"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v3/connection/connection_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"adapterFields":{"host":"10.0.0.13","port":null},"associatedEquipmentIds":["bfi_jdf8BV24"],"automationTemplateIds":["anatmpl_Xk2pQ9cZ"],"dataCatalogFolderId":"lib_o2thOLlq","isEnabled":true,"name":"HPLC 1 Chromeleon"}'
};

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