Analyze API

Endpoints for AI image analysis.

Analyze Images

Start AI analysis for images in a session. Returns a Server-Sent Events (SSE) stream with real-time progress.

Request
SSE Stream
curl -X POST \
     -H "X-API-Key: sk-your-key-here" \
     -H "Content-Type: application/json" \
     -d '{
       "sessionId": "sess_abc123def456",
       "images": [
         {
           "id": "img_001",
           "uploadPath": "/tmp/sessions/sess_abc123def456/photo1.jpg",
           "originalFilename": "photo1.jpg"
         }
       ]
     }' \
     https://your-api-domain.com/image-forge-api/v1/sessions/sess_abc123def456/analyze

Method: POSTPath: /v1/sessions/:sessionId/analyzeAuthentication: Required Response: text/event-stream (SSE)

Request Body

FieldTypeRequiredDescription
sessionIdstringYesSession ID from the upload step
imagesarrayYesArray of image objects to analyze
images[].idstringYesImage ID from the upload response
images[].uploadPathstringYesServer-side path from the upload response
images[].originalFilenamestringYesOriginal filename

SSE Events

EventDescription
progressFired for each image as analysis begins. Contains imageId, status, current, total.
resultFired when an image's analysis completes. Contains imageId and full metadata object.
errorFired if an image fails analysis. Contains imageId and error message.
completeFired when all images are processed. Contains status, processed, total.

Metadata Object

FieldTypeDescription
titlestringDescriptive title
altstringSEO-optimized alt text
captionstringNatural-language caption
descriptionstringExtended description
filenamestringSuggested filename (no extension)
seoTagsstring[]Array of relevant keywords

Credit Cost

1 credit per image. Credits are deducted by the Flask API gateway before the request is proxied to the analysis engine.

Analyze Single Image

Analyze a single image (non-streaming). Useful for processing one image at a time.

curl -X POST \
     -H "X-API-Key: sk-your-key-here" \
     -H "Content-Type: application/json" \
     -d '{
       "sessionId": "sess_abc123def456",
       "image": {
         "id": "img_001",
         "uploadPath": "/tmp/sessions/sess_abc123def456/photo1.jpg",
         "originalFilename": "photo1.jpg"
       }
     }' \
     https://your-api-domain.com/image-forge-api/v1/sessions/sess_abc123def456/analyze-single

Method: POSTPath: /v1/sessions/:sessionId/analyze-singleResponse: JSON (non-streaming)