Chat with us, powered by LiveChat
← Return to MyDisct Solver

BBRE Quick Start Guide

Get up and running with the BBRE (Browser-Backed Request Engine) API in minutes. This guide walks you through obtaining your API key, installing the Node.js SDK, sending your first browser-backed request, and retrieving results using both asynchronous and synchronous patterns. By the end of this page, you will have working code in JavaScript, Python, and cURL that you can adapt for your own projects.

Before You Begin

You need an active MyDisct Solver account with a valid API key and sufficient balance to follow this guide. If you do not have an account yet, sign up at solver.mydisct.com and navigate to the API Keys section in your dashboard to generate your key.

Step 1: Get Your API Key

Every request to the BBRE API requires authentication via an API key. Your API key is a unique string that identifies your account and authorizes your requests. The key must be included in every API call as an HTTP header.

  1. Log in to your MyDisct Solver dashboard at solver.mydisct.com
  2. Navigate to the API Keys section in your account settings
  3. Click Generate New Key to create a new BBRE API key
  4. Copy the generated key and store it securely
Keep Your Key Safe

Never expose your API key in client-side code, public repositories, or shared documents. Store it in environment variables or a secure secrets manager. If you suspect your key has been compromised, revoke it immediately from the dashboard and generate a new one.

The BBRE API accepts your key through the x-api-key HTTP header. You can also use the apikey header name as an alternative. Both are accepted by the API and function identically.

Bash
curl -X POST https://bbre-solver-api.mydisct.com/request/execute   -H "Content-Type: application/json"   -H "x-api-key: YOUR_API_KEY"   -d '{"url": "https://example.com"}'

Step 2: Install the SDK (Optional)

While you can interact with the BBRE API directly using HTTP requests from any language, the official Node.js SDK simplifies common tasks like polling for results, managing sessions, and handling errors. If you are working in a Node.js environment, installing the SDK is strongly recommended.

Bash
npm install mydisctsolver-bbre

After installation, you can import the SDK and create a client instance with your API key. The client handles authentication headers automatically for all subsequent requests.

JavaScript
const BBREClient = require("mydisctsolver-bbre");

const client = new BBREClient({
  apiKey: "YOUR_API_KEY"
});

For Python and other languages, you will use direct HTTP requests to the BBRE API endpoints. The examples throughout this guide show both the SDK approach and the raw HTTP approach so you can choose whichever fits your stack.

Step 3: Send Your First Request (Synchronous)

The fastest way to get started is with a synchronous request using the /request/execute endpoint. This endpoint accepts your request parameters, processes them through a real browser environment, and returns the result in a single HTTP response. No polling required.

The following examples send a simple GET request to https://httpbin.org/get in passive mode with medium sensibility. This is the most common configuration and works well for the majority of websites.

POST https://bbre-solver-api.mydisct.com/request/execute

JavaScript (Node.js SDK)

JavaScript
const BBREClient = require("mydisctsolver-bbre");

const client = new BBREClient({
  apiKey: "YOUR_API_KEY"
});

async function main() {
  const result = await client.get("https://httpbin.org/get", {
    mode: "passive",
    sensibility: "medium"
  });

  console.log("Status Code:", result.statusCode);
  console.log("Response Body:", result.body);
}

main();

JavaScript (Direct HTTP)

JavaScript
const response = await fetch("https://bbre-solver-api.mydisct.com/request/execute", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY"
  },
  body: JSON.stringify({
    url: "https://httpbin.org/get",
    method: "GET",
    mode: "passive",
    sensibility: "medium"
  })
});

const data = await response.json();
console.log("Success:", data.success);
console.log("Status Code:", data.task.result.statusCode);
console.log("Response Body:", data.task.result.body);

Python

Python
import requests

response = requests.post(
    "https://bbre-solver-api.mydisct.com/request/execute",
    headers={
        "Content-Type": "application/json",
        "x-api-key": "YOUR_API_KEY"
    },
    json={
        "url": "https://httpbin.org/get",
        "method": "GET",
        "mode": "passive",
        "sensibility": "medium"
    }
)

