Overview
Detection uses DETR (DEtection TRansformer) with a ResNet-50 backbone, trained by Meta AI on COCO 2017 and released under Apache 2.0, run as an 8-bit quantized ONNX model on APIVerve's servers. The image is decoded, turned upright from its EXIF orientation and, if larger, scaled so its longer side is at most 1,333 pixels, which is the most the model reads. DETR predicts 100 candidate objects per image directly, with no anchor boxes or non-maximum suppression; candidates below `minConfidence` are dropped and the rest are mapped back to the original image size.
`confidence` is the model's class probability, 0 to 1, rounded to 4 places. `box` is in pixels of the upright image: `x` and `y` are the top-left corner, measured from the top-left of the image. `normalizedBox` divides those by `imageWidth` and `imageHeight`. Objects are sorted by confidence, and `counts` tallies the returned objects by label, after the `labels` filter.
`labels` accepts the 80 COCO class names (`traffic light`, `cell phone`, `dining table` and so on), case-insensitive, with underscores or hyphens for spaces, simple plurals and common synonyms (sofa, television, phone, bike, motorbike, fridge). An unknown label returns 400 naming it. URLs are downloaded by APIVerve from public hosts only, with a 10 MB limit; the image service never fetches caller URLs itself.
Live Test Object Detector API →
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl -X POST https://api.apiverve.com/v1/objectdetector \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"image": "http://images.cocodataset.org/val2017/000000039769.jpg",
"minConfidence": 0.5
}'const res = await fetch('https://api.apiverve.com/v1/objectdetector', {
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"image": "http://images.cocodataset.org/val2017/000000039769.jpg",
"minConfidence": 0.5
}),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.post(
"https://api.apiverve.com/v1/objectdetector",
headers={"x-api-key": "your_api_key_here"},
json={
"image": "http://images.cocodataset.org/val2017/000000039769.jpg",
"minConfidence": 0.5
},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"image": "http://images.cocodataset.org/val2017/000000039769.jpg",
"minConfidence": 0.5
}`)
req, _ := http.NewRequest("POST", "https://api.apiverve.com/v1/objectdetector", body)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent as JSON in the request body. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
imageOptional | string | The image file to analyse (JPG, PNG, GIF or WebP, up to 10 MB), or a public image URL |
minConfidenceOptional | number | Lowest confidence to return, from 0.05 to 1 default 0.5 · range 0.05–1 |
labelsOptionalPremium | string | Comma-separated object labels to keep, such as person,car,dog; all 80 labels when omitted length 0–500 |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"status": "ok",
"error": null,
"data": {
"imageWidth": 640,
"imageHeight": 480,
"objectCount": 5,
"counts": {
"cat": 2,
"remote": 2,
"couch": 1
},
"objects": [
{
"label": "cat",
"confidence": 0.999,
"box": {
"x": 4,
"y": 51,
"width": 320,
"height": 417
},
"normalizedBox": {
"x": 0.0063,
"y": 0.1062,
"width": 0.5,
"height": 0.8688
}
},
{
"label": "cat",
"confidence": 0.9987,
"box": {
"x": 331,
"y": 20,
"width": 309,
"height": 350
},
"normalizedBox": {
"x": 0.5172,
"y": 0.0417,
"width": 0.4828,
"height": 0.7292
}
},
{
"label": "remote",
"confidence": 0.9984,
"box": {
"x": 329,
"y": 67,
"width": 42,
"height": 128
},
"normalizedBox": {
"x": 0.5141,
"y": 0.1396,
"width": 0.0656,
"height": 0.2667
}
},
{
"label": "remote",
"confidence": 0.9975,
"box": {
"x": 29,
"y": 68,
"width": 160,
"height": 50
},
"normalizedBox": {
"x": 0.0453,
"y": 0.1417,
"width": 0.25,
"height": 0.1042
}
},
{
"label": "couch",
"confidence": 0.9961,
"box": {
"x": 0,
"y": 0,
"width": 636,
"height": 472
},
"normalizedBox": {
"x": 0,
"y": 0,
"width": 0.9938,
"height": 0.9833
}
}
],
"minConfidence": 0.5,
"labels": null
}
}
Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
imageWidth | number | 640 | Width of the upright image in pixels |
imageHeight | number | 480 | Height of the upright image in pixels |
objectCount | number | 5 | Number of objects returned |
counts | object | {...} | Number of objects per label, such as {"car": 3} |
cat | number | 2 | |
remote | number | 2 | |
couch | number | 1 | |
objects | array[5] | Detected objects, highest confidence first | |
label | string | "cat" | Object class, one of the 80 COCO labels |
confidence | number | 0.999 | Model confidence from 0 to 1 |
box | object | {...} | Bounding box in pixels: x, y (top-left), width, height |
x | number | 4 | Left edge in pixels |
y | number | 51 | Top edge in pixels |
width | number | 320 | Box width in pixels |
height | number | 417 | Box height in pixels |
normalizedBox | object | {...} | The same box as fractions (0-1) of image width and height |
xPremium | number | 0.0063 | Left edge as a fraction of image width |
yPremium | number | 0.1062 | Top edge as a fraction of image height |
widthPremium | number | 0.5 | Box width as a fraction of image width |
heightPremium | number | 0.8688 | Box height as a fraction of image height |
minConfidence | number | 0.5 | Confidence threshold applied |
labels | object | null | Labels the results were filtered to, or null for all |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Object Labels
The 80 COCO object classes the labels parameter accepts
| Value |
|---|
person |
bicycle |
car |
motorcycle |
airplane |
bus |
train |
truck |
boat |
traffic light |
fire hydrant |
stop sign |
parking meter |
bench |
bird |
cat |
dog |
horse |
sheep |
cow |
elephant |
bear |
zebra |
giraffe |
backpack |
umbrella |
handbag |
tie |
suitcase |
frisbee |
skis |
snowboard |
sports ball |
kite |
baseball bat |
baseball glove |
skateboard |
surfboard |
tennis racket |
bottle |
wine glass |
cup |
fork |
knife |
spoon |
bowl |
banana |
apple |
sandwich |
orange |
broccoli |
carrot |
hot dog |
pizza |
donut |
cake |
chair |
couch |
potted plant |
bed |
dining table |
toilet |
tv |
laptop |
mouse |
remote |
keyboard |
cell phone |
microwave |
oven |
toaster |
sink |
refrigerator |
book |
clock |
vase |
scissors |
teddy bear |
hair drier |
toothbrush |
Use cases
- Counting and Occupancy
- Count people, cars or bicycles in camera snapshots to measure footfall, parking use or traffic.
- Image Tagging
- Tag uploaded photos with the objects they contain so they can be searched and filtered in a media library.
- Content Checks
- Confirm that listing photos actually show the item for sale, such as a car, bicycle or couch, before they are published.
- Smart Cropping
- Crop images around the main subject using its bounding box instead of the centre of the frame.
Other ways to use Object Detector
Set up Object Detector on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Images: