Upload directly
https://sangtao.ai/api/v2/images/uploadSend a small image in a single request and get a URL back. Refused above about 1 MB.
One call instead of two, for a screenshot or a logo. Anything from about 1 MB up is refused with a 413 — and a photograph from a phone is larger than that, so use the presigned route for those.
Headers
X-Api-KeystringrequiredYour API key. Create one on the API Key page in your account.
Content-Typestringrequiredmultipart/form-data — not JSON. Most HTTP clients set this for you when you attach a file.
Request
FilebinaryrequiredThe image itself, as a form field named exactly "File". JPEG, PNG or WebP. Measured on production: 1.4 MB comes back 413, so anything from about 1 MB up needs the presigned route instead.
Response
imageUrlstringWhere the image now lives. This is what you pass as referenceImages.
imageIdstringMeasured on production: the same string as imageUrl, not a separate id. Use imageUrl — the name of this field promises something it does not deliver.
imageTypestringAlways "UPLOADED" for this endpoint. It tells apart images you sent from ones the platform generated.
/images/uploadcurl -X POST https://sangtao.ai/api/v2/images/upload -H "X-Api-Key: YOUR_KEY" -F "[email protected]"{
"success": true,
"data": {
"imageId": "https://cdn.sangtao.ai/content/284c42a4-.../0a900d6.png",
"imageUrl": "https://cdn.sangtao.ai/content/284c42a4-.../0a900d6.png",
"imageType": "UPLOADED"
},
"error": null,
"errorCode": null
}/images/uploadcurl -X POST https://sangtao.ai/api/v2/images/upload -H "X-Api-Key: YOUR_KEY" -F "[email protected]"{
"success": true,
"data": {
"imageId": "https://cdn.sangtao.ai/content/284c42a4-.../0a900d6.png",
"imageUrl": "https://cdn.sangtao.ai/content/284c42a4-.../0a900d6.png",
"imageType": "UPLOADED"
},
"error": null,
"errorCode": null
}