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

# BrowserAI task API

The **BrowserAI** API offers developers a powerful interface to launch, control, and collect output from AI-driven browser automation tasks. Built for flexibility, it allows you to automate web actions, gather content, perform scraping, and execute scripts within a cloud-hosted browser—complete with customizable location targeting.

Ideal for **building data pipelines, automating testing processes, or embedding browser automation into your own applications**, this API delivers a robust, secure, and scalable solution for managing complex web-based workflows with ease.

### API Workflow

1. Start by retrieving your **API key** from the Project Dashboard.

<Frame>
  <img src="https://mintcdn.com/brightbrowserai/BMDL4tkYW9ROygnX/api-token/img/copy-api-token.png?fit=max&auto=format&n=BMDL4tkYW9ROygnX&q=85&s=636c3886839b8828469cd24c68a32986" alt="" width="511" height="178" data-path="api-token/img/copy-api-token.png" />
</Frame>

1. Create a task by either running the provided **cURL command in CMD** or sending a request to the `/tasks` endpoint with your **prompt and location settings**.

<Frame>
  <img src="https://mintcdn.com/brightbrowserai/BMDL4tkYW9ROygnX/api-token/img/copy-curl.png?fit=max&auto=format&n=BMDL4tkYW9ROygnX&q=85&s=2f32ba0b9635bbfe209babfe9c9b215b" alt="" width="476" height="292" data-path="api-token/img/copy-curl.png" />
</Frame>

1. If you used the **API endpoint**, you can track the task using the returned `session ID`.
2. You can fetch task **metadata** by calling `/tasks/{session_id}` method and view the response structure similar to this:

```
{
  "executionId": "<string>",
  "scriptId": "<string>",
  "scriptType": "<string>",
  "status": "<string>",
  "progress": {
    "status": "<string>",
    "logs": [
      "<string>"
    ]
  },
  "started": "2023-11-07T05:31:56Z",
  "estimatedCompletion": "2023-11-07T05:31:56Z"
}
```

1. Once completed, retrieve the **final results** by sending a request to the `/results/{session_id}` method and recieve this output:

```
{
  "executionId": "<string>",
  "status": "<string>",
  "started": "2023-11-07T05:31:56Z",
  "completed": "2023-11-07T05:31:56Z",
  "results": [
    {
      "model_output": "<string>",
      "result": "<string>",
      "state": "<string>",
      "metadata": {},
      "history_index": 123,
      "screenshot_url": "<string>",
      "html_url": "<string>",
      "console_url": "<string>",
      "insert_ts": "2023-11-07T05:31:56Z"
    }
  ]
}
```

<Tip>
  Explore more in-depth information about our API [here](https://docs.browser.ai/api-reference/intro)!
</Tip>
