> 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 a Molecule

PATCH https://{tenant_name}.benchling.com/api/v2/molecules/{molecule_id}
Content-Type: application/json

Update a Molecule

Reference: https://docs.benchling.com/docs/api/v2/benchling-api/molecules/update-molecule

## Authentication

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

## Request

### Path parameters

- `molecule_id` (string, required)

### Body (application/json)

This endpoint expects a MoleculeUpdate.

- `aliases` (list of string, optional) — Aliases to add to the Molecule.
- `authorIds` (list of string, optional) — IDs of users to set as the Molecule's authors.
- `chemicalStructure` (MoleculeStructure, optional) — Chemical structure of the Molecule.
- `customFields` (map from string to CustomField, optional) — Custom fields to add to the Molecule. Every field should have its name as a key, mapping to an object with information about the value of the field.
- `entityRegistryId` (string, optional)
- `fields` (map from string to Field, optional) — Fields to set on the Molecule. Must correspond with the schema's field definitions. Every field should have its name as a key, mapping to an object with information about the value of the field.
- `folderId` (string, optional) — ID of the folder containing the Molecule.
- `name` (string, optional) — Name of the Molecule.
- `schemaId` (string, optional) — ID of the Molecule's schema.

## Response

### 200

OK

- `aliases` (list of string, optional) — Array of aliases.
- `apiURL` (string, optional) — The canonical url of the Molecule in the API.
- `archiveRecord` (ArchiveRecord, optional, nullable)
- `authors` (list of UserSummary, optional)
- `canonicalizedSmiles` (string, optional) — The canonicalized chemical structure in SMILES format.
- `createdAt` (datetime, optional) — DateTime the Molecule was created.
- `creator` (UserSummary, optional)
- `customFields` (map from string to CustomField, optional) — Custom fields set on the Molecule.
- `entityRegistryId` (string, optional, nullable) — Registry ID of the Molecule if registered.
- `fields` (map from string to Field, optional)
- `folderId` (string, optional, nullable) — ID of the folder that contains the Molecule.
- `id` (string, optional) — ID of the Molecule.
- `modifiedAt` (datetime, optional) — DateTime the Molecule was last modified.
- `name` (string, optional) — Name of the Molecule.
- `originalSmiles` (string, optional, nullable) — The original chemical structure supplied by the user in SMILES format. Null if the user did not originally supply SMILES.
- `registrationOrigin` (RegistrationOrigin, optional, nullable)
- `registryId` (string, optional, nullable) — Registry the Molecule is registered in.
- `schema` (SchemaSummary, optional, nullable)
- `webURL` (string, optional) — URL of the Molecule.

## Errors

### 400 Bad Request Error

Bad Request

- `error` (BadRequestErrorError, optional)

## Types

### MoleculeStructure

- `structureFormat` (enum, optional) — Format of the chemical structure. - smiles - molfile
  - Allowed values: `smiles`, `molfile`
- `value` (string, optional) — Chemical structure in SMILES or molfile format. Pass an empty SMILES string to create a Molecule with no defined structure (equivalent to leaving the structure blank in the app's sketcher).

### CustomField

- `value` (string, optional)

### Field

- `value` (FieldValue, required, nullable) — For single link fields, use the id of the item you want to link (eg. "seq_jdf8BV24"). For multi-link fields, use an array of ids of the items you want to link (eg. ["seq_jdf8BV24"])
- `displayValue` (string, optional, nullable)
- `isMulti` (boolean, optional)
- `textValue` (string, optional, nullable)
- `type` (enum, optional)
  - Allowed values: `dna_sequence_link`, `aa_sequence_link`, `custom_entity_link`, `entity_link`, `mixture_link`, `molecule_link`, `dropdown`, `part_link`, `translation_link`, `aa_part_link`, `base_molecule_link`, `blob_link`, `text`, `long_text`, `batch_link`, `storage_link`, `entry_link`, `assay_request_link`, `assay_result_link`, `assay_run_link`, `boolean`, `float`, `integer`, `datetime`, `date`, `json`

### ArchiveRecord

- `reason` (string, optional)

### UserSummary

- `handle` (string, optional)
- `id` (string, optional)
- `name` (string, optional)

### RegistrationOrigin

- `originEntryId` (string, optional, nullable)
- `registeredAt` (datetime, optional)

### SchemaSummary

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

### BadRequestErrorError

- `message` (string, optional)
- `type` (enum, optional)
  - Allowed values: `invalid_request_error`
- `userMessage` (string, optional)

### FieldValue

For single link fields, use the id of the item you want to link (eg. "seq_jdf8BV24"). For multi-link fields, use an array of ids of the items you want to link (eg. ["seq_jdf8BV24"])

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "aliases": [
    "string"
  ],
  "apiURL": "string",
  "archiveRecord": {
    "reason": "Made in error"
  },
  "authors": [
    {
      "handle": "string",
      "id": "string",
      "name": "string"
    }
  ],
  "canonicalizedSmiles": "Nc1nc(=O)n([H])cc1C1CC1",
  "createdAt": "2024-01-15T09:30:00Z",
  "creator": {
    "handle": "string",
    "id": "string",
    "name": "string"
  },
  "customFields": {},
  "entityRegistryId": "string",
  "fields": {},
  "folderId": "string",
  "id": "mol_bhuDUw9D",
  "modifiedAt": "2024-01-15T09:30:00Z",
  "name": "string",
  "originalSmiles": "Nc1nc(=O)n([H])cc1C1CC1",
  "registrationOrigin": {
    "originEntryId": "string",
    "registeredAt": "2024-01-15T09:30:00Z"
  },
  "registryId": "string",
  "schema": {
    "id": "string",
    "name": "string"
  },
  "webURL": "https://benchling.com/benchling/f/lib_R8KcsjhW-molecules/mol_xCUXNVyG-molecule1/edit"
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v2/molecules/molecule_id"

payload = {}
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/v2/molecules/molecule_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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