Skip to main content
Query the web and get clean, structured search results using POST https://api.hyperbrowser.ai/x402/web/search. No Hyperbrowser account or API key is required. The price is calculated from your request options and returned in the payment requirements.

Search the web with TypeScript

The X402 SDKs handle the payment challenge, wallet signature, and retry automatically. This example supports both EVM and Solana wallets.

1. Install dependencies

2. Configure your wallet

Set either or both keys in a .env file. Use a 0x-prefixed EVM private key or a base58-encoded Solana 64-byte secret key, and fund the wallet with USDC on the network you intend to use.
Set only one key to choose EVM or Solana. With both set, the client uses the first compatible payment option returned by the server.

3. Search the web

Save this as search.ts. If your keys are in .env.agent, replace dotenv.config() with dotenv.config({ path: ".env.agent" }).
Run the example:

Request payment requirements

Send a search request to receive a 402 Payment Required response:
The PAYMENT-REQUIRED header contains base64-encoded JSON with the accepted networks, assets, amount, and recipient.

Sign and retry

Use your X402 client and wallet to generate a signed payment authorization from those requirements. Set PAYMENT_SIGNATURE to the encoded authorization returned by your client, then retry with the same request body:
The response contains the search status, query, and results with titles, URLs, and descriptions. The PAYMENT-RESPONSE header contains settlement information. See the X402 overview for the shared payment flow.
Each request returns search results. To purchase a browser you can control directly, use Browser Sessions. See the Search API documentation for the full parameter reference and examples, and the X402 Search reference for payment headers and response schemas.