Vacancy Detection - synchronous API
Use Vacancy Detection to locate empty, understocked, and collapsed areas on retail shelves, display boxes, baskets, stack displays, and freezers. Submit one image per request to receive the detection results in the same response. Your business system can map the returned coordinates to the original image for replenishment reminders and manual review. A successful detection that returns an empty array [ ] indicates that no vacancies were found and the shelf is fully stocked. This is a synchronous API.
1. Activate the service
Log on to the Smart Inspection console with the Alibaba Cloud account you intend to use for API calls and activate the service. Smart Inspection console
If you use an API Key to access Aidge, go to Quotas and API Keys > API Key Management > Create API Key in the product console. Save the generated key. Use this key in the
Authorization: Bearer <API_KEY>request header.If you use an AccessKey or STS to access Aidge, an administrator must grant the calling RAM user or role the necessary permissions. You can attach the
AliyunAidgeFullAccesspolicy or create a custom policy that grants theaidge:VacancyDetectionSyncaction permission. RAM Console
To inquire about the throttling quota, contact the Smart Inspection team. If you need to increase your quota, provide your estimated peak queries per second (QPS), daily call volume, and peak call periods.
2. Request parameters
Call the Aidge VacancyDetectionSync operation of version 2026-04-28. Use an HTTPS POST request to submit one image at a time. Include the following fields in the JSON request body. Field names are case-sensitive. The current version does not support Base64-encoded images as input.
Field | Type | Required | Description |
| string | Yes | The public HTTPS URL of the image. |
| string | Yes | For a public URL, set the value to |
The service analyzes the image based on built-in detection rules.
Public image URL
{
"Type": "url",
"Image": "https://example.com/shelf.jpg"
}Replace the example with a publicly accessible image URL. The URL must remain valid throughout the request. The maximum image file size is 10 MiB.
3. Synchronous response
After receiving the response, check the top-level Success field. If the call is successful, parse the Data.Result JSON string to retrieve the coordinate array.
{
"RequestId": "E1AD60F1-BAC7-546B-9533-E7AD02B16E3F",
"Success": true,
"Data": {
"Result": "[[138,406,230,463],[353,526,471,622]]",
"UsageMap": {
"ProcessingCount": 1
}
}
}If no vacancies are found, Success is true and Data.Result is the string "[ ]", which parses to an empty array.
Field | Description |
| The Request ID. Use this for troubleshooting. |
| Indicates whether the API call was successful. |
| The error code and message if the call fails. |
Data.Result: A JSON string of the coordinate array. If no vacancies are found, the value is "[ ]".
Data.UsageMap.ProcessingCount: The number of images processed. The value is 1 for a successful call and 0 for a failed call.
Each bounding box is an array [x1, y1, x2, y2], representing the top-left and bottom-right coordinates, respectively. The horizontal (x) and vertical (y) coordinates are integers normalized to a 0-1000 scale relative to the image's dimensions. To convert to pixel values, use the following formulas: pixel_x = x / 1000 * original_image_width and pixel_y = y / 1000 * original_image_height.
If the call fails, check the Code and Message fields and save the RequestId for troubleshooting. If you receive an error about image parameters, verify that the Type and Image values match, and check the image URL's accessibility, format, and size.
4. Synchronous call examples
Aidge OpenAPI connection parameters
Use the regional endpoint provided when you activated the service. The following example uses the Beijing endpoint: https://aidge.cn-beijing.aliyuncs.com/. Save an image request body, as described in Section 2, to a UTF-8 encoded file named request.json.
Method 1: API Key via HTTP or cURL
Create an Aidge API Key in the Smart Inspection console and set the key as a server-side environment variable named AIDGE_API_KEY.
curl --request POST 'https://aidge.cn-beijing.aliyuncs.com/' \
--header "Authorization: Bearer ${AIDGE_API_KEY}" \
--header 'x-acs-action: VacancyDetectionSync' \
--header 'x-acs-version: 2026-04-28' \
--header 'Content-Type: application/json' \
--data-binary @request.jsonThis authentication method applies to all supported image sources. Parse the Data.Result from the response as described in Section 3.
Method 2: AccessKey or STS via Alibaba Cloud SDK
Authorize the calling identity in RAM as described in Section 1. Configure the AccessKey or temporary STS credentials according to the Alibaba Cloud credentials chain. Manage Access Credentials
In the OpenAPI Portal, select the Aidge
2026-04-28VacancyDetectionSyncoperation and your target region to generate an SDK example in your preferred language. Pass theImageandTypeparameters, and the SDK will handle serialization and signing. Aidge API CatalogParse
Data.Resultfrom the response and save theRequestIdfor troubleshooting.
Method 3: AccessKey or STS via manual signing
Generate an ACS3-HMAC-SHA256 signature according to Alibaba Cloud Signature V3 signing rules. Calculate the signature by using the request URL, parameters, headers, and body. The SHA-256 hash of the JSON request body is calculated from the raw bytes of the request.json file. After signing, send the request with the request.json file as the body. Instructions
curl --request POST 'https://aidge.cn-beijing.aliyuncs.com/' \
--header 'Content-Type: application/json' \
--header 'x-acs-action: VacancyDetectionSync' \
--header 'x-acs-version: 2026-04-28' \
--header "x-acs-date: ${ACS_DATE}" \
--header "x-acs-signature-nonce: ${ACS_NONCE}" \
--header "x-acs-content-sha256: ${ACS_CONTENT_SHA256}" \
--header "Authorization: ${ACS_AUTHORIZATION}" \
--data-binary @request.jsonACS_AUTHORIZATION is the complete authorization header value generated by your signing program. Generate a new UTC timestamp, nonce, and signature for each request. When using STS, add the x-acs-security-token request header and include it in the signature calculation.
5. Pricing
The list price for the Vacancy Detection synchronous API is CNY 0.03 per call.