Inflowpay

Let AI agents retrieve web pages and search the web with pay-per-request USDC payments through x402, settled by the InFlow facilitator.

Use MrScraper's HTTP APIs from an AI agent or application and pay per request in USDC through x402. Payments are settled by the InFlow facilitator, and InFlow buyers can pay from their InFlow balance. Buyers do not need a MrScraper API key or session cookie.

The integration exposes two services:

  • scraperAPI retrieves a public page as rendered HTML, Markdown, a screenshot, or a combination of these outputs.
  • webSearch: Search the web to retrieve real-time search results, including relevant website URLs, titles, and descriptions.

Endpoints and pricing

Base URL: https://api.mrscraper.com/inflowpay

ServiceMethod and pathPrice per request
scraperAPIPOST /api/mrscraper/scraperAPI0.001 USDC
webSearchPOST /api/mrscraper/webSearch0.001 USDC

Both endpoints accept and return application/json.

The live PAYMENT-REQUIRED challenge supplies the payable amount, accepted network, asset, and recipient. Check these requirements before authorizing a payment.

OpenAPI specification

Open the OpenAPI 3.1 JSON specification

The document covers only these two paid endpoints, including required and optional request fields, response schemas, output examples, error responses, and the x402 payment headers. Each operation includes these custom OpenAPI extensions:

ExtensionValueMeaning
x-price-usdc"0.001"USDC price per request.
x-payment-protocol"x402"Payment protocol.
x-x402-version2x402 protocol version.

The specification's servers URL is https://api.mrscraper.com, and each operation path already starts with /inflowpay, for example /inflowpay/api/mrscraper/scraperAPI.

Payment setup and flow

Use an x402 v2 buyer client and either an InFlow balance or a wallet holding USDC on one of the accepted on-chain networks. The live PAYMENT-REQUIRED challenge lists the networks InFlow currently accepts, so read it instead of hard-coding a network.

For each API call:

  1. Send a JSON POST request to either endpoint.
  2. A valid unpaid request returns HTTP 402 with a PAYMENT-REQUIRED header.
  3. Your buyer client reads the challenge, selects a supported payment option, and signs the payment authorization.
  4. The client repeats the same method, URL, and JSON body with PAYMENT-SIGNATURE attached.
  5. The InFlow facilitator verifies the payment, MrScraper runs the service, and the payment is settled when the gateway returns a successful response.
HeaderDirectionPurpose
PAYMENT-REQUIREDResponseBase64-encoded x402 v2 requirements on the initial unpaid challenge.
PAYMENT-SIGNATURERequestBase64-encoded payment payload generated by the buyer client.
PAYMENT-RESPONSEResponseBase64-encoded settlement result, present after a successful settlement.

The cURL examples start the payment flow

The requests below show the JSON inputs and return HTTP 402 when sent without payment. Use your x402 buyer client to sign and complete the paid request.

Invalid service inputs are rejected with HTTP 400 before payment is requested. Unknown request fields are ignored. Use the field names documented here, including camelCase options such as proxyCountry and numResults.

scraperAPI

Retrieve public webpage content, including pages rendered with JavaScript. Use the returned content for research, public product and price monitoring, article collection, or retrieval workflows. Availability depends on the target website.

curl -i 'https://api.mrscraper.com/inflowpay/api/mrscraper/scraperAPI' \
  -H 'Content-Type: application/json' \
  --data '{
    "url": "https://example.com",
    "html": true,
    "markdown": true,
    "screenshot": false
  }'

Request fields

FieldTypeRequiredDefault / accepted values
urlstringYesPublic HTTP(S) URL without embedded credentials. Private/local hosts and IPv6 literals are rejected.
htmlbooleanNotrue. The renderer currently returns html even when set to false.
markdownbooleanNoInclude Markdown in the markdown field.
screenshotbooleanNoInclude a base64 JPEG in the screenshot field. Can substantially increase response size.
proxyCountrystringNo"us". Two-letter proxy country code. Also used as geoCode when geoCode is omitted.
geoCodestringNoTwo-letter upstream geo code. Defaults to proxyCountry.
browserRenderingbooleanNotrue. Set to false to fetch the page without JavaScript rendering.
timeoutintegerNo1–300 seconds for upstream page retrieval.
maxRetriesintegerNo1–10 upstream retries. 0 is not accepted.
tokenCapintegerNo1–10000 upstream plan tokens for retries. Separate from the USDC price.
waitUntilstringNo"domcontentloaded", "load", or "networkidle".
waitForSelectorstringNoCSS selector, up to 1,000 characters.
blockResourcesbooleanNoForward the renderer's resource-blocking option.
warmStartbooleanNoVisit the site's root before retrieving the target page.
returnCookiebooleanNoRequest upstream cookie information when supported.
superbooleanNoForward the real-device routing option.

