Skip to content

Set site access level

PUT
/api/v1/projects/{id}/access/{surface}
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.

id
required
string

Project ID

surface
required
string
Allowed values: preview production

Surface

New level

Media type application/json
object
level
required

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).

string
Allowed values: public team team_guests

Example

team

OK

Media type application/json
object
data
meta
object
request_id
string
timestamp
string
trace_id
string
data
object
preview
object
gate_epoch

GateEpoch increments whenever every visitor session is invalidated.

integer
has_password

HasPassword is true when guests can unlock the surface with a password.

boolean
level

Level is public, team or team_guests.

string
password_set_at

PasswordSetAt is when the current guest password was set; null without one.

string
status

Status is public, protecting (gate set, cache purge not yet confirmed) or protected.

string
production
object
level
string
status
string
writes_enabled

WritesEnabled mirrors PREVIEW_ACCESS_ENABLED: false means the write routes answer 404.

boolean

Example

{
"data": {
"preview": {
"gate_epoch": 3,
"level": "team_guests",
"status": "protected"
},
"production": {
"level": "public",
"status": "public"
}
}
}

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"
}
}

Live a8b7eb1d built