AI Hairstyle Changer API documentation
Change the hairstyle of a person in an image.
Endpoints
| Contract item | Value |
|---|---|
| Capability | ai-hairstyle-changer |
| Submit | POST https://vidmage.ai/api/v1/ai-hairstyle-changer/submit |
| Query | POST https://vidmage.ai/api/v1/ai-hairstyle-changer/query |
| Task identifier | taskId |
| Result field | imageUrl |
Authenticate with Authorization: Bearer YOUR_API_KEY. Save the task identifier and query the same capability. Use a stable Idempotency-Key for submission retries.
Product guide: AI Hairstyle Changer API for Photo Editing
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
imageUrl | string | Yes | Not specified | URL of the source portrait image. |
hairstylePrompt | string | Yes | Not specified | Text description of the desired hairstyle. |
Example request
{
"imageUrl": "https://vidmage.ai/assets/images/samples/blue-eyed-woman-sunlight.webp",
"hairstylePrompt": "Replace the current hairstyle with shoulder-length soft waves and natural curtain bangs"
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/ai-hairstyle-changer/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"imageUrl":"https://vidmage.ai/assets/images/samples/blue-eyed-woman-sunlight.webp","hairstylePrompt":"Replace the current hairstyle with shoulder-length soft waves and natural curtain bangs"}'
# -> { "success": true, "taskId": "...", "creditsConsumed": ... }Task results and recovery
URL of the result image with the new hairstyle. Read imageUrl from the completed query response. Preserve taskId while the task is running.
curl -X POST "https://vidmage.ai/api/v1/ai-hairstyle-changer/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "taskId": "TASK_ID_FROM_SUBMIT" }'
# -> { "success": true, "data": { "status": "...", "imageUrl": "https://..." } }Submission and task queries report the available task and usage information. A timeout is not a confirmed failure. Recover the existing task instead of resubmitting.
For face selection and error recovery, follow Task lifecycle. MCP uses the normalized taskId argument in get_task_result, including capabilities whose REST identifier is requestId.
Credits
| Component / option | Rate | Minimum |
|---|---|---|
| Per request | 5 credits / image | — |
A fixed credit charge applies to this API request.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
