Configure a Browser Session
Select Steel session settings for browser tasks, stored state, regional access, mobile sites, and human control.
Use this guide to select stable, non-experimental session settings for a browser task. Start with no optional settings. Add only the settings that the task needs.
Start with the minimum
1import Steel from 'steel-sdk';23const client = new Steel({4steelAPIKey: process.env.STEEL_API_KEY,5});67const session = await client.sessions.create();
Steel creates a desktop, headful session with a default timeout of 5 minutes. A headful session has
a visible browser window. By default, Steel does not use a proxy or solve CAPTCHAs.
Choose a configuration
Recipes
Select the recipe that is closest to your task. Remove any setting that the task does not need.
| Task | Setting | Go to |
|---|---|---|
| Run standard browser automation | No optional setting | Start with the minimum |
Release an idle session before timeout | timeout, inactivityTimeout | Task with an inactivity timeout |
| Run a longer headless task and release it when idle | Headless and session life settings | Long-running headless worker |
| Extract text from a protected site | Proxy, CAPTCHA, and resource settings | Text extraction on a protected site |
| Detect a CAPTCHA and let a person respond | CAPTCHA and interactive viewer settings | CAPTCHA detection with human control |
| Use stored account state without saving changes | profileId | Account task without saved changes |
| Repeat an account task with one identity | Profile and dedicated IP settings | Account task with stored state |
| Open a mobile site from a selected country | Device and proxy settings | Mobile task in a selected country |
Find a setting
If you know the browser behavior that the task needs, use this table.
| Requirement | Setting | Go to |
|---|---|---|
| Use a residential IP | useProxy: true | Network identity |
| Select the IP location | useProxy.geolocation | Network identity |
| Use the same dedicated IP | useProxy: { type: "fixed", id: "fixed:…" } | Network identity |
| Run the browser in a selected region | region | Network identity |
| Load saved browser state | profileId | Stored state |
| Save profile changes after release | persistProfile: true | Stored state |
| Add cookies or web storage | sessionContext | Stored state |
| Use credentials that Steel stores | credentials | Stored state |
| Detect or solve CAPTCHAs | solveCaptcha | Page support |
| Let a person control the browser | debugConfig.interactive: true | Viewer and connection |
| Make the viewer read-only | debugConfig.interactive: false | Viewer and connection |
| Connect with Selenium | isSelenium: true | Viewer and connection |
| Block page resources | optimizeBandwidth | Resource control |
| Load browser extensions | extensionIds | Resource control |
| Set the browser window size | dimensions | Browser interface |
| Use fullscreen mode | fullscreen: true | Browser interface |
| Select the project context | projectId, namespace | Project context |
useProxy accepts true, false, or a configuration object. Properties such as geolocation are
part of the useProxy object.
Common configurations
Each recipe below is a JSON request body with only the settings for its task. Save a recipe as
session.json. Send the file to POST /v1/sessions with curl.
1curl https://api.steel.dev/v1/sessions \2-H "steel-api-key: $STEEL_API_KEY" \3-H "Content-Type: application/json" \4-d @session.json
@session.json tells curl to read the request body from that file. For supported TypeScript SDK
settings, pass the same object to client.sessions.create(...). If the SDK type does not include a
setting, use the REST API for that recipe.
Task with an inactivity timeout
If Steel must release an idle session before timeout, use this recipe. Steel releases the session
after 1 minute without a Chrome DevTools Protocol (CDP) command or remote input.
1{2"timeout": 600000,3"inactivityTimeout": 600004}
This request sets timeout to 10 minutes. Activity resets the 1-minute inactivity timer.
Long-running headless worker
If an unattended task can run for several minutes, use this recipe. Steel releases the session after 2 minutes without a CDP command or remote input.
1{2"headless": true,3"timeout": 900000,4"inactivityTimeout": 1200005}
The task can run for up to 15 minutes. Activity resets the 2-minute inactivity timer.
Text extraction on a protected site
If the task needs a residential IP and automatic CAPTCHA solving, use these settings. Your account must have access to these features.
1{2"useProxy": true,3"solveCaptcha": true,4"optimizeBandwidth": {5"blockImages": true,6"blockMedia": true,7"blockStylesheets": false8}9}
This recipe keeps stylesheets because they can affect page behavior. Remove each setting that the task does not need.
CAPTCHA detection with human control
If Steel must detect a supported CAPTCHA and a person must respond in the live viewer, use this recipe. Your account must have access to CAPTCHA solving.
1{2"solveCaptcha": true,3"stealthConfig": {4"autoCaptchaSolving": false5},6"debugConfig": {7"interactive": true8}9}
Steel detects the CAPTCHA without solving it automatically. The live viewer accepts input because the session is interactive. Protect the debug URL before you share it.
Account task without saved changes
If the task needs profile state without saving changes, use this recipe. Before you use the recipe,
confirm that the profile status is READY. Replace the example UUID with a profile UUID from your
workspace.
1{2"profileId": "123e4567-e89b-12d3-a456-426614174000"3}
Steel restores the profile state for the session. Because the request omits persistProfile, Steel
does not save the session's profile changes after release.
Account task with stored state
Before you use these settings, confirm that the profile status is READY. Replace the example
profile UUID with a profile UUID from your workspace. Replace the example dedicated IP ID with an ID
from your workspace.
1{2"profileId": "123e4567-e89b-12d3-a456-426614174000",3"persistProfile": true,4"useProxy": {5"type": "fixed",6"id": "fixed:8SdfYs77me"7}8}
This recipe restores stored browser state. Steel saves the new browser state after you release the session. The recipe also uses one dedicated IP.
Mobile task in a selected country
If the site must show its mobile version for a selected country, use these settings. Your account must have access to Steel-provided proxies.
1{2"deviceConfig": {3"device": "mobile"4},5"useProxy": {6"geolocation": {7"country": "DE"8}9}10}
The mobile setting controls the browser fingerprint and input behavior. The proxy setting controls the public IP location.
Setting reference
The following sections explain stable session settings by topic. Use Find a setting to open a section.
Session life
Use these settings to control the total and idle session life.
| Setting | Guidance |
|---|---|
timeout | Sets the requested maximum session life. The default is 300000 ms (5 minutes). Set the value to 15000 ms or more. Your account limits set the maximum permitted value. |
inactivityTimeout | Releases an idle session before timeout. Set the value below timeout. If your SDK type does not include this field, use the REST API. |
CDP commands and remote input reset the inactivity timer. After the task is complete, release the session. See Session Lifecycle for session states and release methods.
Network identity
Use the smallest location scope that the task needs.
| Requirement | Configuration |
|---|---|
| Use the browser machine IP | Set useProxy to false. Omit proxyUrl. |
| Use a residential IP | Set useProxy to true. |
| Select a country, state, or city | Set useProxy.geolocation. Include a country. |
| Use one dedicated IP | Set useProxy.type to fixed and add the dedicated IP id. |
| Use any active dedicated IP | Set useProxy.type to fixed and omit id. |
| Use your proxy | Set useProxy.server or proxyUrl. |
| Select the browser region | Set region. |
regionselects the location of the browser process. Proxy geolocation selects the public IP location that the site receives.- If you load a profile,
useProxy: falseoverrides the proxy setting in that profile. proxyUrloverridesuseProxy. Use only one custom proxy method in a session request.
See Multi-Region Sessions, Proxies, and Dedicated IPs.
Stored state
Select the state methods that the task needs.
| Available state | Method |
|---|---|
| A specific set of cookies or web storage | Use sessionContext. |
| Browser state that must change across sessions | Use a profile. |
| Credentials that Steel stores | Add a credentials object. |
You can use more than one state method in a session. A request-level sessionContext replaces the
profile session context. A request-level credentials object replaces the profile credentials.
Save changes in a profile
To create a profile from a session, set persistProfile to true. Before you use the new profile,
complete these steps:
- 1Copy
profileIdfrom the first session response. - 2Complete the browser task.
- 3Release the first session.
- 4Wait until the profile status is
READY. - 5Create the next session with
profileId. - 6If the next session must save its changes, set
persistProfiletotrue.
Profile and credential rules:
- The API returns
409if the profile status isUPLOADING. - A profile UUID must identify a profile in the same project.
- Stored credentials must use the same project and namespace as the session.
- The
credentialsobject can submit stored values automatically, blur credential fields, and require an exact origin match.
See Profiles, Reusing Auth Context, and Credentials.
Browser interface
Use these settings to select the window size, mobile identity, or display mode.
| Requirement | Configuration |
|---|---|
| Set the browser window size | Set dimensions. |
| Use a mobile browser identity | Set deviceConfig.device to "mobile". If the request and profile omit dimensions, Steel uses 508×1074. |
| Fill the browser screen | Set fullscreen to true. Fullscreen mode uses 1920×1080 and ignores dimensions. |
| Set a specific user agent | Set userAgent. |
Steel rejects custom mobile dimensions below 508×1074 (width × height). Use mobile mode for a complete mobile browser identity. See Mobile Mode and Fullscreen Mode.
Page support
Set solveCaptcha to true to detect and solve supported CAPTCHA types. Use this recipe to detect a
CAPTCHA without automatic solving:
1{2"solveCaptcha": true,3"stealthConfig": {4"autoCaptchaSolving": false5}6}
- Set
stealthConfig.humanizeInteractionstotrueto simulate human pointer movements and keystrokes. - If the task controls the browser fingerprint, set
stealthConfig.skipFingerprintInjectiontotrue. - For all other tasks, omit
stealthConfig.skipFingerprintInjection.
See CAPTCHA Solving for automatic and manual solve methods.
Resource control
Steel does not block ads by default. Use resource settings only when the task needs different behavior.
| Requirement | Configuration |
|---|---|
| Block ads | Set blockAds to true. |
| Block images, media, and stylesheets | Set optimizeBandwidth to true. |
| Select resource types, hosts, or URL patterns | Set optimizeBandwidth to an object. |
| Load uploaded extensions | Set extensionIds to the uploaded extension IDs. See Extensions for extension management. |
Block only the resources that the task does not use. If the task uses screenshots or visual analysis, do not block images. If layout or visibility is important, do not block stylesheets.
Viewer and connection
Use these settings to control the viewer and browser connection.
| Requirement | Configuration |
|---|---|
| Allow input from the live viewer | Set debugConfig.interactive to true. This is the default. |
| Make the live viewer read-only | Set debugConfig.interactive to false, or add interactive=false to the viewer URL. |
| Show the system cursor in a headful stream | Set debugConfig.systemCursor to true. This is the default and does not control viewer input. |
| Use a headless browser | Set headless to true. |
| Connect with Selenium | Set isSelenium to true. This forces headless to true, even if the request sets headless to false. |
The viewer URL cannot make a read-only session interactive.
Anyone with the debug URL can view the session and control an interactive session. Before you share the debug URL, add application access controls.
See Live Sessions, Human-in-the-Loop Controls, and Selenium.
Project context
Use projectId and namespace only to select a different project context. Stored credentials must
use the same project and namespace as the session. For exact request types and validation rules, see
the API Reference.