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

Check Custom Code

Check one custom code file or page stylesheet against the rules a publish uses.

POST/v1/projects/{projectId}/custom-scripts/checkTry it
Session token

Checks the content of one file against the rules a publish uses for custom code from your docs, without saving anything. The web editor uses it for its live checks, so you get the same messages a publish would.

Note

Requires a session JWT and membership of the organization that owns {projectId} — any role. API keys are rejected with 401.

Path Parameters

NameDescription
projectId:stringpathRequired
The project ID, a UUID.

Request Body

NameDescription
path:stringbodyRequired
The file's path from the docs folder, up to 500 characters. _syntext/*.css, _syntext/*.js and _syntext/head.html are checked with their own rules; any other .css path is checked as a page stylesheet. Other paths return no errors.
content:stringbodyRequired
The file's full text, up to 64 KB. A request body over that is refused with 413 payload_too_large; a file between the file limit and 64 KB gets the size message only.

Response

NameDescription
data.errors:string[]
Every rule the file breaks, in the words a publish uses — see What's refused. Empty when the file is fine. Limits across several files (all _syntext/*.css together, the number of scripts) are checked at publish time.
data.domains:string[]
For a script or head.html, the outside domains it loads from.

Errors

StatusCodeWhen
400validation_errorpath or content is missing or too long
413payload_too_largeThe request body is over 64 KB
401unauthorizedNo session token, an invalid or expired one, or an API key
403forbiddenYou're not a member of the project's organization
404not_foundThe project doesn't exist
Was this page helpful? Yes No
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X POST https://api.syntext.dev/v1/projects/$PROJECT_ID/custom-scripts/check \
-H "Authorization: Bearer $SYNTEXT_JWT" \
-H "Content-Type: application/json" \
-d '{ "path": "_syntext/head.html", "content": "<base href=\"/\"><script defer src=\"https://plausible.io/js/script.js\"></script>" }'
Responseapplication/json
200OK
{
"data": {
"errors": [
"<base> is not allowed (head.html may contain only <meta>, <link>, <script>, <noscript> and <style>)"
],
"domains": ["plausible.io"]
}
}
Product
Resources
Company
© 2026 SyntextBuilt with Syntext