cURL
curl --request POST \
--url https://api.perceptron.inc/v1/detect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"media": {
"image_url": "<string>",
"type": "image"
},
"categories": [
"<string>"
],
"config": {
"enable_thinking": false
},
"exemplars": [
{
"annotations": [
{
"mention": "<string>",
"index": 123,
"label": "<string>",
"point": {
"x": 123,
"y": 123
},
"point_box": {
"bottom_right": {
"x": 123,
"y": 123
},
"top_left": {
"x": 123,
"y": 123
}
},
"timestamp": 123
}
],
"media": {
"image_url": "<string>",
"type": "image"
}
}
],
"negative_exemplars": [
{
"media": {
"image_url": "<string>",
"type": "image"
}
}
]
}
'import requests
url = "https://api.perceptron.inc/v1/detect"
payload = {
"media": {
"image_url": "<string>",
"type": "image"
},
"categories": ["<string>"],
"config": { "enable_thinking": False },
"exemplars": [
{
"annotations": [
{
"mention": "<string>",
"index": 123,
"label": "<string>",
"point": {
"x": 123,
"y": 123
},
"point_box": {
"bottom_right": {
"x": 123,
"y": 123
},
"top_left": {
"x": 123,
"y": 123
}
},
"timestamp": 123
}
],
"media": {
"image_url": "<string>",
"type": "image"
}
}
],
"negative_exemplars": [{ "media": {
"image_url": "<string>",
"type": "image"
} }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
media: {image_url: '<string>', type: 'image'},
categories: ['<string>'],
config: {enable_thinking: false},
exemplars: [
{
annotations: [
{
mention: '<string>',
index: 123,
label: '<string>',
point: {x: 123, y: 123},
point_box: {bottom_right: {x: 123, y: 123}, top_left: {x: 123, y: 123}},
timestamp: 123
}
],
media: {image_url: '<string>', type: 'image'}
}
],
negative_exemplars: [{media: {image_url: '<string>', type: 'image'}}]
})
};
fetch('https://api.perceptron.inc/v1/detect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.perceptron.inc/v1/detect",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'media' => [
'image_url' => '<string>',
'type' => 'image'
],
'categories' => [
'<string>'
],
'config' => [
'enable_thinking' => false
],
'exemplars' => [
[
'annotations' => [
[
'mention' => '<string>',
'index' => 123,
'label' => '<string>',
'point' => [
'x' => 123,
'y' => 123
],
'point_box' => [
'bottom_right' => [
'x' => 123,
'y' => 123
],
'top_left' => [
'x' => 123,
'y' => 123
]
],
'timestamp' => 123
]
],
'media' => [
'image_url' => '<string>',
'type' => 'image'
]
]
],
'negative_exemplars' => [
[
'media' => [
'image_url' => '<string>',
'type' => 'image'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.perceptron.inc/v1/detect"
payload := strings.NewReader("{\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n },\n \"categories\": [\n \"<string>\"\n ],\n \"config\": {\n \"enable_thinking\": false\n },\n \"exemplars\": [\n {\n \"annotations\": [\n {\n \"mention\": \"<string>\",\n \"index\": 123,\n \"label\": \"<string>\",\n \"point\": {\n \"x\": 123,\n \"y\": 123\n },\n \"point_box\": {\n \"bottom_right\": {\n \"x\": 123,\n \"y\": 123\n },\n \"top_left\": {\n \"x\": 123,\n \"y\": 123\n }\n },\n \"timestamp\": 123\n }\n ],\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ],\n \"negative_exemplars\": [\n {\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.perceptron.inc/v1/detect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n },\n \"categories\": [\n \"<string>\"\n ],\n \"config\": {\n \"enable_thinking\": false\n },\n \"exemplars\": [\n {\n \"annotations\": [\n {\n \"mention\": \"<string>\",\n \"index\": 123,\n \"label\": \"<string>\",\n \"point\": {\n \"x\": 123,\n \"y\": 123\n },\n \"point_box\": {\n \"bottom_right\": {\n \"x\": 123,\n \"y\": 123\n },\n \"top_left\": {\n \"x\": 123,\n \"y\": 123\n }\n },\n \"timestamp\": 123\n }\n ],\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ],\n \"negative_exemplars\": [\n {\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perceptron.inc/v1/detect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n },\n \"categories\": [\n \"<string>\"\n ],\n \"config\": {\n \"enable_thinking\": false\n },\n \"exemplars\": [\n {\n \"annotations\": [\n {\n \"mention\": \"<string>\",\n \"index\": 123,\n \"label\": \"<string>\",\n \"point\": {\n \"x\": 123,\n \"y\": 123\n },\n \"point_box\": {\n \"bottom_right\": {\n \"x\": 123,\n \"y\": 123\n },\n \"top_left\": {\n \"x\": 123,\n \"y\": 123\n }\n },\n \"timestamp\": 123\n }\n ],\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ],\n \"negative_exemplars\": [\n {\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"detections": [
{
"mention": "<string>",
"point": {
"x": 123,
"y": 123
},
"point_box": {
"bottom_right": {
"x": 123,
"y": 123
},
"top_left": {
"x": 123,
"y": 123
}
}
}
]
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}Detect
POST
/
v1
/
detect
cURL
curl --request POST \
--url https://api.perceptron.inc/v1/detect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"media": {
"image_url": "<string>",
"type": "image"
},
"categories": [
"<string>"
],
"config": {
"enable_thinking": false
},
"exemplars": [
{
"annotations": [
{
"mention": "<string>",
"index": 123,
"label": "<string>",
"point": {
"x": 123,
"y": 123
},
"point_box": {
"bottom_right": {
"x": 123,
"y": 123
},
"top_left": {
"x": 123,
"y": 123
}
},
"timestamp": 123
}
],
"media": {
"image_url": "<string>",
"type": "image"
}
}
],
"negative_exemplars": [
{
"media": {
"image_url": "<string>",
"type": "image"
}
}
]
}
'import requests
url = "https://api.perceptron.inc/v1/detect"
payload = {
"media": {
"image_url": "<string>",
"type": "image"
},
"categories": ["<string>"],
"config": { "enable_thinking": False },
"exemplars": [
{
"annotations": [
{
"mention": "<string>",
"index": 123,
"label": "<string>",
"point": {
"x": 123,
"y": 123
},
"point_box": {
"bottom_right": {
"x": 123,
"y": 123
},
"top_left": {
"x": 123,
"y": 123
}
},
"timestamp": 123
}
],
"media": {
"image_url": "<string>",
"type": "image"
}
}
],
"negative_exemplars": [{ "media": {
"image_url": "<string>",
"type": "image"
} }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
media: {image_url: '<string>', type: 'image'},
categories: ['<string>'],
config: {enable_thinking: false},
exemplars: [
{
annotations: [
{
mention: '<string>',
index: 123,
label: '<string>',
point: {x: 123, y: 123},
point_box: {bottom_right: {x: 123, y: 123}, top_left: {x: 123, y: 123}},
timestamp: 123
}
],
media: {image_url: '<string>', type: 'image'}
}
],
negative_exemplars: [{media: {image_url: '<string>', type: 'image'}}]
})
};
fetch('https://api.perceptron.inc/v1/detect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.perceptron.inc/v1/detect",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'media' => [
'image_url' => '<string>',
'type' => 'image'
],
'categories' => [
'<string>'
],
'config' => [
'enable_thinking' => false
],
'exemplars' => [
[
'annotations' => [
[
'mention' => '<string>',
'index' => 123,
'label' => '<string>',
'point' => [
'x' => 123,
'y' => 123
],
'point_box' => [
'bottom_right' => [
'x' => 123,
'y' => 123
],
'top_left' => [
'x' => 123,
'y' => 123
]
],
'timestamp' => 123
]
],
'media' => [
'image_url' => '<string>',
'type' => 'image'
]
]
],
'negative_exemplars' => [
[
'media' => [
'image_url' => '<string>',
'type' => 'image'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.perceptron.inc/v1/detect"
payload := strings.NewReader("{\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n },\n \"categories\": [\n \"<string>\"\n ],\n \"config\": {\n \"enable_thinking\": false\n },\n \"exemplars\": [\n {\n \"annotations\": [\n {\n \"mention\": \"<string>\",\n \"index\": 123,\n \"label\": \"<string>\",\n \"point\": {\n \"x\": 123,\n \"y\": 123\n },\n \"point_box\": {\n \"bottom_right\": {\n \"x\": 123,\n \"y\": 123\n },\n \"top_left\": {\n \"x\": 123,\n \"y\": 123\n }\n },\n \"timestamp\": 123\n }\n ],\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ],\n \"negative_exemplars\": [\n {\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.perceptron.inc/v1/detect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n },\n \"categories\": [\n \"<string>\"\n ],\n \"config\": {\n \"enable_thinking\": false\n },\n \"exemplars\": [\n {\n \"annotations\": [\n {\n \"mention\": \"<string>\",\n \"index\": 123,\n \"label\": \"<string>\",\n \"point\": {\n \"x\": 123,\n \"y\": 123\n },\n \"point_box\": {\n \"bottom_right\": {\n \"x\": 123,\n \"y\": 123\n },\n \"top_left\": {\n \"x\": 123,\n \"y\": 123\n }\n },\n \"timestamp\": 123\n }\n ],\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ],\n \"negative_exemplars\": [\n {\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perceptron.inc/v1/detect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n },\n \"categories\": [\n \"<string>\"\n ],\n \"config\": {\n \"enable_thinking\": false\n },\n \"exemplars\": [\n {\n \"annotations\": [\n {\n \"mention\": \"<string>\",\n \"index\": 123,\n \"label\": \"<string>\",\n \"point\": {\n \"x\": 123,\n \"y\": 123\n },\n \"point_box\": {\n \"bottom_right\": {\n \"x\": 123,\n \"y\": 123\n },\n \"top_left\": {\n \"x\": 123,\n \"y\": 123\n }\n },\n \"timestamp\": 123\n }\n ],\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ],\n \"negative_exemplars\": [\n {\n \"media\": {\n \"image_url\": \"<string>\",\n \"type\": \"image\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"detections": [
{
"mention": "<string>",
"point": {
"x": 123,
"y": 123
},
"point_box": {
"bottom_right": {
"x": 123,
"y": 123
},
"top_left": {
"x": 123,
"y": 123
}
}
}
]
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}Overview
The Detect API returns grounded object detections for a single image. Use it when you want a direct detection workflow without building a chat-completions prompt. Requests can include textcategories, annotated positive exemplars, both together, or no targets for exhaustive object detection. You can also include negative_exemplars, but only alongside at least one category or positive exemplar. Coordinates for exemplar annotations and returned detections are image pixels.
/v1/detect supports image inputs only and returns detections plus a finish_reason. The response does not include confidence scores.
For request shapes, worked examples, supported permutations, and limits, see the Detect capability guide.Authorizations
Bearer token authentication using your Perceptron API key
Body
application/json
⌘I