---
title: "Mint a short-lived URL for a port running in the application harness sandbox. This intentionally does not return the bare `ws-…` hostname: application sandboxes always have a private preview password and only the gateway can exchange this grant for the preview cookie."
method: POST
path: "/ai/applications/{application_public_id}/preview-link"
tags: ["AI Applications"]
---

# Mint a short-lived URL for a port running in the application harness sandbox. This intentionally does not return the bare \`ws-…\` hostname: application sandboxes always have a private preview password and only the gateway can exchange this grant for the preview cookie.

`POST /ai/applications/{application_public_id}/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/applications/{application_public_id}/preview-link`
- Auth: HTTP bearer

## Path parameters

- `application_public_id` string, required

## 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`
- `404`
- `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** `7a3103561bd0`: 1 info
  - endpoint added

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