> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browserwire.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Base URL, request/response conventions, and endpoint index for the BrowserWire local execution API.

The `bw run` command starts a local HTTP server that serves your discovered APIs. All endpoints documented in this section are served by this local server.

## Base URL

```
http://127.0.0.1:8787
```

The port is configurable via `bw run --port <number>`.

## Request format

`POST` endpoints expect a JSON request body with the `Content-Type` header:

```
Content-Type: application/json
```

`GET` endpoints accept inputs as query parameters.

## Response format

All endpoints return JSON. Successful responses include an `ok: true` field. Error responses include an `error` message.

**Success:**

```json theme={null}
{ "ok": true, "data": [ ... ], "state": "HomePage", "steps": [ ... ] }
```

**Error:**

```json theme={null}
{ "error": "View 'product_list' not found" }
```

HTTP status codes: `200` for success, `404` for unknown slugs/states/operations, `429` for max concurrent reached, `500` for execution errors.

## CORS

All endpoints include permissive CORS headers:

```
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
```

## Endpoints

| Method | Endpoint                                                  | Description                             |
| ------ | --------------------------------------------------------- | --------------------------------------- |
| `GET`  | [`/api/health`](/api/health)                              | Health check                            |
| `GET`  | [`/api/sites`](/api/sites)                                | List all cached manifests               |
| `GET`  | [`/api/sites/:slug/manifest`](/api/manifest)              | Full manifest JSON for a site           |
| `GET`  | [`/api/sites/:slug/views/:state/:view`](/api/views)       | Execute a view (read data)              |
| `POST` | [`/api/sites/:slug/actions/:state/:action`](/api/actions) | Execute an action (perform interaction) |

The `:slug` parameter identifies a site. It's derived from the domain — for example, `example.com` becomes `example-com`. Use `GET /api/sites` to see all available slugs.
