Image Recognition API Documentation

Search v2

This method of the Image Recognition API sends an image recognition request from a client application (such as mobile apps or your own server).

URL
https://search.craftar.net/v2/search
Method
POST
Parameters
  • token: the Token of the collection to be searched.
  • image: the query image, as binary image file in jpeg or png (without transparency) format.
  • app_id: a string identifying the application.
  • version: a string identifying the SDK version.
  • (optional) bboxes: the response will include bounding boxes. By default it’s false.
  • (optional) embed_custom: the response custom data will be embedded. Otherwise, it will be sent as an url. By default it’s false. Note that embedding the custom data results in an additional latency. If you need to minimize response times we recommend getting just URLs (i.e. no embedding) and caching the data.
  • (optional) embed_tracking: the response tracking data will be embedded (if present). Otherwise, it will be sent as an url. By default it’s false.

Note that the parameters must use multipart/form-data encoding.

Request examples

The example uses query image query.jpg and collection token afe34dbe14890fac

Curl example

-F “app_id=com.catchoom.test” -F “version=ARSDK-1”

Python example

Response fields

The response contains a JSON dictionary with recognized items (objects) ordered by their scores, i.e. the first item has the highest score.

The JSON dictionary has the following fields:

  • search_time: the time in seconds it took to CraftAR to process the query.
  • collection: general information for the collection where the query was performed:
    • uuid: the collection id.
    • pubkey: the public key that can be used to verify tracking data’s signature.
    • image_template: a template URL that can be used to find the thumbnail for an image with its id.
    • app_id: the provided App ID.
  • results: result list. If no items are recognized, this will be an empty JSON array.
    • item: the recognized item:
      • uuid: the item id.
      • name: the item name.
      • images: list with the UUID for all the images inside the item.
      • trackable: true if the item is trackable, false otherwise.
      • (optional) url: the item url (if it exists).
      • (optional) custom: the item custom data (if it exists).
      • (optional) tracking: the tracking data (if it exists) signed for the provided App ID.
      • (optional) content: the content (if it exists)
    • image: the UUID for the best matching reference image among all images representing the item
    • score: the recognition score, representing the similarity between the query image and the matched reference image.
    • (optional) bbox: the bounding box (if exists).

In case of an error, in addition to an appropriate HTTP status code, the service will also return a much more specific and informative error codes in the JSON response. Check the documentation on Error codes in the recognition API for more detailed information.

Response examples

Success
Failure