POST /asset/v1/content/assets/query

Use an advanced query to retrieve a collection of assets.

An advanced asset query has the properties listed in this table.

NameTypeDescription
fieldsFields arrayAn array that specifies the fields to return in the response.
pagePage ObjectAn object that controls the page number and page size.
queryQuery ObjectRequired. An object that contains simple queries that are united by using AND or OR logic.
sortSort ArrayAn object that specifies how to sort the items in the response.

The fields array is an array of strings. Each string in the array corresponds to an asset field. The response to an advanced query includes information about the fields that you specify in this array.

Use the page object to paginate and navigate large result sets. The page object contains the properties in this table.

NameTypeDescription
pageIntegerThe page number of results to be returned in the response. The default value is 1.
pageSizeIntegerThe number of results to be returned on each page. The default value is 50.

The query object contains two simple queries that are contained in leftOperand and rightOperand objects. These operands are connected by the logicalOperator property. You can also embed queries within other queries.

The value of the logicalOperator property can be either AND or OR.

The leftOperand and rightOperand objects have the properties listed in this table.

NameTypeDescription
propertyStringThe name of the field to use in the comparison.
simpleOperatorStringThe comparison operator to use in the query. Possible values are:
  • equal
  • notEqual
  • lessThan
  • lessThanOrEqual
  • greaterThan
  • greaterThanOrEqual
  • like
  • isNull
  • isNotNull
  • contains
  • mustContain
  • startsWith
  • in
valueString, number, boolean, or arrayThe value to compare the specified field to.

In queries where the value of property is content and the value of simpleOperator is equal, the property field can contain a minimum of 3 characters and a maximum of 6 characters. This restriction does not apply to any other values of the property field.

The sort array is an array of objects. Each object in the array specifies a method of sorting the result set. You can sort on multiple properties. When you specify multiple sort rules in this array, the API applies the rules in the order that they’re listed in the array, from top to bottom.

Each object in the sort array contains the properties listed in this table.

NameTypeDescription
propertyStringThe name of the field to sort on.
directionStringThe sort direction for the specified property. Possible values are ASC (to sort results in ascending order) and DESC (to sort in descending order).

This example returns all assets whose version is 2 and assetType.name is Template, returning the first 50 results, sorted by asset id in ascending order.

In addition to standard fields always returned on the asset object, the response contains all optional asset fields specified in the request.

You can query for archived assets by including a filter for the asset’s status.name or id value. Modify the first example request to replace the leftOperand with a filter that includes the asset’s status.name of Archived.

The response contains a collection of zero or more archived assets of asset type Template.

StatusNameTypeDescription
200  A collection of assets
 CustomerKeystringReference to customer’s private ID/name for the asset.
 ContentTypestringThe type that the Content attribute is in.
 DataobjectContainer for asset properties.
 AssetTypeobjectThe type of the asset saved as a name/ID pair.
 VersionnumberThe version of the asset.
 LockedbooleanSpecifies whether the asset can be modified.
 FilePropertiesobjectStores the different properties that this asset refers to if it is a file type.
 NamestringName of the asset, set by the client. 200 character maximum.
 DescriptionstringDescription of the asset, set by the client.
 CategoryobjectID of the category the asset belongs to.
 TagsarrayList of tags associated with the asset.
 ContentstringThe actual content of the asset.
 DesignstringFallback for display when both Content and Supercontent are not provided.
 SuperContentstringContent that supersedes Content in terms of display.
 CustomFieldsobjectCustom fields within an asset.
 ViewsobjectViews within an asset.
 BlocksobjectBlocks within the asset.
 MinBlocksnumberMinimum number of blocks within an asset.
 MaxBlocksnumberMaximum number of blocks within an asset.
 ChannelsobjectList of channels allowed to use this asset.
 AllowedBlocksarrayList of blocks allowed in the asset.
 SlotsobjectSlots within the asset.
 BusinessUnitAvailabilityobjectA dictionary of member IDs granted access to the asset.
 sharingPropertiesobjectAllows you to share content with one or more business units having Content Builder Sharing enabled. See Sharing for additional information.
 sharingProperties.sharedWithobjectList of MID IDs with which the asset is shared.
 sharingProperties.sharingTypestringIndicates the permission that you are granting to the list of MIDs in sharedWith. Possible values are
  • view.
  • edit.
  • local.
 TemplateobjectTemplate that the asset follows.
 FilestringBase64-encoded string of a file associated with an asset.
 GenerateFromstringTells the sending compiler what view to use for generating this view’s content.
    
400  Bad request
 MessagestringThe error message.
 ErrorCodenumberThe specific error code.
 DocumentationstringAny specific documentation for the error.
    
403  Permission error
 MessagestringThe error message.
 ErrorCodenumberThe specific error code.
 DocumentationstringAny specific documentation for the error.