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

NameTypeDescription
uidstringuid of the file.

Response fields

uid string
File identifier.
name string
File name in the control panel.
type string
File type, such as image or video.
duration integer
Duration, in seconds.
archived boolean
true if the file is archived.
organization object
Organisation of the file: uid and name.
size integer
Size of the original file, in bytes.
width integer
Width of the original file, in pixels.
height integer
Height of the original file, in pixels.
aspect_ratio string
Ratio between width and height, such as 1.78.
url string
URL of the original file, or an empty string if it is not available.
scheduled boolean
true if the file has an active schedule.
playlists array
Playlists the file is in (uid, name and organization). Only playlists the user can see are listed.

Possible errors

  • 404 not_found The 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."
  }
}