{
  "swagger": "2.0",
  "info": {
    "version": "Swagger 2.0",
    "title": "FaceMine: Biometric Face Detection & Anti-Spoofing Liveness"
  },
  "basePath": "https://services.forecastica.com",
  "securityDefinitions": {
    "Bearer": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header",
      "description": "Send Authorization Header for all API calls with value: Bearer API-KEY (Your API KEY was returned in JSON returned during registration"
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ],
  "paths": {
    "/aws/api/photo/faces/detect": {
      "post": {
        "summary": "Detect faces in photos",
        "description": "Analyzes an image and returns an array of bounding boxes for detected faces.",
        "responses": {
          "200": {
            "description": "Successful detection",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/FaceDetectionResult"
              }
            }
          }
        }
      }
    },
    "/aws/api/video/faces/detect": {
      "post": {
        "summary": "Upload video for face detection",
        "description": "Starts an asynchronous job to detect faces in a video.",
        "responses": {
          "202": {
            "description": "Job created",
            "schema": {
              "$ref": "#/definitions/JobResponse"
            }
          }
        }
      }
    },
    "/aws/api/video/faces/detect/jobId/{jobId}": {
      "get": {
        "summary": "Get video face detection results",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Array of face detections with timestamps",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/VideoFaceDetectionResult"
              }
            }
          }
        }
      }
    },
    "/aws/api/photo/liveness": {
      "post": {
        "summary": "Perform liveness check on photo",
        "description": "Detects if the person in the photo is real or a spoof (paper/screen).",
        "responses": {
          "200": {
            "description": "Returns array of BoundingBox objects",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/LivenessResult"
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "FaceDetectionResult": {
      "type": "object",
      "properties": {
        "X": { "type": "integer" },
        "Y": { "type": "integer" },
        "Width": { "type": "integer" },
        "Height": { "type": "integer" }
      }
    },
    "JobResponse": {
      "type": "object",
      "properties": {
        "jobId": {
          "type": "string",
          "example": "aadf167a-f583-478e-bd25-1fa2947bb5a6"
        },
         "status": {
           "type": "string",
           "example": "Processing | Pending | Failed or VideoFaceDetectionResults "
      }	 },  
    },	  
    "VideoFaceDetectionResult": {
      "type": "object",
      "properties": {
        "X": { "type": "integer" },
        "Y": { "type": "integer" },
        "Width": { "type": "integer" },
        "Height": { "type": "integer" },
        "ElapsedSeconds": { "type": "number", "format": "double" }
      }
    },
    "LivenessResult": {
      "type": "object",
      "properties": {
        "boundingBox": { "$ref": "#/definitions/BoundingBox" },
        "livenessScore": { "type": "number", "format": "double" },
        "status": { "type": "string", "example": "Real Person" },
        "probabilities": {
          "type": "object",
          "properties": {
            "screen": { "type": "number" },
            "paper": { "type": "number" },
            "real": { "type": "number" }
          }
        }
      }
    },
    "BoundingBox": {
      "type": "object",
      "properties": {
        "x": { "type": "integer" },
        "y": { "type": "integer" },
        "width": { "type": "integer" },
        "height": { "type": "integer" },
        "top": { "type": "integer" },
        "bottom": { "type": "integer" },
        "left": { "type": "integer" },
        "right": { "type": "integer" },
        "location": { "$ref": "#/definitions/Point" },
        "size": { "$ref": "#/definitions/Size" },
        "topLeft": { "$ref": "#/definitions/Point" },
        "bottomRight": { "$ref": "#/definitions/Point" }
      }
    },
    "Point": {
      "type": "object",
      "properties": {
        "x": { "type": "integer" },
        "y": { "type": "integer" }
      }
    },
    "Size": {
      "type": "object",
      "properties": {
        "width": { "type": "integer" },
        "height": { "type": "integer" }
      }
    }
  }
}