POST
/
tasks
JavaScript
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
  apiKey: 'My API Key',
});

const task = await client.tasks.create({ task: 'x' });

console.log(task.id);
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Authorizations

X-Browser-Use-API-Key
string
header
required

Body

application/json

Request model for creating a new task

Attributes: task: The task prompt/instruction for the agent agent_settings: Agent configuration (optional) browser_settings: Browser configuration (optional) included_file_names: Optional list of file names to include in the task (file names from user file presigned upload URL response) structured_output_json: JSON schema for structured output (optional) metadata: Additional metadata associated with the task (optionally set by the user) secrets: Sensitive data (passwords, tokens) for the session (deleted after session is stopped)

Response

202
application/json

Successful Response

Response model for creating a task

Attributes: task_id: An unique identifier for the created task session_id: The ID of the session this task belongs to