Generate experiences with Puck AI
Read docs
CloudAPI referencecloud-clientServer APIsassets.list

assets.list

Puck Assets is in early access. Request access.

Find and list assets.

await puck.assets.list();

Returns an AssetList containing the assets, and pagination metadata.

Args

ParamExampleTypeStatus
params{ query: "bike" }Object-
options{ auth: {} }Object-

params

Pagination and filtering options for listing assets. Defaults to the first 50, newest first.

ParamExampleTypeStatus
queryquery: "bike"String-
folderIdfolderId: "folder_123"String | null-
tagstags: { all: ["Brand"] }Object-
typestypes: { any: ["image/"] }Object-
sortsort: { by: "name" }Object-
offsetoffset: 50Number-
limitlimit: 20Number-

Optional filter params

query

Find assets that contain the specified text in their filenames, titles, or tags.

folderId

List assets from the specified folder. Use null to list the assets in no folder or undefined to list all assets. Defaults to all assets.

tags

List assets that have the specified tags.

const { results } = await puck.assets.list({
  tags: { all: ["Brand", "Summer"] },
});
ParamExampleTypeStatus
tags.allall: ["Brand"]String[]-
tags.all

List assets that have all of the specified tags.

types

List assets that match the specified media types. Use media type prefixes or full media types.

const { results } = await puck.assets.list({
  types: { any: ["image/"] },
});
ParamExampleTypeStatus
types.anyany: ["image/"]String[]-
types.any

List assets that match any of the specified media types.

Optional paging params

sort

Sort the resulting asset list after filtering.

const { results } = await puck.assets.list({
  sort: { by: "name", dir: "asc" },
});
ParamExampleTypeStatus
sort.byby: "name""createdAt" | "sizeBytes" | "name" | "type"-
sort.dirdir: "asc""asc" | "desc"-
sort.by

Sort the assets by one of its fields. Defaults to "createdAt".

  • "createdAt": when the asset was created
  • "sizeBytes": the file’s size
  • "name": the filename
  • "type": the media type
sort.dir

Set the sort direction in the selected field. Use "asc" for ascending order or "desc" for descending order. Defaults to "desc".

offset

Skip a number of assets in the resulting list after filtering and sorting, from the start. Defaults to 0.

limit

Limit the number of assets returned in the resulting list after filtering, sorting, and skipping the offset, up to 100. Defaults to 50.

options

Set the request options for this call.