Guides

Search

Send a HTTP POST request with search criteria to run the search and get first page of results (default 50 per page)

POST Request JSON

All parameters are optional. A complete JSON payload for search request below:-

{
  "keyword": "sample",
  "file_name": "test*",
  "content_type": "image* OR video* OR audio*",
  "creator_id": 100,
  "upload_time_range": {
    "start": "2013-01-01T10:25:11Z",
    "end": "2013-02-01T10:25:11Z"
  },
  "file_size_range": {
    "start": 10240,
    "end": 402600
  },
  "sort_by": [
    "upload_time_range_DESC",
    "file_size_range_ASC",
    "content_type_DESC"
  ],
  "limit_per_page": 30
}
KeyTypeDescription
keywordstring(optional) Search for keywords (includes keywords added to reserved Asset metadata field filespin_search_txt or custom schema fields with keyword_searchable set to true. Use OR to find assets that match any of the given search words. john OR doe will find assets that contain john or doe in keywords. Use AND to find assets that contain both john and doe in keywords.OR and AND conditions cannot be used together in a search. keyword cannot contain more than 40 words
file_namestring(optional) File name, * wildcard character is allowed in the suffix. To find multiple types in search supply value separated by OR, like myfile1* OR myfile2*. Note that . is a reserved search character and cannot be used in file name search
content_typestring(optional) File content type type. * wildcard is allowed. To find multiple types in search supply value separated by OR, like image* OR video*
creator_idinteger(optional) Search only the files created by this user. Note that the user calling the API must belong to the same user group as the user id passed
upload_time_rangeJSON(optional) Like {"start": TIME, "end": TIME } where TIME is an ISO 8601 datetime string, such as "2013-01-20T15:30:25Z". Range is inclusive, times will be considered as UTC times
file_size_rangeJSON(optional) Like {"start": SIZE, "end": SIZE } where SIZE is in bytes ( 1 KiB = 1024 bytes, 1 MiB = 1048576 bytes), range is inclusive
limit_per_pageinteger(optional) Limit how many files are returned in a page. Can be from 1 to 30. Defaults to 30.
sort_byJSON(optional) List of key strings. Sort keys can be file_name, content_type, upload_time_range or "file_size_range". Append _ASC or _DESC to the key to sort by ascending or descending order. Example: ["upload_time_range_DESC", "file_size_range_ASC"] will sort by upload_time_range in descending order and within that by ascending file_size. Default sort is by descending order of upload_time_range. If sort_by keys are provided, it will override default sorting.
extended_resultboolean(optional) Set this to true to return extended result which will contain the complete asset data for asset ids returned. Searches with this set to true will take longer to run
trashedboolean(optional) Set this to true to return files that have been deleted (but not purged). Deleted files will not be returned in normal searches. Admin role is required to retrieve deleted assets

HTTP Response

HTTP Status code and JSON response like below.

//Response JSON with {Asset Data}
{
    "status": "OK",
    "search_result_id": "0a9761f2f9",
    "total_files": 1,
    "page": 1,
    "total_pages": 1,
    "result": ["116f6a2a266d45d58d067f7c39a2e4dd"],
    "extended_result": {
       "116f6a2a266d45d58d067f7c39a2e4dd": {Asset Data}
    }
}

Asset Data is as specified in Asset Data Format - the JSON format used across all Asset API responses.

KeyValueDescription
statusstringOK if search was successful, ERROR otherwise
search_result_idstringAn alphanumeric value between 10 and 32 characters, valid 60 minutes from time of API call
total_filesintegerTotal number of files found for the search. Note that there may be more than one page of results if there are more than 100 files in result
pageintegerIndex of currently returned result page, always less than or equal to total_pages
total_pagesintegerTotal number of pages in the search result
resultJSONList of file ids. Defaults to 30 ids per page. The actual count returned may vary but will not exceed 30 depending on asset activity at the time the API is called.
extended_resultJSONA dictionary containing the current data for each file id returned in result. Data for each file follows Asset Data FormatJSON

🚧

Note that the number of result pages that can be retrieved is limited to 10,000 assets. If there are more than 10,000 hits, we recommend that you use additional search parameters such as upload_time_range to limit the results.

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!