Skip to navigation

Benchling SDK Documentation

Installation, authentication, and package structure for version 1.24.1 of the Benchling Python SDK.

Current Version: 1.24.1 (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.benchling import Benchling
from benchling_sdk.auth.api_key_auth import ApiKeyAuth
benchling = Benchling(
url="https://your-tenant.benchling.com",
auth_method=ApiKeyAuth("your_api_key_here")
)

OAuth2 Authentication:

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

Examples

For more, see Common SDK Interactions and Examples and the 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

Need an Older Version?

Previous SDK releases are listed in the sidebar.

Package contents: