Authentication#
Send the secret in the header Authorization: Bearer <secret>: the local token in local mode, an API key in network mode. An API key needs the read scope; the local token has every scope. See the API overview for both modes.
Query parameters#
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | no | The next_cursor of the previous page. |
limit | integer | no | The page size; the default depends on the operation. |
kind | string | no | image, video, audio or lut; omit it for every kind. |
section | string | no | visual (image, lut), video (video) or audio (audio): the three sections of the library. |
tag | string | no | Keep the files that carry this tag. |
project | string | no | Keep the files a project, or one of its timelines, uses. |
origin | string | no | imported, generated, fetched_by_agent or rendered_externally. |
reusable | string | no | true keeps the files marked reusable, false the others. |
text | string | no | A full-text query over name, tags, description and origin; at most 8 words. |
sound_kind | string | no | music, voice or effect: keep the audio files of that sound kind. |
Responses#
200 OK#
Content type application/json. Schema: AssetListResult.
| Name | Type | Required | Description |
|---|---|---|---|
assets | array of LibraryAsset | no | |
file_count | integer | no | |
next_cursor | string or null | no | |
tags_in_use | array of TagCount | no | |
text | string | no | |
total | integer | no | |
total_bytes | integer (int64) | no | |
total_size_text | string | no | |
unsized | integer | no | |
untrusted_notice | string | no |
400#
Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params
Content type application/problem+json. Schema: Problem.
401 Unauthorized#
Error (RFC 9457 problem details)
Content type application/problem+json. Schema: Problem.
403#
Error (RFC 9457 problem details)
Content type application/problem+json. Schema: Problem.
429#
Error (RFC 9457 problem details)
Content type application/problem+json. Schema: Problem.
Any other status#
Error (RFC 9457 problem details)
Content type application/problem+json. Schema: Problem.
curl -X GET "http://127.0.0.1:7878/api/v1/assets" \
-H "Authorization: Bearer $STUARTY_KEY"import os
import requests
response = requests.get(
"http://127.0.0.1:7878/api/v1/assets",
headers={"Authorization": f"Bearer {os.environ['STUARTY_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())const response = await fetch("http://127.0.0.1:7878/api/v1/assets", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.STUARTY_KEY}`,
},
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
console.log(await response.json());package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "http://127.0.0.1:7878/api/v1/assets", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("STUARTY_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(out))
}<?php
$ch = curl_init("http://127.0.0.1:7878/api/v1/assets");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("STUARTY_KEY"),
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:7878/api/v1/assets"))
.header("Authorization", "Bearer " + System.getenv("STUARTY_KEY"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "http://127.0.0.1:7878/api/v1/assets");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("STUARTY_KEY"));
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");require "net/http"
require "uri"
uri = URI("http://127.0.0.1:7878/api/v1/assets")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('STUARTY_KEY')}"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts "#{response.code} #{response.body}"Response examples
{
"assets": [
{
"bytes": 0,
"created_at": "string",
"created_by": "string",
"description": "string",
"duration_ms": 0,
"hash": "string",
"height": 0,
"kind": "string",
"name": "string",
"origin": {},
"poster": {},
"projects": 0,
"reusable": false,
"size_text": "string",
"sound_kind": "string",
"state": "string",
"tags": [],
"uses": [],
"width": 0
}
],
"file_count": 0,
"next_cursor": "string",
"tags_in_use": [
{
"count": 0,
"tag": "string"
}
],
"text": "string",
"total": 0,
"total_bytes": 0,
"total_size_text": "string",
"unsized": 0,
"untrusted_notice": "string"
}{
"code": "string",
"detail": "string",
"details": {},
"errors": {},
"hint": "string",
"instance": "string",
"issues": [
{
"code": "string",
"key": "string",
"message": "string",
"on": "string",
"params": {},
"path": "string"
}
],
"message": "string",
"op_index": 0,
"path": "string",
"request_id": "string",
"retryable": false,
"status": 0,
"title": "string",
"type": "string"
}{
"code": "E_UNAUTHORIZED",
"detail": "string",
"details": {},
"errors": {},
"hint": "send the local token as Authorization: Bearer <token>, or run `stuarty open` to open the editor in a browser",
"instance": "string",
"issues": [
{
"code": "string",
"key": "string",
"message": "string",
"on": "string",
"params": {},
"path": "string"
}
],
"message": "the request carries no credentials.",
"op_index": 0,
"path": "string",
"request_id": "string",
"retryable": false,
"status": 401,
"title": "string",
"type": "string"
}{
"code": "string",
"detail": "string",
"details": {},
"errors": {},
"hint": "string",
"instance": "string",
"issues": [
{
"code": "string",
"key": "string",
"message": "string",
"on": "string",
"params": {},
"path": "string"
}
],
"message": "string",
"op_index": 0,
"path": "string",
"request_id": "string",
"retryable": false,
"status": 0,
"title": "string",
"type": "string"
}{
"code": "string",
"detail": "string",
"details": {},
"errors": {},
"hint": "string",
"instance": "string",
"issues": [
{
"code": "string",
"key": "string",
"message": "string",
"on": "string",
"params": {},
"path": "string"
}
],
"message": "string",
"op_index": 0,
"path": "string",
"request_id": "string",
"retryable": false,
"status": 0,
"title": "string",
"type": "string"
}The examples are built from the schemas of the OpenAPI document, so a value is a placeholder of its type. The fields that carry the real values are in the tables.