Developer tools
Developer SDK & API
xPlant exposes a versioned external API so you can connect your own devices, scripts, and automations. The official SDK wraps the API with typed helpers for TypeScript and JavaScript.
Packages and repositories
What you can do with the API
Connect sensor devices
Register environment sensors and submit temperature, humidity, pH, and CO₂ readings. Live data appears on plant detail pages for any room your sensor is linked to.
Read and write lab records
Query plants, explants, contamination logs, tasks, and media recipes. Submit new records, update stages, or trigger SOP run events from external scripts and automations.
Automate workflows
Build pipelines that respond to lab events — auto-create tasks when contamination is flagged, push transfer records from a bench tablet, or sync counts from a spreadsheet on a schedule.
Integrate with your stack
The SDK wraps the xPlant external API with typed responses and built-in retry logic. Use it from Node.js, Deno, edge workers, or any TypeScript/JavaScript environment.
Quickstart
1Install the SDK
npm install @shmaplex/xplant-sdk
2Generate an API key
xPlant → Settings → Integrations → API Keys → New key
3Initialise the client
import { XPlantClient } from "@shmaplex/xplant-sdk";
const client = new XPlantClient({ apiKey: process.env.XPLANT_API_KEY });4Make your first call
const plants = await client.plants.list(); console.log(plants.data);
Authentication and scopes
All API requests require a bearer token issued from Settings → Integrations → API Keys. Each key carries a set of scopes that control what it can read or write. Create separate keys for separate integrations — for example, a read-only key for a dashboard and a write key for a sensor device.
| Scope | What it allows |
|---|---|
| read:plants / write:plants | List and update plant records |
| read:explants / write:explants | List and update explant records |
| read:devices / write:devices | Register devices and send heartbeats |
| read:sensor_readings / write:sensor_readings | Submit and query environment sensor data |
| write:device_events | Send device status and event logs |
| read:contaminations / write:contaminations | Log and query contamination observations |
| read:tasks / write:tasks | Query and create scheduled tasks |