Profiles

How to save and restore profiles with Airtop

What are profiles?

Profiles are saved archives of the artifacts produced by a browsing session. Most importantly, they contain the cookies and local storage of a session, which can be used to hydrate future sessions and keep the same authenticated state. You will want to use profiles when your users need to authenticate to a site via a Live View, and you want to save the authenticated state for your agents to use.

Creating a new profile

When you create a new session, you can request that the profile generated by that session be persisted by passing the persistProfile parameter as true.

1const session = await client.sessions.create({configuration: {persistProfile: true}});
2const profileId = session.data.profileId;

When the session returns, you will have a new profile ID that you can use to restore the profile later. Note that the profile will not be persisted until the session has been terminated.

Restoring an existing profile

If you have an existing profile ID, you can restore the profile by passing it to the sessions.create method.

1const session = await client.sessions.create({configuration: {baseProfileId: "YOUR_PROFILE_ID"}});

This session will be restored from the existing profile.

Profiles are immutable and cannot be changed once created. When you restore a profile, you are duplicating a base profile and making modifications to it. If you want to save a modified version of a profile, you will need start with a base profile and also request that your session’s profile be persisted, thereby creating a new profile.

1const session = await client.sessions.create({configuration: {persistProfile: true, baseProfileId: "ORIGINAL_PROFILE_ID"}});
2const profileId = session.data.profileId;

In this example, ORIGINAL_PROFILE_ID will be used to restore the profile, but the modified version of the profile will be saved with a new ID returned in profileId.

Fetching and deleting profiles

You can fetch a list of all profiles for your account using the profiles.get method.

1const profiles = await client.profiles.get();

You can also fetch a single profile by ID or a list of IDs, which is useful if you want to check the status of a profile.

1const profile = await client.profiles.get({profileIds: "PROFILE_ID"});
2const profiles = await client.profiles.get({profileIds: ["PROFILE_ID", "ANOTHER_PROFILE_ID"]});

Finally, you can delete profiles by ID, if you no longer want to retain them.

1await client.profiles.delete({profileIds: "PROFILE_ID"});
2await client.profiles.delete({profileIds: ["PROFILE_ID", "ANOTHER_PROFILE_ID"]});

Security & Privacy

Airtop takes the security and privacy of your data seriously. We never share any customer data, including profile data, with any third parties, nor do we use that data for any purpose other than to provide the service to you. All profiles are encrypted at rest using AES-256 encryption. If you have any questions or concerns about data privacy and security, please reach out to us at support@airtop.ai.

Built with