Search your media
const url = 'https://api.colourbox.com/search?media_count=500&media_offset=0&media_type=image%2Bvideo&orientation=horizontal&thumbnail_size=110px&order=relevance&direction=asc&resolution=a3&query_type=strict_and_search&exclude_expired_media=false';const options = {method: 'GET', headers: {Authorization: 'CBX-SIMPLE-TOKEN Token=<token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.colourbox.com/search?media_count=500&media_offset=0&media_type=image%2Bvideo&orientation=horizontal&thumbnail_size=110px&order=relevance&direction=asc&resolution=a3&query_type=strict_and_search&exclude_expired_media=false' \ --header 'Authorization: CBX-SIMPLE-TOKEN Token=<token>'At least one of q, unique_media_id or folder_ids MUST be applied to a search in order to get back a search result.
Return Values
When searching you need to specify which values you need in the result. You need to specify at least one value. The list to choose from is:
| keywords | Keywords on media |
|---|---|
| media_type | The media type. Possible values are “image”, “vector”, “video” or “generic”. “generic” covers all file types that Colourbox do not process, e.g. Word documents and the like |
| height | Height in pixels |
| width | Width in pixels |
| unique_media_id | The ID for specific media |
| folder_id | The folder the media resides in |
| created | The date the media was imported into colourbox.com |
| title | The title of the media if any |
| description | The description of the media if any description |
| thumbnail_url | Publicly accessible URL of the thumbnail. NOTE that the URL is short-lived, 24 hours, signed and not persistent. Do not store these URLs indefinitely. If you desire to cache the result, you should probably cache it for 23 hours at maximum. |
| thumbnail_url_ssl | Publicly accessible HTTPS URL of the thumbnail. NOTE that the URL is short-lived, 24 hours, signed and not persistent. Do not store these URLs indefinitely. If you desire to cache the result, you should probably cache it for 23 hours at maximum. |
| filename | The original filename |
| copyright | Copyright information for the media |
| camera_created | The date the media was shot if the information was available in metadata when the media was uploaded |
| byline | The photographer/creator of the media |
| file_mimetype | The mime type of the media |
| file_disksize | The size of the media in bytes (this is the size of the file when it was uploaded; the download size typically differs from this since we attempt to patch metadata from our system into the file whether it has been changed since uploading it or not) |
| uploaded_by | The user ID of the user who uploaded the media |
| geo_location | The location the image was taken, if available. If the location is available you get {latitude, longitude}, else {} |
Search Algorithm
The q parameter in a search can consist of several terms. A term being a sequence of letters and numbers separated from other terms by a +. Each term is matched against a subset of the fields on the files. The Skyfish API will try and match the query on the following fields on files:
- keywords
- title
- description
- copyright
- uploaded_by
- filename
It is also possible to exclude a term in the query string. This is done by prefixing the term with a -. There should no space between the hyphen and the term.
Please note that the actual algorithm for doing the search is subject to ongoing changes.
Search Data Normalization
All search data are put in unicode normalization form C (NFC), before added to our search engines. We do this to ensure that searching works efficiently, smoothly and seamlessly when searching with non-latin letters and special characters. All input queries are automatically put in unicode normalization for c as well.
Thumbnails
Skyfish automatically generates thumbnails in all relevant sizes for uploaded images. If you have uploaded non-image media via Skyfish, then generic thumbnails are returned for all extensions known to Skyfish.
Note that generic thumbnails have the same size, no matter what size you have requested. Generic thumbnails have size 93x119 pixels.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”The query string that you want to search for, e.g. “cat”. See Search Algorithm for details on which fields are matched.
Specifies which values you want back. The list should be a string with + as separator, e.g. unique_media_id+keywords. See Return Values for a complete list.
Limits the number of results. Assumed default if omitted.
How many rows should be skipped from the start of the result. Mainly used for pagination.
Example
image+videoSpecifies the type of media you are searching for, and the value must be one of the following: “image”, “vector”, “video” and “generic”. If not set, we include media from all types. You can specify multiple by separating them with a “+”.
Limits the folders in which the search is performed. Multiple folder IDs should be concatenated with “+”
Limits the search to only being done on the given unique medias. Multiple unique media IDs should be concatenated with “+”
If you want to filter by dates, you specify either created or camera_created. Created is the point in time when we got a hold of the image. Camera created is the point in time when the picture was taken, given the camera wrote the camera created exif tag.
Specifies the min. date for the date filter field. 2016-03-14T12:23:51Z. This is greater than or equal.
Specifies the max date for the date filter field. This is less than or equal.
Limits search to media of specified orientation
Returned thumbnail URLs in the selected size, if thumbnail_url or thumbnail_url_ssl is given in return_values.
Order the search result. Created is the time the media was imported into the Colourbox system.
Specify the direction of the ordering. Note that this option can only be given if order is given as well.
This will restrict the search result to images which has resolution at least a4 or a3.
Specifies the minimum width.
Specifies the minimum height.
Specifies the query type.
- strict_and_search - Search result which only matches whole words
- wildcards - Result which bends over backwards to provide as many results as possible
Specifies if expired media should be excluded from the search
yyyy-mm-dd, Specifies to only include media with expiration date grater or equal to the date specified.
yyyy-mm-dd Specifies to only include media with expiration date less or equal to the date specified.
Responses
Section titled “Responses”Example response from /search?q=cat&return_values=title+keywords&media_count=1
object
object
object
Example
{ "response": { "hits": 34497, "media": [ { "keywords": [ "cat ", "cute ", "purebred ", "animal ", "attentive ", "beautiful ", "bow ", "domestic ", "feline ", "fur ", "furry ", "gaze ", "head ", "look ", "mammal ", "nose ", "pedigree ", "pedigreed ", "pet ", "portrait ", "pretty ", "shorthair ", "sideburns ", "stare ", "sweet ", "watchful ", "watching ", "whiskers ", "white background " ], "title": "Cat with blue eyes over white background" } ] }}