---
title: "Search for assets"
method: POST
path: "/images/search"
tags: ["Assets"]
---

# Search for assets

`POST /images/search`

## Request

- Base URL: `https://api.pics.io`
- URL: `https://api.pics.io/images/search`
- Auth: HTTP bearer

## Request body

- Search
  - `from` number: A cursor for use in pagination. Defines initial place in the list to return assets from
  - `size` number: A limit on the number of assets to be returned. Keep it below 50.
  - `tagId` string: Collection id to recursively search in
  - `inboxId` string: Inbox id to recursively search in
  - `lightboardId` string: Lightboard id to recursively search in
  - `type` 'images' | 'video' | 'audio' | 'text' | 'pdf' | 'sketch' | 'raw' | 'photoshop': Filter assets by type
  - `text` string: Text query to search. Search fields managed by `searchIn` parameter
  - `searchIn` 'name' | 'title' | 'description' | 'keywords' | 'meta' | 'content' | 'tagName': Specifies field to search `text` at
  - `flag` 'flagged' | 'unflagged' | 'rejected': Filter assets by flag
  - `rating` number: Filter assets by stars rating
  - `color` 'yellow' | 'orange' | 'red' | 'green' | 'aqua' | 'blue' | 'purple' | 'nocolor': Filter assets by color
  - `createdAt` 'today' | 'yesterday' | 'lastweek' | 'lastmonth' | 'last90days' | 'custom': Search by creation date. May be of predefined aliases or specific range Custom date format is similar to HTTP Range header `/^([-0-9]*)_([-0-9]*)$/)`. Contains of two timestamps (milliseconds) separated by underscode symbol. Any timestamp can be postponed to allow specify 'before' and 'after' date ranges. Using alias: `createdAt: today` Between two dates: `createdAt: 1450650500000_1460650500000` After date: `createdAt: 1450650500000_` Before date: `createdAt: _1460650500000`
  - `productSelection` object: Scope the search to an explicit bulk selection of Toriut product/variant records (Toriut only). An asset is returned when it is linked to ANY selected product OR ANY selected variant, and each asset is returned once no matter how many selected records it is attached to. `total` therefore counts unique assets, not product-media associations. The scope comes from the ids passed here, never from the current product search query, filters or page. `layer` and `recordState` are single-valued, so a selection cannot span two channels or mix draft with published records. Combined `productIds` + `variantIds` length is capped (50000 by default, `middlewares.assetsSearch.maxProductSelectionItems`). An empty selection is rejected.
    - `layer` string, required: Product data layer the selection belongs to: the literal `master`, or a salesChannelId
    - `recordState` 'draft' | 'published': Record state within a channel layer. Required when `layer` is a salesChannelId, forbidden for `master`
    - `productIds` string[]: Selected master product or listing ids. At least one of `productIds` / `variantIds` is required
    - `variantIds` string[]: Selected master variant or listing variant ids

## Response `200`

Ok

## Other responses

- `400`: Invalid search query, or a `productSelection` that is empty, over the selection limit, or mixes incompatible contexts

---

[API](https://skmtc.dev/pics/apis/pics-io-rest-api.md) - [All operations](https://skmtc.dev/pics/apis/pics-io-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pics/apis/pics-io-rest-api/revisions/ea41cba5ac37?raw)
