curl --request POST \
--url https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"token": "<string>",
"preview_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"expires_in_seconds": 123
},
"meta": {
"page": 123,
"page_size": 123,
"total": 123,
"total_pages": 123
},
"error": "<string>",
"error_code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Preview Token
Mint a signed, short-lived LIVE-PREVIEW capability for a page’s draft (F2).
The tenant comes from request.state.tenant_id (the staff JWT’s signed
tenant_id claim — NEVER client input), so a staff member can only ever
mint a token for their OWN tenant even behind the shared admin host.
_load_page runs under RLS, so an id belonging to another tenant is 404,
not a mintable token. The token binds tenant_id + page_id + slug; the
storefront draft-preview endpoint re-checks all three. Publishes nothing,
mutates nothing.
curl --request POST \
--url https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vellaro.io/api/v1/admin/cms/pages/{page_id}/preview-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"token": "<string>",
"preview_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"expires_in_seconds": 123
},
"meta": {
"page": 123,
"page_size": 123,
"total": 123,
"total_pages": 123
},
"error": "<string>",
"error_code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Autorizzazioni
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Parametri del percorso
Parametri della query
Risposta
Successful Response
The signed live-preview capability (F2) handed to the admin composer.
preview_url is the fully-qualified storefront route (built server-side
from the tenant's own domain, so the admin needs no storefront-origin env)
that renders the draft when loaded in the iframe. token is exposed
separately so the composer can re-mint / cache-bust without a full URL parse.
Show child attributes
Show child attributes
Show child attributes
Show child attributes