POST /api/process-image
Processes an uploaded image using AI to apply style transformations based on a prompt. This endpoint enhances real estate photos using the Nano Banana Pro AI model.Authentication
This endpoint requires authentication. Include your session token in the request.Request Body
The ID of the image generation record to process. This should reference an existing image in the database with status
pending.Request Example
Request
Response
Indicates whether the processing completed successfully.
The URL of the processed result image stored in Supabase.
Optional message, such as “Already processed” if the image was previously completed.
Error message if the request failed.
Additional error details for debugging.
Response Examples
Status Codes
Image processed successfully or already completed.
Missing
imageId parameter.Image record not found in database.
Processing failed due to AI service error or internal error.
Processing Flow
- Validation - Verifies the image record exists and hasn’t been processed
- Status Update - Sets status to
processing - Upload to Fal.ai - Uploads the original image to Fal.ai storage
- AI Processing - Calls Nano Banana Pro AI model with the image and prompt
- Save Result - Downloads and stores the result in Supabase storage
- Database Update - Updates the image record with
completedstatus and result URL - Project Counts - Updates the project’s completed image count
Image Generation Schema
TheimageId parameter references the imageGeneration table:
AI Model Configuration
This endpoint uses the Nano Banana Pro Edit model with the following parameters:The style transformation prompt from the image generation record.
Array containing the original image URL uploaded to Fal.ai storage.
Number of images to generate (always 1 for this endpoint).
Output format for the processed image.
Health Check
You can verify the API is running with a GET request:Response
Notes
- Images are processed asynchronously via the API or Trigger.dev background jobs
- The endpoint prevents duplicate processing by checking if status is already
completed - All images are stored in Supabase with workspace/project organization
- Failed processing updates the status to
failedwith an error message - Project counts are automatically updated after processing completes
Related Endpoints
- Inpaint Image - Edit specific areas of an image
- Image Status - Check processing status