API Reference Preview Appearance
Preview Appearance
Build the site with unsaved appearance settings and deploy it to your own preview URL
Session token
Starts a real build of the site with unsaved theme, appearance,
themeOverrides, name, logo and favicon laid over its config, and deploys it to a preview URL. The
production site and the config file are not touched.
Needs a session token and the project admin role.
Request Body
The same as Validate Appearance:
theme, appearance, themeOverrides, name, logo and favicon. At least
one is required.
Behaviour
•
A project with a repository builds from its branch; a project without one
builds from its last published source.
•
Each user has one preview URL per project:
https://appearance-preview-<first 8 characters of your user ID>--<project subdomain>.syntext.dev.
A new preview replaces your last one.•
The build counts against the plan's monthly build quota, like any other.
Response
Returns 201 with:
NameDescription
buildIdThe preview build. Follow it with the Builds API.
urlYour preview URL. It serves the new build once the build finishes.
Error Responses
| Status | Code | When |
|---|---|---|
| 400 | no_changes | None of theme, appearance, themeOverrides, name, logo, favicon was sent |
| 400 | invalid_appearance | The settings have a validation error |
| 402 | USAGE_LIMIT_EXCEEDED | The organization has used its monthly builds |
| 403 | admin_required | You're a member, not an admin |
| 404 | not_found | The project doesn't exist, or you're not in its organization |
| 409 | no_source | A project without a repository that hasn't been published yet — publish it once, then preview |
Was this page helpful? Yes No
Previous
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X POST https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview \
-H "Authorization: Bearer <session token>" \
-H "Content-Type: application/json" \
-d '{ "theme": "console", "appearance": { "accent": "#3DDC97" } }'
const response = await fetch('https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview', {
method: 'POST',
headers: {
'Authorization': 'Bearer <session token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"theme": "console",
"appearance": {
"accent": "#3DDC97"
}
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview"
headers = {
"Authorization": "Bearer <session token>",
}
payload = {
"theme": "console",
"appearance": {
"accent": "#3DDC97",
},
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"theme": "console",
"appearance": {
"accent": "#3DDC97"
}
}`)
req, err := http.NewRequest("POST", "https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <session token>")
req.Header.Set("Content-Type", "application/json")
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 "json"
require "net/http"
require "uri"
uri = URI("https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <session token>"
request["Content-Type"] = "application/json"
request.body = JSON.generate({
"theme" => "console",
"appearance" => {
"accent" => "#3DDC97",
},
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'theme' => 'console',
'appearance' => [
'accent' => '#3DDC97',
],
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <session token>',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$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 {
String payload = """
{
"theme": "console",
"appearance": {
"accent": "#3DDC97"
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview"))
.header("Authorization", "Bearer <session token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.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.Post, "https://api.syntext.dev/v1/projects/b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e/appearance/preview");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <session token>");
request.Content = new StringContent(
"""
{
"theme": "console",
"appearance": {
"accent": "#3DDC97"
}
}
""",
Encoding.UTF8,
"application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
json
{
"data": {
"buildId": "bld_9f2c1e",
"url": "https://appearance-preview-usr12345--acme-docs.syntext.dev"
}
}