Cookie & Account Import Guide
Learn how to import existing cookies, account credentials, and session data into NestBrowser profiles to instantly set up established accounts.
Importing existing cookies and account data is one of NestBrowser’s most powerful features. Whether you’re migrating accounts from another device, transferring accounts between team members, or restoring from a backup — cookie import lets you skip the manual login process and get straight to work.
Why Cookie Import Matters
For multi-account operators, cookies represent account state: login credentials, session tokens, platform personalization settings.
If you’re:
- Migrating existing accounts: Moving from another device or browser to NestBrowser
- Transferring account control: Handing an account from one operator to another while preserving the logged-in state
- Restoring backups: Recovering account states from saved exports
- Minimizing detection risk: Aged accounts with browsing history and cookies carry lower detection risk than fresh accounts
Supported Import Formats
NestBrowser supports these cookie formats:
- JSON format (Chrome/Chromium extension export format)
- Netscape format (text file, widely supported by curl and other tools)
- Base64 encoded (API format for bulk operations)
Method 1: Import via Cookie File
Step 1: Export Cookies from the Source Browser
Using a Chrome Extension
Install a Cookie editor extension (such as “Cookie Editor”) and while logged into your target account:
- Navigate to the target website (e.g., amazon.com)
- Click the extension icon
- Click Export → select JSON format
- Save the file (e.g.,
amazon-account-a.json)
Example exported JSON cookie format:
[
{
"domain": ".amazon.com",
"expirationDate": 1734567890,
"httpOnly": true,
"name": "session-id",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"value": "xxx-xxxxxxx-xxxxxxx"
}
]
Step 2: Import in NestBrowser
- Find the target profile in the profile list
- Click the More Actions icon on the right side of the profile
- Select Import Cookies
- Upload your exported JSON file
- Confirm the import
Step 3: Verify Login State
Launch the profile, navigate to the corresponding website, and verify you’re logged in.
Method 2: Programmatic Import via API
For scenarios requiring bulk processing, use NestBrowser’s local API to import cookies programmatically.
API Call to Import Cookies
const axios = require('axios');
async function importCookies(profileId, cookies) {
const response = await axios.post(
'http://localhost:19222/api/v1/browser/cookies/import',
{
id: profileId,
cookies: cookies, // Array of cookie objects
}
);
return response.data;
}
// Usage example
const cookieData = require('./amazon-account-a.json');
await importCookies('profile-uuid', cookieData);
Batch Processing Multiple Accounts
const fs = require('fs');
const path = require('path');
const axios = require('axios');
async function batchImportCookies(mappingFile) {
// mapping.json format: [{ "profileId": "xxx", "cookieFile": "account-a.json" }]
const mapping = JSON.parse(fs.readFileSync(mappingFile, 'utf8'));
for (const item of mapping) {
const cookies = JSON.parse(
fs.readFileSync(item.cookieFile, 'utf8')
);
await importCookies(item.profileId, cookies);
console.log(`Imported cookies for profile ${item.profileId}`);
// Avoid hitting rate limits
await new Promise(r => setTimeout(r, 500));
}
}
Method 3: Inject Cookies with Puppeteer/Playwright
If you’re using an automation framework, you can inject cookies directly via code:
Puppeteer Example
const puppeteer = require('puppeteer-core');
const axios = require('axios');
async function loginWithCookies(profileId, cookieData) {
// Start the profile
const { data } = await axios.post(
`http://localhost:19222/api/v1/browser/start?id=${profileId}`
);
const browser = await puppeteer.connect({
browserWSEndpoint: data.ws.puppeteer,
defaultViewport: null,
});
const page = await browser.newPage();
// First navigate to the target domain
await page.goto('https://www.amazon.com');
// Inject cookies
await page.setCookie(...cookieData);
// Reload the page — cookies are now active
await page.reload();
// Verify login state
const isLoggedIn = await page.evaluate(() => {
return document.querySelector('#nav-link-accountList')
?.textContent.includes('Hello') ?? false;
});
console.log(`Login status: ${isLoggedIn ? 'Logged in' : 'Not logged in'}`);
return browser;
}
Platform-Specific Cookie Notes
Amazon
Amazon uses several critical cookies to maintain login state:
session-id: Primary session identifierat-main,x-main: Authentication tokensubid-main: User ID cookie
After importing these cookies, verify that Seller Central is accessible.
Facebook / Meta
Facebook’s cookies include:
c_user: User IDxs: Session tokendatr: Device cookie (important for account recognition)
⚠️ Note: Facebook’s datr cookie is closely tied to device fingerprint. Migrating this cookie across different fingerprint profiles may trigger security verification. It’s recommended to operate within the same profile environment.
TikTok
TikTok’s key cookies:
sessionid: Primary session cookiett_csrf_token: CSRF protection tokenttwid: Device identifier
General Notes
- Cookie expiration: Most platform cookies expire after 30–90 days; re-login and re-export periodically
- Two-factor authentication: Cookie import cannot bypass 2FA — ensure accounts have 2FA properly configured
- Session token security: Cookie files contain sensitive credentials — store securely, never commit to version control or unsecured storage
Exporting Cookie Backups
Regularly backing up your account cookies is a good practice:
async function exportCookies(profileId) {
// Export via Puppeteer
const page = await getPageForProfile(profileId);
await page.goto('https://www.amazon.com');
const cookies = await page.cookies();
const fs = require('fs');
const timestamp = new Date().toISOString().split('T')[0];
fs.writeFileSync(
`backup-${profileId}-${timestamp}.json`,
JSON.stringify(cookies, null, 2)
);
console.log(`Saved ${cookies.length} cookies`);
}