Grasp DocsGrasp Docs
GitHub
  • English
  • 简体中文
  • 日本語
GitHub
  • English
  • 简体中文
  • 日本語
  • Getting Started

    • Grasp SDK
    • Authentication
  • SDK Documentation

    • TypeScript/Node.js SDK
    • Python SDK

Authentication

You can authenticate with Grasp in two ways:

1. Environment Variable (Recommended)

Set the GRASP_KEY environment variable:

export GRASP_KEY=your_api_key_here

2. Direct Code Usage

Pass the API key directly in your code:

TypeScript/Node.js
const connection = await grasp.launchBrowser({
  key: 'your_api_key_here',
  // other options...
});
Python
async with GraspServer({
    'key': 'your_api_key_here',
    # other options...
}) as connection:
    # your code here

Configuration Parameters

When creating an SDK instance, you can set the following configuration parameters:

ParameterTypeRequiredDefaultDescription
keystringYes*$GRASP_KEYAPI key (optional if GRASP_KEY environment variable is set)
typeenumNochromiumRemote browser type: chromium or chrome-stable
headlessbooleanNotrueHeadless mode (headless saves resources but may be more detectable as bot)
timeoutintegerNo900000 (15 min)Grasp service timeout in milliseconds (max: 86400000 - 24 hours)
adblockbooleanNofalseEnable ad blocking (experimental feature)
debugbooleanNofalseEnable debug mode for more verbose terminal output

Best Practices

  1. Use Environment Variables: Keep your API keys secure by using environment variables instead of hardcoding them
  2. Timeout Configuration: Set appropriate timeouts based on your use case (maximum 24 hours)
  3. Resource Management: Always properly close browsers and pages to avoid resource leaks
Prev
Grasp SDK