data = response.json()
print("Success:", data["success"])
print("Status Code:", data["task"]["result"]["statusCode"])
print("Response Body:", data["task"]["result"]["body"])

cURL

Bash
curl -X POST https://bbre-solver-api.mydisct.com/request/execute   -H "Content-Type: application/json"   -H "x-api-key: YOUR_API_KEY"   -d '{
    "url": "https://httpbin.org/get",
    "method": "GET",
    "mode": "passive",
    "sensibility": "medium"
  }'

Expected Response

A successful synchronous request returns a JSON object with the task status set to completed and the full response data nested inside task.result.

JSON
{
  "success": true,
  "service": "MyDisct Solver BBRE",
  "task": {
    "id": "task_abc123def456",
    "status": "completed",
    "result": {
      "statusCode": 200,
      "headers": {
        "content-type": "application/json",
        "access-control-allow-origin": "*"
      },
      "body": "{"origin": "203.0.113.42", "url": "https://httpbin.org/get"}",
      "cookies": {},
      "profile": null
    }
  },
  "processingTime": 2847
}

Step 4: Asynchronous Pattern (Create + Poll)

For longer-running requests or when you want to fire multiple requests in parallel, use the asynchronous pattern. This involves two steps: first, create a task using /request/create to get a taskId, then poll /request/result with that taskId until the task completes.

The asynchronous pattern is particularly useful when you need to process multiple URLs concurrently. You can create dozens of tasks simultaneously and then poll for their results as they complete, rather than waiting for each one sequentially.

JavaScript (Node.js SDK)

The SDK's request() method with sync: false returns a task object. You can then use the task ID to poll for results manually, or let the SDK handle polling automatically by using the default synchronous behavior.

JavaScript
const BBREClient = require("mydisctsolver-bbre");

const client = new BBREClient({
  apiKey: "YOUR_API_KEY"
});

async function main() {
  const task = await client.request({
    url: "https://httpbin.org/get",
    mode: "passive",
    sensibility: "medium",
    sync: false
  });

  console.log("Task ID:", task.id);
  console.log("Status:", task.status);
}

main();

JavaScript (Direct HTTP with Polling)

JavaScript
const API_BASE = "https://bbre-solver-api.mydisct.com";
const API_KEY = "YOUR_API_KEY";

async function createTask() {
  const response = await fetch(API_BASE + "/request/create", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": API_KEY
    },
    body: JSON.stringify({
      url: "https://httpbin.org/get",
      method: "GET",
      mode: "passive",
      sensibility: "medium"
    })
  });

  return await response.json();
}

async function pollResult(taskId) {
  while (true) {
    const response = await fetch(API_BASE + "/request/result", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "x-api-key": API_KEY
      },
      body: JSON.stringify({ taskId })
    });

    const data = await response.json();

    if (data.task.status === "completed") {
      return data;
    }

    if (data.task.status === "failed") {
      throw new Error("Task failed: " + JSON.stringify(data));
    }

    await new Promise(resolve => setTimeout(resolve, 2000));
  }
}

async function main() {
  const createData = await createTask();
  console.log("Task created:", createData.task.id);

  const result = await pollResult(createData.task.id);
  console.log("Status Code:", result.task.result.statusCode);
  console.log("Response Body:", result.task.result.body);
}

main();

Python

Python
import requests
import time

API_BASE = "https://bbre-solver-api.mydisct.com"
API_KEY = "YOUR_API_KEY"

headers = {
    "Content-Type": "application/json",
    "x-api-key": API_KEY
}

create_response = requests.post(
    API_BASE + "/request/create",
    headers=headers,
    json={
        "url": "https://httpbin.org/get",
        "method": "GET",
        "mode": "passive",
        "sensibility": "medium"
    }
)

task_data = create_response.json()
task_id = task_data["task"]["id"]
print("Task created:", task_id)

