Logo of Lexmount
DocsTemplatesBlogHelp Center
GitHub
Logo of LexmountLexmount Browser

Get started

Lexmount Documentation
Console guide

Browser

Web Fetch

OverviewQuick Start
All-in-One ExtractDump DOM
Common Errors

Web Search

OverviewQuick StartSearch API

Runtime

OverviewQuickstartCapabilitiesExamples

Help and billing

Capability FAQ
ChangelogContact support
API reference

Dump DOM

Capture HTML, inspect rendered output, and reuse DOM snapshots.

POST /v1/dom/dump

Use this endpoint when you need the captured HTML itself, want to inspect rendering output, or want to reuse a DOM snapshot in a later extraction request.

Authentication

  • External requests must include both X-API-Key and X-Project-Id
  • Create or copy them from API key settings on the current site
  • Use https://api.lexmount.com for COM projects and https://api.lexmount.cn for CN projects; credentials must match the API region

Request Body

{
  "url": "https://example.com",
  "options": {
    "engine_preference": "lightmount_dcl",
    "timeout_ms": 30000,
    "filter_scripts_styles": false
  }
}

Fields

FieldTypeRequiredDescription
urlstringYesTarget page URL
options.engine_preferencestringNoPreferred engine, default auto
options.timeout_msintNoPositive timeout in milliseconds; cannot extend the public gateway deadline
options.user_agentstringNoCustom fetch User-Agent
options.filter_scripts_stylesboolNoRemove script and style before returning and saving the dump

Supported engine_preference values:

  • auto
  • http
  • chrome
  • chrome_cdp
  • lightmount_lite
  • lightmount_dcl
  • lightmount_domstable

Engine Behavior

auto uses a matching service-side site-engine rule; without a match it currently selects lightmount_dcl. It does not guarantee HTTP first or a sequence through every browser. Choose an explicit engine when you need a fixed selection, and inspect the returned engine.

EngineBehavior
httpFetch HTML directly without running page JavaScript
chrome / chrome_cdpChrome fetch paths
lightmount_liteLightweight fetch path
lightmount_dclLightMount, waiting for DOMContentLoaded
lightmount_domstableLightMount, waiting for DOM stability

Compatibility varies by engine. DOMContentLoaded or DOM stability does not guarantee that every asynchronously loaded section is present. Dump DOM fetches url; use the extraction endpoint to reuse a snapshot.

Basic Example

API_KEY='<your-api-key>'
PROJECT_ID='<your-project-id>'

curl -sS -X POST https://api.lexmount.cn/v1/dom/dump \
  -H 'Content-Type: application/json' \
  -H "X-API-Key: $API_KEY" \
  -H "X-Project-Id: $PROJECT_ID" \
  -d '{
    "url": "https://example.com",
    "options": {
      "engine_preference": "lightmount_dcl",
      "timeout_ms": 30000
    }
  }' \
  | jq '{final_url, engine, dom_id, html_len:(.html|length)}'

Response Fields

Common response fields:

  • request_id
  • url
  • final_url
  • status_code
  • fetched_at
  • engine
  • dom_id
  • html
  • debug

request_id is the request correlation ID. The same value is also returned in the X-Request-ID response header.

Filter script / style

curl -sS -X POST https://api.lexmount.cn/v1/dom/dump \
  -H 'Content-Type: application/json' \
  -H "X-API-Key: $API_KEY" \
  -H "X-Project-Id: $PROJECT_ID" \
  -d '{
    "url": "https://example.com",
    "options": {
      "engine_preference": "lightmount_dcl",
      "filter_scripts_styles": true
    }
  }' \
  | jq '{dom_id, has_script:(.html|test("<script"; "i")), has_style:(.html|test("<style"; "i"))}'

Use this mode when you want a cleaner DOM for inspection or template work. Do not treat it as an exact browser snapshot.

Reuse dom_id

Capture a snapshot first, then pass dom_id into /v1/extract:

set -euo pipefail

DOM_ID="$(curl --fail-with-body -sS -X POST https://api.lexmount.cn/v1/dom/dump \
  -H 'Content-Type: application/json' \
  -H "X-API-Key: $API_KEY" \
  -H "X-Project-Id: $PROJECT_ID" \
  -d '{"url":"https://example.com","options":{"engine_preference":"lightmount_dcl"}}' \
  | jq -er '.dom_id | select(type == "string" and length > 0)')"

curl -sS -X POST https://api.lexmount.cn/v1/extract \
  -H 'Content-Type: application/json' \
  -H "X-API-Key: $API_KEY" \
  -H "X-Project-Id: $PROJECT_ID" \
  -d "{\"extract\":{\"dom_id\":\"$DOM_ID\"}}" \
  | jq '{title:.result.title, engine:.result.engine, dom_id:.metadata.dom_id}'

For troubleshooting, see Common Errors.

Snapshot Reuse and Response Checks

dom_id is a returned string identifier, such as "123"; preserve it exactly. An example ID is not a reusable real snapshot. Continue using the regional endpoint that captured it. A snapshot is not a cross-region browser Context, and no fixed retention period is guaranteed publicly. If dom_snapshot_not_found occurs, fetch the URL again. Store required content in your application for long-term retention.

HTTP 200 from Dump DOM means the capture completed; the target page may still have returned 403 or 404. Check top-level status_code, final_url, and html as well. Handle empty HTML and absent debug. When filtering is enabled, the saved snapshot also contains the cleaned HTML.

In production, check HTTP status and dom_id before sending the reuse request; do not send null as an ID after a failed dump. Both successful calls count toward Web Fetch usage.

All-in-One Extract

Full request and response reference for POST /v1/extract.

Common Errors

Handle authentication, quota, input, fetch, snapshot, and gateway failures.

Table of Contents

Authentication
Request Body
Fields
Engine Behavior
Basic Example
Response Fields
Filter script / style
Reuse dom_id
Snapshot Reuse and Response Checks

Still need help?Ask on Discord