{
  "auth": {
    "env_vars": [
      "STAGING_API_KEY",
      "PRODUCTION_API_KEY"
    ],
    "header": "x-api-key",
    "notes": "Send the key via 'x-api-key' header. The server identifies api_env and requested_by based on the key.",
    "required": true,
    "users": {
      "production": "Configured by PRODUCTION_API_USER_NAME (default 'production')",
      "staging": "Configured by STAGING_API_USER_NAME (default 'staging')"
    }
  },
  "cell_naming": {
    "box_mapping": {
      "1": "c00",
      "10": "c12",
      "11": "c13",
      "12": "c14",
      "13": "c15",
      "14": "c16",
      "15": "c20",
      "16": "c21",
      "17": "c22",
      "18": "c23",
      "19": "c24",
      "2": "c01",
      "20": "c25",
      "21": "c26",
      "22": "c30",
      "23": "c31",
      "24": "c32",
      "25": "c33",
      "26": "c34",
      "27": "c35",
      "28": "c36",
      "3": "c02",
      "4": "c03",
      "5": "c04",
      "6": "c05",
      "7": "c06",
      "8": "c10",
      "9": "c11"
    },
    "description": "Cells are named using 4x7 grid coordinates (4 columns \u00d7 7 rows = 28 cells per region)",
    "format": "cXY where X=column (0-3), Y=row (0-6)"
  },
  "endpoints": {
    "GET /": "This documentation",
    "GET /api/health": "Health check",
    "GET /api/status/<process_id>": "Check processing status and get results [requires x-api-key]",
    "POST /api/detect": "Submit image for detection (form-data: image, id, region_number - ALL REQUIRED) [requires x-api-key]"
  },
  "message": "Pill Detection API",
  "response_format": {
    "data": {
      "regions": [
        {
          "cells": {
            "c00": {
              "box_number": 1,
              "pills": [
                {
                  "position": {
                    "h": 0.06,
                    "w": 0.05,
                    "x": 0.13,
                    "y": 0.19
                  }
                }
              ],
              "pills_count": 1,
              "position": {
                "h": 0.3,
                "w": 0.25,
                "x": 0.12,
                "y": 0.18
              }
            },
            "c01": {
              "box_number": 2,
              "pills": [
                {
                  "position": {
                    "h": 0.06,
                    "w": 0.05,
                    "x": 0.41,
                    "y": 0.2
                  }
                },
                {
                  "position": {
                    "h": 0.06,
                    "w": 0.05,
                    "x": 0.46,
                    "y": 0.23
                  }
                }
              ],
              "pills_count": 2,
              "position": {
                "h": 0.28,
                "w": 0.24,
                "x": 0.4,
                "y": 0.18
              }
            }
          },
          "region_id": "region_X",
          "region_number": "X",
          "total_boxes": "Boxes in this region",
          "total_pills": "Pills in this region"
        }
      ],
      "requested_region": "Region number requested",
      "total_boxes": "Total boxes in the requested region",
      "total_pills": "Total pills in the requested region",
      "total_regions": "Number of regions processed (always 1)"
    },
    "message": "Human readable status message",
    "progress": "Progress percentage (0-100)",
    "status": "completed|processing|error|queued",
    "timestamp": "ISO timestamp"
  },
  "usage_examples": {
    "detect_specific_region": "POST /api/detect with form-data: image=file.jpg, id=user123, region_number=2",
    "region_numbering": "Regions are numbered 1, 2, 3... from left to right based on their position in the image",
    "required_parameters": "All three parameters (image, id, region_number) are required"
  },
  "version": "1.0.0"
}
