Guides

Face Search

Search for faces in an image. The method requires the image parameter to perform the search. The limit_per_page parameter is optional and defaults to 30 if not provided. The method returns a list of assets that match the search criteria.

Request Body

ParameterTypeDescription
imagebinaryAn image to perform the search. Can contain more than one face. The image cannot have a size greater than 10MB.
save_searchboolean(optional, defaults to true), indicates whether to store the search criteria. Will return the search ID when true.
strictnessnumber(optional, defaults to 5) A number from 0 to 9. Zero returns all matches (may return false positives), and nine is the strictest (less false positives, but more misses).
extended_resultboolean(optional, defaults to false) 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
filtersstring(optional, JSON as string) Provide filter fields and values to filter results. Note that before using filters, FR Addon Settings must be updated for event hooks with appropriate event criteria. Please contact FileSpin Support to set this up.
limit_per_pagenumber(optional) Can be 1 to 30, defaults to 30.

Face Search Filters

filters option provides the ability to filter face search results with the metadata fields associated with the Asset. This is useful when you want to search for faces with specific metadata fields. For example, you can search for faces with metadata fields, such location set to london and age set to 30, etc.

Note:

  • filters option is only available when FR Addon Settings has been updated for event hooks with appropriate event criteria
  • NOTE: filters JSON should be passed as a string, like in below cURL example
    curl --request POST \
      --url <<API_HOST>>/api/v1/ml/people/facesearch \
      --header 'X-FileSpin-Api-Key: UPDATE_ME' \
      --header 'content-type: multipart/form-data' \
      --form [email protected] \
      --form 'filters={"field1": "y"}'
    
  • filters support string, number, boolean and date fields.
  • Asset Metadata fields that end with Date are treated as date fields for the purpose of Face Search Filters. For example, createdDate, updatedDate etc.
  • Date ranges can be passed {"date": ["2021-01-01T01:01:01Z", "2022-02-02T02:02:02Z"]} where the date string is formatted as ISO 8601 string ( YYYY-MM-DDTHH:MM:SSZ ). First element in the array is the start date and second element is the end date. Dates are inclusive.
  • fields passed in filters are case-sensitive and should match the metadata fields exactly
  • fields passed in filters are ANDed together. For example, if you pass {"location": "earth", "age": 30} it will return assets that have location set to earth and age set to 30.
  • a field value may contain multiple values. For example, location can contain multiple values such as earth mars. In such cases, the values are ORed together. For example, if you pass {"location": "earth mars"} it will return assets that have location set to earth or mars.

Example filters value

'filters={"location": "earth","age": 30,"isShortlisted": true, "createdDate": ["2021-01-01T01:01:01Z", "2022-02-02T02:02:02Z"]}

Response

A successful POST request returns a list of assets that match the search criteria. The response format is JSON. If extended_result is true, response includes Asset Data for all assets in the page.

Status CodeDescription
200Successful operation.
400The request body is invalid or missing data.

{
    "data": {
        "matches": [ "asset_id1", "asset_id2", "asset_id3" ],
         "extended_result": {
          "asset_id1": {Asset Data JSON},
          "asset_id2": {Asset Data JSON},
          "asset_id3": {Asset Data JSON},
          }

    }
   "page": 1,
   "search_id": "eed4c602a80a4920a4a9e56b5d3ea161",
   "limit_per_page": 30,
   "hits": 3
}
ParameterTypeDescription
dataJSONA dictionary with matches that contains a list of asset ids that are direct matches. If include groups is set to true in request, group_matches will be returned with the list of asset ids that the algorithm has determined to be in the same group.
extended_resultJSONA dictionary containing the current data for each file id returned in result. Data for each file follows Asset Data Format JSON. If extended_result is false or not set, response will not contain this JSON.
pageintegerindex of the page from the result pages. Index is calculated using limit_per_page
search_idstringreturned if save_search was set to true in the request
limit_per_pageintegerAs specified in the request or the default
hitsintegerTotal number hits for this search. Pagination can be done using this and limit_per_page
Language
Credentials
Header
URL