# One-time setup (initialize database tables)
curl -X GET https://agent-doc-tool.vercel.app/api/init-db
# Small files (Direct upload)
curl -X POST https://agent-doc-tool.vercel.app/api/extract-docx \
-H "Content-Type: application/json" \
-d '"base64": "UEsDBBQABgAIAAAAIQ...", "fileName": "doc.pdf", "fileType": "application/pdf"'
# Large files (Chunked upload)
# Use the same sessionId for all chunks of one file
# chunkIndex starts at 0 and increments by 1
# 1. Upload chunks
curl -X POST https://agent-doc-tool.vercel.app/api/upload-chunk \
-H "Content-Type: application/json" \
-d '"sessionId": "session_123456", "chunk": "base64_chunk_0", "chunkIndex": 0, "totalChunks": 3, "fileName": "big.pdf", "fileType": "application/pdf"'
curl -X POST https://agent-doc-tool.vercel.app/api/upload-chunk \
-H "Content-Type: application/json" \
-d '"sessionId": "session_123456", "chunk": "base64_chunk_1", "chunkIndex": 1, "totalChunks": 3, "fileName": "big.pdf", "fileType": "application/pdf"'
curl -X POST https://agent-doc-tool.vercel.app/api/upload-chunk \
-H "Content-Type: application/json" \
-d '"sessionId": "session_123456", "chunk": "base64_chunk_2", "chunkIndex": 2, "totalChunks": 3, "fileName": "big.pdf", "fileType": "application/pdf"'
# 2. Process assembled chunks
curl -X POST https://agent-doc-tool.vercel.app/api/process-chunks \
-H "Content-Type: application/json" \
-d '"sessionId": "session_123456"'
# 3. Optional: cleanup the session
curl -X POST https://agent-doc-tool.vercel.app/api/cleanup \
-H "Content-Type: application/json" \
-d '"sessionId": "session_123456"'
# Automatic chunking for files > 4MB base64
# Supports: PDF, DOCX, XLSX, XLS, PNG, JPEG, GIF, ZIP