curl --request POST \
--url https://api.anchorbrowser.io/v2/tasks/generate \
--header 'Content-Type: application/json' \
--header 'anchor-api-key: <api-key>' \
--data '
{
"taskName": "file-downloader",
"taskPrompt": "Create a task that downloads a specific file from a given URL."
}
'import requests
url = "https://api.anchorbrowser.io/v2/tasks/generate"
payload = {
"taskName": "file-downloader",
"taskPrompt": "Create a task that downloads a specific file from a given URL."
}
headers = {
"anchor-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'anchor-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
taskName: 'file-downloader',
taskPrompt: 'Create a task that downloads a specific file from a given URL.'
})
};
fetch('https://api.anchorbrowser.io/v2/tasks/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anchorbrowser.io/v2/tasks/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'taskName' => 'file-downloader',
'taskPrompt' => 'Create a task that downloads a specific file from a given URL.'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"anchor-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.anchorbrowser.io/v2/tasks/generate"
payload := strings.NewReader("{\n \"taskName\": \"file-downloader\",\n \"taskPrompt\": \"Create a task that downloads a specific file from a given URL.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("anchor-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.anchorbrowser.io/v2/tasks/generate")
.header("anchor-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"taskName\": \"file-downloader\",\n \"taskPrompt\": \"Create a task that downloads a specific file from a given URL.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anchorbrowser.io/v2/tasks/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["anchor-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"taskName\": \"file-downloader\",\n \"taskPrompt\": \"Create a task that downloads a specific file from a given URL.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "generating",
"taskId": "<string>",
"taskVersionId": "<string>",
"projectId": "<string>"
}{
"error": {
"code": 123,
"message": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>"
}
}Generate a Task
Starts asynchronous generation of a new task from a natural-language prompt.
Poll GET /v2/tasks/{taskId}/generation-status until the status is ready.
curl --request POST \
--url https://api.anchorbrowser.io/v2/tasks/generate \
--header 'Content-Type: application/json' \
--header 'anchor-api-key: <api-key>' \
--data '
{
"taskName": "file-downloader",
"taskPrompt": "Create a task that downloads a specific file from a given URL."
}
'import requests
url = "https://api.anchorbrowser.io/v2/tasks/generate"
payload = {
"taskName": "file-downloader",
"taskPrompt": "Create a task that downloads a specific file from a given URL."
}
headers = {
"anchor-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'anchor-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
taskName: 'file-downloader',
taskPrompt: 'Create a task that downloads a specific file from a given URL.'
})
};
fetch('https://api.anchorbrowser.io/v2/tasks/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anchorbrowser.io/v2/tasks/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'taskName' => 'file-downloader',
'taskPrompt' => 'Create a task that downloads a specific file from a given URL.'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"anchor-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.anchorbrowser.io/v2/tasks/generate"
payload := strings.NewReader("{\n \"taskName\": \"file-downloader\",\n \"taskPrompt\": \"Create a task that downloads a specific file from a given URL.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("anchor-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.anchorbrowser.io/v2/tasks/generate")
.header("anchor-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"taskName\": \"file-downloader\",\n \"taskPrompt\": \"Create a task that downloads a specific file from a given URL.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anchorbrowser.io/v2/tasks/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["anchor-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"taskName\": \"file-downloader\",\n \"taskPrompt\": \"Create a task that downloads a specific file from a given URL.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "generating",
"taskId": "<string>",
"taskVersionId": "<string>",
"projectId": "<string>"
}{
"error": {
"code": 123,
"message": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>"
}
}Authorizations
API key for your Anchor Browser account, sent as the anchor-api-key header on every
request. Create one at app.anchorbrowser.io (API Access),
or obtain one programmatically via the unauthenticated agent-access flow
(POST /v1/agent-access).
Body
Name of the task
Natural-language description of what the task should do, used for AI generation. Make it as detailed as possible with all the logic and steps needed to complete the task.
Whether to generate the task asynchronously
Description of the task
Optional application (connection) ID to associate with the task
Optional identity ID to use during task generation
Input parameters the task accepts
Show child attributes
Show child attributes
Output fields the task produces
Show child attributes
Show child attributes
Whether task runs should return only the bundled session downloads file
Allow human intervention during task execution
Existing finished browser session id to generate the workflow from
Optional default browser/session configuration when running this task
Response
Task generation started
The ID of the created task (use with generation-status and run endpoints)
Whether the task is still generating, ready to run, or failed
generating The ID of the task being generated
The ID of the task version being generated
The ID of the underlying generation project
Was this page helpful?

