---
title: "Create or update a registered Molecule"
method: PATCH
path: "/molecules/{entity_registry_id}:upsert"
tags: ["molecules"]
---

# Create or update a registered Molecule

`PATCH /molecules/{entity_registry_id}:upsert`

## Request

- Base URL: `https://{tenant_name}.benchling.com/api/v2`
- URL: `https://{tenant_name}.benchling.com/api/v2/molecules/{entity_registry_id}:upsert`
- Auth: HTTP bearer

Create or update a registered Molecule.

Schema field links can be populated using entity registry IDs or API IDs. In the `value` field of the `Field` resource, the object `{"entityRegistryId": ENTITY_REGISTRY_ID}` may be provided instead of the API ID if desired (see example value).

## Path parameters

- `entity_registry_id` string, required

## Request body

- MoleculeUpsertRequest
  - `archiveRecord` ArchiveRecordSet: Currently, we only support setting a null value for archiveRecord, which unarchives the item
  - `fields` FieldsWithResolution
  - `name` string, required: Name of the Molecule.
  - `registryId` string, required
  - `schemaId` string, required: ID of the Molecule's schema.
  - `aliases` string[]: Aliases to add to the Molecule.
  - `authorIds` string[]: IDs of users to set as the Molecule's authors.
  - `chemicalStructure` MoleculeStructure, required
    - `structureFormat` 'smiles' | 'molfile': Format of the chemical structure. - smiles - molfile
    - `value` string: 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).
  - `customFields` CustomFields
  - `folderId` string: ID of the folder containing the Molecule.

## Response `200`

OK

- Molecule
  - `aliases` string[]: Array of aliases.
  - `apiURL` string, uri: The canonical url of the Molecule in the API.
  - `archiveRecord` ArchiveRecord
    - `reason` string
  - `authors` UserSummary[]
    - `handle` string
    - `id` string
    - `name` string
  - `canonicalizedSmiles` string: The canonicalized chemical structure in SMILES format.
  - `createdAt` string, date-time: DateTime the Molecule was created.
  - `creator` UserSummary
    - `handle` string
    - `id` string
    - `name` string
  - `customFields` CustomFields
  - `entityRegistryId` string, nullable: Registry ID of the Molecule if registered.
  - `fields` Fields
  - `folderId` string, nullable: ID of the folder that contains the Molecule.
  - `id` string: ID of the Molecule.
  - `modifiedAt` string, date-time: DateTime the Molecule was last modified.
  - `name` string: Name of the Molecule.
  - `originalSmiles` string, nullable: The original chemical structure supplied by the user in SMILES format. Null if the user did not originally supply SMILES.
  - `registrationOrigin` RegistrationOrigin
    - `originEntryId` string, nullable
    - `registeredAt` string, date-time
  - `registryId` string, nullable: Registry the Molecule is registered in.
  - `schema` SchemaSummary
    - `id` string
    - `name` string
  - `webURL` string, uri: URL of the Molecule.

## Other responses

- `400`: Bad Request

---

[API](https://skmtc.dev/benchling/apis/benchling-api-2.md) - [All operations](https://skmtc.dev/benchling/apis/benchling-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/benchling/apis/benchling-api-2/revisions/01d2fa8523cd?raw)
