This guide explains how to handle LinkedIn cookies, manage user accounts, and understand the different LinkedIn licenses supported on Captain Data.

Handling LinkedIn Accounts in Captain Data

Adding a New User

To automate LinkedIn actions, you must first add a user on Captain Data using the API Endpoint POST Create or Update User.

Example Request Body:

{
  "email": "johndoe@test.co",
  "full_name": "John Doe",
  "country": "FR"
}

The country field provisions a proxy IP matching that country. This country must match the location where you log into your LinkedIn account to avoid restrictions.

You can use any ISO 3166-1 alpha-2 country code except the following:

"MG","RE","CI", "NA", "CV", "MU", "HN", "UY", "XK", "GN", "UA", "BB", "PF", "QA", "KY", "LY", "LB", "VE", "UG", "CH", "PK"

These country codes are restricted to ensure compliance with platform requirements and maintain secure automation.

If using a VPN, ensure the VPN’s country matches the one in Captain Data, or disconnect the VPN when logging in.

Linking LinkedIn Accounts to Users

After adding a user, you will create an integration account in order to link the LinkedIn account to the user using the API Endpoint POST - Add or Update an Integration Account.

The core of the LinkedIn integration are the cookies, which allow us to perform the desired actions on LinkedIn.

Here’s an example account payload, using the previously created user_uid:

{
  "account": {
    "name": "Name of the account",
    "cookies": {
      "li_at": "YOUR_SESSION_COOKIE",
      "li_a": "If the account is a Sales Navigator one"
    },
    "user_uid": "xxxxx-xxxxx-xxxxx-xxxxx"
  }
}

For LinkedIn Sales Navigator, include both the li_a and li_at cookies for a more stable and faster connection.

If you wan to create a Shared LinkedIn Account, add the following to your request:

{
  "shared_account": true
}

Reminder: A Shared Account allows external users to connect their accounts via a Captain Data shared link, which grants them access to sync their credentials.

Best Practices for LinkedIn Automation

VPN and Country Settings

  • Ensure the country in Captain Data matches your login location on LinkedIn.
  • Match your VPN’s country with Captain Data, or disconnect the VPN while logging in.

Managing Chrome Sessions

  • Use Captain Data’s Chrome Extension to automatically sync cookies.
  • For multiple LinkedIn accounts, you must create separate Chrome sessions:
    • Click your Chrome profile icon > Add a new profile.
    • Name it according to the LinkedIn account (e.g., “Account B”).
    • Log in to Captain Data and LinkedIn within this new session.

Updating cookies for Account A while logged into Account B can lead to mismatches and errors.

Refreshing Cookies

Cookies need refreshing if:

  • You log out of LinkedIn
  • LinkedIn expires or changes cookies
  • LinkedIn restricts the account due to excessive activity

Regular activity and following Smart Limits guidelines help prevent restrictions.

How to refresh cookies via API

In order to refresh accounts via API you need to use the POST - Add or Update an Integration Account by passing li_a and/or li_at cookie values.

If you build your own Chrome Extension, you should refresh cookies every 2 hours or so.

Here’s a code example for a Chrome Extension that runs in the background using alarms:

/**
 * Alarm to update cookies every X minutes.
 */
chrome.alarms.onAlarm.addListener(() => {
  // Ensure updateTokensHandle() is defined elsewhere in your code
  return updateTokensHandle();
});

// Set up the alarm when the extension is installed
chrome.runtime.onInstalled.addListener(async ({ reason }) => {
  const periodDurationMinutes = 120; // Every 2 hours

  // Create an alarm that will trigger every `periodDurationMinutes`
  await chrome.alarms.create("updateToken", {
    periodInMinutes: periodDurationMinutes,
  });

  console.log(
    "Alarm created to update token every " + periodDurationMinutes + " minutes"
  );
});

Complete source code is available on GitHub.

Smart Limits to Prevent Account Restrictions

Captain Data developed a unique Smart Limits feature to protect your users’ LinkedIn accounts. Learn more in this article LinkedIn Rate Limits.

LinkedIn Licenses Compatibility

Captain Data supports various LinkedIn licenses, each with unique features and limitations. Below is a breakdown of how each license integrates with Captain Data:

LicenseCaptain Data LevelCaptain Data CompatibilityInMails/MonthInvitations with NoteCRM Integration
LinkedIn BasicClassicYes05/monthNo
LinkedIn Premium CareerClassicNo5N/ANo
LinkedIn Premium BusinessClassicYes15400No
Sales Navigator CoreSales NavigatorYes50400No
LinkedIn Sales SolutionsN/AN/AN/AN/AN/A

Today Captain Data handles LinkedIn Basic, LinkedIn Premium Business, and Sales Navigator Core which are defined as levels in the LinkedIn integration.

By following this guide, you can safely automate LinkedIn activities with Captain Data, ensuring stable sessions and avoiding platform restrictions.

For further assistance, feel free to reach out to our support team at support@captaindata.co 🙌