Deploy a preview
Publishes a branch to its own preview URL. The live site is untouched.
Requires editor or admin role. Returns 403 if your plan does not include preview deployments.
curl -X POST "https://api.documentationai.app/api/v1/deploy/preview" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"branch": "feature/new-docs",
"commitSha": "example_string"
}'
import requests
import json
url = "https://api.documentationai.app/api/v1/deploy/preview"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"branch": "feature/new-docs",
"commitSha": "example_string"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.documentationai.app/api/v1/deploy/preview", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"branch": "feature/new-docs",
"commitSha": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"branch": "feature/new-docs",
"commitSha": "example_string"
}`)
req, err := http.NewRequest("POST", "https://api.documentationai.app/api/v1/deploy/preview", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.documentationai.app/api/v1/deploy/preview')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"branch": "feature/new-docs",
"commitSha": "example_string"
}'
response = http.request(request)
puts response.body
{
"deploymentId": "9f1c2e64-3b47-4a8d-91f5-7c2e0a6d5b31",
"status": "pending",
"url": "https://docs.acme.com",
"branch": "example_string"
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Unprocessable Entity",
"message": "The request was well-formed but contains semantic errors",
"code": 422,
"details": [
{
"field": "password",
"message": "Password must be at least 8 characters long"
}
]
}
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Please try again later",
"code": 429,
"retryAfter": 3600
}
/deploy/preview
Target server for requests. Edit to use your own host.
API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Authorization: Bearer dai_...The media type of the request body
Branch to preview
Specific commit to deploy. Defaults to the current head of the branch.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Body
Specific commit to deploy. Defaults to the current head of the branch.