{
  "openapi": "3.1.0",
  "info": {
    "title": "Piracy Sentry Multi-Modal Detection & Evidence API",
    "version": "1.1.0",
    "description": "Multi-modal visual (Google Lens + 64-bit dHash/pHash + horizontal flipX mirror), spoken-hook transcript, online course leak (Telegram, MEGA, Google Drive, group-buy warez), and copycat e-commerce storefront (crt.sh Certificate Transparency logs + DNS/RDAP abuse chain) detection & SHA-256 forensic evidence pack engine. Piracy Sentry is a technical detection and draft notice preparation platform, not a law firm; human rights-holder review under 17 U.S.C. § 512(f) is required before submitting external takedowns.",
    "contact": {
      "name": "Piracy Sentry Engineering & Compliance",
      "url": "https://piracysentry.com/developers",
      "email": "support@piracysentry.com"
    }
  },
  "servers": [
    {
      "url": "https://api.piracysentry.com",
      "description": "Production Multi-Modal REST & x402 Gateway"
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Your Piracy Sentry API key (ps_live_... — claim 5,000 Free Credits [$0.50 = 10 free scans] on verified sign-up at https://piracysentry.com/signup)."
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Pass ps_live_... or OAuth 2.1 mcp_at_... token as Authorization: Bearer <token>."
      }
    }
  },
  "paths": {
    "/v1/scan/video": {
      "post": {
        "operationId": "scanVideoPiracy",
        "summary": "Multi-Modal Stolen Video, Shorts, Reels & TikTok Repost Scanner ($0.05 / 500 Credits)",
        "description": "Runs two-stage multi-modal discovery across Google Lens reverse-frame index, YouTube Shorts, TikTok, Instagram/Facebook Reels, X, Reddit, and crt.sh with 64-bit dHash/pHash + horizontal mirror (flipX) perceptual frame verification.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "example": "https://www.tiktok.com/@lumaskin.official/video/7438910294810293541"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "quick",
                      "deep"
                    ],
                    "default": "quick"
                  },
                  "brand_domain": {
                    "type": "string",
                    "example": "lumaskinlabs.com"
                  },
                  "exclude_handles": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Forensic multi-modal video repost scan dossier",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://piracysentry.com",
                  "status": "ok",
                  "msg": "success",
                  "data": {
                    "scan_id": "showcase-reels-mirror-theft",
                    "scan_kind": "video",
                    "evidence_sha256": "83f019a8c4e72b910d56a381f29e04bc72a18d954e03c6b7a81294f05d6e31c8",
                    "suspects_count": 5,
                    "high_risk_count": 4,
                    "estimated_revenue_at_risk_usd": 14800,
                    "visual_match_preview": {
                      "dhash_similarity_pct": 94.8,
                      "dhash_distance": 3,
                      "is_mirrored_flipx": true,
                      "orientation": "mirror_flipx",
                      "matched_timestamp": "00:02 – 00:14"
                    },
                    "suspects": [
                      {
                        "id": "susp-reels-01",
                        "platform": "tiktok",
                        "suspect_handle": "@glowdeals_daily",
                        "suspect_url": "https://www.tiktok.com/@glowdeals_daily/video/7441028839201948952",
                        "confidence_score": 97,
                        "visual_verification": {
                          "verified": true,
                          "dhash_distance": 3,
                          "visual_similarity_pct": 94.8,
                          "is_mirrored_flipx": true
                        }
                      }
                    ]
                  },
                  "meta": {
                    "endpoint": "/v1/scan/video",
                    "credits_charged": 500,
                    "cached": false,
                    "took_ms": 1842
                  }
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits or keyless x402 Base Mainnet USDC payment challenge ($0.05 USDC = 50,000 atomic)"
          }
        }
      }
    },
    "/v1/scan/course": {
      "post": {
        "operationId": "scanCoursePiracy",
        "summary": "Online Course & Digital Product Leak Scanner ($0.05 / 500 Credits)",
        "description": "Scans Telegram leak channels (t.me), MEGA.nz, Google Drive, GoFile, group-buy warez forums, torrent indexers, and crt.sh clone course domains with og:image visual signature checks.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "course_title"
                ],
                "properties": {
                  "course_title": {
                    "type": "string",
                    "example": "Full-Stack AI Agent Bootcamp"
                  },
                  "creator_name": {
                    "type": "string",
                    "example": "NeuralForge Academy"
                  },
                  "official_domain": {
                    "type": "string",
                    "example": "neuralforge.dev"
                  },
                  "course_page_url": {
                    "type": "string",
                    "example": "https://neuralforge.dev/courses/ai-agent-bootcamp"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Course piracy discovery dossier with cyberlocker, Telegram & clone-domain classifications",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://piracysentry.com",
                  "status": "ok",
                  "data": {
                    "scan_id": "showcase-course-leak",
                    "scan_kind": "course",
                    "suspects_count": 5,
                    "high_risk_count": 5,
                    "estimated_revenue_at_risk_usd": 28900
                  }
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits or keyless x402 Base Mainnet USDC payment challenge ($0.05 USDC = 50,000 atomic)"
          }
        }
      }
    },
    "/v1/scan/store": {
      "post": {
        "operationId": "scanStoreCopycats",
        "summary": "Copycat E-Commerce Storefront (.shop / .store) & Ad Creative Scanner ($0.05 / 500 Credits)",
        "description": "Queries crt.sh Certificate Transparency logs for newly issued .shop, .store, .top, .online, .xyz, and myshopify.com lookalike domains, searches indexed clone storefronts & Meta Ad Library entries, and resolves live DNS/CNAME/NS/RDAP abuse chains.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "brand_name"
                ],
                "properties": {
                  "brand_name": {
                    "type": "string",
                    "example": "AeroPulse Recovery"
                  },
                  "official_domain": {
                    "type": "string",
                    "example": "aeropulserecovery.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Copycat storefront & registrar/CDN abuse chain dossier",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://piracysentry.com",
                  "status": "ok",
                  "data": {
                    "scan_id": "showcase-tiktok-shop-clone",
                    "scan_kind": "store",
                    "suspects_count": 4,
                    "high_risk_count": 4,
                    "estimated_revenue_at_risk_usd": 42600
                  }
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits or keyless x402 Base Mainnet USDC payment challenge ($0.05 USDC = 50,000 atomic)"
          }
        }
      }
    },
    "/v1/evidence/pack": {
      "post": {
        "operationId": "generateEvidencePack",
        "summary": "Generate Tamper-Evident SHA-256 Forensic Evidence Pack & DMCA Draft ($0.02 / 200 Credits)",
        "description": "Generates a timestamped SHA-256 forensic JSON bundle, platform-routed abuse dossiers, and a structured 17 U.S.C. § 512(c)(3) notice draft from any scan_id. Human rights-holder review under 17 U.S.C. § 512(f) is required before external filing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "scan_id"
                ],
                "properties": {
                  "scan_id": {
                    "type": "string",
                    "example": "showcase-course-leak"
                  },
                  "rightsholder_name": {
                    "type": "string",
                    "example": "NeuralForge Academy LLC"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SHA-256 forensic evidence pack and draft notice"
          },
          "402": {
            "description": "Insufficient credits or keyless x402 Base Mainnet USDC payment challenge ($0.02 USDC = 20,000 atomic)"
          }
        }
      }
    },
    "/v1/takedowns/prepare-and-approve": {
      "post": {
        "operationId": "prepareAndApproveTakedown",
        "summary": "Human-in-the-Loop Statutory Takedown Preparation & Approval (17 U.S.C. § 512(f))",
        "description": "Requires authenticated rights-holder session or ps_live_ key plus explicit human_visual_reviewed, good_faith_attested, and perjury_512f_attested checkboxes. Logs approver_account_id, approver_ip, evidence_sha256, and approved_at_utc.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "scan_id",
                  "signer_full_name",
                  "authorized_work_url",
                  "selected_suspect_urls",
                  "human_visual_reviewed",
                  "good_faith_attested",
                  "perjury_512f_attested"
                ],
                "properties": {
                  "scan_id": {
                    "type": "string"
                  },
                  "signer_full_name": {
                    "type": "string"
                  },
                  "signer_role": {
                    "type": "string"
                  },
                  "authorized_work_url": {
                    "type": "string"
                  },
                  "selected_suspect_urls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "human_visual_reviewed": {
                    "type": "boolean"
                  },
                  "good_faith_attested": {
                    "type": "boolean"
                  },
                  "perjury_512f_attested": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed & timestamped takedown approval queued"
          }
        }
      }
    },
    "/v1/leaderboard/stats": {
      "get": {
        "operationId": "getPiracyLeaderboardStats",
        "security": [],
        "summary": "Public Weekly Piracy & Copycat Store Telemetry Index ($0 Free)",
        "responses": {
          "200": {
            "description": "Weekly aggregated creator & e-commerce piracy telemetry"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "getGatewayHealth",
        "security": [],
        "summary": "Gateway Health Check",
        "responses": {
          "200": {
            "description": "Gateway healthy (200 OK)"
          }
        }
      }
    }
  }
}