Image search

This API endpoint allows you to perform a search using an image as the query. The image is sent in base64 format, and the API returns matching results based on the image content.

Endpoint

POST https://api.objective.inc/v1/indexes/:idx_id/search

Headers

  • Content-Type: application/json

Request Body

The request body should be in JSON format and contains the parameters to the search API. All parameters from the GET /search API are supported. For more info, see the search API docs.

Passing an image query

The POST /search API supports passing a query_image field with the following contents:

  • type: Specifies the type of data. For this API, use "base64".
  • media_type: The media type of the image. Supported type: "image/jpeg".
  • data: The base64 encoded string of the image.

Example:

{
    "query_image": {
        "type": "base64",
        "media_type": "image/jpeg",
        "data": "..."
    }
}

Supported media types

  • image/jpeg
  • image/png
  • image/gif
  • image/webp

Limitations

  • The maximum size of the image is 10 MB.
  • Image search is not supported on finetuned indexes. This feature is coming soon.
  • You cannot specify both query_text and query_image in the same POST request.

Examples

curl --location --request POST 'https://api.objective.inc/v1/indexes/idx_.../search' \
--header 'Authorization: Bearer xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "object_fields": "*",
    "query_image": {
        "type": "base64",
        "media_type": "image/jpeg",
        "data": "..."
    }
}'

FAQs

Do you support file uploads?

At this time we only support base64 encoded image contents.

What parameters are supported on the POST endpoint?

We support of all of the parameters from the GET /search API except for relevance_cutoff since reverse image search isn't supported on finetuned indexes (see limitations).

Was this page helpful?