Characters
Upload a reference image
Upload a reference image to a character: JPEG, PNG or WEBP, up to 10 MB.
POST
https://api.sangtao.ai/v2/characters/{id}/ref-imagesAuthorization
X-Api-Keystring · headerrequiredYour API key, from the API keys page of your account.
Path parameters
idstringrequiredThe ID in the path.
Sent as
multipart/form-data, the file in the field file — e.g. curl -F "[email protected]". The playground cannot send a file, so the code column shows only the address.Body
filefile · multipart/form-datarequiredThe image: JPEG, PNG or WEBP, up to 10 MB
Response
The image added: { id, imageUrl, thumbnailUrl, sortOrder } — as the refImages[] items under List characters. At most 3 images per character.
Errors
| Status | errorCode | When |
|---|---|---|
| 400 | VALIDATION_ERROR | No file, not a JPEG, PNG or WEBP, over 10 MB, or the character already has 3 images (the 4th is refused) |
| 404 | CHARACTER_NOT_FOUND | No such character, or it is not yours |
An error has success: false, errorCode as above, and error is a sentence saying what went wrong.
POST
/characters/{id}/ref-imagescurl -X POST "https://api.sangtao.ai/v2/characters/ch_3kT9qPz0B/ref-images" \
-H "X-Api-Key: YOUR_API_KEY"{
"success": true,
"data": {
"id": "ci_8hQ2mZr4K",
"imageUrl": "https://…/a.png",
"thumbnailUrl": "https://…/a_thumb.webp",
"sortOrder": 0
}
}POST
/characters/{id}/ref-imagescurl -X POST "https://api.sangtao.ai/v2/characters/ch_3kT9qPz0B/ref-images" \
-H "X-Api-Key: YOUR_API_KEY"{
"success": true,
"data": {
"id": "ci_8hQ2mZr4K",
"imageUrl": "https://…/a.png",
"thumbnailUrl": "https://…/a_thumb.webp",
"sortOrder": 0
}
}