## web/sessions/execute

`GET /v1/web/sessions/execute`

Evaluate JavaScript in the session's page, optionally after navigating: success flag, the returned value, any thrown error, the page URL and the duration.

*Run code in a browser session*

| Parameter | Required | Description |
| --- | --- | --- |
| `session_id` | yes | Session id returned by web/sessions/create — e.g. `ws_k3j2h1g0abcd` |
| `code` | yes | JavaScript evaluated in the page (a promise is awaited); the value is returned as JSON — e.g. `document.title` |
| `url` | no | Navigate here first (optional) — e.g. `https://example.com` |
| `language` | no | Only javascript: code runs in the page over DevTools, not node, python or bash on a host — e.g. `javascript` |
| `timeout` | no | Milliseconds to allow, 1000 to 30000 (default 10000) — e.g. `10000` |
| `dry_run` | no | Read a zero-credit estimate without fetching sources, running AI, or reserving credits. Cache status is a snapshot, not a guarantee at execution. — e.g. `1` |

**Cost:** 1 credit at list price per successful uncached response; variable-cost operations may quote or settle a different charge. Confirmed uncharged or refunded failures report zero. Pending reconciliation can report credits_used:null; retain request_id and the original idempotency key.

```bash
curl "https://www.monocrawl.com/v1/web/sessions/execute?session_id=ws_k3j2h1g0abcd&code=document.title&url=https%3A%2F%2Fexample.com" \
  -H "x-api-key: mn_your_key_here"
```

### Response data

Illustrative abbreviated data; documented core fields are optional and may be null. Additional source fields are allowed.

```json
{
  "session_id": "ws_example",
  "success": true,
  "language": "javascript"
}
```

[Field reference](https://www.monocrawl.com/docs/endpoints/web/sessions/execute#response) · [JSON Schema for response.data](https://www.monocrawl.com/schemas/web/sessions/execute.json)
