Listing and filtering
Listing and filtering images is done with GET /v1/media. You can filter by resource type, resource ID, status, tags and metadata, and page through the results. This page also covers updating tags and metadata with PATCH and deleting images.
Query parameters
| Parameter | Description |
|---|---|
resourceType |
Resource type, for example product. |
resourceId |
Resource ID, for example 42. |
status |
pending, processing, ready, failed or deleted. |
tags |
Comma-separated tags. An image must carry every listed tag. |
metadata |
URL-encoded JSON object. Returns images whose metadata contains it. |
page |
Page number, starting at 1. Default 1. |
limit |
Items per page, up to 100. Default 20. |
Fetch the ready images for one product:
curl "https://api.nooknear.com/v1/media?resourceType=product&resourceId=42&status=ready" \
-H "X-API-Key: $NOOKNEAR_API_KEY"
Response:
{
"assets": [
{
"assetId": "3f6c2a8e-1b4d-4c1e-9a77-5e2f0d8b9c10",
"status": "ready",
"resourceType": "product",
"resourceId": "42",
"tags": ["cover"],
"metadata": { "color": "red" },
"variants": {
"large": { "url": "https://cdn.nooknear.com/.../large.webp?token=...", "width": 1200, "height": 900, "sizeBytes": 88410, "mimeType": "image/webp" }
},
"originalUrl": "https://cdn.nooknear.com/.../original.webp?token=...",
"createdAt": "2026-12-06T12:00:00.000Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}
Each item’s variants has the same shape as in GET /v1/media/:assetId, so you can load every image on a page with one request instead of fetching them one by one.
Tag filter
tags is an AND filter: an image must carry all of the listed tags.
# Images tagged both "mains" and "dish:adana-kebap"
curl "https://api.nooknear.com/v1/media?tags=mains,dish:adana-kebap" \
-H "X-API-Key: $NOOKNEAR_API_KEY"
Tags follow the same rules as on upload: up to 20, each matching [a-zA-Z0-9:_.-]{1,64}. There’s no “any of these tags” (OR) filter today; if you need one, make a request per tag and merge the results.
Metadata filter
Pass a JSON object in metadata and you get images whose metadata contains it (PostgreSQL jsonb @> containment). Always URL-encode it:
curl -G "https://api.nooknear.com/v1/media" \
--data-urlencode 'metadata={"dish":"adana-kebap"}' \
-H "X-API-Key: $NOOKNEAR_API_KEY"
const params = new URLSearchParams({
resourceType: 'menu-item',
metadata: JSON.stringify({ dish: 'adana-kebap', source: 'menu-editor' }),
limit: '50'
});
const res = await fetch(`https://api.nooknear.com/v1/media?${params}`, {
headers: { 'X-API-Key': process.env.NOOKNEAR_API_KEY }
});
const { assets, total } = await res.json();
Containment makes a few things easy:
- The filter
{"dish":"adana-kebap"}also matches an image whose metadata is{"dish":"adana-kebap","source":"seed"}. - Nested objects work too:
{"menu":{"id":"7"}}. - Invalid JSON returns
400 VALIDATION_ERROR.
Pagination
total is the total number of matches. To walk through everything, increase page up to ceil(total / limit):
async function listAll(query) {
const all = [];
for (let page = 1; ; page++) {
const params = new URLSearchParams({ ...query, page: String(page), limit: '100' });
const res = await fetch(`https://api.nooknear.com/v1/media?${params}`, {
headers: { 'X-API-Key': process.env.NOOKNEAR_API_KEY }
});
const { assets, total } = await res.json();
all.push(...assets);
if (page * 100 >= total) return all;
}
}
Each page request counts toward your rate limit; for large scans, watch the headers described in Errors and limits.
Updating tags and metadata
PATCH /v1/media/:assetId changes an image’s tags and metadata. At least one of tags or metadata is required.
curl -X PATCH https://api.nooknear.com/v1/media/3f6c2a8e-1b4d-4c1e-9a77-5e2f0d8b9c10 \
-H "X-API-Key: $NOOKNEAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tags": ["cover", "campaign"],
"metadata": { "color": "navy" }
}'
{
"assetId": "3f6c2a8e-1b4d-4c1e-9a77-5e2f0d8b9c10",
"tags": ["cover", "campaign"],
"metadata": { "color": "navy", "source": "seed" }
}
Rules:
tagsreplaces the whole list. To add one tag, read the current list, append, and send the full list. Send"tags": []to remove all tags.metadatais shallow-merged by default (mergeMetadata: true): top-level keys you send are added or overwritten and the rest are kept. Nested objects are not merged; they’re replaced as a whole.- Send
"mergeMetadata": falseto replace the metadata object entirely. - Deleted or unknown assets return
404.
Deleting
curl -X DELETE https://api.nooknear.com/v1/media/3f6c2a8e-1b4d-4c1e-9a77-5e2f0d8b9c10 \
-H "X-API-Key: $NOOKNEAR_API_KEY" \
-H "Idempotency-Key: delete-3f6c2a8e"
{ "deletionJobId": "1287" }
- The asset is marked
deletedright away; from then on the API returns404for it. - Files (the original and every variant) are removed from storage by a background job.
- CDN URLs for the deleted asset stop working. Copies already cached by browsers or CDN edge servers may still be served for a while.
- With
Idempotency-Keyyou can safely retry the same delete.
To delete all data in your account, see the data-delete endpoint on the GDPR page.