Overview

Reuse browser context, auth, cookies, extensions, credentials, and browser settings across sessions.

Overview

Steel's profiles API allows you to create, update, and persist profiles acrsoss sessions. Profiles are used to store information about the browser session like auth, cookies, extensions, credentials, and browser settings.

Then you can keep reusing profiles across sessions for each different use case. Think a LinkedIn profile, a GitHub profile, or a Facebook profile.

This allows your agents to look more human, persist everything across sessions and frees you to focus on the most important part of your workflow.

Limits

  • There is a 300 MB limit on the size of a profile, if the upload fails after a session, the profile will be set to a FAILED state and cannot be used
  • If a profile is not used after 30 days, it will be automatically deleted

How Profiles Work

Profiles work by storing a snapshot of the browser's User Data Directory. This includes all the data that is stored in the browser, such as cookies, extensions, credentials, and browser settings.

  1. 1Session gets created with a persistProfile flag
  2. 2Initial profile gets created with some information on the session and gets stored in an UPLOADING state
  3. 3After the session is released, the userDataDir is persisted and the additional information on the profile is updated and the profile is set to the READY state
  4. 4Whenever a session is created with the profileId, the profile is loaded from the storage and the session is started with the same userDataDir and context

Persist a profile when starting a session

1
// Start a session and persist the profile
2
const firstSession = await client.sessions.create({ persistProfile: true })

Start a second session with your new profile

1
// Start a session with the persisted profile
2
const secondSession = await client.sessions.create({ profileId: firstSession.profileId })

This will return a profileId from the session which will allow you to pass it into new sessions in the future.

Persisting browser information automatically

Persisting additional information about the browser session like auth, cookies, extensions, credentials, and browser settings is not on by default, to keep building up context with each session, pass persistProfile=True along with your profileId.

Update your profile after a new session

1
// Update the profile with new information, this will update the profile with whatever happens in the session
2
const thirdSession = await client.sessions.create({ profileId: firstSession.profileId, persistProfile: true })

Persisting browser information manually

You can also manually create and update a profile via the Profiles API. This allows you to update the proxy, user-agent, or replace the entire userDataDir for your profile.

Create your profile

1
// Create a new profile with new information
2
await client.profiles.create({ userDataDir: fs.readFileSync('path/to/userDataDir.zip'), userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'})

Update your profile with some information

1
// Update the profile with new information, this will be used next session
2
await client.profiles.update(firstSession.profileId, { userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'})