DocsContext Managementbrowser_close_context

browser_close_context

browser_close_context

Close a browser context and release all associated resources including cookies, storage, and network connections. Always close contexts when done to free up memory. Any ongoing operations in the context will be terminated.

When to use browser_close_context

Use browser_close_context when you need to spin up or tear down isolated, fingerprint-independent browser sessions. It is part of Owl Browser's Context Management toolset and runs inside a self-hosted, source-level stealth engine, so every call inherits the same undetectable browser fingerprint as the rest of your automation — no separate anti-detect setup required.

Usage Example

1234567891011
import asyncio
from owl_browser import OwlBrowser, RemoteConfig
# Async usage
async with OwlBrowser(config) as browser:
context = await browser.create_context()
context_id = context["context_id"]
await browser.close_context(
context_id=context_id
)

Parameters

Required

context_idstringrequired

The unique identifier of the browser context to close (e.g., 'ctx_000001'). Obtained from browser_create_context or browser_list_contexts

Response

Returns a JSON object with the operation result.

{
  "success": true,
  "result": <value>
}

Frequently Asked Questions

What does browser_close_context do?

Close a browser context and release all associated resources including cookies, storage, and network connections. Always close contexts when done to free up memory. Any ongoing operations in the context will be terminated. It belongs to Owl Browser's Context Management category and is available through the REST API, the Python SDK (browser.close_context()), the Node.js SDK, and the MCP server.

What parameters does browser_close_context accept?

browser_close_context accepts 1 required parameter (context_id) and 0 optional parameters. All parameters are sent as JSON in a POST request to /api/execute/browser_close_context.

Is browser_close_context detectable by anti-bot systems like Cloudflare or DataDome?

No. browser_close_context executes inside Owl Browser's Chromium engine, which applies fingerprint spoofing at the C++ source level rather than through JavaScript patches. Every tool call shares the same consistent, human-like fingerprint, so anti-bot systems such as Cloudflare, DataDome, and Akamai see an ordinary browser.

Related Tools

search

One-shot web search. Creates context, navigates to search engine, extracts structured JSON results, closes context.

browser_create_context

Create a new isolated browser context with its own cookies, storage, and optional proxy configuration. Each context acts as an independent browser session. Use this to create multiple isolated browsing sessions, configure proxy/Tor connections, load browser profiles with saved fingerprints, and enable/disable LLM features. Returns a context_id to use with other browser tools.

browser_list_contexts

List all currently active browser contexts with their IDs, creation time, current URL, and state. Useful for managing multiple browser sessions and checking which contexts are still open.

browser_close_all_contexts

Close ALL browser contexts at once and reclaim the entire context pool. Emergency recovery for when the context limit is reached but contexts are orphaned or unresponsive. Returns the number of contexts closed. Use with care: this terminates every active session.

browser_get_context_info

Get context information including the VM profile and fingerprint hashes (canvas, audio, GPU) currently in use. Returns the stealth configuration for the browser context including vm_id, canvas hash seed, audio noise seed, and GPU profile details.

browser_navigate

Navigate the browser to a specified URL. This is a non-blocking operation that starts navigation and returns immediately. Use browser_wait_for_network_idle or browser_wait_for_selector to wait for the page to fully load. Supports HTTP, HTTPS, file, and data URLs. When wait_until is set (load, networkidle, fullscroll, domcontentloaded) and the page declares WebMCP tools, the response includes a webmcp_tools array containing the full tool definitions (name, description, inputSchema). Use browser_webmcp_call_tool to execute any of these tools directly.

Browse the full Owl Browser API reference or get started with the Python SDK and Node.js SDK.