Skip to main content
POST
The doc Playground does not support file uploads: Please use the cURL, Python, or JavaScript code examples below to test.
Important Change: For better performance and cost control, we no longer support passing base64 image data directly in generation APIs. Please use this API to upload images, get the URL, and then call the generation API.

Why upload images first?

  1. Performance Optimization - base64 encoding inflates data by 33%, uploading first significantly reduces request body size
  2. Reuse Images - Upload once, reuse the URL multiple times without redundant transfers

Workflow

Authorizations

string
required
All APIs require Bearer Token authenticationGet API Key:Visit API Key Management Page to get your API KeyAdd to request headers:

Body

file
required
Image fileSupported formats: JPEG (.jpg, .jpeg), PNG (.png), WebP (.webp), GIF (.gif)Maximum file size: 20MB

Response

string
Public access URL for the image, can be used directly in generation APIs (valid for 72 hours)
string
Original file name
string
Detected MIME type, e.g. image/jpeg
integer
File size in bytes
integer
Upload time as Unix timestamp (seconds)

Full Example: Image-to-Image Workflow

Python