# Browser Render: AI Structured Extraction

AI-powered structured data extraction from a URL via Cloudflare Browser Run (default model: @cf/meta/llama-3.3-70b-instruct-fp8-fast)

- Method: POST
- Path: `/json`
- Price: $0.02000000

## Input Schema

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "prompt": {
      "type": "string",
      "minLength": 1
    },
    "response_format": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "json_schema"
        },
        "schema": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "type",
        "schema"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "url",
    "prompt"
  ],
  "additionalProperties": false
}
```

## Output Schema

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": true,
  "description": "AI-extracted JSON. Exact shape is determined by the `response_format` schema you provide in the request (or the LLM if only `prompt` is given)."
}
```

## Networks

| Name | Mode | CAIP-2 | Chain ID / Cluster | Protocols |
|---|---|---|---|---|
| Tempo Mainnet | live | `eip155:4217` | 4217 | mpp |
| Solana Mainnet | live | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | mainnet-beta | mpp, x402 |
| Base | live | `eip155:8453` | 8453 | x402 |

## Accepted Currencies

| Symbol | Name | Decimals | Network | Address | Protocols |
|---|---|---|---|---|---|
| USDC.e | Bridged USDC (Stargate) | 6 | `eip155:4217` | `0x20c000000000000000000000b9537d11c60e8b50` | mpp |
| USDC | USD Coin (Solana) | 6 | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | mpp, x402 |
| USDC | USD Coin | 6 | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | x402 |

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/json', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "prompt": "",
    "html": ""
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/json', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "prompt": "",
    "html": ""
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/json" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","prompt":"","html":""}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/json" -X POST --json '{"url":"https://example.com","prompt":"","html":""}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/json" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","prompt":"","html":""}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/json" -m POST -b '{"url":"https://example.com","prompt":"","html":""}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/json', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "prompt": "",
    "html": ""
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/json" -m POST -b '{"url":"https://example.com","prompt":"","html":""}' -p x402
```
