---
title: "Set (or autodetect) the browser preview URL for a session"
method: POST
path: "/api/v1/sessions/{sessionId}/preview"
tags: ["sessions"]
---

# Set (or autodetect) the browser preview URL for a session

`POST /api/v1/sessions/{sessionId}/preview`

## Path parameters

- `sessionId` string, required — Session identifier, e.g. project-1.

## Request body

- SetSessionPreviewRequest
  - `url` string — Preview target URL. When empty, the daemon autodetects a static entry point in the session workspace.

## Response `200`

OK

- SessionResponse
  - `session` ControllersSessionView, required
    - `activity` DomainActivity, required
      - `lastActivityAt` string, date-time, required
      - `state` string, required
    - `branch` string
    - `createdAt` string, date-time, required
    - `displayName` string
    - `harness` string
    - `id` string, required
    - `isTerminated` boolean, required
    - `issueId` string
    - `kind` string, required
    - `previewRevision` integer
    - `previewUrl` string
    - `projectId` string, required
    - `prs` SessionPRFacts[], required
      - `ci` 'unknown' | 'pending' | 'passing' | 'failing', required
      - `mergeability` 'unknown' | 'mergeable' | 'conflicting' | 'blocked' | 'unstable', required
      - `number` integer, required
      - `review` 'none' | 'approved' | 'changes_requested' | 'review_required', required
      - `reviewComments` boolean, required
      - `state` 'draft' | 'open' | 'merged' | 'closed', required
      - `updatedAt` string, date-time, required
      - `url` string, required
    - `status` 'working' | 'pr_open' | 'draft' | 'ci_failed' | 'review_pending' | 'changes_requested' | 'approved' | 'mergeable' | 'merged' | 'needs_input' | 'idle' | 'terminated' | 'no_signal', required
    - `terminalHandleId` string
    - `updatedAt` string, date-time, required

## Other responses

- `400` — Bad Request
- `404` — Not Found
- `500` — Internal Server Error
- `501` — Not Implemented

## Changes

- **2026-06-22** `31605d9fa5c7` — 1 info
  - added the optional property `session/previewRevision` to the response with the `200` status
- **2026-06-21** `a6f82f51cdbc` — 1 info
  - endpoint added
- **2026-06-10** `b64f5ab46d87` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/composiohq/apis/agent-orchestrator-http-daemon/changes/api/v1/sessions/:sessionId/preview/post.md)

---

[API](https://skmtc.dev/composiohq/apis/agent-orchestrator-http-daemon.md) · [All operations](https://skmtc.dev/composiohq/apis/agent-orchestrator-http-daemon/llms.txt) · [OpenAPI document](https://skmtc.dev/composiohq/apis/agent-orchestrator-http-daemon/revisions/1e626d3a1e6b?raw)
