{"openapi":"3.1.0","info":{"title":"Document Processing API","version":"1.0.0"},"paths":{"/api/v1/auth/register":{"post":{"tags":["Authentication"],"summary":"Register","operationId":"register_api_v1_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRegister"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["Authentication"],"summary":"Login","operationId":"login_api_v1_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserLogin"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/refresh":{"post":{"tags":["Authentication"],"summary":"Refresh Token","operationId":"refresh_token_api_v1_auth_refresh_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Refresh Data"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/activity":{"post":{"tags":["Authentication"],"summary":"Update Activity","operationId":"update_activity_api_v1_auth_activity_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"CustomHTTPBearer":[]}]}},"/api/v1/auth/password-reset":{"post":{"tags":["Authentication"],"summary":"Request Password Reset","operationId":"request_password_reset_api_v1_auth_password_reset_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/password-reset-confirm":{"post":{"tags":["Authentication"],"summary":"Confirm Password Reset","operationId":"confirm_password_reset_api_v1_auth_password_reset_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetConfirm"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/plans":{"get":{"tags":["Plans"],"summary":"Get Plans","description":"Get all active plans (excludes metered/on-demand config)","operationId":"get_plans_api_v1_plans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/debug_upload":{"post":{"summary":"Debug Upload","operationId":"debug_upload_api_v1_debug_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_debug_upload_api_v1_debug_upload_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"CustomHTTPBearer":[]}]}},"/api/v1/extract_chart_data":{"post":{"tags":["Document Processing"],"summary":"Extract Chart Data","description":"Extract numerical data from a chart image (URL or uploaded file).","operationId":"extract_chart_data_api_v1_extract_chart_data_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_chart_data_api_v1_extract_chart_data_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"CustomHTTPBearer":[]}]}},"/api/v1/process":{"post":{"tags":["Document Processing"],"summary":"Process Document","description":"Process a document using either a URL or base64-encoded file content.\n\nThe request can include:\n- document_type: Type of document to process\n- metadata.url: URL to a remote document\n- metadata.file_bytes: Base64-encoded file content\n- metadata.filename: Original filename (when using file_bytes)\n- metadata.content_type: Content type of the file (when using file_bytes)\n\nSet AI_only=True to skip human review and mark the job as completed once the AI result is available.","operationId":"process_document_api_v1_process_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"CustomHTTPBearer":[]}]}},"/api/v1/earnings/search":{"post":{"tags":["Document Processing"],"summary":"Search Earnings","operationId":"search_earnings_api_v1_earnings_search_post","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"company","in":"query","required":true,"schema":{"type":"string","title":"Company"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/status/{job_id}":{"get":{"tags":["Document Processing"],"summary":"Get Job Status","operationId":"get_job_status_api_v1_status__job_id__get","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/jobs/{job_id}/stream":{"get":{"tags":["Document Processing"],"summary":"Stream Job Status","description":"Stream job status updates via Server-Sent Events.\n\nNOTE: This endpoint uses Authorization header auth and is intended for\nserver-to-server or native-app clients only. Browser-native EventSource\ncannot set custom headers, so this endpoint cannot be consumed directly\nfrom a browser via the EventSource API.","operationId":"stream_job_status_api_v1_jobs__job_id__stream_get","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/find_location":{"get":{"tags":["Document Processing"],"summary":"Find Location","description":"Find the location of a data point from an existing completed job.\nReturns the location from the most recent matching job.\n\nThis endpoint searches for a previously completed job that matches the given\nparameters and returns where the data point was found (e.g., \"page 3\").","operationId":"find_location_api_v1_find_location_get","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"document_type","in":"query","required":true,"schema":{"type":"string","description":"Type of document (pdf, sec, website, etc.)","title":"Document Type"},"description":"Type of document (pdf, sec, website, etc.)"},{"name":"data_point","in":"query","required":true,"schema":{"type":"string","description":"The data point to find location for","title":"Data Point"},"description":"The data point to find location for"},{"name":"url","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"URL for pdf/website documents","title":"Url"},"description":"URL for pdf/website documents"},{"name":"ticker","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Ticker for SEC documents","title":"Ticker"},"description":"Ticker for SEC documents"},{"name":"fiscal_period","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Fiscal period for SEC documents","title":"Fiscal Period"},"description":"Fiscal period for SEC documents"},{"name":"ai_only","in":"query","required":false,"schema":{"type":"boolean","description":"Use AI result instead of consensus result","default":false,"title":"Ai Only"},"description":"Use AI result instead of consensus result"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/classify_document":{"get":{"tags":["Document Processing"],"summary":"Classify Document","description":"Classify a URL by checking its actual Content-Type header.\n\nThis endpoint is called by the Excel add-in only when local URL pattern matching\ncouldn't determine the document type (e.g., URLs without .pdf extension).\nIt makes a HEAD request to check the actual Content-Type served by the URL.\n\nReturns:\n- document_type: The detected type (pdf, website, excel, csv)\n- content_type: The actual HTTP Content-Type header","operationId":"classify_document_api_v1_classify_document_get","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"url","in":"query","required":true,"schema":{"type":"string","description":"URL to classify by checking its Content-Type","title":"Url"},"description":"URL to classify by checking its Content-Type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/jobs/{job_id}":{"delete":{"tags":["Document Processing"],"summary":"Delete Job","description":"Delete a specific job and all its associated data.","operationId":"delete_job_api_v1_jobs__job_id__delete","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Document Processing"],"summary":"Get Job By Id","description":"Get a specific job by ID.","operationId":"get_job_by_id_api_v1_jobs__job_id__get","security":[{"CustomHTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/jobs":{"get":{"tags":["Document Processing"],"summary":"Get User Jobs","operationId":"get_user_jobs_api_v1_jobs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"CustomHTTPBearer":[]}]}},"/process":{"post":{"summary":"Process Document Route","operationId":"process_document_route_process_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"CustomHTTPBearer":[]}]}},"/api/v1/watch":{"post":{"tags":["Website Watcher"],"summary":"Create Watch","description":"Create a website watch job and subscription.\n\nThis endpoint monitors a website for new documents matching the description.\nMultiple requests for the same URL + description will share a single watch job.\n\nArgs:\n    request: Watch configuration including URL, description, and data point to extract\n    \nReturns:\n    WatchResponse with subscription_id and watch job status","operationId":"create_watch_api_v1_watch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"WatchHTTPBearer":[]}]}},"/api/v1/watch/{subscription_id}":{"get":{"tags":["Website Watcher"],"summary":"Get Watch Status","description":"Get the status and result of a watch subscription.\n\nArgs:\n    subscription_id: The subscription ID returned from create_watch\n    \nReturns:\n    WatchStatusResponse with current status and result (if completed)","operationId":"get_watch_status_api_v1_watch__subscription_id__get","security":[{"WatchHTTPBearer":[]}],"parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WatchStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Website Watcher"],"summary":"Cancel Watch Subscription","description":"Cancel a watch subscription.\n\nArgs:\n    subscription_id: The subscription ID to cancel\n    \nReturns:\n    Success message","operationId":"cancel_watch_subscription_api_v1_watch__subscription_id__delete","security":[{"WatchHTTPBearer":[]}],"parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/watch/job/{job_id}":{"get":{"tags":["Website Watcher"],"summary":"Get Watch Job Status","description":"Get the status of a watch job.\n\nArgs:\n    job_id: The watch job ID\n    \nReturns:\n    WatchJobStatusResponse with job details and status","operationId":"get_watch_job_status_api_v1_watch_job__job_id__get","security":[{"WatchHTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WatchJobStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_debug_upload_api_v1_debug_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","title":"Body_debug_upload_api_v1_debug_upload_post"},"Body_extract_chart_data_api_v1_extract_chart_data_post":{"properties":{"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"file":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"File","description":"File to upload"}},"type":"object","title":"Body_extract_chart_data_api_v1_extract_chart_data_post"},"DocumentType":{"type":"string","enum":["pdf","sec","credit_card","lease","earnings_search","website","csv","excel","revenue_segmentation_table_extraction","text_classification","chart_data_extraction","receipt_mapping","pos_mapping","custom_prompt"],"title":"DocumentType"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PasswordResetConfirm":{"properties":{"oobCode":{"type":"string","title":"Oobcode"},"newPassword":{"type":"string","title":"Newpassword"}},"type":"object","required":["oobCode","newPassword"],"title":"PasswordResetConfirm"},"PasswordResetRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"PasswordResetRequest"},"ProcessRequest":{"properties":{"document_type":{"$ref":"#/components/schemas/DocumentType"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"callback_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Url"},"notify_on_ai_completion":{"type":"boolean","title":"Notify On Ai Completion","default":false},"AI_only":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ai Only","default":false},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"ttl_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ttl Seconds"},"extraction_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Key"}},"type":"object","required":["document_type"],"title":"ProcessRequest"},"SubscriptionStatus":{"type":"string","enum":["waiting","completed","failed"],"title":"SubscriptionStatus","description":"Status states for watch subscriptions."},"UserLogin":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"UserLogin"},"UserRegister":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"},"full_name":{"type":"string","title":"Full Name"},"user_type":{"type":"string","title":"User Type"},"invite_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invite Code"},"signup_source":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Signup Source"}},"type":"object","required":["email","password","full_name","user_type"],"title":"UserRegister"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WatchJobStatusResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"status":{"$ref":"#/components/schemas/WatchStatus"},"url":{"type":"string","title":"Url"},"description":{"type":"string","title":"Description"},"document_type":{"type":"string","title":"Document Type"},"candidate_pages":{"items":{"type":"string"},"type":"array","title":"Candidate Pages"},"navigation_attempts":{"type":"integer","title":"Navigation Attempts"},"poll_count":{"type":"integer","title":"Poll Count"},"result_document_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Document Url"},"found_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Found At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["job_id","status","url","description","document_type","candidate_pages","navigation_attempts","poll_count","created_at","updated_at"],"title":"WatchJobStatusResponse","description":"Response model for watch job status query."},"WatchRequest":{"properties":{"url":{"type":"string","title":"Url","description":"Website URL to monitor"},"description":{"type":"string","title":"Description","description":"Description of document to find"},"data_point":{"type":"string","title":"Data Point","description":"Data point to extract from document"},"fiscal_period":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fiscal Period","description":"Fiscal period (e.g., 'FY 2024', 'Q1 2024')"},"document_type":{"type":"string","enum":["pdf","html","any"],"title":"Document Type","description":"Document type filter","default":"any"},"waiting":{"type":"boolean","title":"Waiting","description":"True=continuous monitoring, False=one-time scrape","default":true},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date","description":"Start date for monitoring (default: today)"},"end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date","description":"End date for monitoring (default: start + 7 days)"},"poll_interval":{"type":"number","maximum":86400.0,"minimum":0.1,"title":"Poll Interval","description":"Poll interval in seconds (min 0.1)","default":300},"callback_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Url","description":"Webhook URL for result notification"}},"type":"object","required":["url","description","data_point"],"title":"WatchRequest","description":"Request model for creating a watch job."},"WatchResponse":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"watch_job_id":{"type":"string","title":"Watch Job Id"},"status":{"$ref":"#/components/schemas/WatchStatus"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"}},"type":"object","required":["subscription_id","watch_job_id","status"],"title":"WatchResponse","description":"Response model for watch creation."},"WatchStatus":{"type":"string","enum":["pending","navigating","monitoring","found","extracting","processing","completed","failed","expired"],"title":"WatchStatus","description":"Status states for watch jobs."},"WatchStatusResponse":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"watch_job_id":{"type":"string","title":"Watch Job Id"},"subscription_status":{"$ref":"#/components/schemas/SubscriptionStatus"},"job_status":{"$ref":"#/components/schemas/WatchStatus"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"}},"type":"object","required":["subscription_id","watch_job_id","subscription_status","job_status","created_at"],"title":"WatchStatusResponse","description":"Response model for subscription status query."}},"securitySchemes":{"CustomHTTPBearer":{"type":"http","scheme":"bearer"},"WatchHTTPBearer":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Authentication","description":"Authentication operations"},{"name":"Document Processing","description":"Document processing operations"}]}