> ## Documentation Index
> Fetch the complete documentation index at: https://docs.perceptron.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Detect

## 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 text `categories`, 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](/capabilities/detect).


## OpenAPI

````yaml api-reference/openapi.json POST /v1/detect
openapi: 3.1.0
info:
  title: Perceptron API
  contact:
    name: Perceptron API Support
    email: support@perceptron.inc
  version: 1.0.0
servers:
  - url: https://api.perceptron.inc
security: []
tags:
  - name: Chat Completions
    description: Chat completions API (OpenAI-compatible)
  - name: Detection
    description: Native Perceptron image detection API
  - name: Models
    description: Model listing and metadata API
  - name: Files
    description: File upload, listing, retrieval, and deletion API
paths:
  /v1/detect:
    post:
      tags:
        - Detection
      operationId: handle_detect
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DetectRequest'
        required: true
      responses:
        '200':
          description: Detection completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetectResponse'
        '400':
          description: Invalid detection request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerceptronErrorResponse'
        '401':
          description: Authentication failed. Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerceptronErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerceptronErrorResponse'
        '500':
          description: Internal error while processing detection.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerceptronErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    DetectRequest:
      type: object
      required:
        - media
      properties:
        categories:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            Category names to detect. Entries must be non-empty and must not
            contain commas.
        config:
          $ref: '#/components/schemas/DetectConfig'
        exemplars:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/DetectExemplar'
        media:
          $ref: '#/components/schemas/DetectMedia'
        negative_exemplars:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/DetectNegativeExemplar'
      additionalProperties: false
    DetectResponse:
      type: object
      required:
        - detections
        - finish_reason
      properties:
        detections:
          type: array
          items:
            $ref: '#/components/schemas/Detection'
        finish_reason:
          $ref: '#/components/schemas/DetectFinishReason'
      additionalProperties: false
    PerceptronErrorResponse:
      type: object
      description: Native Perceptron error response format.
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/PerceptronErrorDetail'
    DetectConfig:
      type: object
      properties:
        enable_thinking:
          type: boolean
          description: Toggle reasoning ("thinking") on supported detect models.
          default: false
        output:
          $ref: '#/components/schemas/DetectOutput'
      additionalProperties: false
    DetectExemplar:
      type: object
      required:
        - media
        - annotations
      properties:
        annotations:
          type: array
          items:
            $ref: '#/components/schemas/DetectPointPrimitive'
        media:
          $ref: '#/components/schemas/DetectMedia'
    DetectMedia:
      oneOf:
        - type: object
          required:
            - image_url
            - type
          properties:
            image_url:
              type: string
              description: Image URL or data URL. Video is not supported by /v1/detect yet.
            type:
              type: string
              enum:
                - image
    DetectNegativeExemplar:
      type: object
      required:
        - media
      properties:
        media:
          $ref: '#/components/schemas/DetectMedia'
          description: Image known not to contain requested target objects.
    Detection:
      type: object
      required:
        - mention
      properties:
        mention:
          type: string
        point:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DetectPoint'
              description: Point in target-image pixel coordinates.
        point_box:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DetectPointBox'
              description: Bounding box in target-image pixel coordinates.
      additionalProperties: false
    DetectFinishReason:
      type: string
      enum:
        - complete
        - max_tokens
    PerceptronErrorDetail:
      type: object
      description: Native Perceptron error detail.
      required:
        - message
      properties:
        code:
          type:
            - string
            - 'null'
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        type:
          type:
            - string
            - 'null'
    DetectOutput:
      type: string
      enum:
        - box
        - point
    DetectPointPrimitive:
      type: object
      required:
        - mention
      properties:
        index:
          type:
            - integer
            - 'null'
          format: int64
        label:
          type:
            - string
            - 'null'
        mention:
          type: string
          description: >-
            Category/target identity for this exemplar annotation. Must not
            contain commas.
        point:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DetectPoint'
              description: Exemplar point annotation in exemplar-image pixel coordinates.
        point_box:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DetectPointBox'
              description: Exemplar box annotation in exemplar-image pixel coordinates.
        timestamp:
          type:
            - number
            - 'null'
          format: double
    DetectPoint:
      type: object
      required:
        - x
        - 'y'
      properties:
        x:
          type: number
          format: double
          description: X coordinate in image pixels.
        'y':
          type: number
          format: double
          description: Y coordinate in image pixels.
    DetectPointBox:
      type: object
      required:
        - top_left
        - bottom_right
      properties:
        bottom_right:
          $ref: '#/components/schemas/DetectPoint'
        top_left:
          $ref: '#/components/schemas/DetectPoint'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication using your Perceptron API key

````