Skip to main content

An unofficial python wrapper for the Benchling API

Project description


PyPI version

The (unofficial) python API wrapper for Benchling. For more information, see documentation at


pip install benchlingapi -U

Getting Started

Initialize a session using your Benchling-provided API key:

from benchlingapi import Session
session = Session("your_secret_benchling_api_key")

From there, you can access various models:


Finding models:

# get one model
dna =

# find a specific model by its id
dna = session.DNASequence.find('sdg_4tg23')

# get the last 50 amino acids
proteins = session.AASequence.last(50)

# get a registry by name
registry = session.Registry.find_by_name("Klavins Lab Registry")

Updating models:

dna = = "My new name"

# update the sequence on the server

Saving new models:

folder = session.Folder.find_by_name("My API Folder")
dna = session.DNASequence(
    name = 'my new dna',
    bases = 'AGGTAGGATGGCCA',
    folder_id =,
    is_circular = False

# save the dna to your Benchling account

Registering models to your registry:

dna.set_schema("My DNA Schema")

See the documentation for more information:


Testing is done using pytest. Tests will create live requests to a Benchling account. Since testing is done live, a Benchling account will need to be setup along with testing data.

To run tests, you must have a Benchling Account with an API key. Tests require a file in 'tests/secrets/config.json' with the following format:

  "credentials": {
    "api_key": "asdahhjwrthsdfgadfadfgadadsfa"
  "sharelinks": [
  "project": {
    "name": "API"
  "trash_folder": {
    "name": "API_Trash"
  "inventory_folder": {
    "name": "API_Inventory"

On the Benchling side of things, in the account liked to the credentials["api_key"], you must have a project corresponding to the project["name"] value above. Within this project, you should have two folder corresponding to the trash_folder and inventory_folder values above. Additionally, you should have at least one example of an AminoAcid, DNASequence, CustomEntity, and Oligo stored within your inventory_folder. Tests will copy the examples from the inventory_folder for downstream tests. After the tests, conclude, inventory in the trash_folder will get archived.

Happy Cloning!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benchlingapi-2.1.12.tar.gz (21.5 kB view hashes)

Uploaded source

Built Distribution

benchlingapi-2.1.12-py3-none-any.whl (23.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page