{"openapi":"3.1.0","info":{"title":"BitMind Detection API","description":"\n## BitMind AI Detection API\n\nDetect AI-generated images and videos using state-of-the-art deep learning models.\n\n### Authentication\nAll endpoints require authentication via:\n- `Authorization: Bearer <token>` header with Supabase JWT or API key\n\n### Endpoints\n- **POST /detect-image** - Detect AI-generated images\n- **POST /detect-video** - Detect AI-generated videos\n- **POST /preprocess-video** - Preprocess video for browser compatibility (no detection)\n- **POST /get-video-upload-url** - Get presigned URL for large video uploads\n\n### Input Methods\nImages/videos can be provided as:\n1. File upload (multipart/form-data)\n2. URL (http/https)\n3. Base64 encoded string\n4. Data URI (data:image/...;base64,...)\n        ","version":"1.0.0"},"paths":{"/detect-image":{"post":{"tags":["Detection"],"summary":"Detect Image","description":"Detect if an image is AI-generated.\n\nInput methods:\n- JSON: {\"image\": \"https://...\" OR \"data:image/jpeg;base64,...\", \"debug\": false}\n- Multipart: file upload OR URL string in 'image' field\n\nQuery params (multipart only):\n- debug: Include debug info (raw, processingTime, region, contentCredentials)\n\nReturns: isAI, confidence, similarity, objectKey (+ debug info if requested)","operationId":"detect_image_detect_image_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageDetectionResponse"}}}}}}},"/detect-video":{"post":{"tags":["Detection"],"summary":"Detect Video","description":"Detect if a video is AI-generated.\n\nInput methods:\n- JSON: {\"video\": \"https://...\", \"debug\": false, \"startTime\": 0, \"endTime\": 30, \"fps\": 1} - URL only\n- Multipart: file upload OR URL string in 'video' field\n\nParams:\n- startTime: Starting point in seconds (default: 0)\n- endTime: Ending point in seconds (default: entire video)\n- fps: Frames per second for analysis (default: 1)\n- debug: Include debug info (raw, processingTime, region, contentCredentials, absurdity)\n\nReturns: isAI, confidence, similarity, objectKey (+ debug info if requested)","operationId":"detect_video_detect_video_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoDetectionResponse"}}}}}}},"/preprocess-video":{"post":{"tags":["Preprocessing"],"summary":"Preprocess Video","description":"Preprocess a video for browser compatibility without AI detection.\n\nUse cases:\n1. Convert video to browser-playable format (H.264/AAC MP4)\n2. Generate thumbnails for video preview\n3. Extract specific segments for later processing\n\nInput methods:\n- JSON: {\"video\": \"https://...\", \"generateThumbnails\": true, \"startTime\": 0, \"endTime\": 30}\n- Multipart: file upload OR URL string in 'video' field\n\nReturns presigned URLs (valid for 1 hour) for:\n- browserCompatibleUrl: H.264/AAC MP4 for browser playback\n- processedVideoUrl: Extracted segment (if startTime/endTime specified)\n- thumbnailUrls: 25 evenly-spaced thumbnails (if generateThumbnails=true)","operationId":"preprocess_video_preprocess_video_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreprocessVideoResponse"}}}}}}},"/get-video-upload-url":{"post":{"tags":["Preprocessing"],"summary":"Get Video Upload Url","description":"Get a presigned URL for uploading large video files.\n\nReturns a presigned POST URL that can be used to upload files directly to S3,\nbypassing API size limits. After uploading, use the returned videoUrl with\ndetect-video or preprocess-video endpoints.\n\nRequest:\n- filename: Name of the file to upload\n- contentType: (optional) MIME type, derived from filename if not provided\n\nReturns:\n- url: Presigned POST URL\n- fields: Form fields to include with the POST\n- fileKey: S3 key for the file\n- videoUrl: URL to use with detect-video/preprocess-video","operationId":"get_video_upload_url_get_video_upload_url_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetVideoUploadUrlResponse"}}}}}}},"/health":{"get":{"tags":["Health"],"summary":"Health Check","description":"Health check endpoint for load balancer and monitoring.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"tags":["Health"],"summary":"Health Check","description":"Health check endpoint for load balancer and monitoring.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"tags":["Health"],"summary":"Root","description":"Root endpoint - service info.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"tags":["Health"],"summary":"Root","description":"Root endpoint - service info.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AbsurdityResult":{"properties":{"score":{"type":"integer","title":"Score","description":"Absurdity score (0-100)"},"summary":{"type":"string","title":"Summary","description":"Brief description of content"},"verdict":{"type":"string","title":"Verdict","description":"Reasoning for the score"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata (frames, peak)"}},"type":"object","required":["score","summary","verdict"],"title":"AbsurdityResult","description":"Absurdity analysis result for video detection."},"ContentCredentials":{"properties":{"hasCredentials":{"type":"boolean","title":"Hascredentials","description":"Whether C2PA credentials are present"},"detectedModel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detectedmodel","description":"Detected AI model name"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional C2PA details"}},"type":"object","required":["hasCredentials"],"title":"ContentCredentials","description":"C2PA content credentials information."},"DebugInfo":{"properties":{"raw":{"type":"number","title":"Raw","description":"Raw model prediction score before adjustments"},"processingTime":{"type":"number","title":"Processingtime","description":"Total processing time in seconds"},"region":{"type":"string","title":"Region","description":"Processing region"},"contentCredentials":{"$ref":"#/components/schemas/ContentCredentials","description":"C2PA content credentials"},"absurdity":{"anyOf":[{"$ref":"#/components/schemas/AbsurdityResult"},{"type":"null"}],"description":"Absurdity analysis (video only)"},"chunks":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Chunks","description":"Chunk execution stats for full mode"}},"type":"object","required":["raw","processingTime","region","contentCredentials"],"title":"DebugInfo","description":"Debug information included when debug=true."},"GetVideoUploadUrlResponse":{"properties":{"url":{"type":"string","title":"Url","description":"Presigned POST URL for uploading"},"fields":{"additionalProperties":true,"type":"object","title":"Fields","description":"Form fields to include with the POST request"},"fileKey":{"type":"string","title":"Filekey","description":"S3 key for the uploaded file"},"videoUrl":{"type":"string","title":"Videourl","description":"URL to use in detect-video or preprocess-video after upload"}},"type":"object","required":["url","fields","fileKey","videoUrl"],"title":"GetVideoUploadUrlResponse","description":"Response from get-video-upload-url endpoint.","example":{"fields":{"Content-Type":"video/mp4","key":"upload/..."},"fileKey":"upload/1704067200000-uuid-video.mp4","url":"https://s3.amazonaws.com/bucket","videoUrl":"https://s3.amazonaws.com/..."}},"ImageDetectionResponse":{"properties":{"isAI":{"type":"boolean","title":"Isai","description":"Whether the content is detected as AI-generated"},"confidence":{"type":"number","title":"Confidence","description":"Confidence score (0.0-1.0, higher = more confident)"},"similarity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Similarity","description":"Similarity score to known AI content (null if service unavailable)"},"objectKey":{"type":"string","title":"Objectkey","description":"Storage key for the processed media"},"debug":{"anyOf":[{"$ref":"#/components/schemas/DebugInfo"},{"type":"null"}],"description":"Debug information (only when debug=true)"}},"type":"object","required":["isAI","confidence","objectKey"],"title":"ImageDetectionResponse","description":"Detection response for image analysis.","example":{"confidence":0.23,"isAI":false,"objectKey":"1704067200000.jpg","similarity":0.05}},"PreprocessVideoResponse":{"properties":{"isAI":{"type":"boolean","title":"Isai","description":"Always false for preprocessing (no detection)","default":false},"predictions":{"items":{"type":"number"},"type":"array","title":"Predictions","description":"Always empty for preprocessing"},"confidence":{"type":"number","title":"Confidence","description":"Always 0 for preprocessing","default":0.0},"similarity":{"type":"number","title":"Similarity","description":"Always 0 for preprocessing","default":0.0},"fqdn":{"type":"string","title":"Fqdn","description":"Always empty for preprocessing","default":""},"objectKey":{"type":"string","title":"Objectkey","description":"Storage key for the original video"},"browserCompatibleUrl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Browsercompatibleurl","description":"Presigned URL to browser-compatible video (H.264/AAC)"},"processedVideoUrl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processedvideourl","description":"Presigned URL to processed segment (if startTime/endTime specified)"},"thumbnailUrls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Thumbnailurls","description":"Presigned URLs to generated thumbnails"},"thumbnailObjectKey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnailobjectkey","description":"Storage key for main thumbnail"},"videoMetadata":{"$ref":"#/components/schemas/VideoMetadata","description":"Video metadata"}},"type":"object","required":["objectKey","videoMetadata"],"title":"PreprocessVideoResponse","description":"Response from preprocess-video endpoint.","example":{"browserCompatibleUrl":"https://s3.amazonaws.com/...","objectKey":"uploads/1704067200000.mp4","thumbnailObjectKey":"thumbnails/1704067200000/main.jpg","videoMetadata":{"duration":60.0,"fps":30,"height":1080,"processingOnly":true,"width":1920}}},"VideoDetectionResponse":{"properties":{"isAI":{"type":"boolean","title":"Isai","description":"Whether the content is detected as AI-generated"},"confidence":{"type":"number","title":"Confidence","description":"Confidence score (0.0-1.0, higher = more confident)"},"similarity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Similarity","description":"Similarity score to known AI content (null if service unavailable)"},"objectKey":{"type":"string","title":"Objectkey","description":"Storage key for the processed media"},"thumbnailObjectKey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnailobjectkey","description":"Storage key for the video thumbnail (if generated)"},"debug":{"anyOf":[{"$ref":"#/components/schemas/DebugInfo"},{"type":"null"}],"description":"Debug information (only when debug=true)"}},"type":"object","required":["isAI","confidence","objectKey"],"title":"VideoDetectionResponse","description":"Detection response for video analysis.","example":{"confidence":0.87,"isAI":true,"objectKey":"1704067200000.mp4","similarity":0.0,"thumbnailObjectKey":"thumbnails/1704067200000/main.jpg"}},"VideoMetadata":{"properties":{"width":{"type":"integer","title":"Width","description":"Video width in pixels"},"height":{"type":"integer","title":"Height","description":"Video height in pixels"},"duration":{"type":"number","title":"Duration","description":"Video duration in seconds"},"fps":{"type":"integer","title":"Fps","description":"Frames per second"},"originalDuration":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Originalduration","description":"Original video duration (when segment extracted)"},"processedDuration":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processedduration","description":"Processed segment duration"},"startTime":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Starttime","description":"Segment start time"},"endTime":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Endtime","description":"Segment end time"},"processingOnly":{"type":"boolean","title":"Processingonly","description":"Indicates preprocessing without detection","default":true}},"type":"object","required":["width","height","duration","fps"],"title":"VideoMetadata","description":"Video metadata from preprocessing."}}},"tags":[{"name":"Detection","description":"AI content detection endpoints"},{"name":"Preprocessing","description":"Video preprocessing and upload endpoints"},{"name":"Health","description":"Service health and status"}]}