List media generations
curl --request GET \
--url https://inference.magica.com/v1/media-library/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/media-library/list"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://inference.magica.com/v1/media-library/list', 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://inference.magica.com/v1/media-library/list",
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://inference.magica.com/v1/media-library/list"
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://inference.magica.com/v1/media-library/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/media-library/list")
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{
"items": [
{}
],
"nextCursor": "<string>"
}Generated Media
List media generations
List generated and saved media-library items for the authenticated API key owner.
GET
/
v1
/
media-library
/
list
List media generations
curl --request GET \
--url https://inference.magica.com/v1/media-library/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/media-library/list"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://inference.magica.com/v1/media-library/list', 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://inference.magica.com/v1/media-library/list",
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://inference.magica.com/v1/media-library/list"
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://inference.magica.com/v1/media-library/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/media-library/list")
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{
"items": [
{}
],
"nextCursor": "<string>"
}Returns generated media items owned by the authenticated account. Use it to show a user their saved image, video, audio, and file outputs.
Use
search to match media filenames and prompts. Search cursors are opaque:
pass the returned nextCursor value back unchanged instead of parsing it.
Authorization
Query parameters
| Parameter | Type | Description |
|---|---|---|
type | image, video, audio, or file | Filter by media type. May be repeated. |
fileSubtype | pdf, word, spreadsheet, presentation, or code | Filter file-like media by subtype. May be repeated. |
sourceFilter | generated or uploaded | Filter by generation source. |
isFavorite | boolean | Use true to return only favorites. false is accepted but behaves like omitting the filter. |
folderId | string or null | Folder filter. Empty string means no filter; literal null means uncategorized. |
cursor | string | Cursor for pagination. |
limit | number | Page size, 1-100. Defaults to 30. |
search | string | Search text. |
sortOrder | newest or oldest | Sort by creation time. Defaults to newest. |
createdFrom | date | Lower created-at bound. |
createdTo | date | Upper created-at bound. |
Request
curl "https://inference.magica.com/v1/media-library/list?type=image&limit=20" \
-H "Authorization: Bearer $MAGICA_API_KEY"
Response
Media items include:| Field | Description |
|---|---|
id | Media item ID |
type | image, video, audio, or file |
url | Asset URL |
thumbnailUrl | Thumbnail URL when available |
prompt | Prompt that produced the media, when available |
modelId / modelName | Model metadata when available |
source | Source such as chat, playground, API, generations, or upload |
chatId / messageId | Chat provenance when the media came from chat |
folderIds | Folder IDs containing the item |
width, height, duration, aspectRatio, fps, fileSize, format, sampleRate, channels | Media metadata when available |
creditUsed | Credits used for the generation |
isFavorite | Favorite flag |
tags, filename, mimeType, attachmentId | File and classification metadata when available |
createdAt | ISO timestamp |
Errors
| Status | Reason |
|---|---|
400 | Invalid filter or pagination value |
401 | Missing or invalid API key |
429 | Rate limit exceeded |
500 | Server error |
Authorizations
Query Parameters
Was this page helpful?