{"openapi":"3.1.0","info":{"title":"Nanonets File Extraction API","description":"Extract content from various file types using AI models","version":"1.0.0"},"paths":{"/api/v1/extract/sync":{"post":{"tags":["Extract v1"],"summary":"Synchronous content extraction","description":"Extract content from a document synchronously.","operationId":"extract_sync_api_v1_extract_sync_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_sync_api_v1_extract_sync_post"},"examples":{"file_upload_markdown":{"summary":"File upload with markdown output","description":"Upload a file and extract content as markdown","value":{"file":"(binary)","output_format":"markdown"}},"file_url_json":{"summary":"URL with JSON extraction","description":"Extract structured JSON from a document URL","value":{"file_url":"https://example.com/invoice.pdf","output_format":"json","json_options":["invoice_number","date","total_amount","vendor"]}},"file_url_with_schema":{"summary":"URL with JSON schema","description":"Extract JSON using a custom schema definition","value":{"file_url":"https://example.com/receipt.pdf","output_format":"json","json_options":{"type":"object","properties":{"store_name":{"type":"string"},"total":{"type":"number"},"date":{"type":"string","format":"date"}}}}},"custom_instructions":{"summary":"With custom instructions","description":"Extract with custom processing instructions","value":{"file_url":"https://example.com/document.pdf","output_format":["markdown","json"],"custom_instructions":"Focus on extracting financial data. Ignore headers and footers.","prompt_mode":"append"}}}}}},"responses":{"200":{"description":"Successful extraction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"},"examples":{"markdown_extraction":{"summary":"Markdown extraction result","description":"Example response when extracting content as markdown","value":{"success":true,"message":"Extraction completed successfully","record_id":"550e8400-e29b-41d4-a716-446655440000","status":"completed","result":{"markdown":{"content":"# Invoice\n\n**Invoice Number:** INV-2024-001\n**Date:** 2024-01-15\n\n| Item | Quantity | Price |\n|------|----------|-------|\n| Widget A | 10 | $50.00 |","metadata":{}}},"processing_time":1.23}},"json_extraction":{"summary":"JSON extraction result","description":"Example response when extracting structured JSON data","value":{"success":true,"message":"Extraction completed successfully","record_id":"550e8400-e29b-41d4-a716-446655440001","status":"completed","result":{"json":{"content":{"invoice_number":"INV-2024-001","date":"2024-01-15","vendor":"Acme Corp","total_amount":500.0,"line_items":[{"item":"Widget A","quantity":10,"price":50.0}]},"metadata":{"bounding_boxes":{"invoice_number":{"x":100,"y":50,"width":150,"height":20},"total_amount":{"x":400,"y":300,"width":100,"height":20}},"confidence_score":{"invoice_number":0.98,"date":0.95,"total_amount":0.99}}}},"processing_time":2.45}},"multi_format_extraction":{"summary":"Multiple format extraction","description":"Example response when extracting in both markdown and JSON formats","value":{"success":true,"message":"Extraction completed successfully","record_id":"550e8400-e29b-41d4-a716-446655440002","status":"completed","result":{"markdown":{"content":"# Receipt\n\n**Store:** Coffee Shop\n**Total:** $12.50","metadata":{}},"json":{"content":{"store":"Coffee Shop","total":12.5,"items":["Latte","Croissant"]},"metadata":{"confidence_score":{"store":0.97,"total":0.99}}}},"processing_time":3.12}}}}}},"404":{"description":"Not found"},"500":{"description":"Internal server error","content":{"application/json":{"example":{"detail":"Failed to process document: unsupported file format"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/async":{"post":{"tags":["Extract v1"],"summary":"Asynchronous content extraction","description":"Start an asynchronous content extraction job. The file is uploaded and queued for processing. Use the record_id to check status via /results/{record_id} endpoint.","operationId":"extract_async_api_v1_extract_async_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_async_api_v1_extract_async_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/stream":{"post":{"tags":["Extract v1"],"summary":"Streaming content extraction","description":"Stream document extraction results via Server-Sent Events (SSE).\n\n**Response Format:** `text/event-stream`\n\nThe endpoint returns a stream of JSON events:\n- `metadata`: Initial event with model and streaming mode info\n- `content`: Incremental content chunks (streaming mode)\n- `complete`: Full content at once (batch mode)\n- `done`: Final event with record_id and processing_time\n- `error`: Error event if extraction fails\n- `async_queued`: Event when large files are queued for async processing\n\n**Example Event:**\n```\ndata: {\"type\": \"content\", \"data\": \"# Document Title\\n\"}\n\ndata: {\"type\": \"done\", \"record_id\": \"123\", \"processing_time\": 2.5}\n```","operationId":"extract_stream_api_v1_extract_stream_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_stream_api_v1_extract_stream_post"}}}},"responses":{"200":{"description":"SSE stream of extraction events","content":{"application/json":{"schema":{}},"text/event-stream":{}}},"404":{"description":"Not found"},"401":{"description":"Authentication required"},"429":{"description":"Rate limit exceeded"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/public-stream":{"post":{"tags":["Extract v1"],"summary":"Public streaming content extraction","description":"Stream document extraction results via Server-Sent Events (SSE) — no authentication required.\n\nSame event format as `/stream`, with the public endpoint security model:\n- Rate limited per client IP per day (no API key needed)\n- Direct file upload only — `file_url`, `file_base64`, and `record_id` are not supported\n- Hard caps: 10MB file size, 5 pages\n\n**Response Format:** `text/event-stream` with `metadata`, `content`, `complete`, `done`, and `error` events.","operationId":"public_extract_stream_api_v1_extract_public_stream_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_public_extract_stream_api_v1_extract_public_stream_post"}}},"required":true},"responses":{"200":{"description":"SSE stream of extraction events","content":{"application/json":{"schema":{}},"text/event-stream":{}}},"404":{"description":"Not found"},"413":{"description":"File size or page count exceeds public endpoint limits"},"429":{"description":"Public rate limit exceeded"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/public-vqa/init":{"post":{"tags":["Extract v1"],"summary":"Public VQA — prepare a document for questions","description":"Upload a document once and receive a handle for asking questions about it — no\nauthentication required.\n\nThis is the first phase of the public VQA flow. Send the document here, then use\nthe returned `record_id` and `token` with `/public-vqa/{record_id}/chat` to ask\nas many questions as you like without re-uploading.\n\nPublic endpoint security model:\n- Rate limited per client IP per day (no API key needed)\n- Direct file upload only — no URL / base64 inputs\n- Hard caps: 10MB file size, 5 pages","operationId":"public_vqa_init_api_v1_extract_public_vqa_init_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_public_vqa_init_api_v1_extract_public_vqa_init_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicVQAInitResponse"}}}},"404":{"description":"Not found"},"413":{"description":"File size or page count exceeds public endpoint limits"},"429":{"description":"Public rate limit exceeded"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/public-vqa/{record_id}/chat":{"post":{"tags":["Extract v1"],"summary":"Public VQA — ask a question about a prepared document","description":"Ask a question about a document prepared via `/public-vqa/init` — no\nauthentication required.\n\nProvide the `record_id` from the init phase along with its `token`. Ask as many\nquestions as you like; the document is not re-uploaded between questions.","operationId":"public_vqa_chat_api_v1_extract_public_vqa__record_id__chat_post","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicVQAChatRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicVQAChatResponse"}}}},"404":{"description":"Record not found or token invalid"},"503":{"description":"VQA service temporarily unavailable"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/batch":{"post":{"tags":["Extract v1"],"summary":"Batch content extraction","description":"Process multiple files in a batch asynchronously (max 50 files). Provide uploaded files, record_ids of existing files, or both.","operationId":"extract_batch_api_v1_extract_batch_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_batch_api_v1_extract_batch_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchExtractResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/results/{record_id}":{"get":{"tags":["Extract v1"],"summary":"Get extraction result","description":"Retrieve the result of a specific extraction job by its record ID","operationId":"get_extraction_result_api_v1_extract_results__record_id__get","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"string","title":"Record Id"}},{"name":"metadata_options","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Options for metadata output format. Use 'unified' to merge metadata into JSON content.","title":"Metadata Options"},"description":"Options for metadata output format. Use 'unified' to merge metadata into JSON content."},{"name":"version","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Version to retrieve: 0 for original AI extraction, N for Nth correction, omit for latest.","title":"Version"},"description":"Version to retrieve: 0 for original AI extraction, N for Nth correction, omit for latest."},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/results":{"get":{"tags":["Extract v1"],"summary":"List extraction results","description":"List all extraction results for the authenticated user with pagination","operationId":"list_extraction_results_api_v1_extract_results_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number (1-based)","default":1,"title":"Page"},"description":"Page number (1-based)"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Items per page (max 100)","default":20,"title":"Page Size"},"description":"Items per page (max 100)"},{"name":"sort_by","in":"query","required":false,"schema":{"type":"string","description":"Sort by: created_at, updated_at, original_filename, file_size, processing_status, output_type","default":"created_at","title":"Sort By"},"description":"Sort by: created_at, updated_at, original_filename, file_size, processing_status, output_type"},{"name":"sort_order","in":"query","required":false,"schema":{"type":"string","description":"Sort order: asc or desc","default":"desc","title":"Sort Order"},"description":"Sort order: asc or desc"},{"name":"batch_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Filter by batch ID (integer). Omit to get all files.","title":"Batch Id"},"description":"Filter by batch ID (integer). Omit to get all files."},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionListResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/upload":{"post":{"tags":["Extract v1"],"summary":"Initiate file uploads and get presigned S3 URLs","description":"Create database entries for files and return presigned S3 PUT URLs. The frontend uploads each file directly to S3 using the presigned URL, then calls POST /upload/status to mark each file as 'uploaded'.","operationId":"upload_files_init_api_v1_extract_upload_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadInitRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadInitResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/upload/file":{"post":{"tags":["Extract v1"],"summary":"Upload a file through the backend to S3","description":"Upload a single file through the backend. The server streams the file to S3, creates a database record, and marks it as uploaded — all in one request. Use this instead of the presigned-URL flow when direct S3 access from the client is not desired.","operationId":"upload_file_direct_api_v1_extract_upload_file_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_file_direct_api_v1_extract_upload_file_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectUploadFileResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/upload/status":{"post":{"tags":["Extract v1"],"summary":"Mark a file upload as complete","description":"Called by the frontend after a file has been uploaded directly to S3 via the presigned URL.","operationId":"upload_file_status_api_v1_extract_upload_status_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadStatusRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadStatusResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/bank-statement":{"post":{"tags":["Extract v1"],"summary":"Extract bank statement synchronously","description":"Process bank statement PDF using Gemini with page-wise concurrent extraction. Extracts table metadata and transactions, merging them into a unified structure.","operationId":"extract_bank_statement_sync_api_v1_extract_bank_statement_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_extract_bank_statement_sync_api_v1_extract_bank_statement_post"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/alter-bank":{"post":{"tags":["Extract v1"],"summary":"Extract document for Alter Bank (markdown + translation + summary)","description":"Alter Bank processing pipeline: markdown extraction, per-page English translation via Gemini, and a doc-level structured summary. PDFs are always queued asynchronously (returns 202); images and other file types are processed synchronously and return the result immediately (200). For async jobs, poll /results/{record_id} for the result.","operationId":"extract_alter_bank_api_v1_extract_alter_bank_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_extract_alter_bank_api_v1_extract_alter_bank_post"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/credit-usage":{"get":{"tags":["Extract v1"],"summary":"Get Credit Usage","description":"Get credit usage for the authenticated user/org.\nReturns pages processed, limit, remaining, and subscription status.\nOnly meaningful for free-tier (unpaid) users.","operationId":"get_credit_usage_api_v1_extract_credit_usage_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/results/{record_id}/edits":{"post":{"tags":["Extract v1"],"summary":"Submit edits to extraction result","description":"Submit field-level edits (edit, add, delete) to a JSON extraction result","operationId":"submit_extraction_corrections_api_v1_extract_results__record_id__edits_post","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"string","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/pdf-from-html":{"post":{"tags":["Extract v1"],"summary":"Convert HTML to PDF","description":"Accepts an HTML string and returns a PDF file generated via WeasyPrint.","operationId":"pdf_from_html_api_v1_extract_pdf_from_html_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/extract/alter-bank/pdf-with-cert":{"post":{"tags":["Extract v1"],"summary":"Convert HTML to PDF and append the Alter Bank certification page","description":"Generates a PDF from the provided HTML via WeasyPrint, then appends the Nanonets AI Translation Certification (converted from the source DOCX) as the final page.","operationId":"alter_bank_pdf_with_cert_api_v1_extract_alter_bank_pdf_with_cert_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/classify/batch":{"post":{"tags":["Classify v1"],"summary":"Batch document classification (async)","description":"Classify multiple documents asynchronously.\n\n**Features:**\n- Supports up to 50 files per batch\n- Supports up to 50 categories\n- Provide uploaded files, record_ids of existing files, or both\n- Files are queued for async processing\n- Use record_id to check classification status via /classify/results/{record_id}\n\n**Response:** Returns record IDs for each queued file. Poll status using the record_id.","operationId":"classify_batch_api_v1_classify_batch_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_classify_batch_api_v1_classify_batch_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchClassifyResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/classify/sync":{"post":{"tags":["Classify v1"],"summary":"Synchronous document classification","description":"Classify a single document synchronously.\n\n**mode:**\n- `page` (default) — classifies each page individually\n- `document` — aggregates page results into a single document-level classification\n- `section` — each page may match multiple categories","operationId":"classify_sync_api_v1_classify_sync_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_classify_sync_api_v1_classify_sync_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifySyncResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/classify/results/{record_id}":{"get":{"tags":["Classify v1"],"summary":"Get classification result","description":"Retrieve the result of a specific classification job by its record ID","operationId":"get_classification_result_api_v1_classify_results__record_id__get","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"string","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyGetResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/files":{"post":{"tags":["V2 API"],"summary":"Upload a file for later use","description":"Upload a document via file, file_url, or file_base64. Returns a file:// URI for downstream parse/extract calls.","operationId":"upload_file_api_v2_files_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_upload_file_api_v2_files_post"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/files/{file_id}":{"get":{"tags":["V2 API"],"summary":"Get file metadata and signed download URL","operationId":"get_file_api_v2_files__file_id__get","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/configs":{"post":{"tags":["V2 API"],"summary":"Create a reusable config","description":"Save a reusable set of parse or extract parameters.","operationId":"create_config_api_v2_configs_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["V2 API"],"summary":"List saved configs (paginated)","operationId":"list_configs_api_v2_configs_get","parameters":[{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by type: 'parse' or 'extract'","title":"Type"},"description":"Filter by type: 'parse' or 'extract'"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number (1-indexed)","default":1,"title":"Page"},"description":"Page number (1-indexed)"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Items per page","default":50,"title":"Page Size"},"description":"Items per page"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/configs/{config_id}":{"get":{"tags":["V2 API"],"summary":"Get a config by ID","operationId":"get_config_api_v2_configs__config_id__get","parameters":[{"name":"config_id","in":"path","required":true,"schema":{"type":"string","title":"Config Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["V2 API"],"summary":"Delete a config","operationId":"delete_config_api_v2_configs__config_id__delete","parameters":[{"name":"config_id","in":"path","required":true,"schema":{"type":"string","title":"Config Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/parse/sync":{"post":{"tags":["V2 API"],"summary":"Synchronous parse","description":"Parse a document synchronously. Returns markdown or HTML content.","operationId":"parse_sync_api_v2_parse_sync_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2Response"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/parse/async":{"post":{"tags":["V2 API"],"summary":"Asynchronous parse","description":"Queue one or more parse jobs. Pass a single string input for one job, or a list of strings (max 50) for batch processing. Returns record_id(s) for status polling.","operationId":"parse_async_api_v2_parse_async_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/extract/sync":{"post":{"tags":["V2 API"],"summary":"Synchronous extraction","description":"Extract structured data (JSON/CSV) from a document synchronously.","operationId":"extract_sync_api_v2_extract_sync_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2Response"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/extract/async":{"post":{"tags":["V2 API"],"summary":"Asynchronous extraction","description":"Queue one or more extraction jobs. Pass a single string input for one job, or a list of strings (max 50) for batch processing. Returns record_id(s) for status polling.","operationId":"extract_async_api_v2_extract_async_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/classify/sync":{"post":{"tags":["V2 API"],"summary":"Synchronous classification","description":"Classify a document synchronously. Mode 'document' returns a single best-fit category for the whole file. Mode 'split' returns page-level groupings by category (a page can appear in multiple categories).","operationId":"classify_sync_api_v2_classify_sync_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/classify/async":{"post":{"tags":["V2 API"],"summary":"Asynchronous classification","description":"Queue one or more classification jobs. Pass a single string input for one job, or a list of strings (max 50) for batch processing. Returns record_id(s) for status polling.","operationId":"classify_async_api_v2_classify_async_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/qa/run":{"post":{"tags":["V2 QA & Validate"],"summary":"Run document Q&A over a Markdown or Excel document","description":"Runs the docagent Q&A pipeline (deterministic Phase 1 + agentic Phase 2) against the supplied document and returns a synthesized answer. Input may be a `file://<uuid>` (already uploaded via /files), an `inline://<base64>` payload, or a public URL. Both Markdown and Excel workbooks (.xlsx/.xlsm/.xltx/.xltm) are accepted — Excel is auto-detected and converted to Markdown server-side via docagent's input adapters before reaching the orchestrator.","operationId":"qa_run_api_v2_qa_run_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QARunRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QARunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/qa/stream":{"post":{"tags":["V2 QA & Validate"],"summary":"Stream document Q&A events as NDJSON","description":"Same input contract as POST /api/v2/qa/run — accepts both Markdown and Excel inputs with auto-detection. Returns ``application/x-ndjson`` — one JSON event per line — surfacing docagent's intermediate orchestration events in real time. Useful for agentic clients that want to display tool-call / reasoning traces as the answer is built. The final line is the ``completed`` event (or ``error`` on failure). For Excel inputs, conversion happens before the stream opens — the first event the client sees is still a docagent orchestration event.","operationId":"qa_stream_api_v2_qa_stream_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QARunRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Qa Stream Api V2 Qa Stream Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/validate/run":{"post":{"tags":["V2 QA & Validate"],"summary":"Validate extracted fields against a set of rules","description":"Runs the docagent validator (deterministic math pre-check + agentic web_search / registry_lookup / cross_field verification) against ``validation_answer`` and returns a structured ValidationResult. Each rule produces one claim with status (``valid`` / ``invalid`` / ``inconclusive``), confidence, reasoning, and supporting evidence (for web_search rules).","operationId":"validate_run_api_v2_validate_run_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRunRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/auth/logout":{"post":{"tags":["Internal"],"summary":"Logout","description":"Logout user and invalidate session.","operationId":"logout_internal_auth_logout_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogoutResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/auth/api-key":{"post":{"tags":["Internal"],"summary":"Fetch Api Key","description":"Fetch API key for the authenticated user or the selected organization.\nChecks local user_details table first. If no key exists, generates a new UUID\nand stores it.","operationId":"fetch_api_key_internal_auth_api_key_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/auth/reset-api-key":{"post":{"tags":["Internal"],"summary":"Reset Api Key","description":"Generate a new API key for the authenticated user or selected organization,\nreplacing the old one. Requires owner role for org keys.","operationId":"reset_api_key_internal_auth_reset_api_key_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/app/status":{"get":{"tags":["Internal"],"summary":"Get App Status","description":"Get combined configuration and rate limit status for UI initialization.\n\nAlso verifies that Auth0 login email matches session token email.\nIf they don't match, updates the session token with the Auth0 email.","operationId":"get_app_status_internal_app_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/feedback":{"post":{"tags":["Internal"],"summary":"Submit Feedback","description":"Submit user satisfaction feedback for a specific document extraction.","operationId":"submit_feedback_internal_feedback_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_submit_feedback_internal_feedback_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/generate-schema":{"post":{"tags":["Internal"],"summary":"Generate Schema From Prompt","description":"Generate JSON schema from a natural language prompt using Gemini.\n\nThis endpoint is specifically designed for schema generation only.\nIt uses Gemini to convert a natural language description into a valid JSON schema.\n\nSecurity measures:\n- Requires authentication\n- Input validation (prompt length: 10-2000 chars)\n- Output validation to ensure valid JSON schema format\n- Rate limiting applied\n\nArgs:\n    schema_request: Request containing the natural language prompt\n    user: Authenticated user information\n\nReturns:\n    Generated JSON schema or error message","operationId":"generate_schema_from_prompt_internal_generate_schema_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateSchemaRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateSchemaResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/file/{record_id}/chat":{"post":{"tags":["Internal"],"summary":"Chat With File","description":"Chat about a VQA record. When Gemini is available, the original document is downloaded\nfrom storage and sent to Gemini in one document-level request (full PDF/image). If Gemini\nis unavailable, falls back to pre-extracted page images and the record's configured model.","operationId":"chat_with_file_internal_file__record_id__chat_post","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/file/chat/history":{"get":{"tags":["Internal"],"summary":"Get Chat History","description":"Get chat history for a VQA record.","operationId":"get_chat_history_internal_file_chat_history_get","parameters":[{"name":"record_id","in":"query","required":true,"schema":{"type":"integer","description":"ID of the document extraction record","title":"Record Id"},"description":"ID of the document extraction record"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of messages to return","default":50,"title":"Limit"},"description":"Maximum number of messages to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of messages to skip","default":0,"title":"Offset"},"description":"Number of messages to skip"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatHistoryResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/file/vqa":{"post":{"tags":["Internal"],"summary":"Analyze document for visual question answering","description":"Process a document and extract images for visual question answering (VQA). Returns image URLs that can be used with the chat endpoint for follow-up questions.","operationId":"analyze_document_vision_internal_file_vqa_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_analyze_document_vision_internal_file_vqa_post"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileVQAResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/files":{"get":{"tags":["Internal"],"summary":"Get multiple file records","description":"Retrieve details for multiple file records by their IDs. Returns signed URLs and content for accessible records.","operationId":"get_bulk_files_internal_files_get","parameters":[{"name":"record_ids","in":"query","required":true,"schema":{"type":"string","description":"Comma-separated list of record IDs (max 100)","title":"Record Ids"},"description":"Comma-separated list of record IDs (max 100)","example":"123,456,789"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkFilesResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/files/{record_id}":{"delete":{"tags":["Internal"],"summary":"Delete a file record","description":"Soft delete a file record. Only the record owner can delete their own records.","operationId":"delete_file_record_internal_files__record_id__delete","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteFileResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/batch/create":{"post":{"tags":["Internal"],"summary":"Create a new batch","description":"Create a new batch for organizing files.","operationId":"create_batch_internal_batch_create_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBatchResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/batches":{"get":{"tags":["Internal"],"summary":"Get batches","description":"Get paginated list of batches.","operationId":"get_batches_internal_batches_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum batches to return","default":10,"title":"Limit"},"description":"Maximum batches to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of batches to skip","default":0,"title":"Offset"},"description":"Number of batches to skip"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchesListResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/batch/{batch_id}/files":{"get":{"tags":["Internal"],"summary":"Get files inside a batch","description":"Get paginated list of files inside a specific batch.","operationId":"get_files_in_batch_internal_batch__batch_id__files_get","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"integer","title":"Batch Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Items per page","default":20,"title":"Page Size"},"description":"Items per page"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkFilesResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/files/move":{"post":{"tags":["Internal"],"summary":"Move files to a batch","description":"Move files to a destination batch.","operationId":"move_items_internal_files_move_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveItemsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveItemsResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/batches/delete":{"post":{"tags":["Internal"],"summary":"Delete batches","description":"Delete batches and all files inside them.","operationId":"delete_batches_internal_batches_delete_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteBatchesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteBatchesResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/batches/picker":{"get":{"tags":["Internal"],"summary":"Get all batches for picker","description":"Get all batches in a flat list for batch picker UI.","operationId":"get_batches_for_picker_internal_batches_picker_get","parameters":[{"name":"exclude","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated batch IDs to exclude","title":"Exclude"},"description":"Comma-separated batch IDs to exclude"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchPickerResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/review/{record_id}":{"get":{"tags":["Internal"],"summary":"Get Reviewable Extraction","description":"Get an extraction result for review, including correction history.","operationId":"get_reviewable_extraction_internal_review__record_id__get","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewableExtractionResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/review/{record_id}/edits":{"post":{"tags":["Internal"],"summary":"Submit Corrections","description":"Submit corrections (edits, adds, deletes) to an extraction result.","operationId":"submit_corrections_internal_review__record_id__edits_post","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitCorrectionsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitCorrectionsResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/completions":{"post":{"summary":"Openai Chat Completions","description":"OpenAI-compatible Chat Completions endpoint.\nSupports text messages and optional streaming (SSE) with the OpenAI chunk format.","operationId":"openai_chat_completions_v1_chat_completions_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs":{"get":{"tags":["organizations"],"summary":"List user's organizations","description":"Return every org the authenticated user belongs to (accepted only).","operationId":"list_orgs_api_v1_orgs_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrgResponse"},"title":"Response List Orgs Api V1 Orgs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["organizations"],"summary":"Create a named organization","description":"Create a new named org and set the creator as owner.","operationId":"create_org_api_v1_orgs_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/invites/pending":{"get":{"tags":["organizations"],"summary":"List pending invites for the authenticated user","operationId":"list_pending_invites_api_v1_orgs_invites_pending_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PendingInviteResponse"},"title":"Response List Pending Invites Api V1 Orgs Invites Pending Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/invites/accept":{"get":{"tags":["organizations"],"summary":"Accept invite via email link token","description":"Public endpoint — the token is the sole auth.\nReturns JSON so the frontend InviteAcceptPage can handle the UX.","operationId":"accept_invite_by_token_api_v1_orgs_invites_accept_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/invites/{org_id}/accept":{"post":{"tags":["organizations"],"summary":"Accept a pending invite (from the app)","operationId":"accept_invite_from_app_api_v1_orgs_invites__org_id__accept_post","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/invites/{org_id}/decline":{"post":{"tags":["organizations"],"summary":"Decline a pending invite","operationId":"decline_invite_from_app_api_v1_orgs_invites__org_id__decline_post","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/{org_id}":{"get":{"tags":["organizations"],"summary":"Get organization details","description":"Get org info including member list.  Any accepted member can view.","operationId":"get_org_api_v1_orgs__org_id__get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["organizations"],"summary":"Update organization name","operationId":"update_org_api_v1_orgs__org_id__patch","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["organizations"],"summary":"Delete a named organization","operationId":"delete_org_api_v1_orgs__org_id__delete","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/{org_id}/members":{"get":{"tags":["organizations"],"summary":"List organization members","operationId":"list_members_api_v1_orgs__org_id__members_get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MemberResponse"},"title":"Response List Members Api V1 Orgs  Org Id  Members Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["organizations"],"summary":"Invite a member to the organization","description":"Owners invite new members.  Creates a *pending* row and sends an\nemail.  The invitee must accept before they gain access.","operationId":"invite_member_api_v1_orgs__org_id__members_post","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMemberRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/{org_id}/members/{member_email}":{"patch":{"tags":["organizations"],"summary":"Change a member's role","operationId":"update_member_role_api_v1_orgs__org_id__members__member_email__patch","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"member_email","in":"path","required":true,"schema":{"type":"string","title":"Member Email"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberRoleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["organizations"],"summary":"Remove a member from the organization","operationId":"remove_member_api_v1_orgs__org_id__members__member_email__delete","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"member_email","in":"path","required":true,"schema":{"type":"string","title":"Member Email"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/{org_id}/billing":{"get":{"tags":["organizations"],"summary":"Get org billing status","operationId":"get_org_billing_api_v1_orgs__org_id__billing_get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/{org_id}/usage":{"get":{"tags":["organizations"],"summary":"Get org usage stats","operationId":"get_org_usage_api_v1_orgs__org_id__usage_get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orgs/{org_id}/api-key":{"get":{"tags":["organizations"],"summary":"Get or generate org API key","operationId":"get_org_api_key_api_v1_orgs__org_id__api_key_get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Read Root","description":"Serve the main HTML page","operationId":"read_root__get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/livez":{"get":{"summary":"Liveness Check","description":"Liveness probe — process-alive only, no dependency checks.","operationId":"liveness_check_livez_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Health check endpoint. Only checks database connectivity.\nvLLM status is reported informally but does not affect the response code —\na vLLM outage must not kill pods that are mid-request.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/logout":{"post":{"summary":"Logout","description":"Logout user and invalidate session","operationId":"logout_logout_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/fetch-api-key":{"post":{"summary":"Fetch Api Key","description":"Fetch API key for the authenticated user.\nChecks local user_details table first. If no key exists, generates a new UUID\nand stores it. Never calls app.nanonets anymore for new key fetches.","operationId":"fetch_api_key_fetch_api_key_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/app-status":{"get":{"summary":"Get App Status","description":"Get combined configuration and rate limit status for UI initialization\n\nAlso verifies that Auth0 login email matches session token email.\nIf they don't match, updates the session token with the Auth0 email.","operationId":"get_app_status_app_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/extract":{"post":{"summary":"Extract Content","description":"Extract content from uploaded file or file URL and convert to specified format using AI models.\n\nYou can provide either:\n- file: Upload a file directly\n- file_url: URL to download the file from\n\nAt least one of these must be provided.","operationId":"extract_content_extract_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_content_extract_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/extract-async":{"post":{"summary":"Extract Content Async","description":"Extract content from uploaded file and convert to multiple specified formats using AI models (async processing)","operationId":"extract_content_async_extract_async_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_content_async_extract_async_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public-extract":{"post":{"summary":"Public Extract Content","description":"Public extract endpoint - no authentication required, IP-based rate limiting only.\nSame functionality as /extract but with separate rate limits.","operationId":"public_extract_content_public_extract_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_public_extract_content_public_extract_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/files":{"get":{"summary":"Get User Files","description":"Get paginated list of files uploaded by the authenticated user within the configured visibility window and page count.\n\nArgs:\n    user: Authenticated user information\n    page: Page number (1-based, default: 1)\n    page_size: Items per page (1-100, default: 20)\n    sort_by: Column to sort by (default: created_at)\n    sort_order: Sort order - asc or desc (default: desc)\n\nReturns:\n    Paginated list of user's uploaded files with metadata (only files created within configured visibility window and with minimum page count)","operationId":"get_user_files_files_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number (1-based)","default":1,"title":"Page"},"description":"Page number (1-based)"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of items per page (max 100)","default":20,"title":"Page Size"},"description":"Number of items per page (max 100)"},{"name":"sort_by","in":"query","required":false,"schema":{"type":"string","description":"Sort by: created_at, updated_at, original_filename, file_size, processing_status, output_type, model_type","default":"created_at","title":"Sort By"},"description":"Sort by: created_at, updated_at, original_filename, file_size, processing_status, output_type, model_type"},{"name":"sort_order","in":"query","required":false,"schema":{"type":"string","description":"Sort order: asc or desc","default":"desc","title":"Sort Order"},"description":"Sort order: asc or desc"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/files/bulk":{"get":{"summary":"Get Multiple Files","description":"Get details for multiple file records by their IDs.\n\nAll records must belong to the authenticated user (unless user is from nanonets.com).\nReturns only the records that the user is authorized to access.\n\nArgs:\n    record_ids: Comma-separated string of record IDs (e.g., \"123,456,789\")\n    user: Authenticated user information\n    url_expires_in: Signed URL expiration time in seconds (default: 1 hour)\n\nReturns:\n    List of file records with details, signed URLs, and response content","operationId":"get_multiple_files_files_bulk_get","parameters":[{"name":"record_ids","in":"query","required":true,"schema":{"type":"string","description":"Comma-separated list of record IDs (max 100)","title":"Record Ids"},"description":"Comma-separated list of record IDs (max 100)"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/files/{record_id}":{"get":{"summary":"Get File Details","description":"Get complete details of a specific file record, including signed URLs and full response content.\n\nArgs:\n    record_id: Unique file record ID\n    user: Authenticated user information\n    url_expires_in: Signed URL expiration time in seconds (default: 1 hour)\n\nReturns:\n    Complete file details with signed URLs and full response content","operationId":"get_file_details_files__record_id__get","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"url_expires_in","in":"query","required":false,"schema":{"type":"integer","maximum":86400,"minimum":1,"description":"Signed URL expiration in seconds (1-24 hours)","default":3600,"title":"Url Expires In"},"description":"Signed URL expiration in seconds (1-24 hours)"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete File Record","description":"Soft delete a file record by setting is_deleted = true\nOnly the record owner can delete their own records","operationId":"delete_file_record_files__record_id__delete","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/feedback":{"post":{"summary":"Submit Feedback","description":"Submit user satisfaction feedback for a specific document extraction.\n\nArgs:\n    record_id: The ID of the document extraction record\n    user_satisfied: True if user is satisfied, False if not satisfied\n    user: Authenticated user information\n\nReturns:\n    Success message with feedback status","operationId":"submit_feedback_feedback_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_submit_feedback_feedback_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/extract/stream":{"post":{"summary":"Extract With Streaming V1","description":"New streaming endpoint with modular architecture\n\nAutomatically selects streaming or batch mode based on:\n- Model capabilities\n- Output format compatibility\n- Client preference (enable_streaming flag)\n\nReturns:\n- StreamingResponse (SSE) if streaming enabled and supported\n- Regular JSON response if streaming not available","operationId":"extract_with_streaming_v1_v1_extract_stream_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_with_streaming_v1_v1_extract_stream_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/extract/partial-results/{record_id}":{"get":{"summary":"Get Partial Results","description":"Get partial results for a document extraction record\n\nReturns partial results as pages are processed for large files","operationId":"get_partial_results_v1_extract_partial_results__record_id__get","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"integer","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AddMemberRequest":{"properties":{"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role","default":"viewer"}},"type":"object","required":["email"],"title":"AddMemberRequest"},"BatchClassifyResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"batch_id":{"type":"string","title":"Batch Id"},"total_files":{"type":"integer","title":"Total Files"},"successful_files":{"type":"integer","title":"Successful Files"},"failed_files":{"type":"integer","title":"Failed Files"},"results":{"items":{"$ref":"#/components/schemas/ClassifySyncResponse"},"type":"array","title":"Results"}},"type":"object","required":["success","message","batch_id","total_files","successful_files","failed_files","results"],"title":"BatchClassifyResponse","description":"Response for batch classification (async)."},"BatchExtractResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"batch_id":{"type":"string","title":"Batch Id"},"total_files":{"type":"integer","title":"Total Files"},"accepted_files":{"type":"integer","title":"Accepted Files"},"rejected_files":{"type":"integer","title":"Rejected Files"},"records":{"items":{"$ref":"#/components/schemas/ExtractResponse"},"type":"array","title":"Records"}},"type":"object","required":["success","message","batch_id","total_files","accepted_files","rejected_files","records"],"title":"BatchExtractResponse"},"BatchInfo":{"properties":{"id":{"type":"integer","title":"Id","description":"Batch ID (integer)"},"name":{"type":"string","title":"Name","description":"Batch name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Batch description"},"user_email":{"type":"string","title":"User Email","description":"Owner email"},"created_at":{"type":"string","title":"Created At","description":"Creation timestamp"},"updated_at":{"type":"string","title":"Updated At","description":"Last update timestamp"},"total_files":{"type":"integer","title":"Total Files","description":"Total number of files in batch","default":0},"files_completed":{"type":"integer","title":"Files Completed","description":"Number of successfully processed files","default":0},"files_processing":{"type":"integer","title":"Files Processing","description":"Number of files currently processing","default":0},"files_failed":{"type":"integer","title":"Files Failed","description":"Number of failed files","default":0}},"type":"object","required":["id","name","user_email","created_at","updated_at"],"title":"BatchInfo","description":"Information about a batch."},"BatchPickerItem":{"properties":{"id":{"type":"integer","title":"Id","description":"Batch ID (integer)"},"name":{"type":"string","title":"Name","description":"Batch name"}},"type":"object","required":["id","name"],"title":"BatchPickerItem","description":"Batch item for batch picker."},"BatchPickerResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful","default":true},"batches":{"items":{"$ref":"#/components/schemas/BatchPickerItem"},"type":"array","title":"Batches","description":"All available batches"}},"type":"object","title":"BatchPickerResponse","description":"Response model for batch picker."},"BatchesListResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful","default":true},"batches":{"items":{"$ref":"#/components/schemas/BatchInfo"},"type":"array","title":"Batches","description":"List of batches"},"pagination":{"allOf":[{"$ref":"#/components/schemas/api__internal__schemas__PaginationInfo"}],"description":"Pagination information"}},"type":"object","required":["pagination"],"title":"BatchesListResponse","description":"Response model for listing batches."},"Body_analyze_document_vision_internal_file_vqa_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"Document file to analyze (PDF or image)"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the document to analyze"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use. Options: '' or 'default' (current model), 'nanonets-ocr-2.1' (newer model), 'nanonets-ocr-3' (OCR-3 with crop augmentation)."}},"type":"object","title":"Body_analyze_document_vision_internal_file_vqa_post"},"Body_classify_batch_api_v1_classify_batch_post":{"properties":{"files":{"items":{"type":"string","format":"binary"},"type":"array","title":"Files","description":"Files to classify (maximum 50)","default":[]},"record_ids":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Record Ids","description":"Comma-separated record IDs of existing uploaded files to classify"},"categories":{"type":"string","title":"Categories","description":"JSON array of category objects: [{\"name\": \"Category Name\", \"description\": \"Optional description\"}]"},"mode":{"type":"string","title":"Mode","description":"'document', 'page', or 'section'","default":"page"},"merge_unknown_segments":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merge Unknown Segments","description":"Set to 'true' to fill missing subcategory values from previous pages"}},"type":"object","required":["categories"],"title":"Body_classify_batch_api_v1_classify_batch_post"},"Body_classify_sync_api_v1_classify_sync_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"File to classify"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the file to classify (alternative to file upload)"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Existing record ID to classify (alternative to file upload)"},"categories":{"type":"string","title":"Categories","description":"JSON array of category objects: [{\"name\": \"Category Name\", \"description\": \"Optional description\"}]"},"mode":{"type":"string","title":"Mode","description":"'document', 'page', or 'section'","default":"page"},"merge_unknown_segments":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merge Unknown Segments","description":"Set to 'true' to fill missing subcategory values from previous pages"}},"type":"object","required":["categories"],"title":"Body_classify_sync_api_v1_classify_sync_post"},"Body_extract_alter_bank_api_v1_extract_alter_bank_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"File to process (PDF, images, DOCX, etc.)"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the file to process"},"file_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Base64","description":"Base64 encoded file content"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Existing record ID to process"},"extract_charts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extract Charts","description":"Enable visual data extraction (charts, diagrams) as tables"},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"Enable Precision OCR Enhancement (OCR-3 only)"}},"type":"object","title":"Body_extract_alter_bank_api_v1_extract_alter_bank_post"},"Body_extract_async_api_v1_extract_async_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"File to process (multipart/form-data upload)"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the file to process (alternative to file upload)"},"file_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Base64","description":"Base64 encoded file content (alternative to file upload or file_url)"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Existing record ID to process (alternative to file upload). If provided, processes the file from this existing record."},"output_format":{"type":"string","title":"Output Format","description":"Comma-separated output formats (e.g., 'markdown', 'json', 'markdown,json')"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' (default) or 'replace' base prompt","default":"append"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for content extraction"},"json_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Options","description":"Options for JSON extraction: 'hierarchy_output', or 'table-of-contents', or list of field names to extract, or a JSON schema dict. If not provided when output_format includes 'json', flat key-value extraction is used."},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"Options for CSV extraction: 'table' for table extraction, 'toc' for table of contents."},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Options for Markdown extraction: 'financial-docs' for financial document formatting, 'toc' for table of contents."},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata options to include (e.g., 'confidence_score', 'bounding_boxes' for block-level, 'bounding_boxes_word' for word-level, 'fast_mode' for parallel vLLM+Gemini racing). Bounding boxes apply to markdown and to JSON outputs including flat key-value (no schema) when output_format includes json. fast_mode requires the feature flag to be enabled."},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Options for metadata output format. Use 'unified' to merge metadata (bounding_boxes, confidence_score) directly into JSON content structure."},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for extraction. Options: 'nanonets-ocr-2' (previous generation), 'nanonets-ocr-3' (latest, default). In production, specify an explicit model to avoid changes when defaults are updated."},"agentic_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Mode","description":"Enable agentic post-processing. When 'true', runs agentic pipeline steps on JSON extraction results."},"agentic_steps":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Steps","description":"Comma-separated agentic steps to run (e.g. 'clinical_trials'). Requires agentic_mode='true'. If not specified, defaults to all available steps."},"extraction_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Options","description":"JSON string with hierarchy extraction options. Keys: financial_doc (bool), include_summaries (bool), include_entities (bool), custom_summary_prompt (str), custom_entity_types (list), custom_relationship_types (list). Example: '{\"financial_doc\":true,\"include_summaries\":true,\"include_entities\":true}'"},"extract_charts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extract Charts","description":"When 'true', extract data points from charts/graphs in the document and enrich the markdown with data tables. Each chart's data is inserted inline after the corresponding image tag. Requires chart enrichment to be enabled on the server; when it is not, charts are covered only by the standard page extraction."},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"Precision OCR Enhancement provider for OCR-3 model processing. Disabled by default — omit this field (or pass 'false') to send only the raw image to the vision model. Accepts 'google' to opt in to a Google Vision document_text_detection hint, or 'paddle' (Modal-hosted Paddle+OpenOCR ensemble hint). The legacy value 'true' is accepted as an alias for 'google'."},"auto_rotate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auto Rotate","description":"When 'true', detect page orientation and rotate each page upright before extraction. Uses EXIF first, then a PaddleOCR classifier fallback. Defaults to 'false'."},"gpu":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gpu","description":"OCR-3 GPU selection: 'h200' routes extraction to the secondary deployment (when configured); 'a100' or omitted uses the default. Allowlisted accounts route to the secondary deployment automatically regardless of this value."}},"type":"object","required":["output_format"],"title":"Body_extract_async_api_v1_extract_async_post"},"Body_extract_bank_statement_sync_api_v1_extract_bank_statement_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"PDF file to process"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the PDF file"},"file_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Base64","description":"Base64 encoded PDF content"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Existing record ID to process"},"statement_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Statement Type","description":"Optional statement type: 'auto', 'single', or 'multi'"}},"type":"object","title":"Body_extract_bank_statement_sync_api_v1_extract_bank_statement_post"},"Body_extract_batch_api_v1_extract_batch_post":{"properties":{"files":{"items":{"type":"string","format":"binary"},"type":"array","title":"Files","description":"Files to process (maximum 50)","default":[]},"record_ids":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Record Ids","description":"Comma-separated record IDs of existing uploaded files to process"},"statement_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Statement Type","description":"Bank statement account type: 'auto', 'single', or 'multi'"},"output_format":{"type":"string","title":"Output Format","description":"Comma-separated output formats (e.g., 'markdown', 'json', 'markdown,json')"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' (default) or 'replace' base prompt","default":"append"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for content extraction"},"json_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Options","description":"Options for JSON extraction: 'hierarchy_output', or 'table-of-contents', or list of field names to extract, or a JSON schema dict. If not provided when output_format includes 'json', flat key-value extraction is used."},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"Options for CSV extraction: 'table' for table extraction, 'toc' for table of contents."},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Options for Markdown extraction: 'financial-docs' for financial document formatting, 'toc' for table of contents."},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata options to include (e.g., 'confidence_score', 'bounding_boxes' for block-level, 'bounding_boxes_word' for word-level, 'fast_mode' for parallel vLLM+Gemini racing). Bounding boxes apply to markdown and to JSON outputs including flat key-value (no schema) when output_format includes json. fast_mode requires the feature flag to be enabled."},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Options for metadata output format. Use 'unified' to merge metadata (bounding_boxes, confidence_score) directly into JSON content structure."},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for extraction. Options: 'nanonets-ocr-2' (previous generation), 'nanonets-ocr-3' (latest, default). In production, specify an explicit model to avoid changes when defaults are updated."},"agentic_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Mode","description":"Enable agentic post-processing. When 'true', runs agentic pipeline steps on JSON extraction results."},"agentic_steps":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Steps","description":"Comma-separated agentic steps to run (e.g. 'clinical_trials'). Requires agentic_mode='true'. If not specified, defaults to all available steps."},"extraction_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Options","description":"JSON string with hierarchy extraction options. Keys: financial_doc (bool), include_summaries (bool), include_entities (bool), custom_summary_prompt (str), custom_entity_types (list), custom_relationship_types (list). Example: '{\"financial_doc\":true,\"include_summaries\":true,\"include_entities\":true}'"},"extract_charts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extract Charts","description":"When 'true', extract data points from charts/graphs in the document and enrich the markdown with data tables. Each chart's data is inserted inline after the corresponding image tag. Requires chart enrichment to be enabled on the server; when it is not, charts are covered only by the standard page extraction."},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"Precision OCR Enhancement provider for OCR-3 model processing. Disabled by default — omit this field (or pass 'false') to send only the raw image to the vision model. Accepts 'google' to opt in to a Google Vision document_text_detection hint, or 'paddle' (Modal-hosted Paddle+OpenOCR ensemble hint). The legacy value 'true' is accepted as an alias for 'google'."},"auto_rotate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auto Rotate","description":"When 'true', detect page orientation and rotate each page upright before extraction. Uses EXIF first, then a PaddleOCR classifier fallback. Defaults to 'false'."},"gpu":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gpu","description":"OCR-3 GPU selection: 'h200' routes extraction to the secondary deployment (when configured); 'a100' or omitted uses the default. Allowlisted accounts route to the secondary deployment automatically regardless of this value."}},"type":"object","required":["output_format"],"title":"Body_extract_batch_api_v1_extract_batch_post"},"Body_extract_content_async_extract_async_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"output_type":{"type":"string","title":"Output Type","description":"Output format (comma-separated for multiple): markdown, markdown-financial-docs, html, csv, flat-json, specified-fields, specified-json, vqa. (Note: fields, tables, ocr-with-bounding-boxes available via API but hidden from UI)"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use: gemini, nanonets, or nanonets-ocr-s (defaults to config setting)"},"specified_fields":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specified Fields","description":"Comma-separated list of fields to extract (for specified-fields format)"},"json_schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Schema","description":"JSON schema for extraction (for specified-json format)"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Additional formatting instructions for markdown output. Use this to specify output normalization rules. Example: 'Format all dates as YYYY-MM-DD. Extract amounts without currency symbols.' Max 8000 characters."},"prompt_mode":{"type":"string","title":"Prompt Mode","description":"How to apply custom_instructions: 'append' (add to base prompt) or 'replace' (use only custom instructions)","default":"append"},"source":{"type":"string","title":"Source","description":"Request source: api, ui, or library","default":"api"}},"type":"object","required":["file","output_type"],"title":"Body_extract_content_async_extract_async_post"},"Body_extract_content_extract_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL to download file from (alternative to uploading file)"},"output_type":{"type":"string","title":"Output Type","description":"Output format (comma-separated for multiple): markdown, markdown-financial-docs, html, csv, flat-json, specified-fields, specified-json, vqa. (Note: fields, tables, ocr-with-bounding-boxes available via API but hidden from UI)"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use: gemini, nanonets, or nanonets-ocr-s (defaults to config setting)"},"specified_fields":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specified Fields","description":"Comma-separated list of fields to extract (for specified-fields format)"},"json_schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Schema","description":"JSON schema for extraction (for specified-json format)"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Additional formatting instructions for markdown output. Use this to specify output normalization rules. Example: 'Format all dates as YYYY-MM-DD. Extract amounts without currency symbols.' Max 8000 characters."},"prompt_mode":{"type":"string","title":"Prompt Mode","description":"How to apply custom_instructions: 'append' (add to base prompt) or 'replace' (use only custom instructions)","default":"append"},"source":{"type":"string","title":"Source","description":"Request source: api, ui, or library","default":"api"}},"type":"object","required":["output_type"],"title":"Body_extract_content_extract_post"},"Body_extract_stream_api_v1_extract_stream_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"File to process (multipart/form-data upload)"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the file to process (alternative to file upload)"},"file_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Base64","description":"Base64 encoded file content (alternative to file upload or file_url)"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Record ID of a previously uploaded file to re-extract"},"output_format":{"type":"string","title":"Output Format","description":"Comma-separated output formats (e.g., 'markdown', 'json', 'markdown,json')"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' (default) or 'replace' base prompt","default":"append"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for content extraction"},"json_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Options","description":"Options for JSON extraction: 'hierarchy_output', or 'table-of-contents', or list of field names to extract, or a JSON schema dict. If not provided when output_format includes 'json', flat key-value extraction is used."},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"Options for CSV extraction: 'table' for table extraction, 'toc' for table of contents."},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Options for Markdown extraction: 'financial-docs' for financial document formatting, 'toc' for table of contents."},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata options to include (e.g., 'confidence_score', 'bounding_boxes' for block-level, 'bounding_boxes_word' for word-level, 'fast_mode' for parallel vLLM+Gemini racing). Bounding boxes apply to markdown and to JSON outputs including flat key-value (no schema) when output_format includes json. fast_mode requires the feature flag to be enabled."},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Options for metadata output format. Use 'unified' to merge metadata (bounding_boxes, confidence_score) directly into JSON content structure."},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for extraction. Options: 'nanonets-ocr-2' (previous generation), 'nanonets-ocr-3' (latest, default). In production, specify an explicit model to avoid changes when defaults are updated."},"agentic_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Mode","description":"Enable agentic post-processing. When 'true', runs agentic pipeline steps on JSON extraction results."},"agentic_steps":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Steps","description":"Comma-separated agentic steps to run (e.g. 'clinical_trials'). Requires agentic_mode='true'. If not specified, defaults to all available steps."},"extraction_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Options","description":"JSON string with hierarchy extraction options. Keys: financial_doc (bool), include_summaries (bool), include_entities (bool), custom_summary_prompt (str), custom_entity_types (list), custom_relationship_types (list). Example: '{\"financial_doc\":true,\"include_summaries\":true,\"include_entities\":true}'"},"extract_charts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extract Charts","description":"When 'true', extract data points from charts/graphs in the document and enrich the markdown with data tables. Each chart's data is inserted inline after the corresponding image tag. Requires chart enrichment to be enabled on the server; when it is not, charts are covered only by the standard page extraction."},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"Precision OCR Enhancement provider for OCR-3 model processing. Disabled by default — omit this field (or pass 'false') to send only the raw image to the vision model. Accepts 'google' to opt in to a Google Vision document_text_detection hint, or 'paddle' (Modal-hosted Paddle+OpenOCR ensemble hint). The legacy value 'true' is accepted as an alias for 'google'."},"auto_rotate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auto Rotate","description":"When 'true', detect page orientation and rotate each page upright before extraction. Uses EXIF first, then a PaddleOCR classifier fallback. Defaults to 'false'."},"gpu":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gpu","description":"OCR-3 GPU selection: 'h200' routes extraction to the secondary deployment (when configured); 'a100' or omitted uses the default. Allowlisted accounts route to the secondary deployment automatically regardless of this value."},"enable_streaming":{"type":"boolean","title":"Enable Streaming","description":"Enable real-time streaming. If False, returns SSE events in batch mode.","default":true}},"type":"object","required":["output_format"],"title":"Body_extract_stream_api_v1_extract_stream_post"},"Body_extract_sync_api_v1_extract_sync_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"File to process (multipart/form-data upload)"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL of the file to process (alternative to file upload)"},"file_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Base64","description":"Base64 encoded file content (alternative to file upload or file_url)"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Existing record ID to process (alternative to file upload). If provided, processes the file from this existing record."},"output_format":{"type":"string","title":"Output Format","description":"Comma-separated output formats (e.g., 'markdown', 'json', 'markdown,json')"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' (default) or 'replace' base prompt","default":"append"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for content extraction"},"json_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Options","description":"Options for JSON extraction: 'hierarchy_output', or 'table-of-contents', or list of field names to extract, or a JSON schema dict. If not provided when output_format includes 'json', flat key-value extraction is used."},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"Options for CSV extraction: 'table' for table extraction, 'toc' for table of contents."},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Options for Markdown extraction: 'financial-docs' for financial document formatting, 'toc' for table of contents."},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata options to include (e.g., 'confidence_score', 'bounding_boxes' for block-level, 'bounding_boxes_word' for word-level, 'fast_mode' for parallel vLLM+Gemini racing). Bounding boxes apply to markdown and to JSON outputs including flat key-value (no schema) when output_format includes json. fast_mode requires the feature flag to be enabled."},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Options for metadata output format. Use 'unified' to merge metadata (bounding_boxes, confidence_score) directly into JSON content structure."},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for extraction. Options: 'nanonets-ocr-2' (previous generation), 'nanonets-ocr-3' (latest, default). In production, specify an explicit model to avoid changes when defaults are updated."},"agentic_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Mode","description":"Enable agentic post-processing. When 'true', runs agentic pipeline steps on JSON extraction results."},"agentic_steps":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Steps","description":"Comma-separated agentic steps to run (e.g. 'clinical_trials'). Requires agentic_mode='true'. If not specified, defaults to all available steps."},"extraction_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Options","description":"JSON string with hierarchy extraction options. Keys: financial_doc (bool), include_summaries (bool), include_entities (bool), custom_summary_prompt (str), custom_entity_types (list), custom_relationship_types (list). Example: '{\"financial_doc\":true,\"include_summaries\":true,\"include_entities\":true}'"},"extract_charts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extract Charts","description":"When 'true', extract data points from charts/graphs in the document and enrich the markdown with data tables. Each chart's data is inserted inline after the corresponding image tag. Requires chart enrichment to be enabled on the server; when it is not, charts are covered only by the standard page extraction."},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"Precision OCR Enhancement provider for OCR-3 model processing. Disabled by default — omit this field (or pass 'false') to send only the raw image to the vision model. Accepts 'google' to opt in to a Google Vision document_text_detection hint, or 'paddle' (Modal-hosted Paddle+OpenOCR ensemble hint). The legacy value 'true' is accepted as an alias for 'google'."},"auto_rotate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auto Rotate","description":"When 'true', detect page orientation and rotate each page upright before extraction. Uses EXIF first, then a PaddleOCR classifier fallback. Defaults to 'false'."},"gpu":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gpu","description":"OCR-3 GPU selection: 'h200' routes extraction to the secondary deployment (when configured); 'a100' or omitted uses the default. Allowlisted accounts route to the secondary deployment automatically regardless of this value."}},"type":"object","required":["output_format"],"title":"Body_extract_sync_api_v1_extract_sync_post"},"Body_extract_with_streaming_v1_v1_extract_stream_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL to download file from (alternative to uploading file)"},"output_type":{"type":"string","title":"Output Type"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type"},"enable_streaming":{"type":"boolean","title":"Enable Streaming","default":true},"specified_fields":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specified Fields"},"json_schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Schema"},"source":{"type":"string","title":"Source","default":"ui"}},"type":"object","required":["output_type"],"title":"Body_extract_with_streaming_v1_v1_extract_stream_post"},"Body_public_extract_content_public_extract_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"output_type":{"type":"string","title":"Output Type","description":"Output format (comma-separated for multiple): markdown, markdown-financial-docs, html, csv, flat-json, specified-fields, specified-json, vqa. (Note: fields, tables, ocr-with-bounding-boxes available via API but hidden from UI)"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use: gemini, nanonets, or nanonets-ocr-s (defaults to config setting)"},"specified_fields":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specified Fields","description":"Comma-separated list of fields to extract (for specified-fields format)"},"json_schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Schema","description":"JSON schema for extraction (for specified-json format)"},"source":{"type":"string","title":"Source","description":"Request source: public-api, ui, or library","default":"public-api"}},"type":"object","required":["file","output_type"],"title":"Body_public_extract_content_public_extract_post"},"Body_public_extract_stream_api_v1_extract_public_stream_post":{"properties":{"file":{"type":"string","format":"binary","title":"File","description":"File to process (multipart/form-data upload)"},"output_format":{"type":"string","title":"Output Format","description":"Comma-separated output formats (e.g., 'markdown', 'json', 'markdown,json')"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' (default) or 'replace' base prompt","default":"append"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for content extraction"},"json_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Options","description":"Options for JSON extraction: 'hierarchy_output', or 'table-of-contents', or list of field names to extract, or a JSON schema dict. If not provided when output_format includes 'json', flat key-value extraction is used."},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"Options for CSV extraction: 'table' for table extraction, 'toc' for table of contents."},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Options for Markdown extraction: 'financial-docs' for financial document formatting, 'toc' for table of contents."},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata options to include (e.g., 'confidence_score', 'bounding_boxes' for block-level, 'bounding_boxes_word' for word-level, 'fast_mode' for parallel vLLM+Gemini racing). Bounding boxes apply to markdown and to JSON outputs including flat key-value (no schema) when output_format includes json. fast_mode requires the feature flag to be enabled."},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Options for metadata output format. Use 'unified' to merge metadata (bounding_boxes, confidence_score) directly into JSON content structure."},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for extraction. Options: 'nanonets-ocr-2' (previous generation), 'nanonets-ocr-3' (latest, default). In production, specify an explicit model to avoid changes when defaults are updated."},"agentic_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Mode","description":"Enable agentic post-processing. When 'true', runs agentic pipeline steps on JSON extraction results."},"agentic_steps":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agentic Steps","description":"Comma-separated agentic steps to run (e.g. 'clinical_trials'). Requires agentic_mode='true'. If not specified, defaults to all available steps."},"extraction_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Options","description":"JSON string with hierarchy extraction options. Keys: financial_doc (bool), include_summaries (bool), include_entities (bool), custom_summary_prompt (str), custom_entity_types (list), custom_relationship_types (list). Example: '{\"financial_doc\":true,\"include_summaries\":true,\"include_entities\":true}'"},"extract_charts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extract Charts","description":"When 'true', extract data points from charts/graphs in the document and enrich the markdown with data tables. Each chart's data is inserted inline after the corresponding image tag. Requires chart enrichment to be enabled on the server; when it is not, charts are covered only by the standard page extraction."},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"Precision OCR Enhancement provider for OCR-3 model processing. Disabled by default — omit this field (or pass 'false') to send only the raw image to the vision model. Accepts 'google' to opt in to a Google Vision document_text_detection hint, or 'paddle' (Modal-hosted Paddle+OpenOCR ensemble hint). The legacy value 'true' is accepted as an alias for 'google'."},"auto_rotate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auto Rotate","description":"When 'true', detect page orientation and rotate each page upright before extraction. Uses EXIF first, then a PaddleOCR classifier fallback. Defaults to 'false'."},"gpu":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gpu","description":"OCR-3 GPU selection: 'h200' routes extraction to the secondary deployment (when configured); 'a100' or omitted uses the default. Allowlisted accounts route to the secondary deployment automatically regardless of this value."},"enable_streaming":{"type":"boolean","title":"Enable Streaming","description":"Enable real-time streaming. If False, returns SSE events in batch mode.","default":true}},"type":"object","required":["file","output_format"],"title":"Body_public_extract_stream_api_v1_extract_public_stream_post"},"Body_public_vqa_init_api_v1_extract_public_vqa_init_post":{"properties":{"file":{"type":"string","format":"binary","title":"File","description":"Document to ask questions about (multipart/form-data upload)"}},"type":"object","required":["file"],"title":"Body_public_vqa_init_api_v1_extract_public_vqa_init_post"},"Body_submit_feedback_feedback_post":{"properties":{"record_id":{"type":"integer","title":"Record Id","description":"The ID of the document extraction record"},"user_satisfied":{"type":"boolean","title":"User Satisfied","description":"True if satisfied with the response, False if not satisfied"}},"type":"object","required":["record_id","user_satisfied"],"title":"Body_submit_feedback_feedback_post"},"Body_submit_feedback_internal_feedback_post":{"properties":{"record_id":{"type":"integer","title":"Record Id","description":"The ID of the document extraction record"},"user_satisfied":{"type":"boolean","title":"User Satisfied","description":"True if satisfied with the response, False if not satisfied"}},"type":"object","required":["record_id","user_satisfied"],"title":"Body_submit_feedback_internal_feedback_post"},"Body_upload_file_api_v2_files_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"File upload (multipart)"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"Public URL to fetch the file from"},"file_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Base64","description":"Base64-encoded file content"}},"type":"object","title":"Body_upload_file_api_v2_files_post"},"Body_upload_file_direct_api_v1_extract_upload_file_post":{"properties":{"file":{"type":"string","format":"binary","title":"File","description":"File to upload"},"batch_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Batch Id","description":"Batch ID to assign the file to"}},"type":"object","required":["file"],"title":"Body_upload_file_direct_api_v1_extract_upload_file_post"},"BulkFilesResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful"},"message":{"type":"string","title":"Message","description":"Descriptive message about the result"},"requested_count":{"type":"integer","title":"Requested Count","description":"Number of record IDs requested"},"found_count":{"type":"integer","title":"Found Count","description":"Number of records found and accessible"},"url_expires_in":{"type":"integer","title":"Url Expires In","description":"Signed URL expiration time in seconds"},"user_email":{"type":"string","title":"User Email","description":"Email of the requesting user"},"is_nanonets_user":{"type":"boolean","title":"Is Nanonets User","description":"Whether the user is a nanonets.com user"},"records":{"items":{"$ref":"#/components/schemas/FileRecordDetail"},"type":"array","title":"Records","description":"List of file records"}},"type":"object","required":["success","message","requested_count","found_count","url_expires_in","user_email","is_nanonets_user"],"title":"BulkFilesResponse","description":"Response model for bulk files retrieval endpoint."},"ChatHistoryResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"record_id":{"type":"integer","title":"Record Id"},"messages":{"items":{"$ref":"#/components/schemas/ChatMessage"},"type":"array","title":"Messages"},"total_messages":{"type":"integer","title":"Total Messages"},"has_images":{"type":"boolean","title":"Has Images"},"record_info":{"type":"object","title":"Record Info"}},"type":"object","required":["success","record_id","messages","total_messages","has_images","record_info"],"title":"ChatHistoryResponse","description":"Response model for chat history endpoint."},"ChatMessage":{"properties":{"id":{"type":"integer","title":"Id"},"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"model_type":{"type":"string","title":"Model Type"},"processing_time_seconds":{"type":"number","title":"Processing Time Seconds"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","question","answer","model_type","processing_time_seconds","created_at","updated_at"],"title":"ChatMessage","description":"Individual chat message in history."},"ChatRequest":{"properties":{"question":{"type":"string","title":"Question","description":"The question to ask about the document"}},"type":"object","required":["question"],"title":"ChatRequest","description":"Request model for chat with file endpoint."},"ChatResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"model_type":{"type":"string","title":"Model Type"},"processing_time":{"type":"number","title":"Processing Time"},"chat_id":{"type":"integer","title":"Chat Id"},"record_id":{"type":"integer","title":"Record Id"}},"type":"object","required":["success","question","answer","model_type","processing_time","chat_id","record_id"],"title":"ChatResponse","description":"Response model for chat with file endpoint."},"ClaimResultSchema":{"properties":{"claim":{"type":"string","title":"Claim"},"fields":{"items":{"type":"string"},"type":"array","title":"Fields"},"status":{"$ref":"#/components/schemas/ClaimStatusEnum"},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence"},"reasoning":{"type":"string","title":"Reasoning"},"evidence":{"items":{"$ref":"#/components/schemas/EvidenceSchema"},"type":"array","title":"Evidence"}},"type":"object","required":["claim","fields","status","confidence","reasoning"],"title":"ClaimResultSchema"},"ClaimStatusEnum":{"type":"string","enum":["valid","invalid","inconclusive"],"title":"ClaimStatusEnum"},"Classification":{"properties":{"category":{"type":"string","title":"Category","description":"Top document-level category, derived by confidence-weighted voting across pages"},"confidence":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Confidence","description":"Confidence score (0-1) for the document-level classification"},"reasoning":{"type":"string","title":"Reasoning","description":"Summary of category scores and page breakdown"}},"type":"object","required":["category","reasoning"],"title":"Classification","description":"Document-level classification result."},"ClassificationLevel":{"type":"string","enum":["document","page","section"],"title":"ClassificationLevel"},"ClassificationResult":{"properties":{"total_pages":{"type":"integer","title":"Total Pages","default":0},"mode":{"allOf":[{"$ref":"#/components/schemas/ClassificationLevel"}],"default":"page"},"classification":{"anyOf":[{"$ref":"#/components/schemas/Classification"},{"type":"null"}],"description":"Document-level classification. Populated when mode='document'."},"splits":{"anyOf":[{"items":{"$ref":"#/components/schemas/Split"},"type":"array"},{"type":"null"}],"title":"Splits","description":"Page-level category groupings. Populated when mode='page' or 'section'."}},"type":"object","title":"ClassificationResult","description":"Nested result data for classification responses."},"ClassifyCategory":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name","description":"Name of the category"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description","description":"Description to help with classification"}},"type":"object","required":["name"],"title":"ClassifyCategory","description":"A category for document classification."},"ClassifyConfig":{"properties":{"categories":{"items":{"$ref":"#/components/schemas/ClassifyCategory"},"type":"array","maxItems":50,"minItems":1,"title":"Categories","description":"List of categories (max 50)"},"mode":{"allOf":[{"$ref":"#/components/schemas/ClassifyMode"}],"description":"Classification mode: 'document' (whole-file) or 'split' (page-level grouping)","default":"document"}},"type":"object","required":["categories"],"title":"ClassifyConfig","description":"Inline classification parameters (can override a saved config)."},"ClassifyDocumentResult":{"properties":{"filename":{"type":"string","title":"Filename"},"total_pages":{"type":"integer","title":"Total Pages"},"mode":{"type":"string","title":"Mode","default":"document"},"document_category":{"type":"string","title":"Document Category"},"confidence":{"type":"number","maximum":100.0,"minimum":0.0,"title":"Confidence"},"reasoning":{"type":"string","title":"Reasoning"}},"type":"object","required":["filename","total_pages","document_category","confidence","reasoning"],"title":"ClassifyDocumentResult","description":"Result payload for document-level classification."},"ClassifyGetResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Record Id"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"status":{"allOf":[{"$ref":"#/components/schemas/ProcessingStatus"}],"description":"Processing status"},"result":{"anyOf":[{"$ref":"#/components/schemas/ClassificationResult"},{"type":"null"}],"description":"Classification result data, populated when status='completed'"},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time"}},"type":"object","required":["success","message","status"],"title":"ClassifyGetResponse","description":"Response for polling classification results."},"ClassifyMode":{"type":"string","enum":["document","split"],"title":"ClassifyMode"},"ClassifyRequest":{"properties":{"input":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"title":"Input","description":"file://<uuid> URI or public URL. Async also accepts a list (max 50)."},"config_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Config Id","description":"config://<uuid> of a saved classify config. Inline classification_config overrides saved values."},"classification_config":{"anyOf":[{"$ref":"#/components/schemas/ClassifyConfig"},{"type":"null"}],"description":"Inline classification parameters. Overrides saved config if both provided."}},"type":"object","required":["input"],"title":"ClassifyRequest","description":"Request body for POST /api/v2/classify/sync and /api/v2/classify/async.\n\nFor sync: input must be a single string.\nFor async: input can be a single string or a list of strings (max 50)."},"ClassifyResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Record Id"},"file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Id"},"config_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Config Id"},"status":{"type":"string","title":"Status","default":"completed"},"result":{"anyOf":[{"$ref":"#/components/schemas/ClassifyDocumentResult"},{"$ref":"#/components/schemas/ClassifySplitResult"},{"type":"null"}],"title":"Result"},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"}},"type":"object","required":["success","message"],"title":"ClassifyResponse","description":"Unified response for classify endpoints."},"ClassifySplitEntry":{"properties":{"category":{"type":"string","title":"Category"},"pages":{"items":{"type":"integer"},"type":"array","title":"Pages","description":"1-indexed page numbers belonging to this category"},"confidence":{"type":"number","maximum":100.0,"minimum":0.0,"title":"Confidence"},"reasoning":{"type":"string","title":"Reasoning"}},"type":"object","required":["category","pages","confidence","reasoning"],"title":"ClassifySplitEntry","description":"A single category grouping in split mode."},"ClassifySplitResult":{"properties":{"filename":{"type":"string","title":"Filename"},"total_pages":{"type":"integer","title":"Total Pages"},"mode":{"type":"string","title":"Mode","default":"split"},"splits":{"items":{"$ref":"#/components/schemas/ClassifySplitEntry"},"type":"array","title":"Splits"}},"type":"object","required":["filename","total_pages","splits"],"title":"ClassifySplitResult","description":"Result payload for split (page-level) classification."},"ClassifySyncResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Record Id"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"result":{"anyOf":[{"$ref":"#/components/schemas/ClassificationResult"},{"type":"null"}],"description":"Classification result data, populated on success"},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time"}},"type":"object","required":["success","message"],"title":"ClassifySyncResponse","description":"Response for synchronous classification."},"ConfigCreateRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Human-readable config name"},"type":{"allOf":[{"$ref":"#/components/schemas/ConfigType"}],"description":"'parse' or 'extract'"},"params":{"type":"object","title":"Params","description":"JSON blob of parameters (e.g. output_format, schema, instructions)"}},"type":"object","required":["name","type","params"],"title":"ConfigCreateRequest","description":"Request body for POST /api/v2/configs."},"ConfigListResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"configs":{"items":{"$ref":"#/components/schemas/ConfigResponse"},"type":"array","title":"Configs"},"total":{"type":"integer","title":"Total","default":0},"page":{"type":"integer","title":"Page","default":1},"page_size":{"type":"integer","title":"Page Size","default":50}},"type":"object","required":["success","configs"],"title":"ConfigListResponse","description":"Response for GET /api/v2/configs."},"ConfigResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"config_id":{"type":"string","title":"Config Id","description":"config://<uuid> URI"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"params":{"type":"object","title":"Params"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["success","config_id","name","type","params"],"title":"ConfigResponse","description":"Response for config CRUD operations."},"ConfigType":{"type":"string","enum":["parse","extract","classify"],"title":"ConfigType"},"CorrectionAction":{"type":"string","enum":["edit","add","delete"],"title":"CorrectionAction","description":"Action type for a field correction."},"CreateBatchRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Name of the batch"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of the batch"}},"type":"object","required":["name"],"title":"CreateBatchRequest","description":"Request model for creating a batch."},"CreateBatchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the batch was created successfully"},"batch":{"anyOf":[{"$ref":"#/components/schemas/BatchInfo"},{"type":"null"}],"description":"Created batch information"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Additional message"}},"type":"object","required":["success"],"title":"CreateBatchResponse","description":"Response model for batch creation."},"CreateOrgRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"CreateOrgRequest"},"DeleteBatchesRequest":{"properties":{"batch_ids":{"items":{"type":"integer"},"type":"array","title":"Batch Ids","description":"List of batch IDs to delete"}},"type":"object","required":["batch_ids"],"title":"DeleteBatchesRequest","description":"Request model for deleting batches."},"DeleteBatchesResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the operation was successful"},"deleted_count":{"type":"integer","title":"Deleted Count","description":"Number of batches deleted","default":0},"files_affected":{"type":"integer","title":"Files Affected","description":"Number of files affected","default":0},"errors":{"items":{"type":"string"},"type":"array","title":"Errors","description":"Any errors encountered"},"message":{"type":"string","title":"Message","description":"Result message"}},"type":"object","required":["success","message"],"title":"DeleteBatchesResponse","description":"Response model for batch deletion."},"DeleteFileResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the deletion was successful"},"message":{"type":"string","title":"Message","description":"Descriptive message about the result"},"record_id":{"type":"integer","title":"Record Id","description":"ID of the deleted record"}},"type":"object","required":["success","message","record_id"],"title":"DeleteFileResponse","description":"Response model for file deletion endpoint."},"DirectUploadFileResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"type":"string","title":"Record Id","description":"Database record ID for this file"},"filename":{"type":"string","title":"Filename"}},"type":"object","required":["success","message","record_id","filename"],"title":"DirectUploadFileResponse","description":"Response from direct file upload (backend-proxied to S3)."},"EvidenceSchema":{"properties":{"source":{"type":"string","title":"Source","description":"URL or citation from web_search"},"snippet":{"type":"string","title":"Snippet","description":"Quoted supporting text"}},"type":"object","required":["source","snippet"],"title":"EvidenceSchema"},"ExtractConfig":{"properties":{"output_format":{"anyOf":[{"$ref":"#/components/schemas/ExtractFormat"},{"type":"null"}],"description":"Single extract format: 'json' or 'csv'. Default: json"},"json_options":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"object"},{"type":"null"}],"title":"Json Options","description":"JSON extraction options. Accepts: a list of field names (e.g. [\"invoice_number\", \"total\"]), a JSON schema dict, or a string keyword ('hierarchy_output', 'table-of-contents')."},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"CSV extraction options: 'table', 'toc'"},"custom_instructions":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for extraction"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' or 'replace'","default":"append"},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata to include (e.g. 'confidence_score', 'bounding_boxes')"},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Metadata output format (e.g. 'unified')"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for extraction"}},"type":"object","title":"ExtractConfig","description":"Inline extraction parameters (can override a saved config)."},"ExtractFormat":{"type":"string","enum":["json","csv"],"title":"ExtractFormat"},"ExtractRequest":{"properties":{"input":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"title":"Input","description":"file://<uuid> URI or public URL. Async also accepts a list (max 50)."},"config_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Config Id","description":"config://<uuid> of a saved extract config. Inline extraction_config overrides saved values."},"extraction_config":{"anyOf":[{"$ref":"#/components/schemas/ExtractConfig"},{"type":"null"}],"description":"Inline extraction parameters. Overrides saved config if both provided."}},"type":"object","required":["input"],"title":"ExtractRequest","description":"Request body for POST /api/v2/extract/sync and /api/v2/extract/async.\n\nFor sync: input must be a single string.\nFor async: input can be a single string or a list of strings (max 50)."},"ExtractResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"type":"string","title":"Record Id"},"status":{"type":"string","title":"Status"},"result":{"anyOf":[{"$ref":"#/components/schemas/ExtractionResult"},{"type":"null"}]},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"output_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Format"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"},"pages_processed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pages Processed"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"signed_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signed Url","description":"Signed URL to download the original file"},"request_config":{"anyOf":[{"$ref":"#/components/schemas/RequestConfig"},{"type":"null"}],"description":"Original request configuration"},"progress":{"anyOf":[{"$ref":"#/components/schemas/ProgressInfo"},{"type":"null"}],"description":"Progress tracking for async jobs still processing"}},"type":"object","required":["success","message","record_id","status"],"title":"ExtractResponse"},"ExtractionFormatResult":{"properties":{"content":{"anyOf":[{"type":"object"},{"type":"string"},{"items":{},"type":"array"}],"title":"Content"},"metadata":{"$ref":"#/components/schemas/ExtractionMetadata"}},"type":"object","required":["content"],"title":"ExtractionFormatResult","description":"Result for a single extraction format."},"ExtractionListResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"results":{"items":{"$ref":"#/components/schemas/ExtractResponse"},"type":"array","title":"Results"},"pagination":{"$ref":"#/components/schemas/api__v1__schemas__PaginationInfo"}},"type":"object","required":["success","results","pagination"],"title":"ExtractionListResponse","description":"Response for list extraction results endpoint."},"ExtractionMetadata":{"properties":{"bounding_boxes":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Bounding Boxes","description":"Bounding box data including elements with coordinates, page dimensions, and processing stats"},"confidence_score":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Confidence Score","description":"Granular confidence scores for extracted content (per-field for JSON, per-cell for CSV)"},"overall_confidence":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Overall Confidence","description":"Overall confidence score (0-100) for this format, computed from token logprobs with penalties for truncation/repetition"},"page_confidence":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Page Confidence","description":"Per-page confidence scores: {page_number: score(0-100)}"},"confidence_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confidence Source","description":"Source of confidence scores: 'logprobs', 'ocr', or 'layout'"},"page_dimensions":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Page Dimensions","description":"Per-page image dimensions for bounding box coordinate normalization: {page_number: {width, height}}"},"schema_validation":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Schema Validation","description":"JSON schema validation results: total_fields, valid_fields, error_count, warning_count, and errors list with path/error_type/message/severity per field."}},"type":"object","title":"ExtractionMetadata","description":"Metadata for each extraction format result."},"ExtractionResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"content":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/SingleOutputResult"},"type":"object"}],"title":"Content"},"format":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"title":"Format"},"file_type":{"type":"string","title":"File Type"},"pages_processed":{"type":"integer","title":"Pages Processed"},"processing_time":{"type":"number","title":"Processing Time"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id"},"processing_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processing Status","default":"completed"},"multiple_outputs":{"type":"boolean","title":"Multiple Outputs","default":false}},"type":"object","required":["success","content","format","file_type","pages_processed","processing_time"],"title":"ExtractionResponse"},"ExtractionResult":{"properties":{"markdown":{"anyOf":[{"$ref":"#/components/schemas/ExtractionFormatResult"},{"type":"null"}],"description":"Markdown extraction result (populated if requested)"},"html":{"anyOf":[{"$ref":"#/components/schemas/ExtractionFormatResult"},{"type":"null"}],"description":"HTML extraction result (populated if requested)"},"json":{"anyOf":[{"$ref":"#/components/schemas/ExtractionFormatResult"},{"type":"null"}],"description":"JSON extraction result (populated if requested)"},"csv":{"anyOf":[{"$ref":"#/components/schemas/ExtractionFormatResult"},{"type":"null"}],"description":"CSV extraction result (populated if requested)"}},"type":"object","title":"ExtractionResult","description":"Container for all extraction format results."},"FeedbackResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"type":"integer","title":"Record Id"},"user_satisfied":{"type":"boolean","title":"User Satisfied"},"feedback_status":{"type":"string","title":"Feedback Status"}},"type":"object","required":["success","message","record_id","user_satisfied","feedback_status"],"title":"FeedbackResponse","description":"Response model for feedback submission endpoint."},"FieldCorrection":{"properties":{"field_path":{"type":"string","title":"Field Path","description":"Dot-notation path to the field (e.g., 'invoice_number', 'items[0].amount')"},"action":{"allOf":[{"$ref":"#/components/schemas/CorrectionAction"}],"description":"Type of correction: edit, add, or delete"},"corrected_value":{"anyOf":[{},{"type":"null"}],"title":"Corrected Value","description":"New value (for edit/add)"},"original_value":{"anyOf":[{},{"type":"null"}],"title":"Original Value","description":"Original value (for edit/delete)"}},"type":"object","required":["field_path","action"],"title":"FieldCorrection","description":"A single field-level correction."},"FieldSpec":{"properties":{"name":{"type":"string","maxLength":256,"minLength":1,"title":"Name"},"type":{"type":"string","enum":["string","number","boolean","date","array"],"title":"Type"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"group_key":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Group Key","description":"Category label that clusters this field with others sharing the same key (e.g. 'Profit and Loss|GROSS SALES :'). Fields with the same key are kept together in the same group(s)."},"fiscal_year_end":{"anyOf":[{"items":{"type":"integer"},"type":"array","maxItems":4,"minItems":1},{"type":"null"}],"title":"Fiscal Year End","description":"Calendar year(s) in which the requested fiscal year(s) end. E.g. [2025] for current year only; [2025, 2024] for both. Overrides the request-level fiscal_year_end. Fields differing on this value land in separate groups."}},"type":"object","required":["name","type"],"title":"FieldSpec","description":"One flat field to extract in bulk mode.\n\n``group_key`` (optional) clusters fields into per-category groups in\nthe planner: all fields sharing a key end up in the same group(s)\n(split into chunks of ``group_size`` if larger). Fields with no\n``group_key`` fall back to the default chunk-in-request-order\nbehavior.\n\n``fiscal_year_end`` (optional) declares which fiscal year(s) to\nextract for THIS field. Single year → scalar value; multiple years\n→ dict keyed by year (str). When unset, the request-level\n``fiscal_year_end`` is used as the default. Fields with different\nyear requirements are kept in distinct groups so each prompt\ncarries a single year directive."},"FileDetailResponse":{"properties":{"file_id":{"type":"string","title":"File Id"},"filename":{"type":"string","title":"Filename"},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type"},"file_size":{"type":"integer","title":"File Size","default":0},"signed_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signed Url","description":"Pre-signed S3 download URL"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["file_id","filename"],"title":"FileDetailResponse","description":"Response for GET /api/v2/files/{file_id}."},"FileRecordDetail":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the record was successfully retrieved"},"record_id":{"type":"integer","title":"Record Id","description":"Unique identifier for the record"},"content":{"anyOf":[{"type":"string"},{"type":"object"}],"title":"Content","description":"File content (string or dict for multi-output)"},"format":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"title":"Format","description":"Output format (string or list for multi-output)","default":"unknown"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename","description":"Original filename"},"processing_status":{"type":"string","title":"Processing Status","description":"Processing status of the record"},"total_pages":{"type":"integer","title":"Total Pages","description":"Total number of pages","default":1},"pages_processed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pages Processed","description":"Number of pages processed"},"response_content":{"allOf":[{"$ref":"#/components/schemas/ResponseContentInfo"}],"description":"Response content information"},"owner_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Email","description":"Email of the record owner"},"multiple_outputs":{"type":"boolean","title":"Multiple Outputs","description":"Whether this has multiple output types","default":false}},"type":"object","required":["success","record_id","content","processing_status","response_content"],"title":"FileRecordDetail","description":"Detailed information about a file record."},"FileUploadResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"file_id":{"type":"string","title":"File Id","description":"file://<uuid> URI for downstream use in parse/extract"},"filename":{"type":"string","title":"Filename"},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type"},"file_size":{"type":"integer","title":"File Size","default":0},"message":{"type":"string","title":"Message","default":"File uploaded successfully"}},"type":"object","required":["success","file_id","filename"],"title":"FileUploadResponse","description":"Response from POST /api/v2/files."},"FileVQAResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the analysis was successful"},"record_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Record Id","description":"Unique identifier for this analysis record"},"images":{"items":{"type":"string"},"type":"array","title":"Images","description":"List of extracted image URLs for vision analysis"},"total_pages":{"type":"integer","title":"Total Pages","description":"Total number of pages in the document","default":0},"pages_processed":{"type":"integer","title":"Pages Processed","description":"Number of pages successfully processed","default":0},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time","description":"Processing time in seconds"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename","description":"Original filename"},"file_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Type","description":"Detected file type"},"status":{"type":"string","title":"Status","description":"Processing status: completed, processing, failed","default":"completed"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Additional status message or error details"}},"type":"object","required":["success"],"title":"FileVQAResponse","description":"Response model for document vision analysis endpoint."},"GenerateSchemaRequest":{"properties":{"prompt":{"type":"string","maxLength":2000,"minLength":10,"title":"Prompt","description":"Natural language description of the schema to generate"}},"type":"object","required":["prompt"],"title":"GenerateSchemaRequest","description":"Request model for schema generation from prompt."},"GenerateSchemaResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the schema generation was successful"},"schema":{"anyOf":[{"type":"string"},{"type":"object"},{"type":"null"}],"title":"Schema","description":"Generated JSON schema"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Additional message or error details"},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time","description":"Processing time in seconds"}},"type":"object","required":["success"],"title":"GenerateSchemaResponse","description":"Response model for schema generation endpoint."},"GroupStatus":{"properties":{"group_id":{"type":"string","title":"Group Id"},"kind":{"type":"string","enum":["scalar","nested"],"title":"Kind"},"fields":{"items":{"type":"string"},"type":"array","title":"Fields"},"parent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent"},"primary_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Key"},"group_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Group Key"},"status":{"type":"string","enum":["ok","error","timeout","parse_error","cancelled"],"title":"Status"},"elapsed_ms":{"type":"integer","title":"Elapsed Ms"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"sources":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sources"}},"type":"object","required":["group_id","kind","fields","status","elapsed_ms"],"title":"GroupStatus","description":"Per-group outcome reported in QARunResponse.groups (bulk mode).\n\n``reasoning`` and ``sources`` come from docagent's synthesizer step\nand are populated whenever the LLM emits them (every successful\nbulk-extract group). One reasoning block covers every field in the\ngroup — to attribute a citation to a specific field, cross-reference\nthe field name against ``fields``."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LogoutResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"LogoutResponse","description":"Response model for logout endpoint."},"MemberResponse":{"properties":{"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"status":{"type":"string","title":"Status","default":"accepted"},"invited_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["email","role"],"title":"MemberResponse"},"MoveItemsRequest":{"properties":{"file_ids":{"items":{"type":"integer"},"type":"array","title":"File Ids","description":"List of file record IDs to move"},"destination_batch_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Destination Batch Id","description":"Destination batch ID (null for root)"}},"type":"object","title":"MoveItemsRequest","description":"Request model for moving files to a batch."},"MoveItemsResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the operation was successful"},"files_moved":{"type":"integer","title":"Files Moved","description":"Number of files successfully moved","default":0},"errors":{"items":{"type":"string"},"type":"array","title":"Errors","description":"Any errors encountered"},"message":{"type":"string","title":"Message","description":"Result message"}},"type":"object","required":["success","message"],"title":"MoveItemsResponse","description":"Response model for move operation."},"NestedFieldSpec":{"properties":{"name":{"type":"string","maxLength":256,"minLength":1,"title":"Name"},"primary_key":{"type":"string","maxLength":128,"minLength":1,"title":"Primary Key"},"fields":{"items":{"$ref":"#/components/schemas/FieldSpec"},"type":"array","maxItems":50,"minItems":1,"title":"Fields"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["name","primary_key","fields"],"title":"NestedFieldSpec","description":"An array-of-objects section keyed by ``primary_key``.\n\nEvery sub-field of a nested spec is extracted as one docagent group so\nper-row alignment is preserved — splitting columns across groups would\nlet rows desync."},"OrgDetailResponse":{"properties":{"org_id":{"type":"string","title":"Org Id"},"name":{"type":"string","title":"Name"},"is_personal":{"type":"boolean","title":"Is Personal"},"members":{"items":{"$ref":"#/components/schemas/MemberResponse"},"type":"array","title":"Members"}},"type":"object","required":["org_id","name","is_personal","members"],"title":"OrgDetailResponse"},"OrgResponse":{"properties":{"org_id":{"type":"string","title":"Org Id"},"name":{"type":"string","title":"Name"},"role":{"type":"string","title":"Role"},"is_personal":{"type":"boolean","title":"Is Personal"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["org_id","name","role","is_personal"],"title":"OrgResponse"},"OverallStatusEnum":{"type":"string","enum":["valid","invalid","partially_valid","inconclusive"],"title":"OverallStatusEnum"},"ParseConfig":{"properties":{"output_format":{"anyOf":[{"$ref":"#/components/schemas/ParseFormat"},{"type":"null"}],"description":"Single parse format: 'markdown' or 'html'. Default: markdown"},"custom_instructions":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for parsing"},"prompt_mode":{"allOf":[{"$ref":"#/components/schemas/PromptMode"}],"description":"How to apply custom_instructions: 'append' or 'replace'","default":"append"},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Options for Markdown parsing (e.g. 'financial-docs')"},"include_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Include Metadata","description":"Comma-separated metadata to include (e.g. 'confidence_score', 'bounding_boxes')"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model to use for parsing"}},"type":"object","title":"ParseConfig","description":"Inline parse parameters (can override a saved config)."},"ParseFormat":{"type":"string","enum":["markdown","html"],"title":"ParseFormat"},"ParseRequest":{"properties":{"input":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"title":"Input","description":"file://<uuid> URI or public URL. Async also accepts a list (max 50)."},"config_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Config Id","description":"config://<uuid> of a saved parse config. Inline parse_config overrides saved values."},"parse_config":{"anyOf":[{"$ref":"#/components/schemas/ParseConfig"},{"type":"null"}],"description":"Inline parse parameters. Overrides saved config if both provided."}},"type":"object","required":["input"],"title":"ParseRequest","description":"Request body for POST /api/v2/parse/sync and /api/v2/parse/async.\n\nFor sync: input must be a single string.\nFor async: input can be a single string or a list of strings (max 50)."},"PendingInviteResponse":{"properties":{"org_id":{"type":"string","title":"Org Id"},"org_name":{"type":"string","title":"Org Name"},"role":{"type":"string","title":"Role"},"invited_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["org_id","org_name","role"],"title":"PendingInviteResponse"},"ProcessingStatus":{"type":"string","enum":["queued","processing","completed","failed","retrying"],"title":"ProcessingStatus","description":"Processing status for extraction and classification jobs."},"ProgressInfo":{"properties":{"stage":{"type":"string","title":"Stage","description":"Current processing stage: queued, processing, finalizing"},"pages_done":{"type":"integer","title":"Pages Done","description":"Number of pages completed so far"},"total_pages":{"type":"integer","title":"Total Pages","description":"Total number of pages in the document"},"percent":{"type":"integer","title":"Percent","description":"Completion percentage (0-100)"}},"type":"object","required":["stage","pages_done","total_pages","percent"],"title":"ProgressInfo","description":"Progress tracking for async extraction jobs."},"PromptMode":{"type":"string","enum":["append","replace"],"title":"PromptMode"},"PublicVQAChatRequest":{"properties":{"question":{"type":"string","minLength":1,"title":"Question","description":"Question to answer about the prepared document"},"token":{"type":"string","title":"Token","description":"Capability token returned by the init phase"}},"type":"object","required":["question","token"],"title":"PublicVQAChatRequest","description":"Request body for the public VQA chat phase."},"PublicVQAChatResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the question was answered successfully"},"record_id":{"type":"integer","title":"Record Id","description":"Handle of the document that was queried"},"question":{"type":"string","title":"Question","description":"The question that was asked"},"answer":{"type":"string","title":"Answer","description":"The model's answer grounded in the document"},"model_type":{"type":"string","title":"Model Type","description":"AI model used to answer the question"},"processing_time":{"type":"number","title":"Processing Time","description":"Total processing time in seconds"}},"type":"object","required":["success","record_id","question","answer","model_type","processing_time"],"title":"PublicVQAChatResponse","description":"Response schema for the public VQA chat phase."},"PublicVQAInitResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the document was prepared successfully"},"record_id":{"type":"integer","title":"Record Id","description":"Handle used to ask questions about this document"},"token":{"type":"string","title":"Token","description":"Capability token required to ask questions about this record"},"total_pages":{"type":"integer","title":"Total Pages","description":"Number of pages detected in the document"},"message":{"type":"string","title":"Message","description":"Human-readable status message"}},"type":"object","required":["success","record_id","token","total_pages","message"],"title":"PublicVQAInitResponse","description":"Response schema for the public VQA init phase — returns the handle for asking questions."},"QARunRequest":{"properties":{"input":{"type":"string","title":"Input","description":"file:// URI, inline://<base64>, or a public URL"},"query":{"anyOf":[{"type":"string","maxLength":4000,"minLength":1},{"type":"null"}],"title":"Query","description":"Natural-language question (Q&A mode)"},"metadata_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Instructions","description":"Optional free-form guidance forwarded to the docagent analyzer/extractors"},"fields":{"anyOf":[{"items":{"$ref":"#/components/schemas/FieldSpec"},"type":"array","maxItems":2000},{"type":"null"}],"title":"Fields","description":"Flat fields to extract (bulk mode). Grouped in chunks of group_size."},"fields_file":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fields File","description":"Alternative to inline ``fields``: a URI pointing at a JSON file the server downloads and parses. Same URI conventions as ``input``: ``file://<uuid>`` (uploaded via /files), ``inline://<base64>``, or a public URL. The JSON payload may be a bare list of FieldSpec dicts OR an object with a ``fields`` key containing the list. ``fields`` and ``fields_file`` are mutually exclusive — set at most one."},"nested":{"anyOf":[{"items":{"$ref":"#/components/schemas/NestedFieldSpec"},"type":"array","maxItems":20},{"type":"null"}],"title":"Nested","description":"Array-of-objects sections to extract (bulk mode). Each becomes one group."},"group_size":{"anyOf":[{"type":"integer","maximum":50.0,"minimum":1.0},{"type":"null"}],"title":"Group Size","description":"Override QA_BULK_GROUP_SIZE for this request"},"max_concurrency":{"anyOf":[{"type":"integer","maximum":50.0,"minimum":1.0},{"type":"null"}],"title":"Max Concurrency","description":"Override QA_BULK_MAX_CONCURRENCY for this request"},"fiscal_year_end":{"anyOf":[{"items":{"type":"integer"},"type":"array","maxItems":4,"minItems":1},{"type":"null"}],"title":"Fiscal Year End","description":"Request-level default for fiscal year(s) — applied to every field that doesn't carry its own ``fiscal_year_end``. Per-field values take precedence. Single year returns scalar values; multiple years returns dict-valued fields keyed by year (str). Omit to let the model pick the most recent reported year."}},"type":"object","required":["input"],"title":"QARunRequest","description":"Request body for POST /api/v2/qa/run and /qa/stream.\n\n``input`` accepts the same conventions used elsewhere in v2 plus an\ninline base64 carrier:\n  - ``file://<uuid>`` — references an uploaded file (markdown bytes)\n  - ``inline://<base64>`` — base64-encoded markdown payload\n  - any other URL/string — treated as a public URL fetched server-side\n\nTwo mutually-compatible modes:\n  - **Q&A mode** — set ``query`` only; the response carries ``answer``.\n  - **Bulk-extract mode** — set ``fields`` and/or ``nested``; the\n    response carries ``extracted`` (dict) and ``groups`` (per-group\n    status). ``query``, when set alongside fields, is forwarded to\n    the extractor as a doc-level user-context preamble (every group's\n    prompt is prefixed with ``User context for this extraction:\n    <query>``). Useful for telling docagent things like \"values are\n    in INR thousands\" or \"this is the Q4 earnings report\"."},"QARunResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"answer":{"type":"string","title":"Answer","default":""},"extracted":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Extracted"},"groups":{"anyOf":[{"items":{"$ref":"#/components/schemas/GroupStatus"},"type":"array"},{"type":"null"}],"title":"Groups"},"task_state":{"type":"object","title":"Task State"},"math_calls":{"items":{},"type":"array","title":"Math Calls"},"usage":{"type":"object","title":"Usage"},"processing_time_ms":{"type":"integer","title":"Processing Time Ms"}},"type":"object","required":["success","processing_time_ms"],"title":"QARunResponse","description":"Response body for POST /api/v2/qa/run.\n\n``answer`` is populated in Q&A mode; ``extracted`` + ``groups`` are\npopulated in bulk-extract mode. Both fields are always present (one\nwill be empty/None) so OpenAPI consumers see a single schema."},"RequestConfig":{"properties":{"output_formats":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Output Formats","description":"Requested output formats"},"json_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Json Options","description":"JSON extraction options (schema or field names)"},"csv_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Options","description":"CSV extraction options"},"markdown_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Options","description":"Markdown extraction options"},"include_metadata":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Include Metadata","description":"Metadata options (e.g., confidence_score, bounding_boxes, bounding_boxes_word)"},"metadata_options":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Options","description":"Metadata output format (e.g., 'unified' to merge metadata into content)"},"custom_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for extraction"},"prompt_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt Mode","description":"Prompt mode (append or replace)"},"model_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Type","description":"AI model used for extraction (e.g. nanonets-ocr-3)"},"extract_charts":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Extract Charts","description":"Whether visual data extraction was enabled"},"use_ocr_hinting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Use Ocr Hinting","description":"OCR hint provider used ('google', 'paddle', or 'false' for disabled)"}},"type":"object","title":"RequestConfig","description":"Saved request configuration from sync/async/stream endpoints."},"ResponseContentInfo":{"properties":{"preview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preview","description":"Preview of the response content"},"full_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Content","description":"Full content (if available)"},"content_length":{"type":"integer","title":"Content Length","description":"Length of the content","default":0},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type","description":"Content type"},"encoding":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Encoding","description":"Content encoding"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if content retrieval failed"}},"type":"object","title":"ResponseContentInfo","description":"Response content information."},"ReviewableExtractionResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"record_id":{"type":"integer","title":"Record Id"},"extraction_result":{"title":"Extraction Result","description":"Current extraction result (JSON envelope)"},"corrections_history":{"items":{"type":"object"},"type":"array","title":"Corrections History","description":"Previous correction versions"}},"type":"object","required":["success","record_id","extraction_result"],"title":"ReviewableExtractionResponse","description":"Response model for getting an extraction in review mode."},"RuleTypeEnum":{"type":"string","enum":["web_search","registry_lookup","math","cross_field"],"title":"RuleTypeEnum"},"Segment":{"properties":{"value":{"type":"string","title":"Value","description":"Extracted segment value (e.g. 'INV-001')"},"pages":{"items":{"type":"integer"},"type":"array","title":"Pages","description":"Pages belonging to this segment"}},"type":"object","required":["value","pages"],"title":"Segment","description":"A sub-group of pages within a category, identified by an extracted field value."},"SingleOutputResult":{"properties":{"success":{"type":"boolean","title":"Success"},"content":{"type":"string","title":"Content"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","content"],"title":"SingleOutputResult"},"Split":{"properties":{"category":{"type":"string","title":"Category","description":"Category name"},"pages":{"items":{"type":"integer"},"type":"array","title":"Pages","description":"All pages that belong to this category"},"segment_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Key","description":"Field name used to segment pages within this category (e.g. 'Invoice Number')"},"segments":{"anyOf":[{"items":{"$ref":"#/components/schemas/Segment"},"type":"array"},{"type":"null"}],"title":"Segments","description":"Page segments within this category, populated when segment_key is set"}},"type":"object","required":["category","pages"],"title":"Split","description":"A group of pages belonging to a single category."},"SubmitCorrectionsRequest":{"properties":{"corrections":{"items":{"$ref":"#/components/schemas/FieldCorrection"},"type":"array","minItems":1,"title":"Corrections","description":"List of field corrections"}},"type":"object","required":["corrections"],"title":"SubmitCorrectionsRequest","description":"Request model for submitting corrections to an extraction result."},"SubmitCorrectionsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"type":"integer","title":"Record Id"},"version":{"type":"integer","title":"Version"},"fields_corrected":{"type":"integer","title":"Fields Corrected","default":0},"fields_added":{"type":"integer","title":"Fields Added","default":0},"fields_deleted":{"type":"integer","title":"Fields Deleted","default":0}},"type":"object","required":["success","message","record_id","version"],"title":"SubmitCorrectionsResponse","description":"Response model for correction submission."},"UpdateMemberRoleRequest":{"properties":{"role":{"type":"string","title":"Role"}},"type":"object","required":["role"],"title":"UpdateMemberRoleRequest"},"UpdateOrgRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"UpdateOrgRequest"},"UploadInitFileInfo":{"properties":{"filename":{"type":"string","title":"Filename","description":"Original filename"},"content_type":{"type":"string","title":"Content Type","description":"MIME type of the file","default":"application/octet-stream"},"file_size":{"type":"integer","minimum":0.0,"title":"File Size","description":"File size in bytes"}},"type":"object","required":["filename","file_size"],"title":"UploadInitFileInfo","description":"File metadata sent by the frontend to initiate upload."},"UploadInitFileResult":{"properties":{"record_id":{"type":"string","title":"Record Id","description":"Database record ID for this file"},"filename":{"type":"string","title":"Filename"},"upload_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Upload Url","description":"Presigned S3 PUT URL for direct upload"},"s3_key":{"type":"string","title":"S3 Key","description":"S3 object key"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["record_id","filename","s3_key"],"title":"UploadInitFileResult","description":"Result for a single file in the upload init response."},"UploadInitRequest":{"properties":{"files":{"items":{"$ref":"#/components/schemas/UploadInitFileInfo"},"type":"array","minItems":1,"title":"Files","description":"List of files to upload"},"batch_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Batch Id","description":"Batch ID to place files in"}},"type":"object","required":["files"],"title":"UploadInitRequest","description":"Request to initiate file uploads and get presigned S3 URLs."},"UploadInitResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"batch_id":{"type":"string","title":"Batch Id"},"total_files":{"type":"integer","title":"Total Files"},"accepted_files":{"type":"integer","title":"Accepted Files"},"rejected_files":{"type":"integer","title":"Rejected Files"},"files":{"items":{"$ref":"#/components/schemas/UploadInitFileResult"},"type":"array","title":"Files"}},"type":"object","required":["success","message","batch_id","total_files","accepted_files","rejected_files","files"],"title":"UploadInitResponse","description":"Response from upload init endpoint with presigned URLs."},"UploadStatusRequest":{"properties":{"record_id":{"type":"integer","title":"Record Id","description":"Record ID of the uploaded file"},"status":{"type":"string","title":"Status","description":"Status to set: 'uploaded' or 'failed'","default":"uploaded"}},"type":"object","required":["record_id"],"title":"UploadStatusRequest","description":"Request to mark a file upload as complete."},"UploadStatusResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"type":"string","title":"Record Id"}},"type":"object","required":["success","message","record_id"],"title":"UploadStatusResponse","description":"Response from upload status endpoint."},"V2Response":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"record_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Record Id"},"file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Id"},"config_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Config Id"},"status":{"type":"string","title":"Status","default":"completed"},"result":{"anyOf":[{"$ref":"#/components/schemas/V2Result"},{"type":"null"}]},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"output_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Format"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"}},"type":"object","required":["success","message"],"title":"V2Response","description":"Unified response for parse and extract endpoints."},"V2Result":{"properties":{"content":{"anyOf":[{"type":"object"},{"type":"string"},{"items":{},"type":"array"},{"type":"null"}],"title":"Content"},"elements":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Elements","description":"Element-wise breakup with bounding boxes (parse only, when metadata requested)"},"overall_confidence":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Overall Confidence","description":"Document-level confidence score (0-100)"},"page_confidence":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Page Confidence","description":"Per-page confidence scores"},"confidence_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confidence Source","description":"Source of confidence scores (e.g. 'logprobs+layout', 'ocr')"}},"type":"object","title":"V2Result","description":"Flat result for a single output format.\n\nParse endpoints:\n  - content: the full text (markdown or HTML string)\n  - elements: element-wise breakup with bounding boxes (only when metadata requested)\n  - overall_confidence / confidence_source: document-level confidence info\n\nExtract endpoints (JSON):\n  - content: unified dict where each field has ``value``, ``confidence_score``,\n    ``bounding_box`` merged inline (when metadata requested)\n  - overall_confidence / confidence_source: document-level confidence info\n\nExtract endpoints (CSV):\n  - content: CSV string"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ValidationRuleSchema":{"properties":{"type":{"$ref":"#/components/schemas/RuleTypeEnum"},"fields":{"items":{"type":"string"},"type":"array","title":"Fields","description":"Keys from validation_answer this rule targets"},"hint":{"type":"string","title":"Hint","description":"Free-form guidance forwarded to the verifier","default":""},"operation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Operation","description":"Math operation: 'sum', 'multiply', etc. (math rules only)"},"operand_fields":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Operand Fields","description":"Fields to use as operands (math rules only)"},"expected_field":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected Field","description":"Field whose value must equal the computed result (math rules only)"},"tolerance":{"type":"number","title":"Tolerance","description":"Acceptable absolute numeric tolerance for math rules","default":0.01},"registry_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Registry Type","description":"Registry to query (e.g. 'zip_code', 'checksum')"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country","description":"ISO country code for region-specific lookups"}},"type":"object","required":["type","fields"],"title":"ValidationRuleSchema","description":"One validation rule. Field semantics are kept in lockstep with\n``docagent.validations.ValidationRule``."},"ValidationRunRequest":{"properties":{"validation_answer":{"type":"object","title":"Validation Answer","description":"Extracted fields keyed by name — the values to be verified"},"rules":{"items":{"$ref":"#/components/schemas/ValidationRuleSchema"},"type":"array","minItems":1,"title":"Rules","description":"Validation rules to execute against validation_answer"},"max_iterations":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Max Iterations","description":"Upper bound on agentic LLM steps before returning inconclusive","default":6}},"type":"object","required":["validation_answer","rules"],"title":"ValidationRunRequest","description":"Request body for POST /api/v2/validate/run."},"ValidationRunResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"overall_status":{"$ref":"#/components/schemas/OverallStatusEnum"},"claims":{"items":{"$ref":"#/components/schemas/ClaimResultSchema"},"type":"array","title":"Claims"},"summary":{"type":"string","title":"Summary"},"processing_time_ms":{"type":"integer","title":"Processing Time Ms"}},"type":"object","required":["success","overall_status","summary","processing_time_ms"],"title":"ValidationRunResponse","description":"Response body for POST /api/v2/validate/run."},"api__internal__schemas__PaginationInfo":{"properties":{"limit":{"type":"integer","title":"Limit","description":"Items per page"},"offset":{"type":"integer","title":"Offset","description":"Items skipped"},"total":{"type":"integer","title":"Total","description":"Total items count"}},"type":"object","required":["limit","offset","total"],"title":"PaginationInfo","description":"Pagination information."},"api__v1__schemas__PaginationInfo":{"properties":{"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"total_count":{"type":"integer","title":"Total Count"},"total_pages":{"type":"integer","title":"Total Pages"},"has_next":{"type":"boolean","title":"Has Next"},"has_previous":{"type":"boolean","title":"Has Previous"}},"type":"object","required":["page","page_size","total_count","total_pages","has_next","has_previous"],"title":"PaginationInfo","description":"Pagination metadata."}}}}