← Back to BlogAPI & Scheduling

API Access & Task Scheduling: Automate at Scale

A practical guide to integrating Browse Anything into your applications and setting up automated recurring tasks.

8 min readJanuary 18, 2025

Why API Access Matters

While the Browse Anything web interface is great for ad-hoc tasks, real automation power comes from programmatic access. Our RESTful API lets you integrate AI-powered browser automation into your existing systems, workflows, and applications.

Common Integration Scenarios

  • CI/CD Pipelines: Automated testing as part of your deployment process
  • Data Pipelines: Scheduled data collection from web sources
  • Business Workflows: Triggered automation based on business events
  • Monitoring Systems: Regular health checks and availability monitoring
  • Custom Applications: Web automation as a feature in your own product

Getting Started with the API

Step 1: Generate an API Key

Navigate to your account settings at platform.browseanything.io/api-settingsand create a new API key. You can create multiple keys with different permission scopes.

⚠️ Security Note: Keep your API keys secret. Never commit them to version control or expose them in client-side code.

Step 2: Make Your First Request

Here's a simple example to create a task via the API:

curl -X POST https://platform.browseanything.io/api/v1/tasks \
  -H "Authorization: Bearer ba_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Go to amazon.com and find the price of iPhone 15",
    "model": "gpt-4o"
  }'

Step 3: Check Task Status

Tasks run asynchronously. Poll the status endpoint to check progress:

curl https://platform.browseanything.io/api/v1/tasks/{task_id} \
  -H "Authorization: Bearer ba_your_api_key_here"

# Response
{
  "id": "task_abc123",
  "status": "completed",
  "result": {
    "answer": "The iPhone 15 128GB is priced at $799",
    "screenshots": ["https://..."],
    "steps": [...]
  }
}

API Endpoints Reference

MethodEndpointDescription
POST/api/v1/tasksCreate a new task
GET/api/v1/tasks/{id}Get task status and results
GET/api/v1/tasksList all tasks
POST/api/v1/scheduled-tasksCreate scheduled task
GET/api/v1/scheduled-tasksList scheduled tasks
DELETE/api/v1/scheduled-tasks/{id}Delete scheduled task

📚 Full API Documentation

For complete endpoint documentation with request/response schemas, authentication details, and interactive examples, visit our API docs.

View API Documentation

Task Scheduling

Schedule tasks to run automatically on a recurring basis. Perfect for monitoring, data collection, or any task that needs to run regularly without manual intervention.

Schedule Types

Daily

Run at a specific time every day. Great for morning reports or daily price checks.

Weekly

Run on specific days of the week. Perfect for weekly summaries or competitor analysis.

Monthly

Run on specific days of the month. Ideal for monthly reports or billing checks.

Creating a Scheduled Task

curl -X POST https://platform.browseanything.io/api/v1/scheduled-tasks \
  -H "Authorization: Bearer ba_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Check the price of Bitcoin on coinbase.com",
    "scheduleType": "daily",
    "scheduleTime": "09:00",
    "timezone": "America/New_York",
    "model": "gpt-4o-mini"
  }'

This creates a task that runs every day at 9:00 AM Eastern Time.

Webhooks

Instead of polling for task status, configure webhooks to receive notifications when tasks complete (or fail).

Webhook Payload

When a task completes, we'll POST a JSON payload to your configured webhook URL:

{
  "event": "task.completed",
  "taskId": "task_abc123",
  "status": "completed",
  "result": {
    "answer": "The current Bitcoin price is $67,432",
    "screenshots": ["https://..."],
    "executionTime": 45000
  },
  "timestamp": "2025-01-18T14:30:00Z"
}

Webhook Events

  • task.completed - Task finished successfully
  • task.failed - Task failed after retries
  • task.timeout - Task exceeded time limit

Security

  • • Webhooks include a signature header for verification
  • • Use HTTPS endpoints only
  • • Webhook secrets are stored encrypted

Code Examples

Python

import requests

API_KEY = "ba_your_api_key_here"
BASE_URL = "https://platform.browseanything.io/api/v1"

def create_task(prompt, model="gpt-4o"):
    response = requests.post(
        f"{BASE_URL}/tasks",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"prompt": prompt, "model": model}
    )
    return response.json()

def get_task_result(task_id):
    response = requests.get(
        f"{BASE_URL}/tasks/{task_id}",
        headers={"Authorization": f"Bearer {API_KEY}"}
    )
    return response.json()

# Example usage
task = create_task("Find the weather in San Francisco")
print(f"Task created: {task['id']}")

JavaScript/Node.js

const API_KEY = "ba_your_api_key_here";
const BASE_URL = "https://platform.browseanything.io/api/v1";

async function createTask(prompt, model = "gpt-4o") {
  const response = await fetch(`${BASE_URL}/tasks`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${API_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ prompt, model })
  });
  return response.json();
}

// Example usage
const task = await createTask("Search for flights from NYC to LA");
console.log(`Task created: ${task.id}`);

Best Practices

Recommendations

  • Use webhooks over polling: More efficient and real-time
  • Handle retries gracefully: Implement exponential backoff for failures
  • Be specific in prompts: More detailed prompts yield better results
  • Use appropriate models: GPT-4o-mini for simple tasks, GPT-4o for complex ones
  • Set reasonable timeouts: Complex tasks may take 1-3 minutes
  • Monitor your usage: Track API calls and costs in your dashboard

Start Building with Our API

Get your API key and start integrating Browse Anything into your applications today.