Skip to Content
Mutation APIFetching multiple assets

Fetching assets

Prepr stores all your digital assets in the Media Library (in Prepr: the Media tab), making it easy to access, view, and manage your assets. You can add, edit, download, or delete files whenever needed; categorize, search, and filter assets on multiple attributes to find the right one quickly.

Before calling a REST API endpoint to fetch assets, add the REST API scope assets to your mutation API access token. Check out the authorization guide for more details. Pass this access token in the Authorization header as a Bearer token when making the request.

To fetch assets, send a GET request to the https://cdn.prepr.io/assets endpoint and include your filter criteria in the request payload. Filter assets by the criteria listed below.

You can search assets by their title or text fields.

The example below searches assets for the text Beach Club.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "q": [ { "fz": "Beach Club" } ] }

Types

You can filter assets by their type: Photo, Video, Audio, Document.

The example below fetches all video assets.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "labels": [ { "eq": "Video" } ] }

The example below fetches video and image assets.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "labels": [ { "in": [ "Video", "Photo" ] } ] }

Tags

You can filter assets by their tags. Use the tags argument in your request.

The example below fetches assets with the tag 222b7528-9e3a-294f-21bf-7ec623d1ac74 or bcc9eea7-7307-f45b-5aaf-27eca7d329f9.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "tags": [ { "in": [ "222b7528-9e3a-294f-21bf-7ec623d1ac74", "bcc9eea7-7307-f45b-5aaf-27eca7d329f9" ] } ] }

The example below fetches assets with both the tag 222b7528-9e3a-294f-21bf-7ec623d1ac74 and bcc9eea7-7307-f45b-5aaf-27eca7d329f9.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "tags": [ { "all": [ "222b7528-9e3a-294f-21bf-7ec623d1ac74", "bcc9eea7-7307-f45b-5aaf-27eca7d329f9" ] } ] }

The example below fetches assets that have at least one tag.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "tags": [ { "has": true } ] }

Content Item relation

You can filter assets by whether they are linked to content items.

The example below fetches assets that are used in content items.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "content_item": [ { "has": true } ] }

The example below fetches assets that are not used in any content item.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "content_item": [ { "hasn": true } ] }

Collections

You can filter assets that belong in a specific asset collection by using the collections argument in your request.

The example below fetches assets in the collection with collection ID 0a974a1d-c493-4e12-8045-9c53e75d1b48.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "collections": [ { "eq": "0a974a1d-c493-4e12-8045-9c53e75d1b48" } ] }

Query by Reference ID

The Reference ID is useful for storing external asset IDs, for example during a migration from another system. Check out the Migration doc for more details.

The example below fetches an asset with the reference ID 123456.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "reference_id": [ { "eq": "123456" } ] }

Sorting

You can use the sort argument to order your query results in a particular order.

The example below sorts assets by the created_on field in ascending order.

GET https://cdn.prepr.io/assets Authorization: Bearer <YOUR-ACCESS-TOKEN> Content-Type: application/json { "sort": "created_on" }

Sort by metadata fields

You can sort assets by their created and changed dates in either ascending or descending order.

The current values for sorting those fields are created_on, -created_on, changed_on, -changed_on.

Default ordering

If you don’t pass an explicit order value the returned assets will be ordered descending by asset changed on timestamp -changed_on. This means that the most recently changed asset will appear at the top of the list.

Last updated on