Skip to main content
GET
/
media
/
{id}
Retrieve Media Asset
curl --request GET \
  --url https://{defaultHost}/media/{id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://{defaultHost}/media/{id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://{defaultHost}/media/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/media/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://{defaultHost}/media/{id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://{defaultHost}/media/{id}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{defaultHost}/media/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "media_type": "video",
  "source": "generated",
  "status": "processing",
  "amount_charged": 123,
  "currency": "<string>",
  "error_message": "<string>",
  "created_at": "<string>",
  "completed_at": "<string>",
  "generation": {
    "prompt": "<string>",
    "reference_media": [
      "<string>"
    ],
    "duration_seconds": 123,
    "resolution": "480p"
  },
  "file": {
    "id": "<string>",
    "url": "<string>"
  }
}
{
"error": {
"type": "<string>",
"message": "<string>"
}
}

Authorizations

Authorization
string
header
required

An account API key, account scoped JWT, app API key, or user OAuth token.

Path Parameters

id
string
required

Media asset ID, prefixed media_.

Response

Media asset retrieved.

id
string
required

Media asset ID, prefixed media_.

media_type
enum<string>
required

The kind of media this asset holds.

Available options:
video,
image
Example:

"video"

source
enum<string>
required

How the asset was created. Always generated.

Available options:
generated
Example:

"generated"

status
enum<string>
required

Lifecycle state: processing while generation runs, ready when the file is available, failed when generation failed and the charge was refunded.

Available options:
processing,
ready,
failed
Example:

"processing"

amount_charged
number | null
required

USD amount charged to the account's balance for this generation. null if the generation wasn't billed.

currency
string
required

Currency of amount_charged. Always usd.

error_message
string | null
required

Why generation failed. null unless status is failed.

created_at
string
required

ISO 8601 timestamp when the generation was requested.

completed_at
string | null
required

ISO 8601 timestamp when the asset reached a terminal state. null while processing.

generation
object
required

The inputs the asset was generated from.

file
object | null
required

The produced file, usable anywhere attachments are accepted. null until the asset is ready.