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

# Detect Distribution Board

> Upload an image of an electrical distribution board to run automated AI detection.

### What is detected
- **Board Characteristics:** Identifies whether the board is open or closed, whether the image is thermal, and computes blur metrics (with optional blur check).
- **Components:** Detects and localizes individual breakers and controls (such as MCB, RCBO, RCD, and Main Switch) with bounding boxes, labels, and confidence scores.
- **Layout & Structure:** Determines board orientation, RCD-protected MCB groupings, and total component counts.

### Supported files
- **Formats:** `.jpg`, `.jpeg`, `.png`
- **Max file size:** 10 MB
- **Content type:** `multipart/form-data` under the `file` field




## OpenAPI

````yaml /api/api-reference/detection.yml post /detect
openapi: 3.0.3
info:
  title: Field Sight API
  version: 1.0.0
  description: Field Sight electrical board analysis API.
servers:
  - url: https://api.novumlogictechnologies.com
security:
  - ApiKeyAuth: []
paths:
  /detect:
    post:
      tags:
        - Detection
      summary: Detect Distribution Board
      description: >
        Upload an image of an electrical distribution board to run automated AI
        detection.


        ### What is detected

        - **Board Characteristics:** Identifies whether the board is open or
        closed, whether the image is thermal, and computes blur metrics (with
        optional blur check).

        - **Components:** Detects and localizes individual breakers and controls
        (such as MCB, RCBO, RCD, and Main Switch) with bounding boxes, labels,
        and confidence scores.

        - **Layout & Structure:** Determines board orientation, RCD-protected
        MCB groupings, and total component counts.


        ### Supported files

        - **Formats:** `.jpg`, `.jpeg`, `.png`

        - **Max file size:** 10 MB

        - **Content type:** `multipart/form-data` under the `file` field
      operationId: detect
      parameters:
        - name: check_blur
          in: query
          required: false
          description: >-
            When set to `true`, enables image sharpness and blur level analysis.
            Defaults to `false`.
          schema:
            type: boolean
            default: false
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    The electrical distribution board image file to analyze
                    (.jpg, .jpeg, .png).
      responses:
        '200':
          description: Detection completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetectDistributionBoardResponse'
              example:
                id: 024b6370-ceef-464f-92e1-b001ade3e83
                source: api
                tokens_charged: 1
                status: completed
                created_at: '2026-11-11T10:44:10.410746Z'
                input:
                  endpoint: /detect
                  image_path: 901b68dd-ed2d-49c0-fee163f9bcb2/images/detect 01 demo.jpg
                  service_name: Detect Distribution Board
                output:
                  is_open: true
                  is_blurred: false
                  is_thermal: false
                  blur_percentage: 0
                  predictions:
                    num_detections: 21
                    counts:
                      MCB: 7
                      RCBO: 13
                      Main Switch: 1
                    board_direction: unidentified
                    was_cropped: true
                    crop_region:
                      x: 0
                      'y': 0
                      w: 768
                      h: 1024
                    rcd_groups: []
                    predictions:
                      - detection_id: 295497e9-151c-420d-b24d-f236e1fc162f
                        class_id: 1
                        class_name: Main Switch
                        confidence: 0.93
                        x: 276
                        'y': 709.5
                        width: 94.4
                        height: 79.8
        '400':
          description: Bad request (invalid query parameter or missing multipart file).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: BAD_REQUEST
                error: 'Invalid input: check_blur must be true or false'
        '401':
          description: Missing, invalid, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: UNAUTHORIZED
                error: API key not found or no longer valid
        '402':
          description: No active subscription or token balance exhausted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: TOKENS_EXHAUSTED
                error: Available usage was just used up.
        '413':
          description: File size exceeds the 10MB limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: FILE_TOO_LARGE
                error: file size exceeds 10MB limit
        '415':
          description: Unsupported media type or invalid file content.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: INVALID_FILE_CONTENT
                error: file content is not a valid JPEG or PNG image
        '422':
          description: Unprocessable entity (AI model failed to parse image).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: UNPROCESSABLE_ENTITY
                error: Unprocessable entity
        '429':
          description: Too many requests in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: TOO_MANY_PENDING_REQUESTS
                error: Too many requests in progress. Please wait a moment and retry.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: INTERNAL_ERROR
                error: Internal server error
components:
  schemas:
    DetectDistributionBoardResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        source:
          type: string
          example: api
        tokens_charged:
          type: integer
          example: 1
        status:
          type: string
          example: completed
        created_at:
          type: string
          format: date-time
        input:
          type: object
          properties:
            endpoint:
              type: string
            image_path:
              type: string
            service_name:
              type: string
        output:
          type: object
          properties:
            is_open:
              type: boolean
            is_blurred:
              type: boolean
            blur_percentage:
              type: number
            is_thermal:
              type: boolean
            predictions:
              type: object
              properties:
                num_detections:
                  type: integer
                counts:
                  type: object
                  additionalProperties:
                    type: integer
                board_direction:
                  type: string
                  enum:
                    - unidentified
                    - left_to_right_group
                    - right_to_left_group
                was_cropped:
                  type: boolean
                crop_region:
                  type: object
                  properties:
                    x:
                      type: integer
                    'y':
                      type: integer
                    w:
                      type: integer
                    h:
                      type: integer
                rcd_groups:
                  type: array
                  items:
                    type: object
                predictions:
                  type: array
                  items:
                    $ref: '#/components/schemas/DetectionPrediction'
    Error:
      type: object
      required:
        - code
        - error
      properties:
        code:
          type: string
          description: Standardized error code identifier.
          example: UNAUTHORIZED
        error:
          type: string
          description: Human-readable error description.
          example: API key not found or no longer valid
    DetectionPrediction:
      type: object
      properties:
        detection_id:
          type: string
        class_id:
          type: integer
        class_name:
          type: string
        confidence:
          type: number
          format: float
        x:
          type: number
          format: float
        'y':
          type: number
          format: float
        width:
          type: number
          format: float
        height:
          type: number
          format: float
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Field Sight API key.

````