Skip to main content
POST
Create a preview token

Authorizations

Authorization
string
header
required

Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.

Headers

X-Team-Id
string

Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.

Minimum string length: 1

Path Parameters

sandbox_name
string
required

Immutable sandbox name returned by creation.

Minimum string length: 1
Example:

"baseten-api-review-0916"

preview_name
string
required

Preview name returned by creation.

Minimum string length: 1
Example:

"web"

Query Parameters

team_id
string

Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.

Minimum string length: 1

Body

application/json
expires_at
string<date-time>
required

Time at which the token stops working. Must be in the future.

Example:

"2026-10-13T12:00:00Z"

create_if_not_exists
boolean

When true, return an existing unexpired token of this preview that stays valid at least until expires_at instead of creating a new one. Defaults to false when omitted.

Response

Token created.

Access token for a private preview.

name
string
required

Token name, used in token_name path parameters.

Example:

"7f3k2m9q1x8c4v6b0n5z"

token
string
required

Value to send as the bl_preview_token query parameter.

Example:

"7f3k2m9q1x8c4v6b0n5z"

expires_at
string<date-time>
required
Example:

"2026-10-13T12:00:00Z"

expired
boolean
required

Whether expires_at has passed.

Example:

false