# Kết nối tới runtime trên cloud

Trả về thông tin kết nối tới một runtime trên cloud đang chạy.
- **Điều kiện tiên quyết**
: runtime phải ở đúng trạng thái
`RUNNING`
 và phải do chính bạn khởi động. Một runtime đang dừng hoặc đang lưu trữ sẽ bị từ chối, dù
`/cloudbrowser/page`
 vẫn báo
`RUNNING`
.
- **Tác động**
: phát hành một token truy cập desktop mới và ghi nhận bạn là thành viên đang kết nối.
- **Gọi lặp lại**
:
`cdpUrl`
 trả về là ổn định và các phiên CDP hiện có vẫn hoạt động, nhưng mỗi lần gọi lại phát hành một token desktop mới và ghi đè thành viên kết nối đã lưu.
**Các URL desktop trước đó không bị thu hồi**
, nên hãy coi mỗi URL trả về là một thông tin xác thực còn hiệu lực: không ghi vào log và không lưu trữ lại.
- **Giới hạn phiên**
: runtime tự động dừng khi đạt thời lượng tối đa, và quá trình lưu trữ bắt đầu ngay trước đó, nên một tiến trình tự động hóa chạy dài phải xử lý được việc runtime biến mất.
- **Dùng để**
: kết nối Puppeteer, Playwright hoặc Selenium tới
`cdpUrl`
.

Các mã lỗi nghiệp vụ đã ghi nhận: `40008`, `40009`, `40010`. Xem [Error Codes](/vi/api-reference/getting-started/error-codes) để biết ý nghĩa từng mã. Mọi thao tác cũng có thể trả về các mã dùng chung.

Endpoint: POST /cloudbrowser/connect
Version: 2026-09-05
Security: OpenApiBearer

## Security:

  - `OpenApiBearer` (unknown)
    http bearer JWT

## 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

