Get the workspace
The lab this key acts in, with its name — so an integration can show which lab it is writing to, and stop if it has been pointed at the wrong one.
https://app.xplantpro.com/ api/ v1/ workspacesread:workspaceA key belongs to one workspace, so the list has exactly one entry even when the person who created the key belongs to several labs. It is a list so that your code does not change shape if that ever changes. Takes no paging parameters.
Example
curl https://app.xplantpro.com/api/v1/workspaces \
-H "Authorization: Bearer $XPLANT_API_KEY"Response
200 with { "ok": true, "data": … }. data is an array. Lists have no total: a page shorter than your limit is the last one. See Pagination.
| Field | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | Yes | — |
name | string | Yes | The lab's name as it appears in xPlant. |
type | string | Yes | lab for a lab, team for a group inside one. |
{
"ok": true,
"data": [
{
"id": "8c2d4f6a-1b3e-4a5c-9d7e-0f1a2b3c4d5e",
"name": "Riverside Propagation Lab",
"type": "lab"
}
]
}| Response header | Meaning |
|---|---|
X-Request-Id | Identifies this request. Include it when you contact support. |
Errors
| Status | Code | When |
|---|---|---|
401 | UNAUTHORIZED | The key is missing, malformed or revoked, or its owner is no longer a member of the workspace. |
402 | PAID_PLAN_REQUIRED | The workspace's plan does not include the API. The full API is included with xPlant+ Teams and Enterprise; on Hobby and Pro Lab, keys can connect devices only. |
403 | FORBIDDEN | The key lacks a scope this operation requires, or its owner's current role in the workspace cannot use it — a key never does more than its owner can in xPlant. error names the scope, and for a role, the role it needs. |
403 | DEVICE_TOKEN_NOT_ACCEPTED | A device token was sent; this operation needs a workspace API key. |
429 | RATE_LIMIT_EXCEEDED | Too many requests for this key, device token or workspace. Wait Retry-After seconds. |
500 | WORKSPACE_QUERY_FAILED | The workspace could not be read. Retry later. |
Branch on code, never on the error text. See Errors.
Get the calling key
Who the calling key is: its name, the workspace it acts in, the scopes it holds, and which of them it can use right now. Make this the first call an integration makes: it confirms the key works and tells you in one answer what it may do, instead of one 403 at a time.
List plants
The workspace's plants, newest first, a page at a time. Pass externalId to find the one plant filed under your own identifier instead; the answer is still a list, with that plant or nothing, and meta.next_cursor is always null.