Skip to main content
PRE-RELEASE: Sandbox commands are not GA yet. Their arguments, flags, and output may change.
Previews expose a port of a sandbox on an HTTPS URL. A public preview is reachable by anyone with the URL. A private preview, the default, needs a token from sandbox preview token create.

list

Lists a sandbox’s previews, up to --limit.

Options

TEXT
Filter JSON output with a jq expression; implies —output json (or jsonl for streamed commands)
INTEGER
default:"1000"
Most previews to list. 0 lists all.
TEXT
required
Name of the sandbox.
TEXT
default:"text"
Output formatOne of: text, json, jsonl, none
TEXT
Use a specific stored profile for this command, overriding BASETEN_PROFILE and the current profile
TEXT
Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run ‘baseten org team list’ to see teams.
BOOL
Enable verbose logging

Examples

List a sandbox’s previews

Filter output with --jq

Print every preview’s URL

Output

Text mode (--output text): Table with columns: NAME, PORT, PUBLIC, STATUS, URL, EXPIRES. Prints “No previews found.” to stderr when the list is empty, and a note to stderr when --limit left some out. JSON mode (--output json): payload type cmd.SandboxPreviewList.

describe

Retrieves one preview’s record: URL, port, status, and headers. Request header values are masked unless --show-secrets is passed.

Options

TEXT
Filter JSON output with a jq expression; implies —output json (or jsonl for streamed commands)
TEXT
required
Name of the sandbox.
TEXT
default:"text"
Output formatOne of: text, json, jsonl, none
TEXT
required
Name of the preview.
TEXT
Use a specific stored profile for this command, overriding BASETEN_PROFILE and the current profile
BOOL
Reveal request header values. Requires the workspace administrator role; other callers still see masked values.
TEXT
Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run ‘baseten org team list’ to see teams.
BOOL
Enable verbose logging

Examples

Describe a preview

Filter output with --jq

Print the preview’s URL

Output

Text mode (--output text): One field per line describing the preview. Empty fields are left out. JSON mode (--output json): payload type managementapi.SandboxPreview.

create

Exposes a port of a sandbox on an HTTPS URL. The preview is private unless --public is passed. Port 80 and the sandbox’s reserved system ports are rejected, and port 443 must stay private.

Options

TEXT
Delete the preview at this time. ISO 8601, local when no timezone is given. Cannot be combined with —ttl.
BOOL
Return the existing preview with this name, unchanged, instead of failing.
TEXT
Filter JSON output with a jq expression; implies —output json (or jsonl for streamed commands)
TEXT
required
Name of the sandbox.
TEXT
default:"text"
Output formatOne of: text, json, jsonl, none
INTEGER
required
Sandbox port to expose.
TEXT
Name of the preview, unique within the sandbox. The server generates one when omitted.
TEXT
Use a specific stored profile for this command, overriding BASETEN_PROFILE and the current profile
BOOL
Make the URL reachable without a token.
TEXT (repeatable)
Header added to every request forwarded to the sandbox, such as an Authorization header the app expects, as KEY=VALUE. Masked when read back. Repeatable.
TEXT (repeatable)
Header added to every response the preview serves, such as a CORS header, as KEY=VALUE. Repeatable.
TEXT
Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run ‘baseten org team list’ to see teams.
TEXT
Delete the preview this long from now, such as 24h or 7d. Cannot be combined with —expires-at.
BOOL
Enable verbose logging

Examples

Expose port 3000 publicly for a day
Expose port 8000 privately, adding a CORS header to every response

Filter output with --jq

Create a preview and print its URL

Output

Text mode (--output text): One field per line describing the preview. Empty fields are left out. JSON mode (--output json): payload type managementapi.SandboxPreview.

update

Changes a preview’s access, headers, or expiration. The URL does not change. Unset flags leave their fields unchanged. --ttl or --expires-at replaces any previous expiration.

Options

TEXT
Delete the preview at this time. ISO 8601, local when no timezone is given. Cannot be combined with —ttl.
TEXT
Filter JSON output with a jq expression; implies —output json (or jsonl for streamed commands)
TEXT
required
Name of the sandbox.
TEXT
default:"text"
Output formatOne of: text, json, jsonl, none
TEXT
required
Name of the preview.
BOOL
Require a token to reach the URL. Cannot be combined with —public.
TEXT
Use a specific stored profile for this command, overriding BASETEN_PROFILE and the current profile
BOOL
Make the URL reachable without a token. Cannot be combined with —private.
TEXT (repeatable)
Header added to every request forwarded to the sandbox, as KEY=VALUE, replacing all of the preview’s request headers. Repeatable.
TEXT (repeatable)
Header added to every response the preview serves, as KEY=VALUE, replacing all of the preview’s response headers. Repeatable.
TEXT
Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run ‘baseten org team list’ to see teams.
TEXT
Delete the preview this long from now, such as 24h or 7d. Cannot be combined with —expires-at.
BOOL
Enable verbose logging

Examples

Make a preview private

Filter output with --jq

Make a preview public and print whether it is

Output

Text mode (--output text): One field per line describing the preview. Empty fields are left out. JSON mode (--output json): payload type managementapi.SandboxPreview.

delete

Deletes a preview and its tokens. The URL stops serving at once.

Options

TEXT
Filter JSON output with a jq expression; implies —output json (or jsonl for streamed commands)
TEXT
required
Name of the sandbox.
TEXT
default:"text"
Output formatOne of: text, json, jsonl, none
TEXT
required
Name of the preview.
TEXT
Use a specific stored profile for this command, overriding BASETEN_PROFILE and the current profile
TEXT
Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run ‘baseten org team list’ to see teams.
BOOL
Skip the interactive confirmation prompt. Required when stdin is not a terminal.
BOOL
Enable verbose logging

Examples

Delete a preview without the confirmation prompt

Filter output with --jq

Delete a preview and print its status

Output

Text mode (--output text): A confirmation line on stderr. JSON mode (--output json): payload type managementapi.SandboxPreview. The preview’s record as of deletion.