---
title: "Set who may open the sandbox's preview URLs and from which networks."
method: PUT
path: "/v1/sandboxes/{id}/preview-access"
tags: ["Sandboxes"]
---

# Set who may open the sandbox's preview URLs and from which networks.

`PUT /v1/sandboxes/{id}/preview-access`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/sandboxes/{id}/preview-access`
- Auth: HTTP bearer

The proxy applies the change within 30 seconds (its sandbox lookup
cache). A visitor refused by the allow-list gets a 403 naming their
address and this endpoint.

## Path parameters

- `id` string, required

## Request body

- UpdatePreviewAccessBody: Request body for `PUT /v1/sandboxes/{id}/preview-access`. Both members are required: the call replaces the whole setting, so an omitted allow-list can never be read as "clear it".
  - `access` 'temps_login' | 'password' | 'public', required: `temps_login` | `password` | `public`. `password` is refused while the sandbox has no preview password (set one with `PUT /v1/sandboxes/{id}/preview-password`, which also selects it).
  - `allowed_cidrs` string[], required: IPv4/IPv6 addresses or CIDRs allowed to open the preview URLs, at most 50. A single address is stored as a `/32` or `/128`; a CIDR as its network address. Empty = any client address.

## Response `200`

Preview access updated

- PreviewAccessResponse: A sandbox's preview access settings.
  - `id` string, required: Sandbox public id (`sbx_...`).
  - `preview_access` 'temps_login' | 'password' | 'public', required: Who may open a sandbox's preview URLs (ADR-055 §11: sandboxes default to `TempsLogin`, never anonymous by default). Stored on the sandbox row (`sandboxes.preview_access`). The sandbox's IP allow-list (`sandboxes.preview_allowed_cidrs`) is checked before any of these, so `Public` plus an allow-list means "anyone from these networks".
  - `preview_allowed_cidrs` string[], required: Normalised CIDRs. Empty = any client address.
  - `preview_password_hint` string, nullable: Last 4 characters of the preview password, when one is set.

## Other responses

- `400`: Invalid CIDR, more than 50 networks, or `password` without a preview password
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Sandbox not found
- `500`: Internal server error

## Changes

- **2026-10-28** `b8d51a990805`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/v1/sandboxes/:id/preview-access/put.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
