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

Why Upload First?

  1. Performance - Base64 encoding inflates data by 33%, uploading first significantly reduces request payload size
  2. Reusability - Upload once, use the URL multiple times without re-transmitting

Workflow

Authorizations

string
required
Use Bearer Token for authenticationGet your API Key: Visit API Key Management

Body

file
required
Image fileSupported formats:
  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • WebP (.webp)
  • GIF (.gif)
Limits:
  • Maximum file size: 10MB
string
Upload purpose (optional)Default: generation

Response

boolean
Whether the request succeeded
object

Complete Example: Image-to-Image Workflow

Here’s a complete image-to-image workflow example:
Python Complete Example