/Docs
Search docs or ask a question⌘K
DocsAgent
Changelog
API Reference Move Custom Code Into Your Docs

Move Custom Code Into Your Docs

Move pasted CSS and snippets into _syntext/ files in your docs.

POST/v1/projects/{projectId}/custom-scripts/move-to-docsTry it
Session token

Moves the pasted code under Integrations › Custom code › Override (advanced) into the _syntext/ folder in your docs — the same as Move into your docs in the dashboard:

Pasted codeGoes to
Custom CSS_syntext/style.css
Enabled head snippets that head.html allows_syntext/head.html
Enabled body snippets that are a plain inline <script>_syntext/script.js

Everything else — disabled snippets, and snippets that can't move as they are — stays pasted and is named in kept.

•
Written in Syntext — the files are created and the moved pasted code is cleared, in one step.
•
GitHub — a pull request is opened with the files. The pasted code is left as it is, so the site looks the same; remove it after you merge.
•
Published with stx deploy — refused: Syntext doesn't store your files. Add the code to _syntext/ yourself and run stx deploy.
Note

Requires a session JWT, and the admin or owner role in the organization that owns {projectId}. API keys are rejected with 401. No request body.

Path Parameters

NameDescription
projectId:stringpathRequired
The project ID, a UUID.

Response

NameDescription
data.mode:string
hosted (files created in a project written in Syntext) or pull_request (GitHub).
data.files:string[]
The files written, such as _syntext/style.css.
data.cleared:boolean
true when the moved pasted code was cleared (hosted); false on GitHub, where it stays until you remove it.
data.kept:string[]
The pasted code that stayed where it is, by name.
data.switchesNeeded:string[]
The switches that are still off and must be turned on for the moved code to apply: css, head, scripts. Empty when they already are. Turn them on with Update Custom Code Switches.
data.url:string
pull_request only: the pull request's address. data.number is its number.

Errors

StatusCodeWhen
400nothing_to_moveThere's no pasted code, or none of it can move as it is (details.kept names it)
400unsupported_sourceThe project is published with stx deploy
400invalid_custom_codeA file it would write breaks a rule. The message names the file and the first problem; details.errors lists them all
401unauthorizedNo session token, an invalid or expired one, or an API key
403forbiddenYou're not an admin or owner
404not_foundThe project doesn't exist
409file_existsA file it would write already exists in _syntext/. Rename or remove it first
Was this page helpful? Yes No
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X POST https://api.syntext.dev/v1/projects/$PROJECT_ID/custom-scripts/move-to-docs \
-H "Authorization: Bearer $SYNTEXT_JWT"
Responseapplication/json
200OK (GitHub
{
"data": {
"mode": "pull_request",
"url": "https://github.com/acme/docs/pull/57",
"number": 57,
"files": ["_syntext/style.css", "_syntext/head.html"],
"cleared": false,
"kept": ["Intercom"],
"switchesNeeded": ["head"]
}
}
Product
Resources
Company
© 2026 SyntextBuilt with Syntext