POST /image-analysis
Send a photo and a question. RebelCore™ returns a written answer and the regions of the photo it’s concerned about, so your application can draw them over the photo.
"Does this radiator look like it's leaking or are the fins damaged?" ↓Answer: "The fins are visibly bent across the centre..."Regions: Bent fins, medium severity, at x 0.25, y 0.21, width 0.51, height 0.67There are two endpoints, which work the same way:
| Endpoint | Use it for |
|---|---|
POST /api/v1/image-analysis | One photo. The usual case. |
POST /api/v1/image-analysis/batch | Up to five photos with one question. |
Before you start
- A bearer token. From
/authorize(API user) or/authorize/totp(standard user). Either works. - Your organisation’s permission. Photos can’t be masked, so a photo reaches the AI model as it is, including any faces, number plates or documents in it. If your organisation’s settings don’t allow unmasked data to be sent to AI, these endpoints return
403 image_analysis_not_allowed.
Photos may be processed outside your data residency region.
Request
Send multipart/form-data, with your token in the Authorization: Bearer <token> header.
| Field | Type | Required | Notes |
|---|---|---|---|
image | file | yes, on /image-analysis | One JPEG, PNG or WebP photo. |
images | file, repeated | yes, on /image-analysis/batch | Up to five photos. |
query | text | yes | Your question, up to 1,000 characters. |
The whole request can be up to 25 MB. Each photo needs to be at least 32 pixels on its shortest side, and HEIC isn’t supported, so convert those first.
For a batch, shrink photos to around 2048 pixels on the long side before sending. That’s the size they’re analysed at anyway, and it saves upload time.
Response
200 OK. A response from /image-analysis:
{ "analysis_id": "7f3c1e0a9b2d4c6e8f10a2b3c4d5e6f7", "correlation_id": "api:4b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e", "status": "completed", "answer": "The fins are visibly bent across the centre, which can restrict airflow. The photo doesn't show clear wetness, so a leak can't be confirmed.", "regions": [ { "id": "r1", "label": "Bent and crushed fins", "severity": "medium", "certainty": "high", "explanation": "A broad central section has warped, folded fins.", "box": { "x": 0.25, "y": 0.21, "w": 0.51, "h": 0.67 } } ], "image": { "width": 605, "height": 330 }, "notice": "AI-generated visual assessment, not a professional inspection."}| Field | Notes |
|---|---|
status | completed, or cannot_assess if the photo is too blurry or dark, or doesn’t show what you asked about. answer then explains why. |
answer | The written answer. |
regions | Areas of concern, at most 10. Empty means nothing was found, or that the photo couldn’t be assessed. |
regions[].severity | low, medium or high: how much the problem matters. |
regions[].certainty | low, medium or high: how sure the analysis is that it’s a real problem. |
regions[].box | Where to draw it. See below. |
image | The size of the photo as analysed. It’s reduced to at most 2048 pixels on the long side. |
notice | Show this to your users alongside the results. |
analysis_id | Identifies this analysis in the audit. Log it with your own records. |
Drawing the regions
x and y are the top-left corner, and w and h the size, all as fractions of the photo’s width and height, from 0 to 1. Multiply by the size you display the photo at, and they fit at any size:
const left = box.x * displayedWidth;const top = box.y * displayedHeight;const width = box.w * displayedWidth;const height = box.h * displayedHeight;Coordinates refer to the upright photo. Phone cameras often store a photo sideways with a rotation tag, so display it with that rotation applied (most image libraries do this by default), or the boxes won’t line up.
Batch response
/image-analysis/batch returns one item per photo, in the order you sent them, each with an index:
{ "correlation_id": "api:4b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e", "items": [ { "index": 0, "status": "completed", "analysis_id": "…", "answer": "…", "regions": [], "image": {}, "notice": "…" }, { "index": 1, "status": "failed", "analysis_id": "…", "error": { "code": "invalid_image", "message": "…" } } ]}The call returns 200 once it starts running, even if some photos fail, so check each item’s status. Allow around a minute for five photos.
Errors
On /image-analysis, or for the whole request on /batch, the code is in detail.code:
| Status | Code | When |
|---|---|---|
401 | Missing, expired or invalid token, or a standard user who’s been deactivated. | |
403 | image_analysis_not_allowed | Your organisation doesn’t allow unmasked data to be sent to AI. |
403 | image_analysis_disabled | Photo analysis is turned off. |
413 | request_too_large | The request is over 25 MB. |
413 | image_too_large | The photo has more than 50 million pixels. |
415 | invalid_image | The file isn’t a readable JPEG, PNG or WebP. |
422 | image_too_small | The photo is under 32 pixels on a side. |
422 | too_many_photos | More than five photos on /batch. |
422 | query_required | The question is blank. |
429 | image_analysis_limit_reached | The daily limit is reached: 50 photos per user per day, counted in UTC. A batch of five counts as five. See the Retry-After header. |
502 | image_analysis_failed | The analysis failed. Try again. |
Audit and retention
Each analysis is recorded in your organisation’s audit and doesn’t create a chat session. A Customer Super Admin can review it under Audit → Photo analyses, including the photo and its regions.
Photos are stored in your organisation’s own storage and kept indefinitely. GPS and all other photo metadata are removed first, and the stored copy is the reduced, upright version.
Example
curl
curl https://api.rebelcore.ai/api/v1/image-analysis \ -H "Authorization: Bearer $TOKEN" \ -F "image=@radiator.jpg" \ -F "query=Are the fins damaged? Identify problem areas."Python (httpx)
import httpx
with open("radiator.jpg", "rb") as photo: r = httpx.post( "https://api.rebelcore.ai/api/v1/image-analysis", headers={"Authorization": f"Bearer {token}"}, files={"image": ("radiator.jpg", photo, "image/jpeg")}, data={"query": "Are the fins damaged? Identify problem areas."}, timeout=90.0, )r.raise_for_status()result = r.json()print(result["answer"])for region in result["regions"]: print(region["label"], region["severity"], region["box"])Python, up to five photos
names = ["front.jpg", "left.jpg", "right.jpg"]files = [("images", (name, open(name, "rb"), "image/jpeg")) for name in names]r = httpx.post( "https://api.rebelcore.ai/api/v1/image-analysis/batch", headers={"Authorization": f"Bearer {token}"}, files=files, data={"query": "Are the fins damaged? Identify problem areas."}, timeout=120.0,)r.raise_for_status()for item in r.json()["items"]: if item["status"] == "failed": print(names[item["index"]], "failed:", item["error"]["code"]) else: print(names[item["index"]], item["answer"])