sangtao.ai
API key

Characters

Add an image from a link

Add a reference image to a character from a public link.

POSThttps://api.sangtao.ai/v2/characters/{id}/ref-images/from-url

Authorization

  • X-Api-Keystring · headerrequired

    Your API key, from the API keys page of your account.

Path parameters

  • idstringrequired

    The ID in the path.

Body

  • imageUrlstringrequired

    A 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

StatuserrorCodeWhen
400VALIDATION_ERRORNo 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
400REFERENCE_IMAGE_UNREACHABLEThe image could not be downloaded from the link (error says why). 400 here; GPT Image answers the same code with 422
400UPLOAD_FAILEDThe image was downloaded but could not be saved — try again
404CHARACTER_NOT_FOUNDNo 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-url
curl -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
  }
}