---
title: "Open the website as the CLI session"
description: "Creates a single-use URL, valid for 10 minutes, that signs the browser in as the CLI's WorkOS session and lands on return_to (the app without one)."
canonical: "https://www.cool.computer/docs/api-reference/authentication/open-the-website-as-the-cli-session"
---
# Open the website as the CLI session

> Creates a single-use URL, valid for 10 minutes, that signs the browser in as the CLI's WorkOS session and lands on return_to (the app without one).

```http
POST https://api.cool.computer/api/auth/browser-handoff
```

Creates a single-use URL, valid for 10 minutes, that signs the browser in as the CLI's WorkOS session and lands on return_to (the app without one). The browser stays signed in while that WorkOS session is active. Authentication is cached for five seconds; a matching revocation fence invalidates it immediately, and a missed fence is bounded by that cache. Revalidation checks WorkOS and returns 503 if WorkOS cannot answer. Its cookie carries no token: the CLI's refresh token never leaves the CLI. API keys are rejected with access_token_required.

## Authorization

- A WorkOS access token returned by the self-serve email authorization flow. A claimed agent access token is also accepted for creating an API key, and only for that. API keys are not accepted for API-key administration.

## Request body

Optional.

- `application/json` (object)
  - `return_to` (string, at most 1024 characters): Where the browser lands after signing in: a page on this site (a path such as /app/..., or its whole address, https://www.cool.computer/app/...) or a page on a computer's own host (https://name.cool.computer/...), as a sign-in's return_to. Anything else is refused.

## Responses

- `201`: A single-use browser URL.
  - `application/json` (object)
    - `url` (string, uri, required)
    - `expires_at` (string, date-time, required)
- `400`: return_to is not a page on this site or on a computer's own host.
- `401`: Unauthorized.
- `403`: A user access token from email sign-in (cool login) is required; API keys receive access_token_required.
- `429`: Too Many Requests. If the problem code is api_request_rate_exceeded, wait for Retry-After seconds; other problem codes describe a separate limit.
- `500`: Internal Server Error.
- `503`: Service Unavailable.
- `default`: A machine-readable API error with a stable code and recovery instruction.

An error is an `application/problem+json` document with a stable `code`; [API errors](/docs/api-reference/errors) says how to handle one.

## Example

```sh
curl -X POST "https://api.cool.computer/api/auth/browser-handoff" \
  -H "authorization: Bearer $TOKEN"
```
