[{"data":1,"prerenderedAt":594},["ShallowReactive",2],{"navigation_docs":3,"-sdk-upload-recovery":223,"-sdk-upload-recovery-surround":589},[4,30,83,128,157,182],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Getting Started","\u002Fgetting-started","1.getting-started",[9,13,17,21,25],{"title":10,"path":11,"stem":12},"What is FlashDrive?","\u002Fgetting-started\u002Fwhat-is-flashdrive","1.getting-started\u002F01.what-is-flashdrive",{"title":14,"path":15,"stem":16},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F02.quickstart",{"title":18,"path":19,"stem":20},"Key concepts","\u002Fgetting-started\u002Fkey-concepts","1.getting-started\u002F03.key-concepts",{"title":22,"path":23,"stem":24},"Find files","\u002Fgetting-started\u002Ffind-files","1.getting-started\u002F04.find-files",{"title":26,"path":27,"stem":28},"Common use cases","\u002Fgetting-started\u002Fuse-cases","1.getting-started\u002F05.use-cases",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Platform Guide","\u002Fplatform","2.platform",[35,39,43,47,51,55,59,63,67,71,75,79],{"title":36,"path":37,"stem":38},"Organizations and workspaces","\u002Fplatform\u002Forganizations-and-workspaces","2.platform\u002F01.organizations-and-workspaces",{"title":40,"path":41,"stem":42},"Members, invitations, and roles","\u002Fplatform\u002Fmembers-and-roles","2.platform\u002F02.members-and-roles",{"title":44,"path":45,"stem":46},"API keys and permissions","\u002Fplatform\u002Fapi-keys","2.platform\u002F03.api-keys",{"title":48,"path":49,"stem":50},"Drives and the default drive","\u002Fplatform\u002Fdrives-and-defaults","2.platform\u002F04.drives-and-defaults",{"title":52,"path":53,"stem":54},"Folders and files","\u002Fplatform\u002Ffolders-and-documents","2.platform\u002F05.folders-and-documents",{"title":56,"path":57,"stem":58},"Upload files","\u002Fplatform\u002Fuploads-and-indexing","2.platform\u002F06.uploads-and-processing",{"title":60,"path":61,"stem":62},"Usage","\u002Fplatform\u002Fusage","2.platform\u002F07.usage",{"title":64,"path":65,"stem":66},"Billing and credits","\u002Fplatform\u002Fbilling","2.platform\u002F08.billing",{"title":68,"path":69,"stem":70},"Storage and limits","\u002Fplatform\u002Fstorage-and-upgrades","2.platform\u002F09.storage-and-upgrades",{"title":72,"path":73,"stem":74},"Account settings and security","\u002Fplatform\u002Faccount-and-security","2.platform\u002F10.account-and-security",{"title":76,"path":77,"stem":78},"Redeem a promo code","\u002Fplatform\u002Fpromo-codes","2.platform\u002F11.promo-codes",{"title":80,"path":81,"stem":82},"Build tools from files","\u002Fplatform\u002Ffile-workflows","2.platform\u002F12.file-workflows",{"title":84,"path":85,"stem":86,"children":87,"page":29},"SDK Guide","\u002Fsdk","4.sdk",[88,92,96,100,104,108,112,116,120,124],{"title":89,"path":90,"stem":91},"Python installation and configuration","\u002Fsdk\u002Finstallation","4.sdk\u002F01.installation",{"title":93,"path":94,"stem":95},"Upload your first files","\u002Fsdk\u002Fupload-files","4.sdk\u002F02.upload-files",{"title":97,"path":98,"stem":99},"Upload a large collection","\u002Fsdk\u002Fbulk-imports","4.sdk\u002F03.bulk-imports",{"title":101,"path":102,"stem":103},"Find, read and edit files","\u002Fsdk\u002Ffiles","4.sdk\u002F05.files",{"title":105,"path":106,"stem":107},"Work with folders","\u002Fsdk\u002Ffolders","4.sdk\u002F06.folders",{"title":109,"path":110,"stem":111},"Manage drives and defaults","\u002Fsdk\u002Fdrives-and-defaults","4.sdk\u002F07.drives-and-defaults",{"title":113,"path":114,"stem":115},"Replace files and attach metadata","\u002Fsdk\u002Freplace-and-label","4.sdk\u002F08.replace-and-label",{"title":117,"path":118,"stem":119},"Upload recovery and partial failures","\u002Fsdk\u002Fupload-recovery","4.sdk\u002F09.upload-recovery",{"title":121,"path":122,"stem":123},"Async workflows","\u002Fsdk\u002Fasync","4.sdk\u002F10.async",{"title":125,"path":126,"stem":127},"Errors, timeouts, and retries","\u002Fsdk\u002Ferrors-and-retries","4.sdk\u002F11.errors-and-retries",{"title":129,"path":130,"stem":131,"children":132,"page":29},"CLI Guide","\u002Fcli","5.cli",[133,137,141,145,149,153],{"title":134,"path":135,"stem":136},"Get Started","\u002Fcli\u002Fquickstart","5.cli\u002F01.quickstart",{"title":138,"path":139,"stem":140},"Profiles and Access","\u002Fcli\u002Fconfiguration","5.cli\u002F02.configuration",{"title":142,"path":143,"stem":144},"Uploads and Recovery","\u002Fcli\u002Fuploads-and-recovery","5.cli\u002F03.uploads-and-recovery",{"title":146,"path":147,"stem":148},"Mount and Sync","\u002Fcli\u002Fmount-and-sync","5.cli\u002F05.mount-and-sync",{"title":150,"path":151,"stem":152},"Sandbox Tokens","\u002Fcli\u002Fsandboxes","5.cli\u002F06.sandboxes",{"title":154,"path":155,"stem":156},"Command Reference","\u002Fcli\u002Fcommands","5.cli\u002F07.commands",{"title":158,"path":159,"stem":160,"children":161,"page":29},"MCP","\u002Fmcp","6.mcp",[162,166,170,174,178],{"title":163,"path":164,"stem":165},"Connect an AI client","\u002Fmcp\u002Fconnect","6.mcp\u002F01.connect",{"title":167,"path":168,"stem":169},"Choose an assistant’s permissions","\u002Fmcp\u002Fpermissions","6.mcp\u002F02.permissions",{"title":171,"path":172,"stem":173},"Upload and manage content","\u002Fmcp\u002Fmanage-content","6.mcp\u002F04.manage-content",{"title":175,"path":176,"stem":177},"Tool reference","\u002Fmcp\u002Ftools","6.mcp\u002F05.tools",{"title":179,"path":180,"stem":181},"Troubleshooting and revoking access","\u002Fmcp\u002Ftroubleshooting","6.mcp\u002F06.troubleshooting",{"title":183,"path":184,"stem":185,"children":186,"page":29},"Reference","\u002Freference","7.reference",[187,191,195,199,203,207,211,215,219],{"title":188,"path":189,"stem":190},"Authentication and API conventions","\u002Freference\u002Fauthentication","7.reference\u002F01.authentication",{"title":192,"path":193,"stem":194},"Organizations, workspaces, and access API","\u002Freference\u002Faccess-api","7.reference\u002F02.access-api",{"title":196,"path":197,"stem":198},"Drives, folders, and files API","\u002Freference\u002Fcontent-api","7.reference\u002F03.content-api",{"title":200,"path":201,"stem":202},"Uploads API","\u002Freference\u002Fuploads-api","7.reference\u002F04.uploads-api",{"title":204,"path":205,"stem":206},"Usage and billing API","\u002Freference\u002Fusage-and-billing-api","7.reference\u002F06.usage-and-billing-api",{"title":208,"path":209,"stem":210},"Errors and recovery","\u002Freference\u002Ferrors","7.reference\u002F07.errors",{"title":212,"path":213,"stem":214},"Limits and supported files","\u002Freference\u002Flimits","7.reference\u002F08.limits",{"title":216,"path":217,"stem":218},"Troubleshooting","\u002Freference\u002Ftroubleshooting","7.reference\u002F09.troubleshooting",{"title":220,"path":221,"stem":222},"Changelog","\u002Freference\u002Fchangelog","7.reference\u002F10.changelog",{"id":224,"title":225,"body":226,"description":582,"extension":583,"links":584,"meta":585,"navigation":586,"path":118,"seo":587,"stem":119,"__hash__":588},"docs\u002F4.sdk\u002F09.upload-recovery.md","Recover interrupted uploads",{"type":227,"value":228,"toc":576},"minimark",[229,233,236,241,356,394,398,478,483,487,535,552,559,563,566,569,572],[230,231,232],"p",{},"These examples use the latest stable release of the Python SDK.",[230,234,235],{},"Before uploading, save the drive ID, an idempotency key and the ordered list of file paths. Keep the bytes, external IDs, metadata and folder unchanged for a retry. Unfinished upload sessions and request keys last 24 hours. Keep the receipts of accepted uploads so you can resume by upload ID.",[237,238,240],"h2",{"id":239},"inspect-partial-failures","Inspect partial failures",[242,243,248],"pre",{"className":244,"code":245,"language":246,"meta":247,"style":247},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from flashdrive import Flashdrive, UploadBatchError, UploadError\n\nwith Flashdrive(drive_id=\"DRIVE_UUID\") as client:\n    try:\n        batch = client.upload(\n            [\"handbook.pdf\", \"policies.md\", \"intro.mp4\"],\n            idempotency_key=\"handbook-upload-1\",\n        )\n    except UploadBatchError as exc:\n        for receipt in exc.batch.files:\n            print(\"Completed:\", receipt.upload_id, receipt.document_id)\n        for file_key, issue in exc.failures.items():\n            print(file_key, str(issue))\n            if isinstance(issue, UploadError) and issue.receipt is not None:\n                receipt = issue.receipt\n                print(\"Recover with:\", receipt.upload_id, receipt.drive_id)\n        print(\"Original request:\", exc.idempotency_key, exc.drive_id)\n","python","",[249,250,251,259,266,272,278,284,290,296,302,308,314,320,326,332,338,344,350],"code",{"__ignoreMap":247},[252,253,256],"span",{"class":254,"line":255},"line",1,[252,257,258],{},"from flashdrive import Flashdrive, UploadBatchError, UploadError\n",[252,260,262],{"class":254,"line":261},2,[252,263,265],{"emptyLinePlaceholder":264},true,"\n",[252,267,269],{"class":254,"line":268},3,[252,270,271],{},"with Flashdrive(drive_id=\"DRIVE_UUID\") as client:\n",[252,273,275],{"class":254,"line":274},4,[252,276,277],{},"    try:\n",[252,279,281],{"class":254,"line":280},5,[252,282,283],{},"        batch = client.upload(\n",[252,285,287],{"class":254,"line":286},6,[252,288,289],{},"            [\"handbook.pdf\", \"policies.md\", \"intro.mp4\"],\n",[252,291,293],{"class":254,"line":292},7,[252,294,295],{},"            idempotency_key=\"handbook-upload-1\",\n",[252,297,299],{"class":254,"line":298},8,[252,300,301],{},"        )\n",[252,303,305],{"class":254,"line":304},9,[252,306,307],{},"    except UploadBatchError as exc:\n",[252,309,311],{"class":254,"line":310},10,[252,312,313],{},"        for receipt in exc.batch.files:\n",[252,315,317],{"class":254,"line":316},11,[252,318,319],{},"            print(\"Completed:\", receipt.upload_id, receipt.document_id)\n",[252,321,323],{"class":254,"line":322},12,[252,324,325],{},"        for file_key, issue in exc.failures.items():\n",[252,327,329],{"class":254,"line":328},13,[252,330,331],{},"            print(file_key, str(issue))\n",[252,333,335],{"class":254,"line":334},14,[252,336,337],{},"            if isinstance(issue, UploadError) and issue.receipt is not None:\n",[252,339,341],{"class":254,"line":340},15,[252,342,343],{},"                receipt = issue.receipt\n",[252,345,347],{"class":254,"line":346},16,[252,348,349],{},"                print(\"Recover with:\", receipt.upload_id, receipt.drive_id)\n",[252,351,353],{"class":254,"line":352},17,[252,354,355],{},"        print(\"Original request:\", exc.idempotency_key, exc.drive_id)\n",[230,357,358,361,362,365,366,369,370,373,374,377,378,381,382,385,386,389,390,393],{},[249,359,360],{},"UploadBatchError"," (code ",[249,363,364],{},"upload_batch_failed",") is raised even when only one file was uploaded. ",[249,367,368],{},"exc.batch.files"," holds the receipts of the files that succeeded. ",[249,371,372],{},"exc.failures"," maps each failed file to its error; the key is the file's position and name, such as ",[249,375,376],{},"0:handbook.pdf",". A failed or timed-out entry that is an ",[249,379,380],{},"UploadError"," can carry a ",[249,383,384],{},"receipt"," for work the service already accepted. ",[249,387,388],{},"exc.idempotency_key"," and ",[249,391,392],{},"exc.drive_id"," are what a retry needs.",[237,395,397],{"id":396},"choose-the-recovery-action","Choose the recovery action",[399,400,401,414],"table",{},[402,403,404],"thead",{},[405,406,407,411],"tr",{},[408,409,410],"th",{},"State",[408,412,413],{},"Action",[415,416,417,426,438,454,462],"tbody",{},[405,418,419,423],{},[420,421,422],"td",{},"Bytes have not finished transferring",[420,424,425],{},"Repeat the original upload with the same key, the complete ordered path list and unchanged inputs.",[405,427,428,431],{},[420,429,430],{},"Processing is queued or running",[420,432,433,434,437],{},"Resume waiting by upload ID with ",[249,435,436],{},"uploads.resume()",".",[405,439,440,451],{},[420,441,442,443,446,447,450],{},"Local waiting timed out (",[249,444,445],{},"UploadTimeoutError",", code ",[249,448,449],{},"upload_timeout",")",[420,452,453],{},"Inspect the receipt and resume; a local timeout does not cancel accepted work.",[405,455,456,459],{},[420,457,458],{},"The file or its inputs were refused, or processing failed",[420,460,461],{},"Correct the file or input, then start a new upload with a new key.",[405,463,464,467],{},[420,465,466],{},"The session expired",[420,468,469,470,473,474,477],{},"Check the file with ",[249,471,472],{},"client.files.list()"," or ",[249,475,476],{},"client.documents.get()"," before starting a new upload.",[230,479,480,481,437],{},"When you reuse a batch key, send the complete original file list in the same order. The SDK identifies each file by its position, so retrying a subset or changing the order changes those identities. To continue one upload the service has already accepted, use its receipt with ",[249,482,436],{},[237,484,486],{"id":485},"resume-waiting","Resume waiting",[242,488,490],{"className":244,"code":489,"language":246,"meta":247,"style":247},"from flashdrive import Flashdrive, UploadTimeoutError\n\nwith Flashdrive() as client:\n    try:\n        ready = client.uploads.resume(\"UPLOAD_UUID\", drive_id=\"DRIVE_UUID\")\n        print(ready.status, ready.document_id)\n    except UploadTimeoutError as exc:\n        if exc.receipt is not None:\n            print(\"Still processing:\", exc.receipt.upload_id, exc.receipt.drive_id)\n",[249,491,492,497,501,506,510,515,520,525,530],{"__ignoreMap":247},[252,493,494],{"class":254,"line":255},[252,495,496],{},"from flashdrive import Flashdrive, UploadTimeoutError\n",[252,498,499],{"class":254,"line":261},[252,500,265],{"emptyLinePlaceholder":264},[252,502,503],{"class":254,"line":268},[252,504,505],{},"with Flashdrive() as client:\n",[252,507,508],{"class":254,"line":274},[252,509,277],{},[252,511,512],{"class":254,"line":280},[252,513,514],{},"        ready = client.uploads.resume(\"UPLOAD_UUID\", drive_id=\"DRIVE_UUID\")\n",[252,516,517],{"class":254,"line":286},[252,518,519],{},"        print(ready.status, ready.document_id)\n",[252,521,522],{"class":254,"line":292},[252,523,524],{},"    except UploadTimeoutError as exc:\n",[252,526,527],{"class":254,"line":298},[252,528,529],{},"        if exc.receipt is not None:\n",[252,531,532],{"class":254,"line":304},[252,533,534],{},"            print(\"Still processing:\", exc.receipt.upload_id, exc.receipt.drive_id)\n",[230,536,537,540,541,544,545,547,548,551],{},[249,538,539],{},"uploads.resume(upload_id, *, drive_id, timeout=600)"," waits for an accepted upload and returns its ",[249,542,543],{},"UploadReceipt",". Use the IDs from the saved receipt. If the file's bytes never finished transferring, it raises an ",[249,546,380],{}," with code ",[249,549,550],{},"upload_transfer_incomplete",": repeat the original upload with its saved inputs and key to send them.",[230,553,554,555,437],{},"The SDK keeps upload state in memory only. To recover after your process restarts, save the original request inputs and the receipt IDs in your application's own job record, and keep credentials in your usual secret storage. See ",[556,557,558],"a",{"href":126},"errors and retries",[237,560,562],{"id":561},"queued-processing-and-the-transfer-deadline","Queued processing and the transfer deadline",[230,564,565],{},"Once a file's bytes are verified and queued for processing, it stays queued even after the 24-hour transfer deadline, and it counts toward your storage while it is processed. Follow it by its saved upload ID.",[230,567,568],{},"The original request key can be reused for 24 hours. Reusing an old batch key after that can create new uploads, so resume queued uploads by their saved IDs rather than repeating the batch.",[230,570,571],{},"Cancelling or timing out stops only your local waiting. Work the service already accepted continues.",[573,574,575],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":247,"searchDepth":261,"depth":261,"links":577},[578,579,580,581],{"id":239,"depth":261,"text":240},{"id":396,"depth":261,"text":397},{"id":485,"depth":261,"text":486},{"id":561,"depth":261,"text":562},"Resume accepted work and keep the files that succeeded.","md",null,{},{"title":117},{"title":225,"description":582},"Vu8vBPpK4jWZSfH8wlpWka5du2CkOPa6zZHRLSYeEms",[590,592],{"title":113,"path":114,"stem":115,"description":591,"children":-1},"Replace a file's contents, keep its identity and labels, and delete files safely.",{"title":121,"path":122,"stem":123,"description":593,"children":-1},"Upload, read and edit files with the asynchronous client.",1795366546182]