/Docs
Search docs or ask a question⌘K
DocsAgent
Changelog
API Reference Update Custom Code Switches

Update Custom Code Switches

Turn CSS, head tags and scripts from your docs (_syntext/) on or off.

PUT/v1/projects/{projectId}/custom-scripts/docs-codeTry it
Session token

Changes the three switches at the top of Integrations › Custom code, which decide what your live site applies from the _syntext/ folder in your docs. Every change is recorded in the audit log.

Nothing is rebuilt: a change applies on your next publish. Previews never run head tags or scripts, whatever the switches say.

Note

Requires a session JWT, and the admin or owner role in the organization that owns {projectId}. API keys are rejected with 401. The AI connector can't call this.

Path Parameters

NameDescription
projectId:stringpathRequired
The project ID, a UUID.

Request Body

Send only the switches you want to change; the others stay as they are.

NameDescription
css:booleanbody
CSS from your docs — _syntext/*.css and every page's css: file. On by default.
head:booleanbody
Head tags from your docs — _syntext/head.html. Off by default.
scripts:booleanbody
Scripts from your docs — _syntext/*.js. Off by default.
confirmPrivate:booleanbody
Required as true to turn head or scripts on for a private site (behind a password, invites or SSO): scripts there can read everything a signed-in reader sees. Without it the request returns 409 confirmation_required.

Response

NameDescription
data.docsCode:object
The switches after the change — the same object as docsCode in Get Custom Code.

Response — 409 on a private site

Send the same request with "confirmPrivate": true to go ahead.

Errors

StatusCodeWhen
400validation_errorA value that isn't a boolean, or a key other than css, head, scripts and confirmPrivate
401unauthorizedNo session token, an invalid or expired one, or an API key
403forbiddenYou're not an admin or owner: "Only workspace admins can change custom code switches."
404not_foundThe project doesn't exist
409confirmation_requiredTurning on head or scripts for a private site without confirmPrivate: true. details.switches names them
Was this page helpful? Yes No
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X PUT https://api.syntext.dev/v1/projects/$PROJECT_ID/custom-scripts/docs-code \
-H "Authorization: Bearer $SYNTEXT_JWT" \
-H "Content-Type: application/json" \
-d '{ "head": true, "scripts": true }'
Responseapplication/json
200OK
{
"data": {
"docsCode": {
"css": true,
"head": true,
"scripts": true,
"updatedAt": "2026-11-15T10:04:11.000Z",
"updatedBy": "8f6a2c1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b",
"privateConfirmedAt": null
}
}
}
Responseapplication/json
409on a private site
{
"error": {
"code": "confirmation_required",
"message": "This site is private. Turning on head tags and scripts lets those scripts read everything a signed-in reader sees on the site. Confirm to turn them on.",
"details": { "switches": ["head", "scripts"] }
}
}
Product
Resources
Company
© 2026 SyntextBuilt with Syntext