Introduction

Get started with the Labric API for programmatic access to your data.
View as Markdown

Labric is a platform for managing scientific data, lab instruments, and automated analysis workflows. The Labric API gives you programmatic access to your data — query datasets, manage files, trigger jobs, and more.

Base URL

All API requests are made to:

https://platform.labric.co/api

Authentication

Authenticate by including your API key as a Bearer token in the Authorization header:

$curl https://platform.labric.co/api/files \
> -H "Authorization: Bearer lbk_your_api_key"

API keys use the format lbk_<prefix>_<secret>. Each key can be scoped to read, write, or admin permissions.

Treat your API key like a password. It is only shown once when created — store it somewhere secure.

Getting an API key

  1. Log in to Labric
  2. Go to Settings > API Keys
  3. Click New, give your key a name, and select the scopes you need
  4. Copy the key immediately — it won’t be shown again

Using the Python SDK

If you’re working in a Labric Job, you don’t need to manage keys at all. The environment is pre-configured with a LABRIC_API_KEY and the SDK is available out of the box:

1from labric import Labric
2
3client = Labric()

Jobs run in isolated sandboxes with ephemeral API keys that are automatically provisioned and cleaned up.

Core resources

ResourceDescription
FilesUpload, list, and download files from your organization
DatasetsQuery structured experimental data
JobsCreate and execute automated Python scripts
InstrumentsManage paired lab instruments and devices
ExperimentsOrganize and retrieve experiment metadata
DashboardsBuild and manage data visualizations

See the API Reference for full endpoint documentation.

Jobs

Jobs let you write Python scripts that run automatically when files are uploaded, or on demand via the API. When a job executes, Labric provisions a sandboxed environment with:

Environment variableDescription
LABRIC_API_KEYEphemeral API key scoped to read + write
LABRIC_API_BASE_URLAPI base URL
LABRIC_JOB_EXECUTION_IDCurrent execution ID
LABRIC_ORGANIZATION_IDYour organization ID
LABRIC_FILE_DIRDirectory containing input files
LABRIC_FILE_COUNTNumber of input files
LABRIC_FILE_ID_<N>File ID for each input file
LABRIC_FILE_PATH_<N>File path for each input file