> 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.

# Batch update Connection

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

Update, archive, or unarchive multiple connections synchronously. Maximum 25 items per request. If any item fails, no changes are saved in Benchling. The service that runs connections on their gateways isn't part of that transaction, so archiving, unarchiving, adapter field, and enabled state changes it has already applied for the request may remain after the request fails.

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/batchupdate

## Authentication

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

## Request

### Headers

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

### Body (application/json)

This endpoint expects an object.

- `items` (list of UpdateConnectionInputWithPathParams, required)

## Response

### 200

OK

- `items` (list of Connection, required)

## 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

### UpdateConnectionInputWithPathParams

- `id` (string, required)
- `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.

### Connection

A Connection links Benchling to a lab instrument or other integration through an Adapter running on a Gateway. A Gateway is Benchling's connectivity software deployed to a customer PC, and an Adapter is a component on that Gateway that communicates with instrument software or provides generic functionality like file-watching. Runtime state for the Connection (such as its status and file-sync progress) is managed by the Instruments Service.

- `__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`

### GeneralErrorDetail

- string
- map from string to any

### TooManyRequestsErrorDetail

- string
- map from string to any

### InternalServerErrorDetail

- string
- map from string to any

### PrincipalRef

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

### FolderRef

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

### OwnerRef

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

## Examples

**Request**

```json
{
  "items": [
    {
      "id": "string"
    }
  ]
}
```

**Response**

```json
{
  "items": [
    {
      "__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:batch-update"

payload = { "items": [{ "id": "string" }] }
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:batch-update';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"items":[{"id":"string"}]}'
};

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