Functions API
Invoke a Function
POST
/
v1
/
functions
/
{id}
/
invoke
Invoke a Function
curl --request POST \
--url https://api.browserbase.com/v1/functions/{id}/invoke \
--header 'Content-Type: application/json' \
--header 'X-BB-API-Key: <api-key>' \
--data '
{
"params": {},
"sessionCreateParams": {
"extensionId": "<string>",
"browserSettings": {
"extensionId": "<string>",
"viewport": {
"width": 123,
"height": 123
},
"blockAds": true,
"solveCaptchas": true,
"recordSession": true,
"logSession": true,
"advancedStealth": true,
"verified": true,
"captchaImageSelector": "<string>",
"captchaInputSelector": "<string>",
"size": "small",
"enableNativeSelectPolyfill": true,
"enablePdfViewer": true,
"extensions": [],
"allowedDomains": [],
"ignoreCertificateErrors": true
},
"proxies": [
{
"type": "browserbase",
"domainPattern": "<string>"
}
],
"proxySettings": {
"caCertificates": []
},
"userMetadata": {},
"timeout": 900
}
}
'import requests
url = "https://api.browserbase.com/v1/functions/{id}/invoke"
payload = {
"params": {},
"sessionCreateParams": {
"extensionId": "<string>",
"browserSettings": {
"extensionId": "<string>",
"viewport": {
"width": 123,
"height": 123
},
"blockAds": True,
"solveCaptchas": True,
"recordSession": True,
"logSession": True,
"advancedStealth": True,
"verified": True,
"captchaImageSelector": "<string>",
"captchaInputSelector": "<string>",
"size": "small",
"enableNativeSelectPolyfill": True,
"enablePdfViewer": True,
"extensions": [],
"allowedDomains": [],
"ignoreCertificateErrors": True
},
"proxies": [
{
"type": "browserbase",
"domainPattern": "<string>"
}
],
"proxySettings": { "caCertificates": [] },
"userMetadata": {},
"timeout": 900
}
}
headers = {
"X-BB-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-BB-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
params: {},
sessionCreateParams: {
extensionId: '<string>',
browserSettings: {
extensionId: '<string>',
viewport: {width: 123, height: 123},
blockAds: true,
solveCaptchas: true,
recordSession: true,
logSession: true,
advancedStealth: true,
verified: true,
captchaImageSelector: '<string>',
captchaInputSelector: '<string>',
size: 'small',
enableNativeSelectPolyfill: true,
enablePdfViewer: true,
extensions: [],
allowedDomains: [],
ignoreCertificateErrors: true
},
proxies: [{type: 'browserbase', domainPattern: '<string>'}],
proxySettings: {caCertificates: []},
userMetadata: {},
timeout: 900
}
})
};
fetch('https://api.browserbase.com/v1/functions/{id}/invoke', 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.browserbase.com/v1/functions/{id}/invoke",
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([
'params' => [
],
'sessionCreateParams' => [
'extensionId' => '<string>',
'browserSettings' => [
'extensionId' => '<string>',
'viewport' => [
'width' => 123,
'height' => 123
],
'blockAds' => true,
'solveCaptchas' => true,
'recordSession' => true,
'logSession' => true,
'advancedStealth' => true,
'verified' => true,
'captchaImageSelector' => '<string>',
'captchaInputSelector' => '<string>',
'size' => 'small',
'enableNativeSelectPolyfill' => true,
'enablePdfViewer' => true,
'extensions' => [
],
'allowedDomains' => [
],
'ignoreCertificateErrors' => true
],
'proxies' => [
[
'type' => 'browserbase',
'domainPattern' => '<string>'
]
],
'proxySettings' => [
'caCertificates' => [
]
],
'userMetadata' => [
],
'timeout' => 900
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-BB-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.browserbase.com/v1/functions/{id}/invoke"
payload := strings.NewReader("{\n \"params\": {},\n \"sessionCreateParams\": {\n \"extensionId\": \"<string>\",\n \"browserSettings\": {\n \"extensionId\": \"<string>\",\n \"viewport\": {\n \"width\": 123,\n \"height\": 123\n },\n \"blockAds\": true,\n \"solveCaptchas\": true,\n \"recordSession\": true,\n \"logSession\": true,\n \"advancedStealth\": true,\n \"verified\": true,\n \"captchaImageSelector\": \"<string>\",\n \"captchaInputSelector\": \"<string>\",\n \"size\": \"small\",\n \"enableNativeSelectPolyfill\": true,\n \"enablePdfViewer\": true,\n \"extensions\": [],\n \"allowedDomains\": [],\n \"ignoreCertificateErrors\": true\n },\n \"proxies\": [\n {\n \"type\": \"browserbase\",\n \"domainPattern\": \"<string>\"\n }\n ],\n \"proxySettings\": {\n \"caCertificates\": []\n },\n \"userMetadata\": {},\n \"timeout\": 900\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-BB-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.browserbase.com/v1/functions/{id}/invoke")
.header("X-BB-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"params\": {},\n \"sessionCreateParams\": {\n \"extensionId\": \"<string>\",\n \"browserSettings\": {\n \"extensionId\": \"<string>\",\n \"viewport\": {\n \"width\": 123,\n \"height\": 123\n },\n \"blockAds\": true,\n \"solveCaptchas\": true,\n \"recordSession\": true,\n \"logSession\": true,\n \"advancedStealth\": true,\n \"verified\": true,\n \"captchaImageSelector\": \"<string>\",\n \"captchaInputSelector\": \"<string>\",\n \"size\": \"small\",\n \"enableNativeSelectPolyfill\": true,\n \"enablePdfViewer\": true,\n \"extensions\": [],\n \"allowedDomains\": [],\n \"ignoreCertificateErrors\": true\n },\n \"proxies\": [\n {\n \"type\": \"browserbase\",\n \"domainPattern\": \"<string>\"\n }\n ],\n \"proxySettings\": {\n \"caCertificates\": []\n },\n \"userMetadata\": {},\n \"timeout\": 900\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.browserbase.com/v1/functions/{id}/invoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-BB-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"params\": {},\n \"sessionCreateParams\": {\n \"extensionId\": \"<string>\",\n \"browserSettings\": {\n \"extensionId\": \"<string>\",\n \"viewport\": {\n \"width\": 123,\n \"height\": 123\n },\n \"blockAds\": true,\n \"solveCaptchas\": true,\n \"recordSession\": true,\n \"logSession\": true,\n \"advancedStealth\": true,\n \"verified\": true,\n \"captchaImageSelector\": \"<string>\",\n \"captchaInputSelector\": \"<string>\",\n \"size\": \"small\",\n \"enableNativeSelectPolyfill\": true,\n \"enablePdfViewer\": true,\n \"extensions\": [],\n \"allowedDomains\": [],\n \"ignoreCertificateErrors\": true\n },\n \"proxies\": [\n {\n \"type\": \"browserbase\",\n \"domainPattern\": \"<string>\"\n }\n ],\n \"proxySettings\": {\n \"caCertificates\": []\n },\n \"userMetadata\": {},\n \"timeout\": 900\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"functionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"versionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"region": "<string>",
"params": {},
"results": "<string>",
"endedAt": "2023-11-07T05:31:56Z"
}Authorizations
Your Browserbase API Key.
Path Parameters
Body
application/json
Response
202 - application/json
The request has been accepted for processing, but processing has not yet completed.
Available options:
PENDING, RUNNING, COMPLETED, FAILED Minimum string length:
1JSON object that can be stored in a JSONB column
Any JSON-serializable value that can be stored in a JSONB column
Was this page helpful?
⌘I
Invoke a Function
curl --request POST \
--url https://api.browserbase.com/v1/functions/{id}/invoke \
--header 'Content-Type: application/json' \
--header 'X-BB-API-Key: <api-key>' \
--data '
{
"params": {},
"sessionCreateParams": {
"extensionId": "<string>",
"browserSettings": {
"extensionId": "<string>",
"viewport": {
"width": 123,
"height": 123
},
"blockAds": true,
"solveCaptchas": true,
"recordSession": true,
"logSession": true,
"advancedStealth": true,
"verified": true,
"captchaImageSelector": "<string>",
"captchaInputSelector": "<string>",
"size": "small",
"enableNativeSelectPolyfill": true,
"enablePdfViewer": true,
"extensions": [],
"allowedDomains": [],
"ignoreCertificateErrors": true
},
"proxies": [
{
"type": "browserbase",
"domainPattern": "<string>"
}
],
"proxySettings": {
"caCertificates": []
},
"userMetadata": {},
"timeout": 900
}
}
'import requests
url = "https://api.browserbase.com/v1/functions/{id}/invoke"
payload = {
"params": {},
"sessionCreateParams": {
"extensionId": "<string>",
"browserSettings": {
"extensionId": "<string>",
"viewport": {
"width": 123,
"height": 123
},
"blockAds": True,
"solveCaptchas": True,
"recordSession": True,
"logSession": True,
"advancedStealth": True,
"verified": True,
"captchaImageSelector": "<string>",
"captchaInputSelector": "<string>",
"size": "small",
"enableNativeSelectPolyfill": True,
"enablePdfViewer": True,
"extensions": [],
"allowedDomains": [],
"ignoreCertificateErrors": True
},
"proxies": [
{
"type": "browserbase",
"domainPattern": "<string>"
}
],
"proxySettings": { "caCertificates": [] },
"userMetadata": {},
"timeout": 900
}
}
headers = {
"X-BB-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-BB-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
params: {},
sessionCreateParams: {
extensionId: '<string>',
browserSettings: {
extensionId: '<string>',
viewport: {width: 123, height: 123},
blockAds: true,
solveCaptchas: true,
recordSession: true,
logSession: true,
advancedStealth: true,
verified: true,
captchaImageSelector: '<string>',
captchaInputSelector: '<string>',
size: 'small',
enableNativeSelectPolyfill: true,
enablePdfViewer: true,
extensions: [],
allowedDomains: [],
ignoreCertificateErrors: true
},
proxies: [{type: 'browserbase', domainPattern: '<string>'}],
proxySettings: {caCertificates: []},
userMetadata: {},
timeout: 900
}
})
};
fetch('https://api.browserbase.com/v1/functions/{id}/invoke', 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.browserbase.com/v1/functions/{id}/invoke",
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([
'params' => [
],
'sessionCreateParams' => [
'extensionId' => '<string>',
'browserSettings' => [
'extensionId' => '<string>',
'viewport' => [
'width' => 123,
'height' => 123
],
'blockAds' => true,
'solveCaptchas' => true,
'recordSession' => true,
'logSession' => true,
'advancedStealth' => true,
'verified' => true,
'captchaImageSelector' => '<string>',
'captchaInputSelector' => '<string>',
'size' => 'small',
'enableNativeSelectPolyfill' => true,
'enablePdfViewer' => true,
'extensions' => [
],
'allowedDomains' => [
],
'ignoreCertificateErrors' => true
],
'proxies' => [
[
'type' => 'browserbase',
'domainPattern' => '<string>'
]
],
'proxySettings' => [
'caCertificates' => [
]
],
'userMetadata' => [
],
'timeout' => 900
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-BB-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.browserbase.com/v1/functions/{id}/invoke"
payload := strings.NewReader("{\n \"params\": {},\n \"sessionCreateParams\": {\n \"extensionId\": \"<string>\",\n \"browserSettings\": {\n \"extensionId\": \"<string>\",\n \"viewport\": {\n \"width\": 123,\n \"height\": 123\n },\n \"blockAds\": true,\n \"solveCaptchas\": true,\n \"recordSession\": true,\n \"logSession\": true,\n \"advancedStealth\": true,\n \"verified\": true,\n \"captchaImageSelector\": \"<string>\",\n \"captchaInputSelector\": \"<string>\",\n \"size\": \"small\",\n \"enableNativeSelectPolyfill\": true,\n \"enablePdfViewer\": true,\n \"extensions\": [],\n \"allowedDomains\": [],\n \"ignoreCertificateErrors\": true\n },\n \"proxies\": [\n {\n \"type\": \"browserbase\",\n \"domainPattern\": \"<string>\"\n }\n ],\n \"proxySettings\": {\n \"caCertificates\": []\n },\n \"userMetadata\": {},\n \"timeout\": 900\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-BB-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.browserbase.com/v1/functions/{id}/invoke")
.header("X-BB-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"params\": {},\n \"sessionCreateParams\": {\n \"extensionId\": \"<string>\",\n \"browserSettings\": {\n \"extensionId\": \"<string>\",\n \"viewport\": {\n \"width\": 123,\n \"height\": 123\n },\n \"blockAds\": true,\n \"solveCaptchas\": true,\n \"recordSession\": true,\n \"logSession\": true,\n \"advancedStealth\": true,\n \"verified\": true,\n \"captchaImageSelector\": \"<string>\",\n \"captchaInputSelector\": \"<string>\",\n \"size\": \"small\",\n \"enableNativeSelectPolyfill\": true,\n \"enablePdfViewer\": true,\n \"extensions\": [],\n \"allowedDomains\": [],\n \"ignoreCertificateErrors\": true\n },\n \"proxies\": [\n {\n \"type\": \"browserbase\",\n \"domainPattern\": \"<string>\"\n }\n ],\n \"proxySettings\": {\n \"caCertificates\": []\n },\n \"userMetadata\": {},\n \"timeout\": 900\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.browserbase.com/v1/functions/{id}/invoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-BB-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"params\": {},\n \"sessionCreateParams\": {\n \"extensionId\": \"<string>\",\n \"browserSettings\": {\n \"extensionId\": \"<string>\",\n \"viewport\": {\n \"width\": 123,\n \"height\": 123\n },\n \"blockAds\": true,\n \"solveCaptchas\": true,\n \"recordSession\": true,\n \"logSession\": true,\n \"advancedStealth\": true,\n \"verified\": true,\n \"captchaImageSelector\": \"<string>\",\n \"captchaInputSelector\": \"<string>\",\n \"size\": \"small\",\n \"enableNativeSelectPolyfill\": true,\n \"enablePdfViewer\": true,\n \"extensions\": [],\n \"allowedDomains\": [],\n \"ignoreCertificateErrors\": true\n },\n \"proxies\": [\n {\n \"type\": \"browserbase\",\n \"domainPattern\": \"<string>\"\n }\n ],\n \"proxySettings\": {\n \"caCertificates\": []\n },\n \"userMetadata\": {},\n \"timeout\": 900\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"functionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"versionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"region": "<string>",
"params": {},
"results": "<string>",
"endedAt": "2023-11-07T05:31:56Z"
}