xPlantAPI
API referenceMedia

Get a media file

One photo or file, with a view_url that works for 15 minutes from this response. Fetch it again whenever you need the file; never store the link.

GET/api/v1/assets/{id}
Scope read:assets

Path parameters

NameTypeRequiredDescription
idstring (uuid)YesThe record's id.

Example

curl https://app.xplantpro.com/api/v1/assets/9e1a3c5b-7d9f-4b1d-a3c5-e7f9b1d3f5a7 \
  -H "Authorization: Bearer $XPLANT_API_KEY"

Response

200 with { "ok": true, "data": … }. data holds the result.

FieldTypeRequiredDescription
idstring (uuid)Yes—
target"plant" | "explant" | "contamination" | "sop"YesThe kind of record the file is attached to.
target_idstring (uuid)YesThe id of that record.
kindstringYesWhat the file is: photo, video, annotation, document, diagram, scan, audio, other. Images attached through the API are photo.
file_namestring | nullYesThe file's name as xPlant shows it.
content_typestring | nullYesThe file's media type, for example image/jpeg, image/png.
captionstring | nullYesThe note stored with the file.
captured_atstring | nullYesWhen the photo was taken, where that was recorded. ISO 8601.
uploaded_bystring | nullYesUser id of the workspace member who added the file.
created_atstring | nullYesWhen the file was added. ISO 8601.
view_urlstring | nullYesA link to the file itself, valid for 15 minutes from this response. Fetch the asset again for a fresh link, and never store one. null when the file cannot be linked.
view_url_expires_atstring | nullYesWhen view_url stops working. ISO 8601.
Response
{
  "ok": true,
  "data": {
    "id": "8c2f1a6e-4b3d-4f7a-9e21-5d6c7b8a9f10",
    "target": "explant",
    "target_id": "3f9a2c1e-7b4d-4e8f-a6c5-1d2e3f4a5b6c",
    "kind": "photo",
    "file_name": "vessel-12-week-3.png",
    "content_type": "image/png",
    "caption": "Callus forming at the cut edge",
    "captured_at": null,
    "uploaded_by": "0d7e4b9a-6f21-4c3e-8a5b-2e9f1c7d4a60",
    "created_at": "2026-09-25T14:20:11.000Z",
    "view_url": "https://files.example.com/vessel-12-week-3.png?signature=4f9c2e",
    "view_url_expires_at": "2026-09-25T14:35:11.000Z"
  }
}
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.
404NOT_FOUNDNo file with this id is attached to a record in the key's workspace.
429RATE_LIMIT_EXCEEDEDToo many requests for this key, device token or workspace. Wait Retry-After seconds.
500ASSET_QUERY_FAILEDThe file could not be read. Retry later.

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

On this page