---
title: "Bulk upsert entities"
method: POST
path: "/entities:bulk-upsert"
tags: ["entities"]
deprecated: true
---

# Bulk upsert entities

`POST /entities:bulk-upsert`

## Request

- Base URL: `https://{tenant_name}.benchling.com/api/v2-beta`
- URL: `https://{tenant_name}.benchling.com/api/v2-beta/entities:bulk-upsert`
- Auth: HTTP bearer

> **Deprecated.**

All entities and their schemas must be within the same registry.

This operation performs the following actions:
1. Any existing objects are looked up in Benchling by the provided entity registry ID.
2. Then, all objects are either created or updated accordingly, temporarily skipping any schema field links between objects.
3. 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). You may link to objects being created in the same operation.
4. Entities are registered, using the provided name and entity registry ID.

If any action fails, the whole operation is canceled and no objects are created or updated.

## Query parameters

- `returning` string

## Request body

- EntitiesBulkUpsertRequest
  - `aaSequences` AaSequenceBulkUpsertRequest[]
    - `archiveRecord` ArchiveRecordSet: Currently, we only support setting a null value for archiveRecord, which unarchives the item
    - `fields` FieldsWithResolution
    - `name` string, required: Name of the AA sequence.
    - `registryId` string, required
    - `schemaId` string, required: ID of the AA sequence's schema.
    - `entityRegistryId` string, required: Registry ID of the entity in Benchling.
    - `aliases` string[]: Aliases to add to the AA sequence
    - `aminoAcids` string, required: Amino acids for the AA sequence.
    - `annotations` AaAnnotation[], required: Annotations to create on the AA sequence.
      - `color` string
      - `end` integer: 0-based exclusive end index. The end of the AA sequence is always represented as 0.
      - `id` string
      - `name` string
      - `notes` string
      - `start` integer: 0-based inclusive start index.
      - `type` string
    - `authorIds` string[]: IDs of users to set as the AA sequence's authors.
    - `customFields` CustomFields
    - `folderId` string: ID of the folder containing the AA sequence.
  - `customEntities` CustomEntityBulkUpsertRequest[]
    - `archiveRecord` ArchiveRecordSet: Currently, we only support setting a null value for archiveRecord, which unarchives the item
    - `fields` FieldsWithResolution
    - `name` string, required
    - `registryId` string, required
    - `schemaId` string, required
    - `entityRegistryId` string, required: Registry ID of the entity in Benchling.
    - `aliases` string[]: Aliases to add to the custom entity
    - `authorIds` string[]: IDs of users to set as the custom entity's authors.
    - `customFields` CustomFields
    - `folderId` string: ID of the folder that the entity is moved into
  - `dnaOligos` OligoBulkUpsertRequest[]
    - `archiveRecord` ArchiveRecordSet: Currently, we only support setting a null value for archiveRecord, which unarchives the item
    - `fields` FieldsWithResolution
    - `name` string, required: Name of the Oligo.
    - `registryId` string, required
    - `schemaId` string, required: ID of the oligo's schema.
    - `entityRegistryId` string, required: Registry ID of the entity in Benchling.
    - `aliases` string[]: Aliases to add to the Oligo
    - `authorIds` string[]: IDs of users to set as the Oligo's authors.
    - `bases` string: Base pairs of the oligo.
    - `customFields` CustomFields
    - `folderId` string: ID of the folder containing the Oligo.
  - `dnaSequences` DnaSequenceBulkUpsertRequest[]
    - `archiveRecord` ArchiveRecordSet: Currently, we only support setting a null value for archiveRecord, which unarchives the item
    - `fields` FieldsWithResolution
    - `name` string, required: Name of the DNA sequence.
    - `registryId` string, required
    - `schemaId` string, required: ID of the DNA sequence's schema.
    - `entityRegistryId` string, required: Registry ID of the entity in Benchling.
    - `aliases` string[]: Aliases to add to the DNA sequence
    - `annotations` DnaAnnotation[], required: Annotations to create on the DNA sequence.
      - `color` string: Hex color code used when displaying this feature in the UI.
      - `customFields` SequenceFeatureCustomField[]
        - `name` string: Name of the custom field
        - `value` string: Value of the custom field
      - `name` string
      - `notes` string
      - `end` integer: 0-based exclusive end index. The end of the sequence is always represented as 0.
      - `start` integer: 0-based inclusive start index.
      - `strand` integer
      - `type` string
    - `authorIds` string[]: IDs of users to set as the DNA sequence's authors.
    - `bases` string, required: Base pairs for the DNA sequence.
    - `customFields` CustomFields
    - `folderId` string: ID of the folder containing the DNA sequence.
    - `isCircular` boolean, required: Whether the DNA sequence is circular or linear.
    - `parts` DnaSequencePart[]
      - `end` integer: 0-based exclusive end index. The end of the sequence is always represented as 0.
      - `sequenceId` string
      - `start` integer: 0-based inclusive start index.
      - `strand` integer
    - `primers` Primer[], required
      - `bases` string
      - `bindPosition` integer
      - `color` string
      - `end` integer: 0-based exclusive end index. The end of the sequence is always represented as 0.
      - `name` string
      - `oligoId` string
      - `overhangLength` integer
      - `start` integer: 0-based inclusive start index.
      - `strand` integer
    - `translations` Translation[]: Translations to create on the DNA sequence. Translations are specified by either a combination of 'start' and 'end' fields, or a list of regions. Both cannot be provided.
      - `color` string: Hex color code used when displaying this feature in the UI.
      - `customFields` SequenceFeatureCustomField[]
        - `name` string: Name of the custom field
        - `value` string: Value of the custom field
      - `name` string
      - `notes` string
      - `aminoAcids` string
      - `coerceStartCodonToMethionine` boolean: Whether to override the translation of the start codon to Methionine. Has no effect when the start codon already translates to Methionine.
      - `end` integer: 0-based exclusive end index. The end of the sequence is always represented as 0.
      - `geneticCode` 'STANDARD' | 'VERTEBRATE_MITOCHONDRIAL' | 'YEAST_MITOCHONDRIAL' | 'MOLD_PROTOZOAN_COELENTERATE_MITOCHONDRIAL_MYCOPLASMA_SPIROPLASMA' | 'INVERTEBRATE_MITOCHONDRIAL' | 'CILIATE_DASYCLADACEAN_HEXAMITA_NUCLEAR' | 'ECHINODERM_FLATWORM_MITOCHONDRIAL' | 'EUPLOTID_NUCLEAR' | 'BACTERIAL_ARCHAEAL_PLANT_PLASTID' | 'ALTERNATIVE_YEAST_NUCLEAR' | 'ASCIDIAN_MITOCHONDRIAL' | 'ALTERNATIVE_FLATWORM_MITOCHONDRIAL' | 'CHLOROPHYCEAN_MITOCHONDRIAL' | 'TREMATODE_MITOCHONDRIAL' | 'SCENEDESMUS_OBLIQUUS_MITOCHONDRIAL' | 'THRAUSTOCHYTRIUM_MITOCHONDRIAL' | 'RHABDOPLEURIDAE_MITOCHONDRIAL' | 'CANDIDATE_DIVISION_SR1_GRACILIBACTERIA' | 'PACHYSOLEN_TANNOPHILUS_NUCLEAR' | 'MESODINIUM_NUCLEAR' | 'PERITRICH_NUCLEAR' | 'CEPHALODISCIDAE_MITOCHONDRIAL_UAA_TYR': The genetic code to use when translating the nucleotide sequence into amino acids.
      - `regions` TranslationRegionsItems[]
        - `end` integer: 0-based exclusive end index. The end of the sequence is always represented as 0.
        - `start` integer: 0-based inclusive start index.
      - `start` integer: 0-based inclusive start index.
      - `strand` integer
  - `molecules` MoleculeBulkUpsertRequest[]
    - `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.
    - `entityRegistryId` string, required: Registry ID of the entity in Benchling.
    - `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.
  - `rnaOligos` OligoBulkUpsertRequest[]
    - `archiveRecord` ArchiveRecordSet: Currently, we only support setting a null value for archiveRecord, which unarchives the item
    - `fields` FieldsWithResolution
    - `name` string, required: Name of the Oligo.
    - `registryId` string, required
    - `schemaId` string, required: ID of the oligo's schema.
    - `entityRegistryId` string, required: Registry ID of the entity in Benchling.
    - `aliases` string[]: Aliases to add to the Oligo
    - `authorIds` string[]: IDs of users to set as the Oligo's authors.
    - `bases` string: Base pairs of the oligo.
    - `customFields` CustomFields
    - `folderId` string: ID of the folder containing the Oligo.

## Response `202`

This endpoint launches a [long-running task](https://docs.benchling.com/docs/api/v2/benchling-api/tasks/get-task) and returns the Task ID of the launched task.
When successful, the task returns the resources of the objects that were upserted.

- AsyncTaskLink
  - `taskId` string

## Other responses

- `400`: Bad Request

---

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