Image Search: Upload Image
Image Search
Image Search: Upload Image
Image Upload API endpoint that accepts a binary image and returns an image ID you can pass into the Image Search endpoint for visual product lookup.
POST
Image Search: Upload Image
Authorization
string
required
Token-based authentication header in the form of
<YOUR_LAYERS_TOKEN>.Headers
string
default:"multipart/form-data"
required
string
default:"application/json"
required
Body
file
required
Image file to upload. Supported formats: JPEG, JPG, PNG, WebP, HEIC, and HEIF. Maximum file size: 15MB (15,360 KB).
integer
X-coordinate (in pixels) of the top-left corner of the crop region. Must be
0 or greater. When provided, all four crop parameters (crop_x, crop_y, crop_width, crop_height) are required.integer
Y-coordinate (in pixels) of the top-left corner of the crop region. Must be
0 or greater.integer
Width (in pixels) of the crop region. Must be
1 or greater.integer
Height (in pixels) of the crop region. Must be
1 or greater.Response
string
Status of the upload operation. Returns “success” on successful upload.
string
Unique UUID identifier for the uploaded image. Use this ID in the Image Search API to perform visual searches.
Usage
The Image Upload endpoint enables a two-step process for visual search:- Upload the image using this endpoint to receive an
imageId - Search with the image using the
imageIdin the Image Search API
- Better performance: Avoids repeated base64 encoding/decoding
- Caching: Processed image embeddings are cached for faster subsequent searches
- Reduced payload size: Use lightweight UUID instead of large base64 strings
Error responses
object
Validation errors returned when the request fails validation.
- File required: No image file provided
- Invalid file type: File format not supported (must be JPEG, JPG, PNG, WebP, HEIC, or HEIF)
- File too large: Image exceeds 15MB size limit
- Missing crop parameters: All four crop parameters must be provided together