Create Browser Session
Create a new browser session.
Pricing: Browser sessions are charged per browser-hour at your account rate, shown on your billing page.
The full rate is charged upfront when the session starts. When you stop the session, any unused time is automatically refunded proportionally.
Billing is rounded up to the minute (minimum 1 minute). For example, if you stop a session after 30 minutes, you’ll be refunded half the charged amount.
Session Limits:
- All users: Up to 4 hours per session
POST
/
browsers
Create Browser Session
const options = {
method: 'POST',
headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profileId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
proxyCountryCode: 'us',
metadata: {},
timeout: 60,
browserScreenWidth: 3232,
browserScreenHeight: 1888,
allowResizing: false,
pdfRendererEnabled: true,
solveCaptchas: true,
customProxy: {
host: '<string>',
port: 32768,
username: '<string>',
password: '<string>',
ignoreCertErrors: false,
caBundle: '<string>',
caBundleUrl: '<string>'
},
enableRecording: false,
extensionIds: []
})
};
fetch('https://api.browser-use.com/api/v2/browsers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.browser-use.com/api/v2/browsers \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"profileId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"proxyCountryCode": "us",
"metadata": {},
"timeout": 60,
"browserScreenWidth": 3232,
"browserScreenHeight": 1888,
"allowResizing": false,
"pdfRendererEnabled": true,
"solveCaptchas": true,
"customProxy": {
"host": "<string>",
"port": 32768,
"username": "<string>",
"password": "<string>",
"ignoreCertErrors": false,
"caBundle": "<string>",
"caBundleUrl": "<string>"
},
"enableRecording": false,
"extensionIds": []
}
'import requests
url = "https://api.browser-use.com/api/v2/browsers"
payload = {
"profileId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"proxyCountryCode": "us",
"metadata": {},
"timeout": 60,
"browserScreenWidth": 3232,
"browserScreenHeight": 1888,
"allowResizing": False,
"pdfRendererEnabled": True,
"solveCaptchas": True,
"customProxy": {
"host": "<string>",
"port": 32768,
"username": "<string>",
"password": "<string>",
"ignoreCertErrors": False,
"caBundle": "<string>",
"caBundleUrl": "<string>"
},
"enableRecording": False,
"extensionIds": []
}
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"timeoutAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"liveUrl": "<string>",
"cdpUrl": "<string>",
"finishedAt": "2023-11-07T05:31:56Z",
"proxyUsedMb": "0",
"proxyCost": "0",
"browserCost": "0",
"agentSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"recordingUrl": "<string>",
"metadata": {},
"extensions": []
}{
"detail": "<string>"
}{
"detail": "Maximum session timeout is 4 hours (240 minutes)."
}{
"detail": "Profile not found"
}{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}{
"detail": "Too many concurrent active sessions. Please wait for one to finish, kill one, or upgrade your plan."
}Body
application/json
Request model for creating a browser session.
Country code for proxy location. Defaults to US. Set to null to disable proxy.
Available options:
ad, ae, af, ag, ai, al, am, an, ao, aq, ar, as, at, au, aw, az, ba, bb, bd, be, bf, bg, bh, bi, bj, bl, bm, bn, bo, bq, br, bs, bt, bv, bw, by, bz, ca, cc, cd, cf, cg, ch, ci, ck, cl, cm, co, cr, cs, cu, cv, cw, cx, cy, cz, de, dj, dk, dm, do, dz, ec, ee, eg, eh, er, es, et, fi, fj, fk, fm, fo, fr, ga, gd, ge, gf, gg, gh, gi, gl, gm, gn, gp, gq, gr, gs, gt, gu, gw, gy, hk, hm, hn, hr, ht, hu, id, ie, il, im, in, iq, ir, is, it, je, jm, jo, jp, ke, kg, kh, ki, km, kn, kp, kr, kw, ky, kz, la, lb, lc, li, lk, lr, ls, lt, lu, lv, ly, ma, mc, md, me, mf, mg, mh, mk, ml, mm, mn, mo, mp, mq, mr, ms, mt, mu, mv, mw, mx, my, mz, na, nc, ne, nf, ng, ni, nl, no, np, nr, nu, nz, om, pa, pe, pf, pg, ph, pk, pl, pm, pn, pr, ps, pt, pw, py, qa, re, ro, rs, ru, rw, sa, sb, sc, sd, se, sg, sh, si, sj, sk, sl, sm, sn, so, sr, ss, st, sv, sx, sy, sz, tc, td, tf, tg, th, tj, tk, tl, tm, tn, to, tr, tt, tv, tw, tz, ua, ug, uk, us, uy, uz, va, vc, ve, vg, vi, vn, vu, wf, ws, xk, ye, yt, za, zm, zw Response
Successful Response
View model for representing a browser session in list views.
Was this page helpful?
⌘I
Create Browser Session
const options = {
method: 'POST',
headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profileId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
proxyCountryCode: 'us',
metadata: {},
timeout: 60,
browserScreenWidth: 3232,
browserScreenHeight: 1888,
allowResizing: false,
pdfRendererEnabled: true,
solveCaptchas: true,
customProxy: {
host: '<string>',
port: 32768,
username: '<string>',
password: '<string>',
ignoreCertErrors: false,
caBundle: '<string>',
caBundleUrl: '<string>'
},
enableRecording: false,
extensionIds: []
})
};
fetch('https://api.browser-use.com/api/v2/browsers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.browser-use.com/api/v2/browsers \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"profileId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"proxyCountryCode": "us",
"metadata": {},
"timeout": 60,
"browserScreenWidth": 3232,
"browserScreenHeight": 1888,
"allowResizing": false,
"pdfRendererEnabled": true,
"solveCaptchas": true,
"customProxy": {
"host": "<string>",
"port": 32768,
"username": "<string>",
"password": "<string>",
"ignoreCertErrors": false,
"caBundle": "<string>",
"caBundleUrl": "<string>"
},
"enableRecording": false,
"extensionIds": []
}
'import requests
url = "https://api.browser-use.com/api/v2/browsers"
payload = {
"profileId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"proxyCountryCode": "us",
"metadata": {},
"timeout": 60,
"browserScreenWidth": 3232,
"browserScreenHeight": 1888,
"allowResizing": False,
"pdfRendererEnabled": True,
"solveCaptchas": True,
"customProxy": {
"host": "<string>",
"port": 32768,
"username": "<string>",
"password": "<string>",
"ignoreCertErrors": False,
"caBundle": "<string>",
"caBundleUrl": "<string>"
},
"enableRecording": False,
"extensionIds": []
}
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"timeoutAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"liveUrl": "<string>",
"cdpUrl": "<string>",
"finishedAt": "2023-11-07T05:31:56Z",
"proxyUsedMb": "0",
"proxyCost": "0",
"browserCost": "0",
"agentSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"recordingUrl": "<string>",
"metadata": {},
"extensions": []
}{
"detail": "<string>"
}{
"detail": "Maximum session timeout is 4 hours (240 minutes)."
}{
"detail": "Profile not found"
}{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}{
"detail": "Too many concurrent active sessions. Please wait for one to finish, kill one, or upgrade your plan."
}