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

# API Reference

> Authenticate and start using the Browser Use API v4 — the current REST API for long-horizon agents.

## Authentication

All requests require an API key in the `X-Browser-Use-API-Key` header:

```
X-Browser-Use-API-Key: bu_your_key_here
```

Get a key at [cloud.browser-use.com/settings](https://cloud.browser-use.com/settings?tab=api-keys\&new=1). Keys start with `bu_`.

## Base URL

```
https://api.browser-use.com/api/v4
```

## The core loop

Create a run, poll its status until terminal, then fetch the full result. `status` is a cheap indexed lookup — poll it, not the full run.

```bash Create a run theme={null}
curl -X POST https://api.browser-use.com/api/v4/runs \
  -H "X-Browser-Use-API-Key: bu_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"task": "Find the top 3 trending repos on GitHub today"}'
```

```bash Poll status until completed | failed | cancelled (replace RUN_ID) theme={null}
curl https://api.browser-use.com/api/v4/runs/RUN_ID/status \
  -H "X-Browser-Use-API-Key: bu_your_key_here"
```

```bash Fetch the full run once it's terminal theme={null}
curl https://api.browser-use.com/api/v4/runs/RUN_ID \
  -H "X-Browser-Use-API-Key: bu_your_key_here"
```

## Sessions and follow-ups

A run belongs to a session (a conversation). Send a follow-up message to a session's queue — it runs as the next turn, or immediately with `interrupt: true`:

```bash Queue a follow-up (replace SESSION_ID) theme={null}
curl -X POST https://api.browser-use.com/api/v4/sessions/SESSION_ID/queue \
  -H "X-Browser-Use-API-Key: bu_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text": "Now open the top result", "interrupt": false}'
```

## SDKs

The [Cloud SDK](/cloud/sdk) wraps this loop — `runs.create()` then `runs.waitForCompletion()` / `runs.wait_for_completion()` — for TypeScript and Python.
