> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://platform.bctrl.ai/_mcp/server.

# Create a runtime or session

POST https://api.bctrl.ai/v1/runtimes
Content-Type: application/json

Create a browser runtime. Ephemeral runtimes (profile omitted or false) are single-session: by default they start in the same call and the response includes a `connection` with the run-scoped connect endpoint; pass start:false to defer startup (for example, to mint a share view first), then POST /start. They archive when their run finishes and never restart. Profile-backed runtimes (profile true) retain browser identity, remain reusable, and are created stopped by default; pass start:true for one-call create-and-start. Omit spaceId to use the caller's default space.

Reference: https://platform.bctrl.ai/api/api-reference/runtimes/create

## Authentication

- `Authorization` header (bearer token, required) — Use Bearer \<api-key>.

## Servers

- `https://api.bctrl.ai` (Production, default)
- `http://localhost:8787` (Local development gateway)

## Request

### Headers

- `BCTRL-Subaccount-Id` (string, optional) — Optional effective subaccount context for organization API keys. Subaccount API keys are already scoped and cannot use this header to act as another subaccount.
- `Idempotency-Key` (string, optional) — Optional retry key for this billable operation. Reusing the same key with the same request replays its stable outcome; credential-bearing results may be freshly issued for the same principal. Reusing it with a different request returns 409.

### Body (application/json)

- `config` (object, optional)
  - `autoUpgrade` (boolean, optional)
  - `extensionIds` (list of string, optional)
  - `fingerprint` (object, optional)
    - `browser` ("chrome", optional)
    - `viewport` (object, optional)
      - `height` (integer, required)
      - `width` (integer, required)
  - `forceOpenShadowRoots` (boolean, optional)
  - `headless` (boolean, optional)
  - `idleTimeoutSeconds` (integer, optional)
  - `networkTraffic` (object, optional)
    - `blockAds` (boolean, optional)
    - `blockResourceTypes` (list of enum, optional)
      - Allowed values: `media`, `texttrack`, `font`, `image`, `ping`, `prefetch`, `beacon`
    - `blockTrackers` (boolean, optional)
    - `saver` (enum, optional)
      - Allowed values: `none`, `light`, `medium`, `high`
    - `urlAllowlist` (list of string, optional)
    - `urlBlocklist` (list of string, optional)
  - `proxy` (string or any or any or object or object or any or any or object, optional)
    - RuntimeInlineCustomProxyUrlInput
      - `url` (string, required)
      - `dnsResolution` (enum, optional)
        - Allowed values: `local`, `proxy`
      - `password` (string, optional)
      - `type` ("custom", optional)
      - `udpMode` (enum, optional)
        - Allowed values: `disabled`, `auto`, `required`
      - `username` (string, optional)
    - RuntimeInlineCustomProxyConnectionInput
      - `host` (string, required)
      - `port` (integer, required)
      - `protocol` (enum, required)
        - Allowed values: `http`, `socks5`
      - `dnsResolution` (enum, optional)
        - Allowed values: `local`, `proxy`
      - `password` (string, optional)
      - `type` ("custom", optional)
      - `udpMode` (enum, optional)
        - Allowed values: `disabled`, `auto`, `required`
      - `username` (string, optional)
    - RuntimeInlineManagedRotatingDefaultProxyInput
      - `type` ("managed-rotating", required)
      - `city` (string, optional)
      - `country` (string, optional)
      - `dnsResolution` (enum, optional)
        - Allowed values: `local`, `proxy`
      - `geoId` (string, optional)
      - `ipFamily` (enum, optional)
        - Allowed values: `dual-stack`, `ipv4-only`
      - `isp` (string, optional)
      - `pool` ("pool1", optional, default: pool1)
      - `preference` (enum, optional)
        - Allowed values: `balanced`, `speed`, `quality`, `coverage`
      - `protocol` (enum, optional)
        - Allowed values: `http`, `socks5`
      - `region` (string, optional)
      - `rotation` (enum, optional)
        - Allowed values: `sticky`, `rotating`
      - `stickyKey` (string, optional)
      - `udpMode` (enum, optional)
        - Allowed values: `disabled`, `auto`, `required`
  - `stealth` (enum, optional)
    - Allowed values: `normal`, `best`, `experimental`
  - `webRtcProxyOnly` (boolean, optional)
- `metadata` (object, optional)
- `name` (string, optional)
- `profile` (boolean, optional)
- `recording` (boolean, optional)
- `spaceId` (string or "default", optional)
- `start` (boolean, optional)
- `type` ("browser", optional)

## Response

### 201

Created

