Skip to main content

๐Ÿง  Image Classification

The /analyze endpoint allows you to extract visual information from a static image using AI-powered classification. It returns a list of detected objects, scenes, and tags, along with confidence scores.


๐Ÿ“ฅ Endpoint : POST /analyzeโ€‹

Base URL: https://api.visionary.ai/v1/analyze


๐Ÿ” Headersโ€‹

KeyValueRequired
AuthorizationBearer YOUR_API_KEYโœ…
Content-Typeapplication/json or multipart/form-dataโœ…

๐Ÿ“ธ Request Bodyโ€‹

Option 1 โ€“ JSON (Base64)โ€‹

{
"image": "data:image/jpeg;base64,/9j/4AAQSkZ..."
}

Option 2 โ€“ Multipartโ€‹

Use image as the field name when sending the file.

๐Ÿงช Example (curl โ€“ multipart)โ€‹

curl -X POST https://api.visionary.ai/v1/analyze \
-H "Authorization: Bearer demo-api-key" \
-F "image=@/path/to/image.jpg"

โœ… Responseโ€‹

{
"objects": [
{
"label": "cat",
"confidence": 0.984
},
{
"label": "sofa",
"confidence": 0.877
}
],
"tags": ["indoor", "living room", "pet"]
}

๐Ÿง  Fieldsโ€‹

FieldTypeDescription
labelstringName of the detected object or scene
confidencefloatValue between 0 and 1 (higher = more confident)
tagsarrayHigh-level context tags (non-exhaustive)

๐Ÿšซ Error Responsesโ€‹

CodeMessageCause
400"Missing required field: image"No image provided in request
401"Unauthorized"Invalid or missing API key
422"Unprocessable Entity"Corrupt or unsupported image

๐Ÿ“Œ Notesโ€‹

  • This endpoint is synchronous.

  • For best results, use images with clear subjects and good lighting.

  • The classification model is trained on a general dataset and may not identify niche objects.


๐Ÿ”— Next endpointโ€‹

โžก๏ธ Try the /emotion endpoint to analyze facial expressions.