Set site access level
const url = 'https://api.deploybase.eu/api/v1/api/v1/projects/example/access/preview';const options = { method: 'PUT', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"level":"public"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.deploybase.eu/api/v1/api/v1/projects/example/access/preview \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "level": "public" }'Sets who may view the surface: public, team or team_guests. Only the preview surface can be changed. Leaving team_guests removes the guest password and signs every guest out. Every change republishes the project’s preview routes and purges their cached copies; the response’s preview.status is protected once that purge was confirmed. Setting the current level again changes nothing, except that re-sending the current level while status is protecting retries the purge.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Project ID
Surface
Request Body
Section titled “ Request Body ”New level
object
Level is who may view the surface: public (anyone), team (signed-in team members) or team_guests (team members plus anyone holding the guest password).
Example
teamResponses
Section titled “ Responses ”OK
object
object
object
object
GateEpoch increments whenever every visitor session is invalidated.
HasPassword is true when guests can unlock the surface with a password.
Level is public, team or team_guests.
PasswordSetAt is when the current guest password was set; null without one.
Status is public, protecting (gate set, cache purge not yet confirmed) or protected.
object
WritesEnabled mirrors PREVIEW_ACCESS_ENABLED: false means the write routes answer 404.
Example
{ "data": { "preview": { "gate_epoch": 3, "level": "team_guests", "status": "protected" }, "production": { "level": "public", "status": "public" } }}Bad Request
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unauthorized
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Forbidden
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Not Found
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unprocessable Entity
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Internal Server Error
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Live a8b7eb1d built