> 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 full documentation content, see https://platform.bctrl.ai/llms-full.txt.

# Create Runtime

POST https://api.bctrl.ai/v1/spaces/{id}/runtimes
Content-Type: application/json

Create a live execution environment inside a space. Use a runtime when an agent or external client needs a browser or other managed environment to work in.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: bctrl API
  version: 1.0.0
paths:
  /v1/spaces/{id}/runtimes:
    post:
      operationId: runtimes-create
      summary: Create a runtime inside a space
      description: >-
        Create a live execution environment inside a space. Use a runtime when
        an agent or external client needs a browser or other managed environment
        to work in.
      tags:
        - subpackage_spaces
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Use Bearer <api-key>.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/spaces_runtimesCreate_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/spaces_runtimesCreate_Request'
servers:
  - url: https://api.bctrl.ai
  - url: http://localhost:8787
components:
  schemas:
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprintBrowser:
      type: string
      enum:
        - chrome
        - edge
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprintBrowser
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprintLocale:
      type: string
      enum:
        - en-US
        - en-GB
        - de-DE
        - fr-FR
        - es-ES
        - es-MX
        - it-IT
        - nl-NL
        - pt-BR
        - pt-PT
        - pl-PL
        - tr-TR
        - sv-SE
        - da-DK
        - nb-NO
        - fi-FI
        - ja-JP
        - ko-KR
        - zh-CN
        - zh-TW
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprintLocale
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprint:
      type: object
      properties:
        browser:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprintBrowser
        locale:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprintLocale
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprint
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingCustomProtocol:
      type: string
      enum:
        - http
        - socks5
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingCustomProtocol
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesAffinity:
      oneOf:
        - type: object
          properties:
            strategy:
              type: string
              enum:
                - rotate
              description: 'Discriminator value: rotate'
          required:
            - strategy
          description: rotate variant
        - type: object
          properties:
            strategy:
              type: string
              enum:
                - sticky
              description: 'Discriminator value: sticky'
            key:
              type: string
          required:
            - strategy
          description: sticky variant
      discriminator:
        propertyName: strategy
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesAffinity
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesGeo:
      type: object
      properties:
        city:
          type: string
        country:
          type: string
        isp:
          type: string
        region:
          type: string
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesGeo
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesIpFamily:
      type: string
      enum:
        - dual-stack
        - ipv4-only
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesIpFamily
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesPoolPreference:
      type: string
      enum:
        - quality
        - quality-speed
        - speed
        - max-pool
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesPoolPreference
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesProtocol:
      type: string
      enum:
        - http
        - socks5
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesProtocol
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverrides:
      type: object
      properties:
        affinity:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesAffinity
        geo:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesGeo
        ipFamily:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesIpFamily
        poolPreference:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesPoolPreference
        protocol:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverridesProtocol
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverrides
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxy:
      oneOf:
        - type: object
          properties:
            mode:
              type: string
              enum:
                - custom
              description: 'Discriminator value: custom'
            host:
              type: string
            password:
              type: string
            port:
              type: integer
            protocol:
              $ref: >-
                #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingCustomProtocol
            username:
              type: string
          required:
            - mode
            - host
            - port
            - protocol
          description: custom variant
        - type: object
          properties:
            mode:
              type: string
              enum:
                - saved
              description: 'Discriminator value: saved'
            id:
              type: string
              format: uuid
            overrides:
              $ref: >-
                #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxyDiscriminatorMappingSavedOverrides
          required:
            - mode
            - id
          description: saved variant
      discriminator:
        propertyName: mode
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxy
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigStealth:
      type: string
      enum:
        - medium
        - high
        - ultra
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigStealth
    V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0Config:
      type: object
      properties:
        fingerprint:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigFingerprint
        humanize:
          type: boolean
        humanizePersonaId:
          type: integer
        proxy:
          oneOf:
            - $ref: >-
                #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigProxy
            - type: 'null'
        solveCaptchas:
          type: boolean
        stealth:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0ConfigStealth
      title: >-
        V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0Config
    SpacesRuntimesCreateRequest0:
      type: object
      properties:
        config:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostRequestBodyContentApplicationJsonSchemaOneOf0Config
        extensionIds:
          type: array
          items:
            type: string
        metadata:
          type: object
          additionalProperties:
            description: Any type
        name:
          type: string
        profile:
          type: string
        type:
          type: string
          enum:
            - browser
      required:
        - type
      title: SpacesRuntimesCreateRequest0
    spaces_runtimesCreate_Request:
      oneOf:
        - $ref: '#/components/schemas/SpacesRuntimesCreateRequest0'
      title: spaces_runtimesCreate_Request
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking0:
      type: object
      properties:
        kind:
          type: string
          enum:
            - ephemeral
      required:
        - kind
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking0
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking1:
      type: object
      properties:
        kind:
          type: string
          enum:
            - profile
        profile:
          type: string
      required:
        - kind
        - profile
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking1
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking:
      oneOf:
        - $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking0
        - $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking1
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsCdp:
      type: object
      properties:
        available:
          type: boolean
      required:
        - available
      title: >-
        V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsCdp
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsCua:
      type: object
      properties:
        available:
          type: boolean
      required:
        - available
      title: >-
        V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsCua
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsHttp:
      type: object
      properties:
        available:
          type: boolean
      required:
        - available
      title: >-
        V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsHttp
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsMcp:
      type: object
      properties:
        available:
          type: boolean
      required:
        - available
      title: >-
        V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsMcp
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsRdp:
      type: object
      properties:
        available:
          type: boolean
      required:
        - available
      title: >-
        V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsRdp
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsVnc:
      type: object
      properties:
        available:
          type: boolean
      required:
        - available
      title: >-
        V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsVnc
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnections:
      type: object
      properties:
        cdp:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsCdp
        cua:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsCua
        http:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsHttp
        mcp:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsMcp
        rdp:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsRdp
        vnc:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnectionsVnc
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnections
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaKind:
      type: string
      enum:
        - browser
        - desktop
        - spreadsheet
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaKind
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaStatus:
      type: string
      enum:
        - active
        - stopped
        - failed
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaStatus
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaSummary:
      type: object
      properties:
        browserRunning:
          type: boolean
        currentDriver:
          type:
            - string
            - 'null'
        defaultContextId:
          type:
            - string
            - 'null'
        defaultPageId:
          type:
            - string
            - 'null'
        storageSpace:
          type:
            - string
            - 'null'
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaSummary
    V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaType:
      type: string
      enum:
        - browser
        - desktop
        - spreadsheet
      title: V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaType
    spaces_runtimesCreate_Response_200:
      type: object
      properties:
        activeRunId:
          type:
            - string
            - 'null'
          format: uuid
        backing:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaBacking
        capabilities:
          type: array
          items:
            type: string
        connections:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaConnections
        createdAt:
          type: string
        id:
          type: string
          format: uuid
        kind:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaKind
        metadata:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        name:
          type: string
        region:
          type: string
        spaceId:
          type: string
          format: uuid
        status:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaStatus
        summary:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaSummary
        type:
          $ref: >-
            #/components/schemas/V1SpacesIdRuntimesPostResponsesContentApplicationJsonSchemaType
        updatedAt:
          type: string
      required:
        - activeRunId
        - capabilities
        - connections
        - createdAt
        - id
        - kind
        - metadata
        - name
        - region
        - spaceId
        - status
        - type
        - updatedAt
      title: spaces_runtimesCreate_Response_200
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use Bearer <api-key>.

```

## SDK Code Examples

```python
import requests

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

payload = { "type": "string" }
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/spaces/id/runtimes';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"type":"string"}'
};

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/spaces/id/runtimes"

	payload := strings.NewReader("{\n  \"type\": \"string\"\n}")

	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/spaces/id/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 = "{\n  \"type\": \"string\"\n}"

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/spaces/id/runtimes")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bctrl.ai/v1/spaces/id/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()
```