Skip to main content

REST API

Swarm AI provides a REST API for programmatic device control, useful for building custom integrations, dashboards, and automated workflows.

Base URL

https://swarm.cheshirelabs.io

Authentication

All requests require an API key in the X-API-Key header:

curl -H "X-API-Key: your-api-key" \
https://swarm.cheshirelabs.io/api/devices

Interactive Documentation

The complete API reference with request/response schemas is available at:

swarm.cheshirelabs.io/docs

The interactive docs let you:

  • Browse all endpoints
  • See request/response schemas
  • Try API calls in your browser

Quick Reference

Device Endpoints

MethodEndpointDescription
GET/api/devicesList connected devices
GET/api/devices/{device_id}Get device info
GET/api/devices/{device_id}/capabilitiesGet device capabilities
GET/api/devices/{device_id}/initializedCheck if initialized
POST/api/devices/{device_id}/initializeInitialize device
POST/api/devices/{device_id}/shakeShake device
POST/api/devices/{device_id}/centrifugeRun centrifuge
POST/api/devices/{device_id}/sealSeal plate
POST/api/devices/{device_id}/stopEmergency stop
POST/api/devices/{device_id}/openOpen door/lid
POST/api/devices/{device_id}/closeClose door/lid
POST/api/devices/{device_id}/lock_plateLock plate
POST/api/devices/{device_id}/unlock_plateUnlock plate
POST/api/devices/{device_id}/set_temperatureSet temperature
GET/api/devices/{device_id}/get_temperatureGet temperature

Teachpoint Endpoints

MethodEndpointDescription
GET/api/teachpoints?device_id=...List teachpoints for device
GET/api/teachpoints/{device_id}/{name}Get specific teachpoint
POST/api/teachpointsCreate teachpoint
PUT/api/teachpoints/{device_id}/{name}Update teachpoint
DELETE/api/teachpoints/{device_id}/{name}Delete teachpoint
POST/api/teachpoints/bulkBulk import teachpoints
GET/api/teachpoints/export/{device_id}Export all teachpoints

Example Requests

List Devices

curl -H "X-API-Key: your-api-key" \
https://swarm.cheshirelabs.io/api/devices

Response:

{
"devices": [
{
"device_id": "lab1-shaker-01",
"type": "shaker",
"name": "Plate Shaker",
"is_initialized": true
}
]
}

Shake Device

curl -X POST \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"speed": 500, "duration": 30}' \
https://swarm.cheshirelabs.io/api/devices/lab1-shaker-01/shake

Response:

{
"success": true,
"message": "Shake completed"
}

Create Teachpoint

curl -X POST \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"device_id": "robot-arm",
"name": "source_rack",
"coord_type": "cartesian",
"coords": {
"x": 100.5,
"y": 200.0,
"z": 50.0,
"yaw": 0,
"pitch": 90,
"roll": 0
}
}' \
https://swarm.cheshirelabs.io/api/teachpoints

Error Responses

Errors return appropriate HTTP status codes:

StatusMeaning
400Bad request (invalid parameters)
401Unauthorized (invalid or missing API key)
404Not found (device or teachpoint doesn't exist)
500Server error

Error response body:

{
"detail": "Device lab1-shaker-01 not found"
}

Rate Limits

During the beta, there are no strict rate limits. For production use, please contact us to discuss your needs.

What's Next?