---
title: "Mint a short-lived preview URL for a port in the user's shared global AI workspace. The gateway grant is identical to application previews; the only difference is how the owning sandbox is resolved."
method: POST
path: "/ai/workspace/preview-link"
tags: ["AI Chat"]
---

# Mint a short-lived preview URL for a port in the user's shared global AI workspace. The gateway grant is identical to application previews; the only difference is how the owning sandbox is resolved.

`POST /ai/workspace/preview-link`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/ai/workspace/preview-link`
- Auth: HTTP bearer

## Request body

- CreateApplicationPreviewLinkRequest
  - `path` string, nullable: Optional same-origin path to open after the preview grant is exchanged.
  - `port` integer, required: The development server port detected or selected in the sandbox.

## Response `200`

- ApplicationPreviewLinkResponse
  - `expires_at` string, date-time, required: When the link stops working, ISO 8601 in UTC.
  - `url` string, required: A short-lived authenticated URL. Its fragment carries the grant and never reaches the development server or referrer headers.

## Other responses

- `400`
- `401`
- `403`
- `503`

## Changes

- **2026-11-26** `e1864d950604`: 1 breaking
  - the `expires_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
- **2026-09-07** `504478bfd788`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/ai/workspace/preview-link/post.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)
