xPlantAPI
API referenceAccount

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.

GET/api/v1/workspaces
Scope read:workspace

A 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.

FieldTypeRequiredDescription
idstring (uuid)Yes—
namestringYesThe lab's name as it appears in xPlant.
typestringYeslab for a lab, team for a group inside one.
Response
{
  "ok": true,
  "data": [
    {
      "id": "8c2d4f6a-1b3e-4a5c-9d7e-0f1a2b3c4d5e",
      "name": "Riverside Propagation Lab",
      "type": "lab"
    }
  ]
}
Response headerMeaning
X-Request-IdIdentifies this request. Include it when you contact support.

Errors

StatusCodeWhen
401UNAUTHORIZEDThe key is missing, malformed or revoked, or its owner is no longer a member of the workspace.
402PAID_PLAN_REQUIREDThe 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.
403FORBIDDENThe 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.
403DEVICE_TOKEN_NOT_ACCEPTEDA device token was sent; this operation needs a workspace API key.
429RATE_LIMIT_EXCEEDEDToo many requests for this key, device token or workspace. Wait Retry-After seconds.
500WORKSPACE_QUERY_FAILEDThe workspace could not be read. Retry later.

Branch on code, never on the error text. See Errors.

On this page