AI tasks are asynchronous. Prefer webhook-based completion handling when the feature supports webhooks. Configure your webhook endpoint, verify webhook signatures, and use the received task_id to query the task result after a success or error notification. See the webhook integration guide for setup and verification details.
If webhooks are not supported for the feature, or if your integration cannot use webhooks, implement polling. After starting an AI task, keep polling the task status endpoint at the given polling_interval until the task status is either success or error.
Do not stop polling a running task for longer than the allowed polling window. If the task is not polled in time, the task may expire; a later status check can return InvalidTaskId even if processing finished, and the consumed units may still be charged.
Zero-based index of the target object to apply the effect to. For multi-objects images, run the pre-process task first, inspect the object coordinates in data.results.result, and pass the index of the selected object here.
The pre-processing step analyzes the input image to identify all detectable objects before any effect is applied. It runs a detection task that returns structured data for each object, including a list of bounding box coordinates. The position of each entry in this list serves as its zero-based index, which is then used to specify the target object for the effect.
This information is returned in a structured format, commonly under data.results.result. By running this step first, you can:
- Understand how many objects are present in the image
- Inspect their positions and sizes
- Select the correct target object by its index
Always run the pre-processing step for images with multiple objects. Review data.results.result to identify objects and their indices. Use the corresponding zero-based index to select the correct target.
- Run task with src file url
- Run task with src file ID
curl -i -X POST \
https://yce-api-01.makeupar.com/s2s/v2.0/task/teeth-whiten \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"src_file_url": "https://example.com/selfie.jpg",
"version": "1.0",
"index": 0,
"effect": {
"whitening_intensity": 100,
"skin_smooth_strength": 50,
"skin_smooth_color_intensity": 50
}
}'{ "status": 200, "data": { "task_id": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe" } }