- `activeRunId` (string, required, nullable)
- `createdAt` (datetime, required) — RFC 3339 timestamp with a UTC offset.
- `id` (string, required) — Unique runtime identifier generated by BCTRL.
- `name` (string, required)
- `profile` (boolean, required)
- `spaceId` (string, required) — Unique space identifier generated by BCTRL.
- `status` (enum, required)
  - Allowed values: `active`, `stopped`, `failed`
- `type` ("browser", required)
- `updatedAt` (datetime, required) — RFC 3339 timestamp with a UTC offset.
- `archivedAt` (datetime, optional) — RFC 3339 timestamp with a UTC offset.
- `config` (object, optional)
  - `headless` (boolean, required)
  - `autoUpgrade` (boolean, optional)
  - `extensionIds` (list of string, optional)
  - `fingerprint` (object, optional)
    - `browser` ("chrome" or string, optional)
    - `browserVersion` (string, optional)
    - `device` (enum, optional)
      - Allowed values: `desktop`, `mobile`
    - `locale` (string or list of string, optional)
    - `os` (enum, optional)
      - Allowed values: `windows`, `macos`, `android`, `ios`
    - `timezone` (string, optional)
    - `userAgent` (string, optional)
    - `viewport` (object, optional)
      - `height` (integer, required)
      - `width` (integer, required)
  - `forceOpenShadowRoots` (boolean, optional)
  - `idleTimeoutSeconds` (integer, optional)
  - `networkTraffic` (object, optional)
    - `blockAds` (boolean, optional)
    - `blockResourceTypes` (list of enum, optional)
      - Allowed values: `media`, `texttrack`, `font`, `image`, `ping`, `prefetch`, `beacon`
    - `blockTrackers` (boolean, optional)
    - `saver` (enum, optional)
      - Allowed values: `none`, `light`, `medium`, `high`
    - `urlAllowlist` (list of string, optional)
    - `urlBlocklist` (list of string, optional)
  - `proxy` (any or any or any, optional, nullable)
  - `stealth` (enum, optional)
    - Allowed values: `normal`, `best`, `experimental`
  - `webRtcProxyOnly` (boolean, optional)
- `connection` (object, optional)
  - `cdpUrl` (string, required)
  - `expiresAt` (datetime, required)
  - `recording` (object, required)
    - `enabled` (boolean, required)
  - `runId` (string, required) — Unique run identifier generated by BCTRL.
  - `webDriverUrl` (string, required)
  - `webMcpUrl` (string, optional)
- `lastActivityAt` (datetime, optional) — RFC 3339 timestamp with a UTC offset.
- `metadata` (object, optional, nullable)
- `needsInput` (boolean, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "activeRunId": "run_AAAAAAAAAAAAAAAAAAAAAA",
  "createdAt": "2026-07-26T12:00:00Z",
  "id": "rt_AAAAAAAAAAAAAAAAAAAAAA",
  "name": "string",
  "profile": true,
  "spaceId": "sp_AAAAAAAAAAAAAAAAAAAAAA",
  "status": "active",
  "type": "string",
  "updatedAt": "2026-07-26T12:00:00Z",
  "archivedAt": "2026-07-26T12:00:00Z",
  "config": {
    "headless": true,
    "autoUpgrade": true,
    "extensionIds": [
      "string"
    ],
    "fingerprint": {
      "browser": "chrome",
      "browserVersion": "string",
      "device": "desktop",
      "locale": "string",
      "os": "windows",
      "timezone": "string",
      "userAgent": "string",
      "viewport": {
        "height": 1,
        "width": 1
      }
    },
    "forceOpenShadowRoots": true,
    "idleTimeoutSeconds": 1,
    "networkTraffic": {
      "blockAds": true,
      "blockResourceTypes": [
        "media"
      ],
      "blockTrackers": true,
      "saver": "none",
      "urlAllowlist": [
        "string"
      ],
      "urlBlocklist": [
        "string"
      ]
    },
    "proxy": {
      "id": "string",
      "name": "string",
      "type": "custom"
    },
    "stealth": "normal",
    "webRtcProxyOnly": true
  },
  "connection": {
    "cdpUrl": "string",
    "expiresAt": "2024-01-15T09:30:00Z",
    "recording": {
      "enabled": true
    },
    "runId": "run_AAAAAAAAAAAAAAAAAAAAAA",
    "webDriverUrl": "string",
    "webMcpUrl": "string"
  },
  "lastActivityAt": "2026-07-26T12:00:00Z",
  "metadata": {},
  "needsInput": true
}
```

**SDK Code**

```python
import requests

url = "https://api.bctrl.ai/v1/runtimes"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.bctrl.ai/v1/runtimes';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.bctrl.ai/v1/runtimes"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.bctrl.ai/v1/runtimes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.bctrl.ai/v1/runtimes")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.bctrl.ai/v1/runtimes', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.bctrl.ai/v1/runtimes");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bctrl.ai/v1/runtimes")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```