Get media library stats
curl --request GET \
--url https://inference.magica.com/v1/media-library/stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/media-library/stats"
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/stats', 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/stats",
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/stats"
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/stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/media-library/stats")
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{
"total": 123,
"images": 123,
"videos": 123,
"audio": 123,
"files": 123,
"favorites": 123
}Generated Media
Get media library stats
Return media-library counts and storage statistics.
GET
/
v1
/
media-library
/
stats
Get media library stats
curl --request GET \
--url https://inference.magica.com/v1/media-library/stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/media-library/stats"
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/stats', 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/stats",
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/stats"
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/stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/media-library/stats")
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{
"total": 123,
"images": 123,
"videos": 123,
"audio": 123,
"files": 123,
"favorites": 123
}Returns aggregate counts and storage statistics for generated media owned by the authenticated account. It accepts the same core filters as media listing, without pagination.
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. |
folderId | string or null | Folder filter. Empty string means no filter; literal null means uncategorized. |
isFavorite | boolean | true or false. |
Request
curl "https://inference.magica.com/v1/media-library/stats?type=image" \
-H "Authorization: Bearer $MAGICA_API_KEY"
Response
{
"total": 42,
"images": 30,
"videos": 4,
"audio": 3,
"files": 5,
"favorites": 9
}
Errors
| Status | Reason |
|---|---|
400 | Invalid filter value |
401 | Missing or invalid API key |
429 | Rate limit exceeded |
500 | Server error |
Authorizations
Query Parameters
Was this page helpful?