Characters
Add an image from a link
Add a reference image to a character from a public link.
POST
https://api.sangtao.ai/v2/characters/{id}/ref-images/from-urlAuthorization
X-Api-Keystring · headerrequiredYour API key, from the API keys page of your account.
Path parameters
idstringrequiredThe ID in the path.
Body
imageUrlstringrequiredA public http or https link to a JPEG, PNG or WEBP image, up to 10 MB. It is downloaded and a copy is kept
Response
The image added: { id, imageUrl, thumbnailUrl, sortOrder }. thumbnailUrl is null at first, and filled in a few seconds later.
Errors
| Status | errorCode | When |
|---|---|---|
| 400 | VALIDATION_ERROR | No imageUrl, the link is not http/https, it is a file of another account, it is not a JPEG, PNG or WEBP, or the character already has 3 images |
| 400 | REFERENCE_IMAGE_UNREACHABLE | The image could not be downloaded from the link (error says why). 400 here; GPT Image answers the same code with 422 |
| 400 | UPLOAD_FAILED | The image was downloaded but could not be saved — try again |
| 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-images/from-urlcurl -X POST "https://api.sangtao.ai/v2/characters/ch_3kT9qPz0B/ref-images/from-url" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/meo.png"
}'{
"success": true,
"data": {
"id": "ci_8hQ2mZr4K",
"imageUrl": "https://…/a.png",
"thumbnailUrl": null,
"sortOrder": 0
}
}POST
/characters/{id}/ref-images/from-urlcurl -X POST "https://api.sangtao.ai/v2/characters/ch_3kT9qPz0B/ref-images/from-url" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/meo.png"
}'{
"success": true,
"data": {
"id": "ci_8hQ2mZr4K",
"imageUrl": "https://…/a.png",
"thumbnailUrl": null,
"sortOrder": 0
}
}