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

# Object detection

> Run inference on object detection models hosted on Epigos AI.

Once your models are deployed on the Epigos AI platform, they come with a readily accessible REST API.




## OpenAPI

````yaml post /predict/detect/{model_id}/
openapi: 3.0.0
info:
  title: Epigos API
  version: 0.1.0
  contact:
    name: Epigos Support
    email: hello@epigos.ai
    url: https://epigos.ai/contact
  termsOfService: https://epigos.ai/terms
  license:
    name: MIT
    url: https://raw.githubusercontent.com/Epigos-AI/docs/main/LICENSE
  description: |-
    Epigos AI API reference documentation.
    Our API is still very much a work in product and subject to change.
servers:
  - url: https://api.epigos.ai
security:
  - APIKeyHeader: []
  - APIKeyQuery: []
paths:
  /predict/detect/{model_id}/:
    post:
      tags:
        - Detection
      summary: Object detection
      description: >
        Run inference on object detection models hosted on Epigos AI.


        Once your models are deployed on the Epigos AI platform, they come with
        a readily accessible REST API.
      parameters:
        - name: model_id
          in: path
          required: true
          example: 5581982d-721c-4e3c-b863-da2d985364a2
          description: >-
            The unique ID of your model deployed on Epigos AI. You can find it
            in the web dashboard by viewing the model details.
          schema:
            type: string
            format: uuid
            title: Model Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ObjectDetectionIn'
            examples:
              Predict Image URL:
                value:
                  image: https://example.org/image.jpg
              Predict Base64 encoded image:
                value:
                  image: base64
              Predict with confidence threshold:
                value:
                  image: https://example.org/image.jpg
                  confidence: 0.7
              Predict with annotation options:
                value:
                  image: https://example.org/image.jpg
                  annotate: true
                  stroke_width: 2
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectDetectionResult'
              examples:
                Object Detection:
                  value:
                    image: base64
                    detections:
                      - label: car
                        confidence: 0.954
                        x: 281
                        'y': 187
                        width: 46
                        height: 36
                      - label: person
                        confidence: 0.854
                        x: 21
                        'y': 87
                        width: 40
                        height: 30
                    labelsCount:
                      - label: car
                        total: 1
                      - label: person
                        total: 1
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '401':
          description: Unauthorized Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPUnauthorizedError'
components:
  schemas:
    ObjectDetectionIn:
      description: >-
        You can POST a base64 encoded image directly to your model endpoint. Or
        you can pass a URL as the image parameter in the request body if image
        is already hosted elsewhere
      properties:
        image:
          type: string
          title: Image
          description: >-
            Image path to run detections on. It can be base64 encoded string or
            URL to the image.
          example: https://example.org/image.jpg
        confidence:
          type: number
          maximum: 1
          minimum: 0
          title: Confidence
          description: The confidence threshold used to filter out predictions
          nullable: false
          example: 0.7
        annotate:
          type: boolean
          title: Annotate
          description: >-
            Indicate whether to draw bounding boxes on the image for the
            detected objects
          nullable: false
          default: true
        show_prob:
          type: boolean
          title: Show Probabilities
          description: Indicate whether to show prediction confidences on each bounding box
          nullable: true
          default: true
        stroke_width:
          type: number
          title: Stroke width
          maximum: 5
          minimum: 1
          description: Bounding box border width
          nullable: true
      additionalProperties: false
      type: object
      required:
        - image
      title: ObjectDetectionIn
    ObjectDetectionResult:
      description: >
        The API inference route hosted by us returns a JSON object that includes
        a predictions array. Each prediction within this array comprises the
        following attributes:
      properties:
        detections:
          items:
            $ref: '#/components/schemas/DetectedObject'
          type: array
          title: Detections
          description: collection of all detected objects for the prediction
        image:
          type: string
          title: Image
          description: Base64-encoded string of the annotated image.
          nullable: true
        labelsCount:
          items:
            $ref: '#/components/schemas/ObjectLabelCount'
          type: array
          title: Labels Count
          description: aggregate of count of all detected objects
      additionalProperties: false
      type: object
      title: ObjectDetectionResult
    HTTPValidationError:
      title: Bad Request
      description: Bad Request (HTTP 400).
      properties:
        type:
          type: string
          description: '`error`.'
          enum:
            - error
          example: error
        code:
          type: string
          description: '`bad_request`.'
          example: bad_request
          enum:
            - bad_request
        status:
          type: integer
          description: '`400`.'
          example: 400
          enum:
            - 400
        message:
          type: string
          description: >-
            Describes the fields that are missing or incorrectly formatted in
            the API

            request.
          example: Missing '****' field
        details:
          type: array
          description: >-
            A list of detail objects that further clarify the reason for the
            error.
          items:
            $ref: '#/components/schemas/ErrorDetail'
    HTTPUnauthorizedError:
      title: Unauthorized Error
      description: Unauthorized Error (HTTP 401)
      properties:
        type:
          type: string
          description: '`error`.'
          enum:
            - error
          example: error
        code:
          type: string
          description: '`unauthorized`.'
          example: unauthorized
          enum:
            - unauthorized
        status:
          type: integer
          description: '`401`.'
          example: 401
          enum:
            - 401
        message:
          type: string
          description: No valid API authentication found.
          example: Invalid or missing credentials
          enum:
            - Invalid or missing credentials
        details:
          type: array
          example: []
          description: >-
            A list of detail objects that further clarify the reason for the
            error.
          items:
            $ref: '#/components/schemas/ErrorDetail'
    DetectedObject:
      properties:
        label:
          type: string
          title: Label
          description: the label of the detected object.
        confidence:
          type: number
          title: Confidence
          description: the model's confidence that the image contains the detected objects.
        x:
          type: number
          title: X
          description: X-coordinates of the bounding box of the detected object.
        'y':
          type: number
          title: 'Y'
          description: Y-coordinates of the bounding box of the detected object.
        width:
          type: number
          title: Width
          description: Width of the bounding box of the detected object.
        height:
          type: number
          title: Height
          description: Height of the bounding box of the detected object.
      additionalProperties: false
      type: object
      title: DetectedObject
    ObjectLabelCount:
      properties:
        label:
          type: string
          title: Label
          description: the label of the detected object.
        total:
          type: number
          title: Total
          description: the total number of detections for the label.
      additionalProperties: false
      type: object
      title: ObjectLabelCount
    ErrorDetail:
      description: Additional detail about the part of a request body that caused an issue
      properties:
        location:
          type: string
          example: body
          description: The location where the error caused an issue.
          enum:
            - query
            - body
            - path
            - header
        type:
          type: string
          example: value_error.missing
          description: A unique identifier for the type of error that occurred.
        pointer:
          type: string
          example: /image
          description: >-
            The exact item for which the validation did not succeed. This is a
            JSON

            pointer for request bodies, while for query, path, and header
            parameters

            it is the name of the parameter.
        message:
          type: string
          example: field required
          description: A human readable message for this error detail.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your API key (obtained via your workspace API settings page)
    APIKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: Your API key (obtained via your workspace API settings page)

````