Reference · Files
Get a file
GET
/v1/files/{uid}
Returns a file by its uid, with its size, resolution, the URL of the original file and the playlists it is in.
Path parameter
| Name | Type | Description |
|---|---|---|
uid | string | uid of the file. |
Response fields
uidstring- File identifier.
namestring- File name in the control panel.
typestring- File type, such as
imageorvideo. durationinteger- Duration, in seconds.
archivedbooleantrueif the file is archived.organizationobject- Organisation of the file:
uidandname. sizeinteger- Size of the original file, in bytes.
widthinteger- Width of the original file, in pixels.
heightinteger- Height of the original file, in pixels.
aspect_ratiostring- Ratio between width and height, such as
1.78. urlstring- URL of the original file, or an empty string if it is not available.
scheduledbooleantrueif the file has an active schedule.playlistsarray- Playlists the file is in (
uid,nameandorganization). Only playlists the user can see are listed.
Possible errors
- 404
not_foundThe endpoint does not exist, or the item does not exist or belongs to an organisation the user cannot see. - Key and rate limit errors apply to every endpoint. See all errors
Request
curl "https://api.on-cloud.live/v1/files/a87ff679a2f3e71d9181a67b7542122c" \
-H "X-API-Key: $API_KEY"<?php
$ch = curl_init('https://api.on-cloud.live/v1/files/a87ff679a2f3e71d9181a67b7542122c');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('API_KEY')],
]);
$response = json_decode(curl_exec($ch), true);const res = await fetch('https://api.on-cloud.live/v1/files/a87ff679a2f3e71d9181a67b7542122c', {
headers: { 'X-API-Key': process.env.API_KEY }
});
const { data } = await res.json();Response200
{
"data": {
"uid": "a87ff679a2f3e71d9181a67b7542122c",
"name": "Promoção de verão",
"type": "video",
"duration": 30,
"archived": false,
"organization": {
"uid": "8f14e45fceea167a5a36dedd4bea2543",
"name": "Loja Centro"
},
"size": 18734520,
"width": 1920,
"height": 1080,
"aspect_ratio": "1.78",
"url": "https://oncloud.bunny.files.on-cloud.live/files/a87ff679a2f3e71d9181a67b7542122c-1.mp4",
"scheduled": true,
"playlists": [
{
"uid": "e4da3b7fbbce2345d7772b0674a318d5",
"name": "Lista principal",
"organization": {
"uid": "8f14e45fceea167a5a36dedd4bea2543",
"name": "Loja Centro"
}
}
]
}
}Item that does not exist or without access404
{
"error": {
"code": "not_found",
"message": "Item not found or you do not have access to it."
}
}