List Assets
Returns a paginated list of assets in the project library. Each item uses the same shape as Get an Asset.
The HTTP path is /api/files (the word “files” in the path is the REST resource name for assets).
Request
GET /api/files HTTP/1.1
Host: app.nomacms.com
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/jsonRequires the read ability on the token.
Query parameters
| Param | Description |
|---|---|
search | Optional. Matches filename, original filename, or MIME type (substring match, case-sensitive per database collation). |
type | Optional. One of image, video, audio, or document. Filters by file extension groups configured on the server (for example images include jpg, png, webp, and similar). |
paginate | Optional. Page size. Defaults to 25, minimum 1, maximum 100. |
Results are ordered by created_at descending (newest first).
Response (200)
JSON object with Laravel-style pagination:
| Field | Type | Description |
|---|---|---|
data | array | Asset objects (see below) |
links | object | Pagination links (first, last, prev, next) |
meta | object | Pagination metadata (current_page, per_page, total, and so on) |
Each element of data includes:
| Field | Type | Description |
|---|---|---|
uuid | string | Asset UUID |
filename | string | Original filename (as stored on upload) |
mime_type | string | MIME type (images may be normalized, for example to image/webp after optimization) |
size | string | Human-readable size (for example 1.0 MB) |
url | string | Public URL for the primary file |
original_url | string | null | URL for the original upload when an optimized variant exists |
thumbnail_url | string | null | Thumbnail URL when applicable |
metadata | object | null | Related metadata (for example alt_text, width, height for images) when loaded |
Errors
| Status | When |
|---|---|
| 400 | Missing project-id or project cannot be resolved (see Authentication) |
| 401 | Missing or invalid bearer token |
| 403 | Token does not have read (or *) |
| 404 | No project with that UUID |
| 429 | Rate limited |
Example
import { createClient } from "@nomacms/js-sdk"
const client = createClient({
projectId: process.env.NOMA_PROJECT_ID!,
apiKey: process.env.NOMA_API_KEY!,
})
const page = await client.assets.list({
search: "hero",
type: "image",
paginate: 24,
})
console.log(page)import axios from "axios"
async function main() {
const { data } = await axios.get("https://app.nomacms.com/api/files", {
headers: {
"project-id": process.env.NOMA_PROJECT_ID!,
Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
Accept: "application/json",
},
params: { search: "hero", type: "image", paginate: 24 },
})
console.log(data)
}
void main()<?php
$query = http_build_query(['search' => 'hero', 'type' => 'image', 'paginate' => 24]);
$ch = curl_init('https://app.nomacms.com/api/files?' . $query);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
'project-id: ' . getenv('NOMA_PROJECT_ID'),
'Authorization: Bearer ' . getenv('NOMA_API_KEY'),
'Accept: application/json',
],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);curl -sS \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json" \
"https://app.nomacms.com/api/files?search=hero&type=image&paginate=24"package main
import (
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://app.nomacms.com/api/files?search=hero&type=image&paginate=24", nil)
if err != nil {
panic(err)
}
req.Header.Set("project-id", os.Getenv("NOMA_PROJECT_ID"))
req.Header.Set("Authorization", "Bearer "+os.Getenv("NOMA_API_KEY"))
req.Header.Set("Accept", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
_, _ = io.Copy(os.Stdout, res.Body)
}require "net/http"
require "uri"
uri = URI("https://app.nomacms.com/api/files")
uri.query = URI.encode_www_form("search" => "hero", "type" => "image", "paginate" => 24)
req = Net::HTTP::Get.new(uri)
req["project-id"] = ENV.fetch("NOMA_PROJECT_ID")
req["Authorization"] = "Bearer #{ENV.fetch('NOMA_API_KEY')}"
req["Accept"] = "application/json"
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
puts http.request(req).body
endimport os
import urllib.parse
import urllib.request
params = urllib.parse.urlencode({"search": "hero", "type": "image", "paginate": 24})
url = f"https://app.nomacms.com/api/files?{params}"
req = urllib.request.Request(
url,
headers={
"project-id": os.environ["NOMA_PROJECT_ID"],
"Authorization": f"Bearer {os.environ['NOMA_API_KEY']}",
"Accept": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.read().decode())Related
- Authentication - Headers and abilities
- Get an Asset - One asset by id or filename
- Upload an Asset - Create assets
- JavaScript SDK -
assets.list