API reference
Base URL https://api.roots.sh. Send Authorization: Bearer rk_… on every request. Bodies are JSON. The machine-readable spec is at api.roots.sh/openapi.json.
Lists return { "data": [...] } and take limit (up to 500) and before (an ISO time) to page back.
Farms
/v1/farmsList farms
/v1/farmsCreate a farm
| Field | Type |
|---|---|
name * |
string |
timezone |
string |
lat |
number |
lon |
number |
acres |
number |
/v1/farms/{farm}Get a farm
/v1/farms/{farm}Update a farm (settings.rules overrides alert thresholds)
| Field | Type |
|---|---|
id |
string |
name |
string |
mode |
live · test |
timezone |
string |
lat |
number |
lon |
number |
acres |
number |
sample |
boolean |
settings |
object |
created_at |
ISO time |
/v1/farms/{farm}Delete a farm
/v1/farms/{farm}/briefMorning brief: what needs you, ranked
Alerts
/v1/farms/{farm}/alertsList alerts
Query: status
/v1/alerts/{id}Get an alert
/v1/alerts/{id}/acknowledgeAcknowledge an alert
/v1/alerts/{id}/resolveResolve an alert
Roost
/v1/farms/{farm}/roostsEvery Roost with its latest readings and recent commands
/v1/roosts/{id}One Roost
Animals
/v1/farms/{farm}/animalsList animals
Query: species, group_id, paddock_id, status, tag, eid, q, limit, before
/v1/farms/{farm}/animalsCreate an animal
| Field | Type |
|---|---|
species * |
string |
name |
string |
tag |
string |
eid |
string |
sex |
string |
breed |
string |
birth_date |
ISO time |
group_id |
string |
paddock_id |
string |
status |
string |
notes |
string |
fields |
object |
/v1/animals/{id}Get an animal
/v1/animals/{id}Update an animal
| Field | Type |
|---|---|
species |
string |
name |
string |
tag |
string |
eid |
string |
sex |
string |
breed |
string |
birth_date |
ISO time |
group_id |
string |
paddock_id |
string |
status |
string |
notes |
string |
fields |
object |
/v1/animals/{id}Delete an animal
Groups
/v1/farms/{farm}/groupsList groups
Query: species, kind, paddock_id, limit, before
/v1/farms/{farm}/groupsCreate a group
| Field | Type |
|---|---|
name * |
string |
species * |
string |
kind |
string |
head_count |
number |
hatch_date |
ISO time |
paddock_id |
string |
/v1/groups/{id}Get a group
/v1/groups/{id}Update a group
| Field | Type |
|---|---|
name |
string |
species |
string |
kind |
string |
head_count |
number |
hatch_date |
ISO time |
paddock_id |
string |
/v1/groups/{id}Delete a group
Paddocks
/v1/farms/{farm}/paddocksList paddocks
Query: limit, before
/v1/farms/{farm}/paddocksCreate a paddock
| Field | Type |
|---|---|
name * |
string |
acres |
number |
geometry |
object |
rest_days_target |
number |
last_grazed_at |
ISO time |
/v1/paddocks/{id}Get a paddock
/v1/paddocks/{id}Update a paddock
| Field | Type |
|---|---|
name |
string |
acres |
number |
geometry |
object |
rest_days_target |
number |
last_grazed_at |
ISO time |
/v1/paddocks/{id}Delete a paddock
Devices
/v1/farms/{farm}/devicesList devices
Query: type, animal_id, group_id, limit, before
/v1/farms/{farm}/devicesCreate a device (returns device_key once)
| Field | Type |
|---|---|
type * |
string |
name * |
string |
serial |
string |
animal_id |
string |
group_id |
string |
firmware |
string |
lat |
number |
lon |
number |
/v1/devices/{id}Get a device
/v1/devices/{id}Update a device
| Field | Type |
|---|---|
type |
string |
name |
string |
serial |
string |
animal_id |
string |
group_id |
string |
firmware |
string |
lat |
number |
lon |
number |
/v1/devices/{id}Delete a device
/v1/devices/{id}/readingsReadings (time series)
Query: metric, since, limit
/v1/devices/{id}/commandsCommand history
/v1/devices/{id}/commandsSend a command (see /v1/catalog)
| Field | Type |
|---|---|
command * |
string |
params |
object |
/v1/devices/{id}/keyRotate the device key
Tasks
/v1/farms/{farm}/tasksList tasks
Query: status, assignee, subject_id, limit, before
/v1/farms/{farm}/tasksCreate a task
| Field | Type |
|---|---|
title * |
string |
notes |
string |
due_at |
ISO time |
assignee |
string |
status |
string |
subject_id |
string |
alert_id |
string |
/v1/tasks/{id}Get a task
/v1/tasks/{id}Update a task
| Field | Type |
|---|---|
title |
string |
notes |
string |
due_at |
ISO time |
assignee |
string |
status |
string |
subject_id |
string |
alert_id |
string |
/v1/tasks/{id}Delete a task
/v1/tasks/{id}/doneMark a task done
Events
/v1/farms/{farm}/eventsList events
Query: type, subject_id, subject_type, limit, before
/v1/farms/{farm}/eventsCreate a event
| Field | Type |
|---|---|
type * |
string |
subject_type |
string |
subject_id |
string |
data |
object |
at |
ISO time |
/v1/events/{id}Get a event
/v1/events/{id}Update a event
| Field | Type |
|---|---|
type |
string |
subject_type |
string |
subject_id |
string |
data |
object |
at |
ISO time |
/v1/events/{id}Delete a event
Webhooks
/v1/farms/{farm}/webhooksList webhooks
Query: limit, before
/v1/farms/{farm}/webhooksCreate a webhook (returns the signing secret once)
| Field | Type |
|---|---|
url * |
string |
events |
string[] |
/v1/webhooks/{id}Get a webhook
/v1/webhooks/{id}Update a webhook
| Field | Type |
|---|---|
url |
string |
events |
string[] |
/v1/webhooks/{id}Delete a webhook
Ingest
/v1/ingestDevice report (device key). Returns queued commands. Takes a device key (rd_…).
| Field | Type |
|---|---|
readings |
object[] |
state |
object |
events |
object[] |
battery |
number |
lat |
number |
lon |
number |
firmware |
string |
/v1/device/commandsPoll for queued commands (device key) Takes a device key (rd_…).
/v1/device/commands/{id}Report a command result (device key) Takes a device key (rd_…).
| Field | Type |
|---|---|
status * |
done · failed |
result |
object |
Account
/v1/meWho am I
/v1/keysList API keys
/v1/keysCreate an API key
| Field | Type |
|---|---|
name |
string |
mode |
live · test |
/v1/keys/{id}Revoke an API key
/v1/usageCalls by day and surface
Catalog
/v1/catalogMetrics, commands, rules and webhook events No key needed.
Objects
Error
error
Farm
id · name · mode · timezone · lat · lon · acres · sample · settings · created_at
Alert
id · farm_id · severity · title · reason · rule · subject_type · subject_id · status · created_at · resolved_at
Command
id · device_id · command · params · status · result · created_at · done_at
Reading
metric · value · unit · at
Brief
headline · text · alerts · tasks · roosts
Key
id · name · mode · prefix · key · created_at · last_used_at
Animal
id · farm_id · species · name · tag · eid · sex · breed · birth_date · group_id · paddock_id · status · notes · fields · created_at
Group
id · farm_id · name · species · kind · head_count · hatch_date · paddock_id · created_at
Paddock
id · farm_id · name · acres · geometry · rest_days_target · last_grazed_at · created_at
Device
id · farm_id · type · name · serial · animal_id · group_id · firmware · lat · lon · battery · state · last_seen_at · created_at
Task
id · farm_id · title · notes · due_at · assignee · status · subject_id · alert_id · created_at
Event
id · farm_id · type · subject_type · subject_id · data · at · created_at
Webhook
id · farm_id · url · events · created_at