while True:
    result_response = requests.post(
        API_BASE + "/request/result",
        headers=headers,
        json={"taskId": task_id}
    )

    result_data = result_response.json()

    if result_data["task"]["status"] == "completed":
        print("Status Code:", result_data["task"]["result"]["statusCode"])
        print("Response Body:", result_data["task"]["result"]["body"])
        break

    if result_data["task"]["status"] == "failed":
        print("Task failed:", result_data)
        break

    time.sleep(2)

cURL

With cURL, you perform the create and poll steps as separate commands. First create the task, then use the returned taskId to poll for the result.

Bash
curl -X POST https://bbre-solver-api.mydisct.com/request/create   -H "Content-Type: application/json"   -H "x-api-key: YOUR_API_KEY"   -d '{
    "url": "https://httpbin.org/get",
    "method": "GET",
    "mode": "passive",
    "sensibility": "medium"
  }'

The create endpoint returns a task object with the taskId. Use that ID to poll for the result:

Bash
curl -X POST https://bbre-solver-api.mydisct.com/request/result   -H "Content-Type: application/json"   -H "x-api-key: YOUR_API_KEY"   -d '{"taskId": "task_abc123def456"}'

Step 5: Sending a POST Request

BBRE supports all standard HTTP methods. Here is an example of sending a POST request with a JSON body and custom headers. This pattern is common when interacting with REST APIs that require browser-level TLS fingerprints.

JavaScript (Node.js SDK)

JavaScript
const BBREClient = require("mydisctsolver-bbre");

const client = new BBREClient({
  apiKey: "YOUR_API_KEY"
});

async function main() {
  const result = await client.post("https://httpbin.org/post", {
    mode: "passive",
    sensibility: "medium",
    headers: {
      "Accept": "application/json"
    },
    body: {
      username: "testuser",
      action: "login"
    }
  });

  console.log("Status Code:", result.statusCode);
  console.log("Response:", result.body);
}

main();

Python

Python
import requests

response = requests.post(
    "https://bbre-solver-api.mydisct.com/request/execute",
    headers={
        "Content-Type": "application/json",
        "x-api-key": "YOUR_API_KEY"
    },
    json={
        "url": "https://httpbin.org/post",
        "method": "POST",
        "mode": "passive",
        "sensibility": "medium",
        "headers": {
            "Accept": "application/json"
        },
        "body": {
            "username": "testuser",
            "action": "login"
        }
    }
)

data = response.json()
print("Status Code:", data["task"]["result"]["statusCode"])
print("Response:", data["task"]["result"]["body"])

cURL

Bash
curl -X POST https://bbre-solver-api.mydisct.com/request/execute   -H "Content-Type: application/json"   -H "x-api-key: YOUR_API_KEY"   -d '{
    "url": "https://httpbin.org/post",
    "method": "POST",
    "mode": "passive",
    "sensibility": "medium",
    "headers": {
      "Accept": "application/json"
    },
    "body": {
      "username": "testuser",
      "action": "login"
    }
  }'

Understanding the Response

Every BBRE API response follows a consistent structure. Understanding this structure is essential for building robust integrations. Here is a breakdown of the key fields you will encounter.

Field Type Description
success boolean Indicates whether the API call itself was successful
service string Always returns "MyDisct Solver BBRE" to identify the service
task.id string Unique identifier for the task, used for polling in async mode
task.status string Current task status: "processing", "completed", "failed", or "timeout"
task.result.statusCode number HTTP status code returned by the target website
task.result.headers object Response headers from the target website
task.result.body string Response body content from the target website
task.result.cookies object Cookies set by the target website during the request
processingTime number Total processing time in milliseconds

Error Response

When a request fails, the API returns an error object instead of a task result. The error includes a machine-readable code and a human-readable message to help you diagnose the issue.

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Your account balance is insufficient to process this request"
  }
}

Request Parameters Reference

The following table lists all available parameters you can include when creating a request. Only the url parameter is required. All other parameters have sensible defaults that work well for most use cases.

