> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.labric.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.labric.co/_mcp/server.

# Introduction

[Labric](https://labric.co) 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:

```bash
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](https://platform.labric.co)
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](https://platform.labric.co/jobs), 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:

```python
from labric import Labric

client = Labric()
```

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

## Core resources

| Resource        | Description                                             |
| --------------- | ------------------------------------------------------- |
| **Files**       | Upload, list, and download files from your organization |
| **Datasets**    | Query structured experimental data                      |
| **Jobs**        | Create and execute automated Python scripts             |
| **Instruments** | Manage paired lab instruments and devices               |
| **Experiments** | Organize and retrieve experiment metadata               |
| **Dashboards**  | Build and manage data visualizations                    |

See the [API Reference](/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 variable      | Description                              |
| ------------------------- | ---------------------------------------- |
| `LABRIC_API_KEY`          | Ephemeral API key scoped to read + write |
| `LABRIC_API_BASE_URL`     | API base URL                             |
| `LABRIC_JOB_EXECUTION_ID` | Current execution ID                     |
| `LABRIC_ORGANIZATION_ID`  | Your organization ID                     |
| `LABRIC_FILE_DIR`         | Directory containing input files         |
| `LABRIC_FILE_COUNT`       | Number of input files                    |
| `LABRIC_FILE_ID_<N>`      | File ID for each input file              |
| `LABRIC_FILE_PATH_<N>`    | File path for each input file            |