# 连接云端运行环境

返回运行中云端实例的连接信息。
- **前置条件**：运行实例必须**恰好处于** `RUNNING` 状态，且必须由你本人启动。正在停止或归档中的实例会被拒绝，即使 `/cloudbrowser/page` 仍显示 `RUNNING`。
- **副作用**：签发一个新的桌面访问令牌，并把你记录为当前连接成员。
- **重复调用**：返回的 `cdpUrl` 保持不变，已有的 CDP 会话继续可用；但每次调用都会签发新的桌面令牌并覆盖连接成员记录。**旧的桌面 URL 不会被吊销**，因此返回的每个 URL 都要当作有效凭据对待：不要记录、不要持久化。
- **会话上限**：运行实例达到最长时长后会被自动停止，归档在此之前不久开始，所以长时间运行的自动化必须能处理实例消失。
- **用途**：把 Puppeteer、Playwright 或 Selenium 连到 `cdpUrl`。

已记录的业务错误码：`40008`, `40009`, `40010`。 各错误码的含义见 [Error Codes](../Getting%20Started/error-codes.md)。任何接口还可能返回通用错误码。

Endpoint: POST /api/cloudbrowser/connect
Version: 2026-09-05

## Request fields (application/json):

  - `envId` (string, required)
    Browser profile (environment) ID. Serialized as a decimal string to avoid JavaScript
precision loss on 64-bit integers.
    Example: 1800000000000001

## Response 200:

  - `200` (unknown)
    Success

## Response 200 fields (application/json):

  - `code` (integer, required)
    Return result code. `0` means success; other codes indicate exceptions.
    Example: 0

  - `msg` (string | null, required)
    Error message. Usually `null` on success.
    Example: null

  - `requestId` (string)
    Operation request ID. This field may be present when the request passes through the API gateway.
    Example: 1d4f3ea968664593860b94b35d4ebf5e

  - `data` (object, required)

  - `data.cdpUrl` (string, required)
    Full CDP (Chrome DevTools Protocol) address including the access `token` parameter. Pass this
URL to an automation framework such as Puppeteer, Playwright, or Selenium to attach to the
remote browser.
    Example: https://runtime1.morelogin.com:16167?token=c62fedaaac524e41a0f02fc4345d41cb

  - `data.accessUrl` (string | null)
    Cloud browser page wrapper address. Open it in a browser to view and control the cloud
browser desktop. `null` when the page wrapper is not configured.
The `token` parameter is a Base64-encoded payload carrying the desktop URL, desktop token,
expiry, and team, user, member, and environment IDs. The `envName` and `lang` parameters set
the displayed environment name and interface language.
    Example: https://official-website.morelogin.com/browser-remote?token=eyJkZXNrdG9wVXJsIjoi...ZW52SWQiOiIyMDczMzk1NDg5NzM4OTE5OTM2In0%3D&envName=P-1267&lang=en-US

