Get short-lived access to a preview
POST
/api/v1/projects/{id}/previews/{previewId}/access
const url = 'https://api.deploybase.eu/api/v1/api/v1/projects/example/previews/example/access';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"ttl_seconds":900}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.deploybase.eu/api/v1/api/v1/projects/example/previews/example/access \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "ttl_seconds": 900 }'Returns what an agent, a CI job or a headless browser needs to open one branch preview for a while. On a protected preview, send header.name: header.value on every request, or open url once in a fresh browser to get a session (the link itself works for 60 seconds). Both stop working at expires_at. On a public preview protected is false, header.value is empty and url is the plain preview address. ttl_seconds is 60 to 3600, default 900. The response is a credential: never log it.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” id
required
string
Project ID (UUID)
previewId
required
string
Preview ID (UUID)
Request Body
Section titled “ Request Body ”Access lifetime
Media type application/json
object
ttl_seconds
TTLSeconds is how long the access lasts, 60 to 3600. Default 900.
integer
Example
900Responses
Section titled “ Responses ”OK
Media type application/json
object
data
meta
object
request_id
string
timestamp
string
trace_id
string
data
object
expires_at
string
header
object
name
string
value
string
host
string
protected
boolean
url
string
Example
{ "data": { "expires_at": "2026-10-23T12:15:00Z", "header": { "name": "x-deploybase-access", "value": "eyJhbGciOiJFZERTQSIsImtpZCI6ImsxIiwidHlwIjoiZGItZ2F0ZS1jb2RlIn0.example.signature" }, "host": "feature-login-acme-site.previews.deploybase.eu", "protected": true, "url": "https://feature-login-acme-site.previews.deploybase.eu/.deploybase/gate/callback?code=eyJhbGciOiJFZERTQSJ9.example.signature" }}Bad Request
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unauthorized
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Forbidden
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Not Found
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unprocessable Entity
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Internal Server Error
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Service Unavailable
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Live b001be8d built