Benchling SDK Documentation

Note

Current Version: 1.23.0 (Latest)

You are viewing the documentation for the latest version of the Benchling SDK.

The official Python SDK for Benchling, providing programmatic access to the Benchling platform for life science R&D.

Getting Started

Installation

pip install benchling-sdk

Authentication

Choose one of these authentication methods:

API Key Authentication:

from benchling_sdk import Benchling
from benchling_sdk.auth.api_key_auth import ApiKeyAuth

benchling = Benchling(
    url="https://your-tenant.benchling.com",
    auth=ApiKeyAuth("your_api_key_here")
)

OAuth2 Authentication:

from benchling_sdk import Benchling
from benchling_sdk.auth.client_credentials_oauth2 import ClientCredentialsOAuth2

benchling = Benchling(
    url="https://your-tenant.benchling.com",
    auth=ClientCredentialsOAuth2(
        client_id="your_client_id",
        client_secret="your_client_secret"
    )
)

Examples

See here for more common SDK interactions and here for additional code recipes.

Create a DNA Sequence

from benchling_sdk.models import DnaSequenceCreate

# Create a new DNA sequence
sequence = DnaSequenceCreate(
    name="My DNA Sequence",
    bases="ATGCGATCGATCGATC",
    folder_id="lib_abc123"  # Your folder ID
)

created_sequence = benchling.dna_sequences.create(sequence)
print(f"Created sequence: {created_sequence.name} (ID: {created_sequence.id})")

Get a Sequence by ID

# Retrieve an existing sequence
sequence = benchling.dna_sequences.get_by_id("seq_abc123")
print(f"Sequence: {sequence.name}")
print(f"Bases: {sequence.bases}")

Previous Versions

Tip

Need an Older Version?

Previous SDK releases are available in the sidebar version selector.