{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/tree":{"post":{"tags":["PageIndex Tree Generation"],"summary":"Page Index","operationId":"page_index_tree_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_page_index_tree_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"202":{"description":"ZIP import accepted; returns per-entry submission results.","content":{"application/json":{"example":{"root_folder_id":"folder_x","items":[{"path":"2024/report.pdf","folder_id":"folder_2024","file_name":"report.pdf","doc_id":"pi_x","status":"queued"}],"skipped":[{"path":"notes/image.png","reason":"unsupported_format"}],"failed":[]}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/doc":{"post":{"tags":["PageIndex Tree Generation"],"summary":"Page Index","operationId":"page_index_doc_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_page_index_doc_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"202":{"description":"ZIP import accepted; returns per-entry submission results.","content":{"application/json":{"example":{"root_folder_id":"folder_x","items":[{"path":"2024/report.pdf","folder_id":"folder_2024","file_name":"report.pdf","doc_id":"pi_x","status":"queued"}],"skipped":[{"path":"notes/image.png","reason":"unsupported_format"}],"failed":[]}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/markdown":{"post":{"tags":["Markdown Processing"],"summary":"Markdown To Tree","operationId":"markdown_to_tree_markdown_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_markdown_to_tree_markdown_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/docs":{"get":{"tags":["PageIndex Tree Generation"],"summary":"List Documents","description":"List documents for the authenticated user with pagination, OR aggregate\nthem by metadata fields when group_by is given. The virtual folder ids\n'shared-with-me' / 'following' list the caller's saved shares instead of\nowned documents.\n\nDefault (no group_by): paginated documents ordered by creation date (newest first).\nEach document carries \"path\", its folder chain rendered \"Parent/Child\".\npath is a display label, not an identifier: different folders can render\nthe same path, so use folderId to tell them apart.\npath is null when the document is unfiled or its folder is outside the\ncaller's visible scope (e.g. shared listing with recursive=false).\nOnly present on GET /docs listings; search and single-document endpoints\ndo not populate it.\nGroup mode: returns {\"groups\": [...], \"total\": N, \"truncated\": bool}.","operationId":"list_documents_docs_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":10000,"minimum":1},{"type":"null"}],"description":"Max rows returned. List mode (no group_by): default 50, max 10000. Group mode (with group_by): default 1000, max 10000. Mirrors SQL LIMIT semantics — unit is whatever the response rows are (documents in list mode, group buckets in group mode). Note: list rows include full doc fields (metadata, description); large limits → large response payloads.","title":"Limit"},"description":"Max rows returned. List mode (no group_by): default 50, max 10000. Group mode (with group_by): default 1000, max 10000. Mirrors SQL LIMIT semantics — unit is whatever the response rows are (documents in list mode, group buckets in group mode). Note: list rows include full doc fields (metadata, description); large limits → large response payloads."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of documents to skip. Ignored when group_by is given.","default":0,"title":"Offset"},"description":"Number of documents to skip. Ignored when group_by is given."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact document name to look up. Returns at most one match.","title":"Name"},"description":"Exact document name to look up. Returns at most one match."},{"name":"folder_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by folder ID. Use 'root' for unfiled documents, a folder ID for a specific folder, or omit for all. 'shared-with-me' / 'following' list the caller's saved shares (user / official); group_by and aggregates are not supported there.","title":"Folder Id"},"description":"Filter by folder ID. Use 'root' for unfiled documents, a folder ID for a specific folder, or omit for all. 'shared-with-me' / 'following' list the caller's saved shares (user / official); group_by and aggregates are not supported there."},{"name":"recursive","in":"query","required":false,"schema":{"type":"boolean","description":"When combined with a folder_id, include documents in all descendant folders. Combined with folder_id='root' returns all documents. For 'shared-with-me' / 'following', false covers only directly shared documents and true also expands each shared folder's subtree. Ignored when folder_id is omitted.","default":false,"title":"Recursive"},"description":"When combined with a folder_id, include documents in all descendant folders. Combined with folder_id='root' returns all documents. For 'shared-with-me' / 'following', false covers only directly shared documents and true also expands each shared folder's subtree. Ignored when folder_id is omitted."},{"name":"metadata_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"URL-encoded JSON. Operators: $eq $ne $in $gt $gte $lt $lte $and $or. Example: {\"$and\":[{\"source\":\"web\"},{\"year\":{\"$gte\":2024}}]}","title":"Metadata Filter"},"description":"URL-encoded JSON. Operators: $eq $ne $in $gt $gte $lt $lte $and $or. Example: {\"$and\":[{\"source\":\"web\"},{\"year\":{\"$gte\":2024}}]}"},{"name":"sort","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"URL-encoded JSON. MongoDB-style sort spec, 1=asc, -1=desc, up to 5 fields. List mode (no group_by): sorts by metadata fields, default createdAt DESC. Group mode (with group_by): sorts by group key or aggregate alias, default first group key ASC. Example list: {\"score\":-1,\"year\":1}. Example group: {\"count\":-1}.","title":"Sort"},"description":"URL-encoded JSON. MongoDB-style sort spec, 1=asc, -1=desc, up to 5 fields. List mode (no group_by): sorts by metadata fields, default createdAt DESC. Group mode (with group_by): sorts by group key or aggregate alias, default first group key ASC. Example list: {\"score\":-1,\"year\":1}. Example group: {\"count\":-1}."},{"name":"aggregates","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"URL-encoded JSON. MongoDB-style aggregate spec over the full filter match (ignores limit/offset). Operators: $count $sum $avg $max $min; up to 10 entries. Required when group_by is given (per-group aggregation). Example: {\"n\":{\"$count\":{}},\"total_size\":{\"$sum\":\"$size\"},\"max_score\":{\"$max\":\"$score\"}}.","title":"Aggregates"},"description":"URL-encoded JSON. MongoDB-style aggregate spec over the full filter match (ignores limit/offset). Operators: $count $sum $avg $max $min; up to 10 entries. Required when group_by is given (per-group aggregation). Example: {\"n\":{\"$count\":{}},\"total_size\":{\"$sum\":\"$size\"},\"max_score\":{\"$max\":\"$score\"}}."},{"name":"group_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"URL-encoded JSON array of metadata field names, max 5. When given, response shape switches to {\"groups\", \"total\", \"truncated\"} (no documents) and requires at least one aggregate. Example: [\"category\",\"year\"]. The shared `limit` parameter caps returned group rows (default 1000, max 10000).","title":"Group By"},"description":"URL-encoded JSON array of metadata field names, max 5. When given, response shape switches to {\"groups\", \"total\", \"truncated\"} (no documents) and requires at least one aggregate. Example: [\"category\",\"year\"]. The shared `limit` parameter caps returned group rows (default 1000, max 10000)."},{"name":"mode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Read-surface selector. External callers should normally omit this (returns the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers.","title":"Mode"},"description":"Read-surface selector. External callers should normally omit this (returns the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers."},{"name":"teamspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/folder":{"post":{"tags":["Folders"],"summary":"Create Folder Endpoint","description":"Create a new folder (workspace) for the authenticated user.","operationId":"create_folder_endpoint_folder_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFolderMsg"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/folders":{"get":{"tags":["Folders"],"summary":"List Folders Endpoint","description":"List folders for the authenticated user.","operationId":"list_folders_endpoint_folders_get","parameters":[{"name":"parent_folder_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Use 'root' for root-level folders, a folder ID for subfolders, or omit for all","title":"Parent Folder Id"},"description":"Use 'root' for root-level folders, a folder ID for subfolders, or omit for all"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/folder/{folder_id}/metadata/schema":{"put":{"tags":["Folders"],"summary":"Put Folder Metadata Schema","description":"Declare the metadata schema for a workspace, or the user-level schema\nwhen folder_id == \"root\". Immutable: subsequent PUT returns 409. Use DELETE\nto clear and re-PUT.","operationId":"put_folder_metadata_schema_folder__folder_id__metadata_schema_put","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","description":"Top-level folder (workspace) ID, or \"root\" for the user-level schema","title":"Folder Id"},"description":"Top-level folder (workspace) ID, or \"root\" for the user-level schema"},{"name":"mode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Write-surface selector, used only when folder_id == \"root\" to pick which user-level schema slot to write. External callers should normally omit this (writes the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers.","title":"Mode"},"description":"Write-surface selector, used only when folder_id == \"root\" to pick which user-level schema slot to write. External callers should normally omit this (writes the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers."},{"name":"teamspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Schema JSON, e.g. {\"fields\":{\"year\":{\"type\":\"number\"}}}","title":"Schema"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Folders"],"summary":"Get Folder Metadata Schema","description":"Return the **effective** schema for docs in this folder — the same\nschema upload/PUT enforces. Resolution: workspace's own schema if declared;\notherwise the user-level (root) schema; otherwise null.\n\nfolder_id == \"root\" returns just the user-level schema.","operationId":"get_folder_metadata_schema_folder__folder_id__metadata_schema_get","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","description":"Any folder ID (resolves to its workspace schema), or \"root\" for the user-level schema","title":"Folder Id"},"description":"Any folder ID (resolves to its workspace schema), or \"root\" for the user-level schema"},{"name":"include_values","in":"query","required":false,"schema":{"type":"boolean","description":"If true, attach observed distinct values per field as 'values' inside each field spec (scoped to the schema's domain).","default":false,"title":"Include Values"},"description":"If true, attach observed distinct values per field as 'values' inside each field spec (scoped to the schema's domain)."},{"name":"values_limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Max distinct values per field when include_values=true. Truncated silently when exceeded.","default":100,"title":"Values Limit"},"description":"Max distinct values per field when include_values=true. Truncated silently when exceeded."},{"name":"mode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Read-surface selector for include_values lookups. External callers should normally omit this (returns the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers.","title":"Mode"},"description":"Read-surface selector for include_values lookups. External callers should normally omit this (returns the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers."},{"name":"teamspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Folders"],"summary":"Delete Folder Metadata Schema","description":"Clear the metadata schema on a workspace, or the user-level schema when\nfolder_id == \"root\". Existing documents' metadata is preserved (not touched).","operationId":"delete_folder_metadata_schema_folder__folder_id__metadata_schema_delete","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","description":"Top-level folder (workspace) ID, or \"root\" for the user-level schema","title":"Folder Id"},"description":"Top-level folder (workspace) ID, or \"root\" for the user-level schema"},{"name":"mode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Write-surface selector, used only when folder_id == \"root\" to pick which user-level schema slot to delete. External callers should normally omit this (deletes the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers.","title":"Mode"},"description":"Write-surface selector, used only when folder_id == \"root\" to pick which user-level schema slot to delete. External callers should normally omit this (deletes the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers."},{"name":"teamspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/metadata/schema":{"get":{"tags":["PageIndex Tree Generation"],"summary":"Get Metadata Schema","description":"NL-introspection endpoint for agents.\n\n- folder_id=\"root\": returns just the user-level schema.\n- folder_id=<workspace or sub-folder>: returns the workspace schema.\n- omitted: returns the user-level schema plus all declared workspace\n  schemas (for agents building cross-workspace filters). Semantic 2\n  (REPLACE): workspace schema wins over the user schema; workspaces\n  without their own row inherit it.","operationId":"get_metadata_schema_metadata_schema_get","parameters":[{"name":"folder_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Folder ID (resolves to its workspace), \"root\" for the user-level schema, or omit to get user + all workspace schemas.","title":"Folder Id"},"description":"Folder ID (resolves to its workspace), \"root\" for the user-level schema, or omit to get user + all workspace schemas."},{"name":"include_values","in":"query","required":false,"schema":{"type":"boolean","description":"If true, attach observed distinct values per field as 'values' inside each field spec (scoped to the schema's domain).","default":false,"title":"Include Values"},"description":"If true, attach observed distinct values per field as 'values' inside each field spec (scoped to the schema's domain)."},{"name":"values_limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Max distinct values per field when include_values=true. Truncated silently when exceeded.","default":100,"title":"Values Limit"},"description":"Max distinct values per field when include_values=true. Truncated silently when exceeded."},{"name":"mode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Read-surface selector for include_values lookups and the omitted-folder_id workspace aggregate. External callers should normally omit this (returns the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers.","title":"Mode"},"description":"Read-surface selector for include_values lookups and the omitted-folder_id workspace aggregate. External callers should normally omit this (returns the api surface). \"mcp\" selects the chat surface and is only meaningful for the chat backend's own requests, or, during the ADR 0010 compatibility window, API-key callers."},{"name":"teamspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/doc/{doc_id}":{"get":{"tags":["PageIndex Tree Generation"],"summary":"Page Index Status","operationId":"page_index_status_doc__doc_id__get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Doc Id"},"description":"Document ID"},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Result type. Use 'tree' for tree structure or 'ocr' for OCR results.","title":"Type"},"description":"Result type. Use 'tree' for tree structure or 'ocr' for OCR results."},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Format for OCR results. Use 'page' for page-based results, 'node' for node-based results, or 'raw' for concatenated markdown.","default":"page","title":"Format"},"description":"Format for OCR results. Use 'page' for page-based results, 'node' for node-based results, or 'raw' for concatenated markdown."},{"name":"summary","in":"query","required":false,"schema":{"type":"boolean","description":"If True, add summary to the results.","default":false,"title":"Summary"},"description":"If True, add summary to the results."},{"name":"include_images","in":"query","required":false,"schema":{"type":"boolean","description":"If True, include presigned URLs for images referenced in OCR results.","default":false,"title":"Include Images"},"description":"If True, include presigned URLs for images referenced in OCR results."},{"name":"include_text","in":"query","required":false,"schema":{"type":"boolean","description":"If False, omit text fields from tree nodes. Only applies when type=tree.","default":true,"title":"Include Text"},"description":"If False, omit text fields from tree nodes. Only applies when type=tree."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["PageIndex Tree Generation"],"summary":"Page Index Delete","operationId":"page_index_delete_doc__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Doc Id"},"description":"Document ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tree/{doc_id}":{"get":{"tags":["PageIndex Tree Generation"],"summary":"Page Index Status","operationId":"page_index_status_tree__doc_id__get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Doc Id"},"description":"Document ID"},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Result type. Use 'tree' for tree structure or 'ocr' for OCR results.","title":"Type"},"description":"Result type. Use 'tree' for tree structure or 'ocr' for OCR results."},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Format for OCR results. Use 'page' for page-based results, 'node' for node-based results, or 'raw' for concatenated markdown.","default":"page","title":"Format"},"description":"Format for OCR results. Use 'page' for page-based results, 'node' for node-based results, or 'raw' for concatenated markdown."},{"name":"summary","in":"query","required":false,"schema":{"type":"boolean","description":"If True, add summary to the results.","default":false,"title":"Summary"},"description":"If True, add summary to the results."},{"name":"include_images","in":"query","required":false,"schema":{"type":"boolean","description":"If True, include presigned URLs for images referenced in OCR results.","default":false,"title":"Include Images"},"description":"If True, include presigned URLs for images referenced in OCR results."},{"name":"include_text","in":"query","required":false,"schema":{"type":"boolean","description":"If False, omit text fields from tree nodes. Only applies when type=tree.","default":true,"title":"Include Text"},"description":"If False, omit text fields from tree nodes. Only applies when type=tree."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["PageIndex Tree Generation"],"summary":"Page Index Delete","operationId":"page_index_delete_tree__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Doc Id"},"description":"Document ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/doc/{doc_id}/metadata":{"put":{"tags":["PageIndex Tree Generation"],"summary":"Replace Doc Metadata","description":"Replace the document's metadata with the provided dict (full overwrite).\n\nPass `{}` to clear. Only the document owner may call this.","operationId":"replace_doc_metadata_doc__doc_id__metadata_put","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Doc Id"},"description":"Document ID"},{"name":"teamspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Full replacement metadata dict; pass {} to clear","title":"Metadata"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/retrieval/{retrieval_id}":{"get":{"tags":["PageIndex Retrieval"],"summary":"Get Pageindex Retrieval Status","operationId":"get_pageindex_retrieval_status_retrieval__retrieval_id__get","parameters":[{"name":"retrieval_id","in":"path","required":true,"schema":{"type":"string","description":"Retrieval ID","title":"Retrieval Id"},"description":"Retrieval ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/chat/completions":{"post":{"tags":["Chat"],"summary":"Chat Completions","description":"OpenAI-compatible chat completions endpoint with PageIndex MCP server.\nSupports both streaming and non-streaming responses.\nUses the user's API key to authenticate with PageIndex MCP server.","operationId":"chat_completions_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/doc/{doc_id}/block-reference":{"post":{"tags":["Internal (Chat Platform)","PageIndex Tree Generation"],"summary":"Enable Block Reference","description":"Enable block reference feature for a document.\nDownloads the file from S3, runs OCR to extract page-level blocks,\nsaves results to TextPageIndexByPage, and updates features with {\"blockReference\": true}.","operationId":"enable_block_reference_doc__doc_id__block_reference_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Doc Id"},"description":"Document ID"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BlockReferenceMsg"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/retrieval":{"post":{"tags":["Internal (Chat Platform)","PageIndex Retrieval"],"summary":"Submit Pageindex Retrieval","operationId":"submit_pageindex_retrieval_retrieval_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageIndexRetrievalRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/resources/delete":{"post":{"tags":["Resources API"],"summary":"Delete Resources","operationId":"delete_resources_resources_delete_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/folder/{folder_id}":{"delete":{"tags":["Folders"],"summary":"Delete Folder","description":"Delete a folder, including all documents and subfolders inside it.\n\nChat-platform content is not accessible from this endpoint: chat folders\n404 as targets and chat content nested inside the subtree survives the\ncascade. A partial delete fails with 409 on a state conflict (documents\nstill queued or processing, or chat-platform content inside) and 500 when\na server error interrupted the cascade; both bodies carry the counts of\nwhat was already deleted and what survived.","operationId":"delete_folder_folder__folder_id__delete","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","description":"Folder ID","title":"Folder Id"},"description":"Folder ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp":{"get":{"tags":["MCP"],"summary":"Mcp Proxy","description":"MCP proxy endpoint. Forwards MCP protocol requests to pageindex-chat MCP server.","operationId":"mcp_proxy_mcp_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["MCP"],"summary":"Mcp Proxy","description":"MCP proxy endpoint. Forwards MCP protocol requests to pageindex-chat MCP server.","operationId":"mcp_proxy_mcp_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"BlockReferenceMsg":{"properties":{"teamspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}},"type":"object","title":"BlockReferenceMsg"},"Body_markdown_to_tree_markdown_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"if_thinning":{"type":"string","title":"If Thinning","default":"no"},"thinning_threshold":{"type":"integer","title":"Thinning Threshold","default":5000},"summary_token_threshold":{"type":"integer","title":"Summary Token Threshold","default":200},"if_add_node_id":{"type":"string","title":"If Add Node Id","default":"yes"},"if_add_node_summary":{"type":"string","title":"If Add Node Summary","default":"yes"},"if_add_node_text":{"type":"string","title":"If Add Node Text","default":"yes"},"if_add_doc_description":{"type":"string","title":"If Add Doc Description","default":"no"}},"type":"object","required":["file"],"title":"Body_markdown_to_tree_markdown_post"},"Body_page_index_doc_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"if_add_node_id":{"type":"string","title":"If Add Node Id","default":"yes"},"if_add_node_summary":{"type":"string","title":"If Add Node Summary","default":"yes"},"if_add_doc_description":{"type":"string","title":"If Add Doc Description","default":"yes"},"if_add_node_text":{"type":"string","title":"If Add Node Text","default":"no"},"if_retrieval":{"type":"boolean","title":"If Retrieval","default":false},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"ultra_mode":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ultra Mode","default":false},"golden_data":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Golden Data","default":false},"folder_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Folder Id"},"if_ocr":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"If Ocr","default":true},"beta_headers":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Beta Headers"},"metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["file"],"title":"Body_page_index_doc_post"},"Body_page_index_tree_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"if_add_node_id":{"type":"string","title":"If Add Node Id","default":"yes"},"if_add_node_summary":{"type":"string","title":"If Add Node Summary","default":"yes"},"if_add_doc_description":{"type":"string","title":"If Add Doc Description","default":"yes"},"if_add_node_text":{"type":"string","title":"If Add Node Text","default":"no"},"if_retrieval":{"type":"boolean","title":"If Retrieval","default":false},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"ultra_mode":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ultra Mode","default":false},"golden_data":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Golden Data","default":false},"folder_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Folder Id"},"if_ocr":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"If Ocr","default":true},"beta_headers":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Beta Headers"},"metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["file"],"title":"Body_page_index_tree_post"},"ChatCompletionRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/ChatMessage"},"type":"array","title":"Messages"},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","default":false},"doc_id":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Doc Id"},"folder_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Folder Id"},"enable_citations":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Citations","default":false}},"type":"object","required":["messages"],"title":"ChatCompletionRequest"},"ChatMessage":{"properties":{"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"ChatMessage"},"CreateFolderMsg":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"parent_folder_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Folder Id"}},"type":"object","required":["name"],"title":"CreateFolderMsg"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PageIndexRetrievalRequest":{"properties":{"doc_id":{"type":"string","title":"Doc Id"},"query":{"type":"string","title":"Query"},"thinking":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Thinking","default":false},"teamspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teamspace Id"}},"type":"object","required":["doc_id","query"],"title":"PageIndexRetrievalRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}