Opens a browser preview of one port the run listens on and returns its URL, which expires within the hour and when the session stops.
POST
/v1/m/sessions/runs/{ref}/preview
const url = 'https://example.com/v1/m/sessions/runs/example/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"port":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/m/sessions/runs/example/preview \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "port": 1 }'Opens a browser preview of one port the run listens on and returns its URL, which expires within the hour and when the session stops.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” ref
required
string
Path parameter ref.
Header Parameters
Section titled “ Header Parameters ” X-Olivares-Tenant
string format: uuid
Target tenant id; required when the principal can act in more than one tenant.
Request Body required
Section titled “ Request Body required ” Media type application/json
object
port
required
A port the session’s own processes listen on (GET /runs/{ref}/preview).
integer
Example generated
{ "port": 1}Responses
Section titled “ Responses ”The preview’s URL on this engine
Media type application/json
object
expires_at
required
string format: date-time
port
required
integer
url
required
Same-origin path of the preview; the token in it is its only credential.
string
Example generated
{ "expires_at": "2026-04-15T12:00:00Z", "port": 1, "url": "example"}Bad request
Media type application/json
object
Example generated
{}Unauthenticated
Media type application/json
object
Example generated
{}Forbidden
Media type application/json
object
Example generated
{}No process of this session listens on the port
Media type application/json
object
Example generated
{}The session is not running on this node
Media type application/json
object
Example generated
{}Too many previews are open on this node
Media type application/json
object
Example generated
{}The session’s ports cannot be read on this host
Media type application/json
object
Example generated
{}