{
"error": "You do not have access to this resource."
}
{
"error": "You do not have access to this resource."
}
{
"error": "You do not have access to this resource."
}
{
"error": "You do not have access to this resource."
}
{
"error": "You do not have access to this resource."
}
Artifacts
Write artifact files
Creates or overwrites one or more files in an artifact. Files that
already exist are replaced; new files are appended. Files not
mentioned in the request are left untouched.
This only updates source files — it does not compile or publish.
Call POST /v3/designs/{editorId}/artifacts/{artifactId}/publish when
you’re done with all file changes to compile and set the artifact
active.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Magic Patterns","description":"Magic Patterns is an AI design tool for product teams. Create prototypes with your real design system, hand off to engineering, and speed up your software development lifecycle.","colors":{"primary":"#9784BF","light":"#FFFFFF","dark":"#001617"},"logo":{"light":"https://mintcdn.com/magicpatterns/owWJh7xQtXBlIJ16/logo/magicpatterns_logo_light.svg?fit=max\u0026auto=format\u0026n=owWJh7xQtXBlIJ16\u0026q=85\u0026s=2a7a773a8194091ebfe3e1c0104f2c92","dark":"https://mintcdn.com/magicpatterns/owWJh7xQtXBlIJ16/logo/magicpatterns_logo_dark.svg?fit=max\u0026auto=format\u0026n=owWJh7xQtXBlIJ16\u0026q=85\u0026s=20e5d64413256401004cd68c98e798d0"},"favicon":"https://mintcdn.com/magicpatterns/owWJh7xQtXBlIJ16/icon.svg?fit=max\u0026auto=format\u0026n=owWJh7xQtXBlIJ16\u0026q=85\u0026s=7854f15b01790c1d076cf1f1e10c61b0","api":{"openapi":["openapi-v3.yml","openapi.yml"]},"navbar":{"links":[{"href":"https://www.magicpatterns.com/customers","label":"Case Studies"}],"primary":{"type":"button","label":"Start designing","href":"https://www.magicpatterns.com"}},"footer":{"socials":{"twitter":"https://x.com/magicpatterns","github":"https://github.com/magicpatterns","linkedin":"https://www.linkedin.com/company/magicpatterns"}},"integrations":{"intercom":{"appId":"ftkg08cn"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"magicpatterns","hasAudioNarration":false,"actualSubdomain":"magicpatterns","customDomains":["www.magicpatterns.com"],"gitSource":{"type":"github","owner":"magicpatterns","repo":"patterns","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aecbba141290b71c3828cbd","collectionId":"2e385020-b02a-471f-85a4-79efe7f6e8f4","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aecbba141290b71c3828cbd"},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6aece1b3a84f97fba518a7c7","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Publish and Integrate","count":37},{"language":"default","tag":"Designs","count":18},{"language":"default","tag":"Introduction","count":15},{"language":"default","tag":"API","count":14},{"language":"default","tag":"Design Systems","count":14},{"language":"default","tag":"Integrations","count":11},{"language":"default","tag":"Teams and Enterprise","count":9},{"language":"default","tag":"Workflows and Video Guide","count":8},{"language":"default","tag":"Prompting and iterating","count":6},{"language":"default","tag":"Importing your Design System","count":6}]},"assistantConfig":{"deflection":{"enabled":true,"email":"support@magicpatterns.com","showHelpButton":true}},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".nav-tabs-item[href^=\"/documentation/magic-os/\"]::after{content:\"NEW\";margin-left:0.375rem;padding:0.0625rem 0.375rem;border-radius:9999px;font-size:0.625rem;font-weight:600;line-height:1rem;color:rgb(var(--primary));background-color:rgb(var(--primary) / 0.1)}"}],"page":{"pagePath":"api/write-artifact-files","slug":"/api/write-artifact-files","pageMetadata":{"openapi":"openapi-v3.yml patch /v3/designs/{editorId}/artifacts/{artifactId}/files","title":"Write artifact files","description":"Creates or overwrites one or more files in an artifact. Files that\nalready exist are replaced; new files are appended. Files not\nmentioned in the request are left untouched.\n\nThis only updates source files — it does **not** compile or publish.\nCall `POST /v3/designs/{editorId}/artifacts/{artifactId}/publish` when\nyou're done with all file changes to compile and set the artifact\nactive.\n","href":"/api/write-artifact-files"},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n strong: \"strong\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Creates or overwrites one or more files in an artifact. Files that\\nalready exist are replaced; new files are appended. Files not\\nmentioned in the request are left untouched.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"This only updates source files — it does \", _jsx(_components.strong, {\n children: \"not\"\n }), \" compile or publish.\\nCall \", _jsx(_components.code, {\n children: \"POST /v3/designs/{editorId}/artifacts/{artifactId}/publish\"\n }), \" when\\nyou’re done with all file changes to compile and set the artifact\\nactive.\"]\n })]\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":{"openapi":"openapi-v3.yml patch /v3/designs/{editorId}/artifacts/{artifactId}/files","title":"Write artifact files","description":"Creates or overwrites one or more files in an artifact. Files that\nalready exist are replaced; new files are appended. Files not\nmentioned in the request are left untouched.\n\nThis only updates source files — it does **not** compile or publish.\nCall `POST /v3/designs/{editorId}/artifacts/{artifactId}/publish` when\nyou're done with all file changes to compile and set the artifact\nactive.\n","href":"/api/write-artifact-files"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"summary":"Write artifact files","description":"Creates or overwrites one or more files in an artifact. Files that\nalready exist are replaced; new files are appended. Files not\nmentioned in the request are left untouched.\n\nThis only updates source files — it does **not** compile or publish.\nCall `POST /v3/designs/{editorId}/artifacts/{artifactId}/publish` when\nyou're done with all file changes to compile and set the artifact\nactive.\n","operationId":"writeArtifactFilesV3","tags":["Artifacts"],"parameters":["88f69b98-3113-4590-ae26-4f8c4181d432","406181a1-fd30-4e24-a83b-b42ef8837051"],"requestBody":"e50fc42f-dbf3-4ab1-98d2-abf7673cd72e","responses":{"200":"3d19eef0-d1ef-40a4-93db-ceac6114ba99","400":"22196d89-3280-42eb-98a0-f8deec456245","401":"82c58b9e-f93b-4767-a80e-fba7cfd6bea6","403":"92eb023a-1155-4a8a-b6c3-5dba131d20e6","404":"f57591be-a0d2-4da5-a481-f37e23b874aa","500":"2bfa429b-9ac9-4ab4-a430-fc491cd4d6f5"},"method":"patch","type":"path","servers":["16a655ae-93ce-4eda-95a5-8198d7b1febb"],"security":["9cc8e0f0-34b7-4808-bee7-0bea238e1ec7"],"path":"/v3/designs/{editorId}/artifacts/{artifactId}/files","baseUrlOptions":["https://api.magicpatterns.com/api"],"title":"Write artifact files","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"88f69b98-3113-4590-ae26-4f8c4181d432":{"name":"editorId","in":"path","required":true,"description":"The design's editor ID.","schema":{"type":"string","example":"abc123","isRequired":true,"description":"The design's editor ID.","uniqueKey":"","typeLabel":"string"}},"406181a1-fd30-4e24-a83b-b42ef8837051":{"name":"artifactId","in":"path","required":true,"description":"The artifact ID.","schema":{"type":"string","isRequired":true,"description":"The artifact ID.","uniqueKey":"","typeLabel":"string"}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["files"],"properties":{"files":{"type":"array","minItems":1,"items":{"type":"object","required":["fileName","code"],"properties":{"fileName":{"type":"string","example":"App.tsx","isRequired":true,"uniqueKey":"files.items.[INDEX].fileName","typeLabel":"string"},"code":{"type":"string","description":"Full file contents (replaces any existing content for that file).","isRequired":true,"uniqueKey":"files.items.[INDEX].code","typeLabel":"string"}},"uniqueKey":"files.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"files","typeLabel":"object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"files":[{"fileName":"App.tsx","code":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"3d19eef0-d1ef-40a4-93db-ceac6114ba99":{"description":"Updated. Response lists all file names in the artifact after the write.","content":{"application/json":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"type":"string","uniqueKey":"files.items.[INDEX]","typeLabel":"string"},"example":["App.tsx","index.tsx","index.css"],"uniqueKey":"files","typeLabel":"string[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"files":["App.tsx","index.tsx","index.css"]}}},"exampleType":"generated"}},"exampleType":"generated"},"22196d89-3280-42eb-98a0-f8deec456245":{"description":"Invalid or missing required input.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Human-readable error message.","example":"You do not have access to this resource.","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"You do not have access to this resource."}}},"exampleType":"generated"}},"exampleType":"generated"},"82c58b9e-f93b-4767-a80e-fba7cfd6bea6":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Human-readable error message.","example":"You do not have access to this resource.","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"You do not have access to this resource."}}},"exampleType":"generated"}},"exampleType":"generated"},"92eb023a-1155-4a8a-b6c3-5dba131d20e6":{"description":"The caller does not have access to this resource.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Human-readable error message.","example":"You do not have access to this resource.","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"You do not have access to this resource."}}},"exampleType":"generated"}},"exampleType":"generated"},"f57591be-a0d2-4da5-a481-f37e23b874aa":{"description":"The requested design or artifact does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Human-readable error message.","example":"You do not have access to this resource.","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"You do not have access to this resource."}}},"exampleType":"generated"}},"exampleType":"generated"},"2bfa429b-9ac9-4ab4-a430-fc491cd4d6f5":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Human-readable error message.","example":"You do not have access to this resource.","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"You do not have access to this resource."}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"9cc8e0f0-34b7-4808-bee7-0bea238e1ec7":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-mp-api-key","description":"Magic Patterns API key. The same key authenticates v3 REST and the\nMCP server. Create one at https://www.magicpatterns.com/settings/api-keys.\n","scopes":[],"schemeName":"ApiKeyAuth"}}},"servers":{"16a655ae-93ce-4eda-95a5-8198d7b1febb":{"url":"https://api.magicpatterns.com/api"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-mp-api-key","description":"Magic Patterns API key. The same key authenticates v3 REST and the\nMCP server. Create one at https://www.magicpatterns.com/settings/api-keys.\n","scopes":[],"schemeName":"ApiKeyAuth"},"schema":{"title":"x-mp-api-key","type":"string","description":"Magic Patterns API key. The same key authenticates v3 REST and the\nMCP server. Create one at https://www.magicpatterns.com/settings/api-keys.\n","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKeyAuth","name":"x-mp-api-key"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"openapi-v3.yml"},"subdomain":"magicpatterns","siteName":"Magic Patterns","title":"Write artifact files - Magic Patterns","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-23T00:50:34.861Z","originalFileLocation":"api/write-artifact-files.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=\"Creates or overwrites one or more files in an artifact. Files that already exist are replaced; new files are appended. Files not mentioned in the request are left untouched. This only updates source files — it does not compile or publish. Call POST /v3/designs/{editorId}/artifacts/{artifactId}/publish when you\u0026#x27;re done with all file changes to compile and set the artifact active.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Magic Patterns\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_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=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Write artifact files - Magic Patterns\">\u003cmeta data-mint-head property=\"og:description\" content=\"Creates or overwrites one or more files in an artifact. Files that already exist are replaced; new files are appended. Files not mentioned in the request are left untouched. This only updates source files — it does not compile or publish. Call POST /v3/designs/{editorId}/artifacts/{artifactId}/publish when you\u0026#x27;re done with all file changes to compile and set the artifact active.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Magic Patterns\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.magicpatterns.com/docs/api/write-artifact-files\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://magicpatterns.mintlify.site/docs/_mintlify/api/og/v2?division=Artifacts\u0026amp;title=Write+artifact+files\u0026amp;description=Creates+or+overwrites+one+or+more+files+in+an+artifact.+Files+that%0Aalready+exist+are+replaced%3B+new+files+are+appended.+Files+not%0Amentioned+in+the+request+are+le\u0026amp;theme=58b3985732190453b80d7ef2\u0026amp;signature=90eada388bb8d4e21e5c22e76f1f3aeaf990ff4d630cb91aa75ba3eaaafd86ce\">\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=\"Write artifact files - Magic Patterns\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Creates or overwrites one or more files in an artifact. Files that already exist are replaced; new files are appended. Files not mentioned in the request are left untouched. This only updates source files — it does not compile or publish. Call POST /v3/designs/{editorId}/artifacts/{artifactId}/publish when you\u0026#x27;re done with all file changes to compile and set the artifact active.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://magicpatterns.mintlify.site/docs/_mintlify/api/og/v2?division=Artifacts\u0026amp;title=Write+artifact+files\u0026amp;description=Creates+or+overwrites+one+or+more+files+in+an+artifact.+Files+that%0Aalready+exist+are+replaced%3B+new+files+are+appended.+Files+not%0Amentioned+in+the+request+are+le\u0026amp;theme=58b3985732190453b80d7ef2\u0026amp;signature=90eada388bb8d4e21e5c22e76f1f3aeaf990ff4d630cb91aa75ba3eaaafd86ce\">\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=\"/docs/mintlify-assets/_mintlify/favicons/magicpatterns/7ZqRXq6s1-Htf8k5/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Magic Patterns\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#9784BF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.magicpatterns.com/docs/api/write-artifact-files\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api/write-artifact-files.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.magicpatterns.com/#organization\",\"name\":\"Magic Patterns\",\"url\":\"https://www.magicpatterns.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/magicpatterns/owWJh7xQtXBlIJ16/logo/magicpatterns_logo_light.svg?fit=max\u0026auto=format\u0026n=owWJh7xQtXBlIJ16\u0026q=85\u0026s=2a7a773a8194091ebfe3e1c0104f2c92\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.magicpatterns.com/docs#website\",\"name\":\"Magic Patterns\",\"url\":\"https://www.magicpatterns.com/docs\",\"publisher\":{\"@id\":\"https://www.magicpatterns.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.magicpatterns.com/docs/api/write-artifact-files#webpage\",\"url\":\"https://www.magicpatterns.com/docs/api/write-artifact-files\",\"name\":\"Write artifact files\",\"description\":\"Creates or overwrites one or more files in an artifact. Files that already exist are replaced; new files are appended. Files not mentioned in the request are left untouched. This only updates source files — it does not compile or publish. Call POST /v3/designs/{editorId}/artifacts/{artifactId}/publish when you're done with all file changes to compile and set the artifact active.\",\"dateModified\":\"2026-05-23T00:50:34.861Z\",\"isPartOf\":{\"@id\":\"https://www.magicpatterns.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.magicpatterns.com/docs/api/write-artifact-files#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.magicpatterns.com/docs/api/write-artifact-files#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API\",\"item\":\"https://www.magicpatterns.com/docs/api/getting-started\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Artifacts\",\"item\":\"https://www.magicpatterns.com/docs/api/get-active-artifact\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Write artifact files\",\"item\":\"https://www.magicpatterns.com/docs/api/write-artifact-files\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://www.magicpatterns.com/docs/api/write-artifact-files#apireference\",\"headline\":\"Write artifact files\",\"name\":\"Write artifact files\",\"description\":\"Creates or overwrites one or more files in an artifact. Files that already exist are replaced; new files are appended. Files not mentioned in the request are left untouched. This only updates source files — it does not compile or publish. Call POST /v3/designs/{editorId}/artifacts/{artifactId}/publish when you're done with all file changes to compile and set the artifact active.\",\"url\":\"https://www.magicpatterns.com/docs/api/write-artifact-files\",\"mainEntityOfPage\":{\"@id\":\"https://www.magicpatterns.com/docs/api/write-artifact-files#webpage\"},\"dateModified\":\"2026-05-23T00:50:34.861Z\",\"publisher\":{\"@id\":\"https://www.magicpatterns.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.magicpatterns.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Magic Patterns\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Magic Patterns","nav":{"global":null,"tabs":[{"tab":"Introduction","pages":[{"title":"Introduction","href":"/documentation/get-started/introduction"}]},{"tab":"Designs","pages":[{"title":"Designs","href":"/documentation/editor/what-is-a-design"}]},{"tab":"MagicOS","pages":[{"title":"MagicOS","href":"/documentation/magic-os/overview"}]},{"tab":"Design Systems","pages":[{"title":"Design Systems","href":"/documentation/design-systems/overview"}]},{"tab":"Publish and Integrate","groups":[{"group":"Publishing","pages":[{"title":"Custom Publish URL","icon":"link","href":"/documentation/publishing/publish-url"},{"title":"Host on a Custom Domain","icon":"cloud","href":"/documentation/get-started/custom-domain"},{"title":"Website Metadata","icon":"hashtag","href":"/documentation/publishing/metadata"},{"title":"Password Protection","icon":"lock","href":"/documentation/publishing/password-protection"}]},{"group":"Export","pages":[{"title":"Overview of exporting","icon":"share","href":"/documentation/exporting/overview"},{"title":"Copy Code as Prompt","icon":"file-lines","href":"/documentation/get-started/copy-code-as-prompt"},{"title":"Sync with Github","icon":"github","href":"/documentation/get-started/sync-to-github"},{"title":"Bring your designs into code","icon":"code","href":"/documentation/get-started/download-code"},{"title":"Export to Figma","icon":"figma","href":"/documentation/get-started/figma-plugin"},{"title":"Integration Skill for AI Agents","icon":"wand-magic-sparkles","href":"/documentation/exporting/integration-skill"}]},{"group":"MCP server","pages":[{"title":"Overview of MCP","icon":"server","href":"/documentation/features/mcp-server/overview"},{"title":"MCP Tools \u0026 Workflows","icon":"toolbox","href":"/documentation/features/mcp-server/available_tools"}]},{"group":"Integrations","pages":[{"title":"Overview","icon":"puzzle-piece","href":"/documentation/integrations/overview"},{"title":"OpenAI","icon":"openai","href":"/documentation/integrations/openai"},{"title":"Anthropic","icon":"microchip-ai","href":"/documentation/integrations/anthropic"},{"title":"Google Sheets","icon":"google","href":"/documentation/integrations/google-sheets"},{"title":"EmailJS","icon":"envelope","href":"/documentation/integrations/emailjs"},{"title":"Collecting Feedback","icon":"comment","href":"/documentation/integrations/collecting-feedback"},{"title":"Google Analytics","icon":"chart-mixed","href":"/documentation/integrations/google-analytics"},{"title":"PostHog","icon":"chart-area","href":"/documentation/integrations/posthog"},{"title":"Meta Pixel","icon":"meta","href":"/documentation/integrations/meta-pixel"},{"title":"Shopify","icon":"shop","href":"/documentation/integrations/shopify"},{"title":"LinkedIn","icon":"linkedin","href":"/documentation/integrations/linkedin"}]},{"group":"API","pages":[{"title":"Getting Started","icon":"terminal","href":"/api/getting-started"},{"openapi":"openapi-v3.yml get /v3/health","title":"Health check","href":"/api/health"},{"openapi":"openapi-v3.yml get /v3/design-systems","title":"List design systems","href":"/api/list-design-systems"},{"group":"Designs","pages":[{"openapi":"openapi-v3.yml post /v3/designs","title":"Create a design","href":"/api/create-design"},{"openapi":"openapi-v3.yml post /v3/designs/resolve-url","title":"Resolve a Magic Patterns URL to an editor ID","href":"/api/resolve-design-url"},{"openapi":"openapi-v3.yml get /v3/designs/{editorId}/status","title":"Get design status","href":"/api/get-design-status"},{"openapi":"openapi-v3.yml post /v3/designs/{editorId}/prompts","title":"Send a prompt","href":"/api/send-prompt"},{"openapi":"openapi-v3.yml get /v3/designs/{editorId}/messages","title":"Read recent message history","href":"/api/get-design-messages"},{"openapi":"openapi-v3.yml get /v3/designs/{editorId}/versions","title":"List version history","href":"/api/get-design-versions"}]},{"group":"Artifacts","pages":[{"openapi":"openapi-v3.yml get /v3/designs/{editorId}/active-artifact","title":"Get the active artifact","href":"/api/get-active-artifact"},{"openapi":"openapi-v3.yml post /v3/designs/{editorId}/artifacts","title":"Create a new artifact","href":"/api/create-artifact"},{"openapi":"openapi-v3.yml post /v3/designs/{editorId}/artifacts/{artifactId}/files/read","title":"Read artifact files","description":"Returns the contents of one or more files in an artifact. Files that\ndon't exist in the artifact are simply omitted from the response.\n\nThis endpoint uses POST (with a request body) rather than GET (with a\nquery string) so file names containing `/`, commas, or other special\ncharacters don't need URL encoding.\n","href":"/api/read-artifact-files"},{"openapi":"openapi-v3.yml patch /v3/designs/{editorId}/artifacts/{artifactId}/files","title":"Write artifact files","href":"/api/write-artifact-files"},{"openapi":"openapi-v3.yml post /v3/designs/{editorId}/artifacts/{artifactId}/publish","title":"Publish an artifact","description":"Compiles the artifact's source files and sets it as the active\nartifact for the design. This is the final step in a code-first\nworkflow: after writing files, call this to make the changes visible\nin the editor and live preview.\n\nReturns `422 Unprocessable Entity` if compilation fails.\n","href":"/api/publish-artifact"}]}]}]},{"tab":"Teams and Enterprise","pages":[{"title":"Teams and Enterprise","href":"/documentation/collaboration/team-workspaces"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/documentation/feature-releases/changelog"}]}]},"basePath":"","title":"Write artifact files - Magic Patterns","buildId":"dpl_ATnXPMW25DMPUr9VBw6kL6MfBt6T","deploymentId":"dpl_ATnXPMW25DMPUr9VBw6kL6MfBt6T","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CNqlzjVB.js","utils-BqFiXZ79.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-CnR4QBe6.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-BY2ZM1OO.js","snippetPresets-x-8ACO8V.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Ch-SJE05.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-CqqG_0NE.js","shallow-BXrZ2b0C.js","getApiPlaygroundDisplay-n7J_wkjq.js","CodeSnippet-CQsp4vyQ.js","CodeSnippets-BfuHqvZx.js","Page-CTxrMSpo.js","getPastedJson-BjrGIK1i.js","icon-7iLZnVOC.js","MethodPill-TBS1m84e.js","DuplicateIcon-BNMrV4Vs.js","createIcon-C5kCqeU2.js","DynamicMarkdown-Bq09mRwR.js","SectionHeading-G4Bflf5Q.js","axios-vUo_bRtp.js","Markdown-BTUds0aX.js","clsx-6wHzaN2_.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-BPypQKlo.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-o6bee4ro.js"]}