Export API
Endpoints for image compression and export.
Export Images
Start the export pipeline for images in a session. Returns a Server-Sent Events (SSE) stream with real-time progress.
Method: POSTPath: /v1/sessions/:sessionId/exportAuthentication: Required
Response: text/event-stream (SSE)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Session ID from the upload step |
images | array | Yes | Array of image objects to export |
images[].id | string | Yes | Image ID from the upload response |
images[].uploadPath | string | Yes | Server-side file path |
images[].originalFilename | string | Yes | Original filename |
images[].metadata | object | No | AI metadata (if available). Contains filename for renaming. |
settings | object | Yes | Export configuration |
Settings Object
| Field | Type | Default | Description |
|---|---|---|---|
format | string | "webp" | Output format: webp, avif, jpeg, png, or original |
preset | string | "high" | Quality preset: maximum, very_high, high, medium, low, minimum |
responsive | boolean | false | Generate responsive size variants |
responsiveSizes | object[] | — | Custom breakpoints when responsive is true |
SSE Events
| Event | Description |
|---|---|
progress | Fired during processing. Contains imageId, status, step, current, total. |
complete | Fired when all images are exported. Contains full results array with variant details. |
error | Fired on failure. Contains error message. |
Export Result Object
Each image result contains an array of variants:
| Field | Type | Description |
|---|---|---|
name | string | Variant name (e.g., full, 1024w, 768w) |
path | string | Server-side path to the exported file |
size | number | File size in bytes |
width | number | Image width in pixels |
height | number | Image height in pixels |
Filename Behavior
- If
images[].metadata.filenameexists, it's used as the output basename (e.g.,golden-gate-bridge-sunset.webp) - If no metadata filename, the original filename is used with the new extension (e.g.,
photo1.webp)
Credit Cost
1 credit per image. Credits are deducted by the Flask API gateway before proxying.
Download Exported File
Download a specific exported file from a session.
Method: GETPath: /v1/sessions/:sessionId/downloadQuery Parameters: filename — the exported filename to download
Response: Binary file with appropriate Content-Type header
