API Reference Get Custom Code
Get Custom Code
Read a project's custom code: the switches for code from your docs, what the last publish applied, and the pasted snippets and CSS.
Session token
Returns everything on Integrations › Custom code: the three switches for custom code from your docs (_syntext/), what the last published site applied from it, and the pasted head snippets, body snippets and CSS under Override (advanced).
Note
Requires a session JWT and membership of the organization that owns {projectId} — any role. API keys are rejected with 401. Reading works on any plan; saving needs Starter or higher.
Path Parameters
NameDescription
projectIdThe project ID, a UUID.
Response
NameDescription
data.enabledWhether the pasted code (Override (advanced)) is on.
false until the first save.data.configThe pasted code — the same shape you send to Update Pasted Custom Code. Before anything is saved it's
{ "headSnippets": [], "bodySnippets": [] }.data.updatedAtWhen the pasted code was last saved, or
null.data.docsCodeThe switches for code from your docs.
Show 6 child attributesobject
cssCSS from your docs —
_syntext/*.css and page css: files. true by default.headHead tags from your docs —
_syntext/head.html. false by default.scriptsScripts from your docs —
_syntext/*.js. false by default.updatedAtWhen a switch was last changed, or
null.updatedByThe user who last changed a switch, or
null.privateConfirmedAtWhen an admin last confirmed turning on head tags or scripts for a private site, or
null.data.canManagetrue when you're a workspace admin or owner, so you can change the switches and use Move into your docs.data.isPrivatetrue when the site is behind a password, invites or SSO. Turning on head tags or scripts then needs confirmPrivate — see Update Custom Code Switches.data.sourceWhere the project's files live:
github, hosted (written in Syntext) or upload (published with stx deploy).data.appliedWhat the last published site applied from your docs, or
null before the first publish with custom code.Show 3 child attributesobject | null
buildIdThe build.
deployedAtWhen it went live.
filesOne entry per file:
path (_syntext/theme.css, or a page stylesheet such as guides/pricing.css), kind (css, js, head or page-css), bytes, sha256 (a short fingerprint of the content, 12 characters), status (applied, off — its switch is off — or preview — not run on a preview) and domains (for scripts and head.html, the outside domains it loads from).Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No session token, an invalid or expired one, or an API key |
| 403 | forbidden | You're not a member of the project's organization |
| 404 | not_found | The project doesn't exist |
Was this page helpful? Yes No
Previous
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl https://api.syntext.dev/v1/projects/$PROJECT_ID/custom-scripts \
-H "Authorization: Bearer $SYNTEXT_JWT"
// A browser has no environment variables: set these to your values.
const PROJECT_ID = '<PROJECT_ID>';
const SYNTEXT_JWT = '<SYNTEXT_JWT>';
const response = await fetch(`https://api.syntext.dev/v1/projects/${PROJECT_ID}/custom-scripts`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${SYNTEXT_JWT}`,
},
});
const data = await response.json();
console.log(response.status, data);
import os
import requests
url = f"https://api.syntext.dev/v1/projects/{os.environ['PROJECT_ID']}/custom-scripts"
headers = {
"Authorization": f"Bearer {os.environ['SYNTEXT_JWT']}",
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://api.syntext.dev/v1/projects/"+os.Getenv("PROJECT_ID")+"/custom-scripts", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SYNTEXT_JWT"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "net/http"
require "uri"
uri = URI("https://api.syntext.dev/v1/projects/#{ENV.fetch("PROJECT_ID")}/custom-scripts")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("SYNTEXT_JWT")}"
response = http.request(request)
puts response.code
puts response.body
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/projects/' . getenv('PROJECT_ID') . '/custom-scripts',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SYNTEXT_JWT'),
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/projects/" + System.getenv("PROJECT_ID") + "/custom-scripts"))
.header("Authorization", "Bearer " + System.getenv("SYNTEXT_JWT"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.syntext.dev/v1/projects/" + Environment.GetEnvironmentVariable("PROJECT_ID") + "/custom-scripts");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer " + Environment.GetEnvironmentVariable("SYNTEXT_JWT"));
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200OK
{
"data": {
"enabled": true,
"config": {
"headSnippets": [
{ "id": "plausible", "name": "Plausible", "code": "<script defer data-domain=\"docs.acme.com\" src=\"https://plausible.io/js/script.js\"></script>", "enabled": true }
],
"bodySnippets": [],
"customCss": ".hero h1 { letter-spacing: -0.02em; }"
},
"updatedAt": "2026-11-10T14:03:22.000Z",
"docsCode": {
"css": true,
"head": true,
"scripts": false,
"updatedAt": "2026-11-14T09:12:40.000Z",
"updatedBy": "8f6a2c1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b",
"privateConfirmedAt": null
},
"canManage": true,
"isPrivate": false,
"source": "github",
"applied": {
"buildId": "b2f1c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"deployedAt": "2026-11-14T09:20:03.000Z",
"files": [
{ "path": "_syntext/theme.css", "kind": "css", "bytes": 2048, "sha256": "3f9a1c0b7e2d", "status": "applied", "domains": [] },
{ "path": "_syntext/head.html", "kind": "head", "bytes": 412, "sha256": "a81d44e09c5f", "status": "applied", "domains": ["plausible.io"] },
{ "path": "_syntext/app.js", "kind": "js", "bytes": 1530, "sha256": "0c7be2915a3d", "status": "off", "domains": [] }
]
}
}
}