Fields without a documented default are forwarded only when supplied; otherwise, the upstream service chooses its default.

Response

The response body is the renderer result itself, without an ok/service/data wrapper. Illustrative successful response:

{
  "html": "<html><body><h1>Example Domain</h1></body></html>",
  "markdown": "# Example Domain",
  "screenshot": null,
  "runtime": 4.2,
  "retry_count": 0,
  "error": null
}
FieldTypeMeaning
htmlstringRendered HTML; can be empty when disabled.
markdownstringMarkdown; can be empty when disabled.
screenshotstring or nullBase64 JPEG image bytes, without a data: prefix; can be null when disabled.
runtimenumberUpstream renderer runtime in seconds.
retry_countintegerRetries reported by the renderer.
errorstring or nullUpstream page-rendering error, if any.

Disabled outputs can remain present with empty or null values. Allow enough time in your client for rendering and response transfer. The request's timeout field is separate from your client's HTTP deadline.

webSearch

Search the web to retrieve real-time search results, including relevant website URLs, titles, and descriptions. Use region to compare results across countries.

curl -i 'https://api.mrscraper.com/inflowpay/api/mrscraper/webSearch' \
  -H 'Content-Type: application/json' \
  --data '{
    "query": "web scraping",
    "region": "us",
    "numResults": 10
  }'

Request fields

FieldTypeRequiredDefault / accepted values
querystringYesSearch text, 1–1,000 characters after trimming whitespace.
regionstringNo"us". Two-letter country code for the results.
numResultsintegerNo10. Accepts 10–100. The search can return fewer results.

Response

The response has success, message, and data at the top level, without an ok/service wrapper. data is the list of ranked results. Illustrative response, with the list shortened:

{
  "success": true,
  "message": "Search completed",
  "data": [
    {
      "rank": 1,
      "title": "Web scraping",
      "url": "https://en.wikipedia.org/wiki/Web_scraping",
      "description": "Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites.",
      "source": "Wikipedia"
    },
    {
      "rank": 2,
      "title": "What is Web Scraping? The Complete Guide",
      "url": "https://www.scraperapi.com/web-scraping/",
      "description": "Web scraping, or web data extraction, is the process of extracting publicly available web data using automated tools.",
      "source": "ScraperAPI"
    }
  ]
}
FieldTypeMeaning
successbooleanWhether the upstream search service succeeded.
messagestringUpstream status message.
dataarrayRanked results, at most numResults. Can be empty.
data[].rankintegerOne-based position in the results.
data[].titlestringResult title.
data[].urlstringDestination page URL.
data[].descriptionstringResult snippet, when available.
data[].sourcestringSite or publisher name shown with the result, when available.

Upstream tokenUsage is omitted. When success is false, the shape of data varies by failure and can be null.

Errors

HTTP statusMeaning
200Upstream request completed. Inspect error for scraperAPI or success for webSearch.
400Invalid service inputs, rejected before payment.
402Payment required or rejected. Read the payment headers and any error details.
500Unexpected gateway or payment-processing error. The payment is not settled.
502Upstream connection, HTTP status, or response-size error, or a facilitator failure. The payment is not settled.
504Upstream HTTP request timed out. The payment is not settled.

Gateway validation and upstream errors use an ok: false envelope:

{
  "ok": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Request validation failed",
    "issues": [
      {
        "path": ["url"],
        "message": "URL must target a public host"
      }
    ]
  }
}

This is an illustrative validation error; issue messages vary. Other error codes include UPSTREAM_TIMEOUT, UPSTREAM_HTTP_ERROR, UPSTREAM_TOO_LARGE, UPSTREAM_UNAVAILABLE, and INTERNAL_ERROR. Payment middleware errors use a different shape: a string error with optional reason or message; a facilitator failure on 502 can also use this shape. The initial unpaid 402 body is {}; its requirements are in PAYMENT-REQUIRED.

When a request is charged

The payment is verified before the upstream service runs and settled only when the gateway returns a successful response. Requests that end in an HTTP error status (400, 402, 500, 502, or 504) are not settled. A 200 response whose upstream fields report an error, such as webSearch success: false, is still settled, so a retry is a new paid request.

On this page