Recursive is true when files and subdirectories hold every level below
path (tree read with recursive=true). Older APIs ignore that parameter
and omit this field, so clients can tell a one-level listing apart.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Documentation","description":"Blaxel documentation: cloud sandboxes, AI agent hosting, MCP servers, batch jobs, and model gateway for building and deploying AI-powered applications.","colors":{"primary":"#F0652D","light":"#FD7B35","dark":"#F0652D"},"logo":{"light":"https://mintcdn.com/blaxel/Z-RIT2VoXMT2Aw7L/images/logo-light.svg?fit=max\u0026auto=format\u0026n=Z-RIT2VoXMT2Aw7L\u0026q=85\u0026s=7a7cf1e3c766c77f97f32e5c0d4fd209","dark":"https://mintcdn.com/blaxel/Z-RIT2VoXMT2Aw7L/images/logo-dark.svg?fit=max\u0026auto=format\u0026n=Z-RIT2VoXMT2Aw7L\u0026q=85\u0026s=17297eca3e92fe15a91eed262f17d659"},"favicon":"https://mintcdn.com/blaxel/nH6Nd4qmP2OsLhOO/favicon.svg?fit=max\u0026auto=format\u0026n=nH6Nd4qmP2OsLhOO\u0026q=85\u0026s=484b8f0ebe3fb56aef259d514eeaa18c","appearance":{"default":"system"},"background":{"color":{"dark":"#09090B"}},"navbar":{"links":[{"icon":"calendar","href":"/changelog","label":"Changelog"},{"icon":"robot","href":"/skills-mcp","label":"Agent Skill"},{"icon":"puzzle-piece","href":"https://blaxel.ai/integrations","label":"Integrations"},{"icon":"discord","href":"/Community","label":"Community"}],"primary":{"type":"button","label":"Blaxel Console","href":"https://app.blaxel.ai"}},"footer":{"socials":{"github":"https://github.com/blaxel-ai","linkedin":"https://www.linkedin.com/company/blaxel-ai","twitter":"https://x.com/blaxelai","discord":"https://discord.gg/CsWKUZUHFQ"}},"search":{"prompt":"Search Blaxel docs..."},"seo":{"metatags":{"og:type":"website","og:site_name":"Blaxel Documentation"},"indexing":"navigable"},"fonts":{"family":"Inter"},"integrations":{"posthog":{"apiKey":"phc_HGJ7t7Qa8cJJilL0CONU5se4vM6jU6nKFCuoCC9LSha","apiHost":"https://events.blaxel.ai"}},"banner":{"content":"Blaxel has joined Baseten to build the future of agentic infrastructure! [Read our announcement.](https://www.baseten.co/blog/blaxel-is-joining-baseten-to-build-the-future-of-agentic-cloud/)","dismissible":true},"contextual":{"options":["copy","view","chatgpt","claude","cursor","devin","download-spec"],"display":"header"},"metadata":{"timestamp":true},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Changelog","icon":"calendar","href":"/changelog"},{"anchor":"Blaxel Skills \u0026 MCP","icon":"robot","href":"/skills-mcp"},{"anchor":"Integrations directory","icon":"puzzle-piece","href":"https://blaxel.ai/integrations"},{"anchor":"Community","icon":"discord","href":"/Community"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"blaxel","hasAudioNarration":false,"actualSubdomain":"blaxel","customDomains":["docs.blaxel.ai"],"gitSource":{"type":"github","owner":"blaxel-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"issues":true,"edits":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af5fcb3dee269cf351393e1","clientVersion":"0.0.4117","searchFilterCounts":[{"language":"default","tag":"Platform APIs Reference","count":180},{"language":"default","tag":"Management API","count":177},{"language":"default","tag":"Documentation","count":115},{"language":"default","tag":"Overview","count":75},{"language":"default","tag":"CLI Reference","count":73},{"language":"default","tag":"Commands","count":72},{"language":"default","tag":"Sandbox API Reference","count":46},{"language":"default","tag":"Troubleshooting","count":41},{"language":"default","tag":"Tutorials and Examples","count":35},{"language":"default","tag":"compute","count":35}]},"assistantConfig":{"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"deflection":{"enabled":true,"email":"support@blaxel.ai","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#navbar .nav-logo{height:2.5rem;width:auto}#navbar:has(#banner){display:flex;flex-direction:column}#navbar:has(#banner)>.max-w-8xl{width:100%}#navbar:has(#banner)>div[aria-hidden=\"true\"]{display:none}#banner{position:relative;inset:auto;order:1;padding:1.25rem 3rem;background:transparent;font-size:0.9375rem;font-weight:400}#banner>div{width:100%;max-width:70rem;margin:0;padding:1rem 3.5rem 1rem 1.75rem;border:1px solid #394655;border-radius:0.75rem;background:radial-gradient(ellipse at 50% 0, rgb(99 216 226 / 12%), transparent 70%),\n linear-gradient(110deg, #121b29, #081827 52%, #141925);box-shadow:0 12px 32px -16px rgb(7 11 17 / 40%),\n inset 0 1px 0 rgb(255 255 255 / 5%)}#banner>button{right:max(4rem, calc((100% - 70rem) / 2 + 1rem))}#banner p{color:#dbdbdb!important;line-height:1.5}#banner a{display:inline-flex;align-items:center;gap:0.5rem;margin-left:0.75rem;color:#fff!important;text-decoration:none;white-space:nowrap}#banner a::after{content:\"\";width:1.25rem;height:1.25rem;background-color:#eb7229;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='black' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9h12M10 4l5 5-5 5'/%3E%3C/svg%3E\") center / contain no-repeat}#banner a:hover{text-decoration:underline;text-decoration-color:#fff}#banner a:focus-visible{border-radius:2px;outline:2px solid #eb7229;outline-offset:4px}@media (max-width: 767px){#banner{padding:1rem;text-align:left}#banner>div{padding:1rem 2.75rem 1rem 1rem}#banner a{display:flex;width:fit-content;margin:0.375rem 0 0}#banner>button{top:1.75rem;right:1.75rem;transform:none}}"}],"page":{"pagePath":"api-reference/filesystem/create-or-update-directory-tree","slug":"/api-reference/filesystem/create-or-update-directory-tree","pageMetadata":{"title":"Create or update directory tree","description":"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /filesystem/tree/{path}","href":"/api-reference/filesystem/create-or-update-directory-tree","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Create or update directory tree","description":"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /filesystem/tree/{path}","href":"/api-reference/filesystem/create-or-update-directory-tree","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"description":"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.","parameters":["6b9583e7-fe03-4be0-bd86-ebe57b16ae5d"],"requestBody":"bb1fa95b-d30c-467a-a188-6a52b49d8c1d","responses":{"200":"ff1f0973-4985-4670-a746-6976d128dd94","400":"3c0ba410-7404-479c-9581-8368926430ae","422":"36a2aed1-70f0-42d3-9463-74b350501b9c","500":"4a36631b-ad92-4d8e-9f4a-2b23e393d166"},"summary":"Create or update directory tree","tags":["filesystem"],"method":"put","type":"path","servers":["ff88ca9c-14df-4a73-8f06-c85d07d8b0e3"],"security":["98c6ee7a-933a-4976-92a2-acfaf47da6fc"],"path":"/filesystem/tree/{path}","baseUrlOptions":["https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run"],"title":"Create or update directory tree","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"6b9583e7-fe03-4be0-bd86-ebe57b16ae5d":{"description":"Root directory path","in":"path","name":"path","required":true,"schema":{"type":"string","isRequired":true,"description":"Root directory path","uniqueKey":"","typeLabel":"string"}}},"requestBody":{"content":{"application/json":{"schema":{"properties":{"files":{"additionalProperties":{"type":"string","uniqueKey":"files.additionalProperties","typeLabel":"string"},"example":{"\"dir/file2.txt\"":"\"content2\"}","{\"file1.txt\"":"\"content1\""},"type":"object","uniqueKey":"files","typeLabel":"object"}},"type":"object","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"files":{"\"dir/file2.txt\"":"\"content2\"}","{\"file1.txt\"":"\"content1\""}}}},"exampleType":"generated"}},"description":"Map of file paths to content","required":true,"exampleType":"generated"},"responses":{"ff1f0973-4985-4670-a746-6976d128dd94":{"description":"Updated directory tree","content":{"application/json":{"schema":{"properties":{"files":{"items":{"properties":{"group":{"type":"string","isRequired":true,"uniqueKey":"files.items.[INDEX].group","typeLabel":"string"},"lastModified":{"type":"string","isRequired":true,"uniqueKey":"files.items.[INDEX].lastModified","typeLabel":"string"},"name":{"type":"string","isRequired":true,"uniqueKey":"files.items.[INDEX].name","typeLabel":"string"},"owner":{"type":"string","isRequired":true,"uniqueKey":"files.items.[INDEX].owner","typeLabel":"string"},"path":{"type":"string","isRequired":true,"uniqueKey":"files.items.[INDEX].path","typeLabel":"string"},"permissions":{"type":"string","isRequired":true,"uniqueKey":"files.items.[INDEX].permissions","typeLabel":"string"},"size":{"type":"integer","isRequired":true,"uniqueKey":"files.items.[INDEX].size","typeLabel":"integer"},"content":{"description":"Content is set only by a tree read with content=true, for regular files.","type":"string","uniqueKey":"files.items.[INDEX].content","typeLabel":"string"}},"required":["group","lastModified","name","owner","path","permissions","size"],"type":"object","uniqueKey":"files.items.[INDEX]","typeLabel":"object"},"type":"array","isRequired":true,"uniqueKey":"files","typeLabel":"object[]"},"name":{"type":"string","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"path":{"type":"string","isRequired":true,"uniqueKey":"path","typeLabel":"string"},"subdirectories":{"description":"@name Subdirectories","items":{"properties":{"name":{"type":"string","isRequired":true,"uniqueKey":"subdirectories.items.[INDEX].name","typeLabel":"string"},"path":{"type":"string","isRequired":true,"uniqueKey":"subdirectories.items.[INDEX].path","typeLabel":"string"}},"required":["name","path"],"type":"object","uniqueKey":"subdirectories.items.[INDEX]","typeLabel":"object"},"type":"array","isRequired":true,"uniqueKey":"subdirectories","typeLabel":"object[]"},"recursive":{"description":"Recursive is true when files and subdirectories hold every level below\npath (tree read with recursive=true). Older APIs ignore that parameter\nand omit this field, so clients can tell a one-level listing apart.","type":"boolean","uniqueKey":"recursive","typeLabel":"boolean"}},"required":["files","name","path","subdirectories"],"type":"object","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"files":[{"group":"\u003cstring>","lastModified":"\u003cstring>","name":"\u003cstring>","owner":"\u003cstring>","path":"\u003cstring>","permissions":"\u003cstring>","size":123,"content":"\u003cstring>"}],"name":"\u003cstring>","path":"\u003cstring>","subdirectories":[{"name":"\u003cstring>","path":"\u003cstring>"}],"recursive":true}}},"exampleType":"generated"}},"exampleType":"generated"},"3c0ba410-7404-479c-9581-8368926430ae":{"description":"Bad request","content":{"application/json":{"schema":{"properties":{"error":{"example":"Error message","type":"string","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"code":{"example":"FILE_ALREADY_EXISTS","type":"string","uniqueKey":"code","typeLabel":"string"}},"required":["error"],"type":"object","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"Error message","code":"FILE_ALREADY_EXISTS"}}},"exampleType":"generated"}},"exampleType":"generated"},"36a2aed1-70f0-42d3-9463-74b350501b9c":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"properties":{"error":{"example":"Error message","type":"string","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"code":{"example":"FILE_ALREADY_EXISTS","type":"string","uniqueKey":"code","typeLabel":"string"}},"required":["error"],"type":"object","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"Error message","code":"FILE_ALREADY_EXISTS"}}},"exampleType":"generated"}},"exampleType":"generated"},"4a36631b-ad92-4d8e-9f4a-2b23e393d166":{"description":"Internal server error","content":{"application/json":{"schema":{"properties":{"error":{"example":"Error message","type":"string","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"code":{"example":"FILE_ALREADY_EXISTS","type":"string","uniqueKey":"code","typeLabel":"string"}},"required":["error"],"type":"object","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"Error message","code":"FILE_ALREADY_EXISTS"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"98c6ee7a-933a-4976-92a2-acfaf47da6fc":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"BearerAuth"}}},"servers":{"ff88ca9c-14df-4a73-8f06-c85d07d8b0e3":{"url":"https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run","variables":{"sandbox_id":{"default":"unknown"},"workspace_id":{"default":"unknown"},"region":{"default":"unknown"}}}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"BearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"}],"title":"BearerAuth"}]},"originalFileLocation":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml"},"subdomain":"blaxel","siteName":"Documentation","title":"Create or update directory tree - Documentation","contextualStarterQuestions":[{"_id":"69d94bd0d26302b05e2a9583","deploymentId":"672e5f6ba9a398341da2aaec","questionText":"What's the directory structure format?","status":"active","generatedBy":"contextual","path":"api-reference/filesystem/create-or-update-directory-tree","createdAt":"2026-04-10T19:13:20.804Z","updatedAt":"2026-04-10T19:13:20.804Z","__v":0},{"_id":"69d94bd0d26302b05e2a9582","deploymentId":"672e5f6ba9a398341da2aaec","questionText":"Can I update multiple files at once?","status":"active","generatedBy":"contextual","path":"api-reference/filesystem/create-or-update-directory-tree","createdAt":"2026-04-10T19:13:20.804Z","updatedAt":"2026-04-10T19:13:20.804Z","__v":0},{"_id":"69d94bd0d26302b05e2a9581","deploymentId":"672e5f6ba9a398341da2aaec","questionText":"How do I create a directory tree?","status":"active","generatedBy":"contextual","path":"api-reference/filesystem/create-or-update-directory-tree","createdAt":"2026-04-10T19:13:20.804Z","updatedAt":"2026-04-10T19:13:20.804Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"originalFileLocation":"api-reference/filesystem/create-or-update-directory-tree.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create or update directory tree - Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Blaxel Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://blaxel.mintlify.site/_mintlify/api/og/v2?division=filesystem\u0026amp;title=Create+or+update+directory+tree\u0026amp;description=Create+or+update+multiple+files+within+a+directory+tree+structure.+Idempotent%3A+existing+files+are+overwritten%2C+so+retrying+the+same+request+is+safe.\u0026amp;theme=aa6a37f877c64d380f9dda80\u0026amp;signature=93d7d66560584b252ace1b8a6791e4e73a4eab7f8e5f4ab778e1b432cf0af5fe\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Create or update directory tree - Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://blaxel.mintlify.site/_mintlify/api/og/v2?division=filesystem\u0026amp;title=Create+or+update+directory+tree\u0026amp;description=Create+or+update+multiple+files+within+a+directory+tree+structure.+Idempotent%3A+existing+files+are+overwritten%2C+so+retrying+the+same+request+is+safe.\u0026amp;theme=aa6a37f877c64d380f9dda80\u0026amp;signature=93d7d66560584b252ace1b8a6791e4e73a4eab7f8e5f4ab778e1b432cf0af5fe\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/blaxel/uaLoRkh_ONjRStCE/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#F0652D\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/filesystem/create-or-update-directory-tree.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.blaxel.ai/#organization\",\"name\":\"Documentation\",\"url\":\"https://docs.blaxel.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/blaxel/Z-RIT2VoXMT2Aw7L/images/logo-light.svg?fit=max\u0026auto=format\u0026n=Z-RIT2VoXMT2Aw7L\u0026q=85\u0026s=7a7cf1e3c766c77f97f32e5c0d4fd209\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.blaxel.ai#website\",\"name\":\"Documentation\",\"url\":\"https://docs.blaxel.ai\",\"publisher\":{\"@id\":\"https://docs.blaxel.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree#webpage\",\"url\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree\",\"name\":\"Create or update directory tree\",\"description\":\"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.\",\"isPartOf\":{\"@id\":\"https://docs.blaxel.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"filesystem\",\"item\":\"https://docs.blaxel.ai/api-reference/filesystem/search-for-text-content-in-files\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create or update directory tree\",\"item\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree#apireference\",\"headline\":\"Create or update directory tree\",\"name\":\"Create or update directory tree\",\"description\":\"Create or update multiple files within a directory tree structure. Idempotent: existing files are overwritten, so retrying the same request is safe.\",\"url\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree\",\"mainEntityOfPage\":{\"@id\":\"https://docs.blaxel.ai/api-reference/filesystem/create-or-update-directory-tree#webpage\"},\"publisher\":{\"@id\":\"https://docs.blaxel.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.blaxel.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/filesystem/create-or-update-directory-tree.md","siteName":"Documentation","nav":{"global":{"anchors":[{"anchor":"Changelog","icon":"calendar","href":"/changelog"},{"anchor":"Blaxel Skills \u0026 MCP","icon":"robot","href":"/skills-mcp"},{"anchor":"Integrations directory","icon":"puzzle-piece","href":"https://blaxel.ai/integrations"},{"anchor":"Community","icon":"discord","href":"/Community"}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/Overview"}]},{"tab":"Tutorials and Examples","pages":[{"title":"Tutorials and Examples","href":"/Tutorials/Overview"}]},{"tab":"Platform APIs Reference","pages":[{"title":"Platform APIs Reference","href":"/api-reference/introduction"}]},{"tab":"Sandbox API Reference","groups":[{"group":"archive","pages":[{"title":"Export the filesystem changes to a presigned URL","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /archive/export","href":"/api-reference/archive/export-the-filesystem-changes-to-a-presigned-url"},{"title":"Lift the archive freeze","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /archive/resume","href":"/api-reference/archive/lift-the-archive-freeze"},{"title":"Get the archive status","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /archive/status","href":"/api-reference/archive/get-the-archive-status"}]},{"group":"fastapply","pages":[{"title":"Apply code edit","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /codegen/fastapply/{path}","href":"/api-reference/fastapply/apply-code-edit"}]},{"group":"codegen","pages":[{"title":"Code reranking/semantic search","deprecated":true,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /codegen/reranking/{path}","href":"/api-reference/codegen/code-rerankingsemantic-search"}]},{"group":"drive","pages":[{"title":"List currently mounted drives","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /drives/mount","href":"/api-reference/drive/list-currently-mounted-drives"},{"title":"Attach a drive to a local path","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /drives/mount","href":"/api-reference/drive/attach-a-drive-to-a-local-path"},{"title":"Detach a drive from a local path","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /drives/mount/{mountPath}","href":"/api-reference/drive/detach-a-drive-from-a-local-path"}]},{"group":"system","pages":[{"title":"Reload environment from guest metadata","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /environment/reload","href":"/api-reference/system/reload-environment-from-guest-metadata"},{"title":"Health check","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /health","href":"/api-reference/system/health-check"},{"title":"Resume the sandbox","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /resume","href":"/api-reference/system/resume-the-sandbox"},{"title":"Put the sandbox in standby","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /standby","href":"/api-reference/system/put-the-sandbox-in-standby"},{"title":"Upgrade the sandbox-api","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /upgrade","href":"/api-reference/system/upgrade-the-sandbox-api"}]},{"group":"filesystem","pages":[{"title":"Search for text content in files","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem-content-search/{path}","href":"/api-reference/filesystem/search-for-text-content-in-files"},{"title":"Copy a file or directory","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /filesystem-copy","href":"/api-reference/filesystem/copy-a-file-or-directory"},{"title":"Find files and directories","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem-find/{path}","href":"/api-reference/filesystem/find-files-and-directories"},{"title":"List multipart uploads","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem-multipart","href":"/api-reference/filesystem/list-multipart-uploads"},{"title":"Abort multipart upload","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /filesystem-multipart/{uploadId}/abort","href":"/api-reference/filesystem/abort-multipart-upload"},{"title":"Complete multipart upload","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /filesystem-multipart/{uploadId}/complete","href":"/api-reference/filesystem/complete-multipart-upload"},{"title":"Upload part","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /filesystem-multipart/{uploadId}/part","href":"/api-reference/filesystem/upload-part"},{"title":"List parts","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem-multipart/{uploadId}/parts","href":"/api-reference/filesystem/list-parts"},{"title":"Initiate multipart upload","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /filesystem-multipart/initiate/{path}","href":"/api-reference/filesystem/initiate-multipart-upload"},{"title":"Fuzzy search for files and directories","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem-search/{path}","href":"/api-reference/filesystem/fuzzy-search-for-files-and-directories"},{"title":"Get file or directory information","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem/{path}","href":"/api-reference/filesystem/get-file-or-directory-information"},{"title":"Create or update a file or directory","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /filesystem/{path}","href":"/api-reference/filesystem/create-or-update-a-file-or-directory"},{"title":"Delete file or directory","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /filesystem/{path}","href":"/api-reference/filesystem/delete-file-or-directory"},{"title":"Stat a file or directory","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml head /filesystem/{path}","href":"/api-reference/filesystem/stat-a-file-or-directory"},{"title":"Get directory tree","description":"List a directory. Without query parameters, `files` and `subdirectories` hold its direct children.\n\nWith `recursive=true`, they hold every file and directory below the path (flat, with full paths). With `content=true`, each regular file (or symlink to one) also carries its `content` as UTF-8 text, like a JSON file read; other entries have no `content`. `patterns`, `excludeDirs` and `excludeHidden` select entries the same way as find, but nothing is excluded by default.\n\nThe response is all or nothing: when more than `maxFiles` files match, or `content=true` and they hold more than `maxBytes` bytes, the request fails with 422 before any content is read.","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /filesystem/tree/{path}","href":"/api-reference/filesystem/get-directory-tree"},{"title":"Create or update directory tree","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /filesystem/tree/{path}","href":"/api-reference/filesystem/create-or-update-directory-tree"},{"title":"Delete directory tree","description":"Delete a directory tree recursively","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /filesystem/tree/{path}","href":"/api-reference/filesystem/delete-directory-tree"},{"title":"Stream file modification events in a directory","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /watch/filesystem/{path}","href":"/api-reference/filesystem/stream-file-modification-events-in-a-directory"}]},{"group":"network","pages":[{"title":"Start monitoring ports for a process","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /network/process/{pid}/monitor","href":"/api-reference/network/start-monitoring-ports-for-a-process"},{"title":"Stop monitoring ports for a process","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /network/process/{pid}/monitor","href":"/api-reference/network/stop-monitoring-ports-for-a-process"},{"title":"Get open ports for a process","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /network/process/{pid}/ports","href":"/api-reference/network/get-open-ports-for-a-process"},{"title":"Disconnect tunnel","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /network/tunnel","href":"/api-reference/network/disconnect-tunnel"},{"title":"Update tunnel configuration","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /network/tunnel/config","href":"/api-reference/network/update-tunnel-configuration"}]},{"group":"process","pages":[{"title":"List all processes","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /process","href":"/api-reference/process/list-all-processes"},{"title":"Execute a command","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /process","href":"/api-reference/process/execute-a-command"},{"title":"Get process by identifier","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /process/{identifier}","href":"/api-reference/process/get-process-by-identifier"},{"title":"Stop a process","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /process/{identifier}","href":"/api-reference/process/stop-a-process"},{"title":"Kill a process","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /process/{identifier}/kill","href":"/api-reference/process/kill-a-process"},{"title":"Get process logs","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /process/{identifier}/logs","href":"/api-reference/process/get-process-logs"},{"title":"Stream process logs in real time","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /process/{identifier}/logs/stream","href":"/api-reference/process/stream-process-logs-in-real-time"},{"title":"Write to a process's stdin","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml post /process/{identifier}/stdin","href":"/api-reference/process/write-to-a-processs-stdin"},{"title":"Close a process's stdin","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml delete /process/{identifier}/stdin","href":"/api-reference/process/close-a-processs-stdin"},{"title":"Wait for a process to finish","deprecated":null,"version":null,"openapi":"https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml get /process/{identifier}/wait","href":"/api-reference/process/wait-for-a-process-to-finish"}]}]},{"tab":"SDK Reference","pages":[{"title":"SDK Reference","href":"/sdk-reference/introduction"}]},{"tab":"CLI Reference","pages":[{"title":"CLI Reference","href":"/cli-reference/introduction"}]},{"tab":"Deployment Reference","pages":[{"title":"Deployment Reference","href":"/deployment-reference"}]}]},"basePath":"","title":"Create or update directory tree - Documentation","buildId":"dpl_41S5Z2jG9QnfDRwN1KZrLdBwj7DM","deploymentId":"dpl_41S5Z2jG9QnfDRwN1KZrLdBwj7DM","dynamics":["10e4515597","c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["BannerMarkdown-CRkbAgbc.js","dist-CI2D8R2Y.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-C8f2yC9R.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","OpenApiReferenceProvider-DDP9JXtj.js","utils-8yQyvEtx.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-CBCFR8Sn.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-rQaXkUHa.js","snippetPresets-J5KpBTgV.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-BVxVH4Cj.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BxdQ2vIi.js","shallow-BjV2tFiD.js","getApiPlaygroundDisplay-C_55tL4O.js","CodeSnippet-C0JpiCOC.js","CodeSnippets-w9Ps7djG.js","Page-DTNSD-0M.js","getPastedJson-BDfB-H8d.js","icon-g-kUkkO9.js","MethodPill-v4l6fq0h.js","DuplicateIcon-CvLo-CfU.js","createIcon-165clrrV.js","DynamicMarkdown-D3RQ-fEj.js","SectionHeading-vvo-3yLf.js","axios-vUo_bRtp.js","Markdown-CMT1uFWQ.js","AssistantPageLink-k78Wrw_e.js"]}