> 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 create Connection

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

Create multiple connections synchronously. Maximum 25 items per request. If any item fails, no connections are created.

- `adapterId` is the ID of the adapter the connection runs, such as `chromeleon-adapter`. The adapter can't be changed after the connection is created.
- `gatewayId` is the API ID of a gateway (`gtw_`). The gateway can't be changed after the connection is created.
- `ownerId` is the API ID of an organization (`ent_`) you can read.
- `adapterFields` are keyed by the adapter's field IDs.
- `dataCatalogFolderId` must be a folder you can add items to.
- `associatedEquipmentIds` requires the equipment feature, and `automationTemplateIds` requires the connection integration feature.

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

## 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 CreateConnectionInput, required)

## Response

### 201

Created

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

### CreateConnectionInput

- `adapterId` (string, required) — The ID of the adapter the connection uses.
- `gatewayId` (string, required) — The ID of the gateway the connection runs on.
- `name` (string, required) — The name of the connection. Cannot be blank.
- `ownerId` (string, required) — The API ID of the organization that owns the connection.
- `adapterFields` (map from string to string, optional) — Values for the adapter's configuration fields, keyed by field ID.
- `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.

### 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": [
    {
      "adapterId": "string",
      "gatewayId": "string",
      "name": "string",
      "ownerId": "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-create"

payload = { "items": [
        {
            "adapterId": "string",
            "gatewayId": "string",
            "name": "string",
            "ownerId": "string"
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v3/connection:batch-create';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"items":[{"adapterId":"string","gatewayId":"string","name":"string","ownerId":"string"}]}'
};

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