openapi: 3.0.0
info:
  title: PeabodySecure Identity Verification API
  description: API for integrating Identity Verification (IDV) into third-party applications.
  version: 1.0.0
servers:
  - url: https://peabodysecure.com
    description: Production Server
  - url: http://localhost:8000
    description: Local Development

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    VerificationResponse:
      type: object
      properties:
        verification_id:
          type: string
          example: "550e8400-e29b-41d4-a716-446655440000"
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: "Invalid file type"

security:
  - bearerAuth: []

paths:
  /api/kyc/capture-id:
    post:
      summary: Upload Front of ID
      description: Uploads the front image of the identity document.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                image:
                  type: string
                  description: Base64 encoded image data (JPEG/PNG)
                  example: "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
      responses:
        '200':
          description: Image uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerificationResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized

  /api/kyc/capture-id-back:
    post:
      summary: Upload Back of ID
      description: Uploads the back image of the identity document. Requires verification_id from the front upload.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                verification_id:
                  type: string
                  example: "550e8400-e29b-41d4-a716-446655440000"
                image:
                  type: string
                  description: Base64 encoded image data
      responses:
        '200':
          description: Image uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: "Back of ID processed successfully"
        '400':
          description: Bad Request
        '500':
          description: Server Error

  /api/kyc/status:
    post:
      summary: Get Verification Status
      description: Retrieve the current status and extracted data for a verification.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                verification_id:
                  type: string
      responses:
        '200':
          description: Status retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: "pending_selfie"
                  fields:
                    type: object
                    description: Extracted OCR data
                  dl_validation_status:
                    type: string
                    example: "Passed"