Parameter Type Required Description
url string Required The target URL to request
method string Optional HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS. Defaults to GET
headers object Optional Custom HTTP headers to include in the request
body any Optional Request body for POST, PUT, and PATCH requests
params object Optional Query parameters to append to the URL
mode string Optional "passive" or "adaptive". Defaults to "passive"
sensibility string Optional "low", "medium", or "high". Defaults to "medium"
timeout number Optional Request timeout in seconds (1 to 300). Defaults to 30 for async, 120 for sync
proxy object Optional Custom proxy configuration with host, port, and optional username/password
fingerprint object Optional Custom browser fingerprint parameters
cookies object Optional Cookies to include in the request
allowRedirects boolean Optional Whether to follow HTTP redirects. Defaults to true
maxRedirects number Optional Maximum number of redirects to follow. Defaults to 10
verify boolean Optional Whether to verify SSL certificates. Defaults to true
auth object Optional HTTP authentication credentials

Best Practices

  • Start with the synchronous endpoint for prototyping. The /request/execute endpoint is the simplest way to test your integration. It returns the result in a single call, which makes debugging straightforward. Once your integration is working, switch to the async pattern for production workloads that require concurrency.
  • Use passive mode and medium sensibility as your default. This combination handles the vast majority of websites effectively. Only switch to adaptive mode when you need browser automation (clicking, form filling, JavaScript execution), and only increase sensibility to high when medium is getting blocked by the target site.
  • Store your API key in environment variables. Never hardcode your API key directly in source files. Use process.env.BBRE_API_KEY in Node.js or os.environ["BBRE_API_KEY"] in Python to read the key from your environment. This prevents accidental exposure in version control systems.
  • Implement proper error handling from the start. Always check the success field in the response before accessing task.result. Handle common error codes like INSUFFICIENT_BALANCE, URL_REQUIRED, and SERVICE_TIMEOUT gracefully in your application logic.
  • Set explicit timeouts for synchronous requests. The default sync timeout is 120 seconds, which may be too long for your use case. Set a timeout value that matches your expectations. For fast APIs, 30 seconds is usually sufficient. For complex pages with heavy JavaScript, consider 60 to 90 seconds.

Common Issues

API_KEY_REQUIRED or INVALID_API_KEY Error

This error means the API did not receive a valid API key with your request. Make sure you are sending the key in the x-api-key header (or the apikey header as an alternative). Double-check that the header name is spelled correctly and that the key value does not contain extra whitespace or newline characters. If you recently regenerated your key, make sure you are using the new one.

INSUFFICIENT_BALANCE Error

Your account does not have enough balance to process the request. Each BBRE request has an associated cost that is deducted from your balance before processing begins. Check your current balance using the /account/balance endpoint and add funds through the MyDisct Solver dashboard. If a request fails after the balance deduction, the amount is automatically refunded.

SERVICE_TIMEOUT on Synchronous Requests

Synchronous requests have a maximum timeout of 300 seconds. If the target website takes longer than your configured timeout to respond, you will receive a SERVICE_TIMEOUT error. Try increasing the timeout parameter, or switch to the asynchronous pattern where you can poll for results without HTTP connection timeout constraints.

Empty Response Body

If you receive a successful response but the body is empty, the target website may be returning content that requires JavaScript rendering. In passive mode, BBRE does not execute client-side JavaScript. Switch to adaptive mode with a session to get the fully rendered page content. You can also try increasing the sensibility level, as some sites serve different content based on detected bot signals.

Next Steps

Now that you have successfully sent your first BBRE request, here are some directions to explore depending on your use case:

  • Need browser automation? Learn how to create sessions and control a real browser instance in the Session Create and Browser Action documentation.
  • Building complex workflows? The Hybrid Workflow Guide shows you how to combine passive and adaptive modes for multi-step processes like login flows and data extraction pipelines.
  • Using Node.js? The Node.js SDK provides a much cleaner interface than raw HTTP calls, with built-in polling, session management, and error handling.