> ## Documentation Index
> Fetch the complete documentation index at: https://v3.captaindata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LinkedIn Accounts & Licences

> Learn to manage LinkedIn cookies, user accounts, and licenses in Captain Data.

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

## **Handling LinkedIn Accounts**

### **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`](/v3/api-reference/users/create-update-user).

**Example Request Body:**

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

<Warning>
  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.
</Warning>

You can use any [ISO 3166-1 alpha-2 country code](https://www.iban.com/country-codes) 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.

<Tip>
  If using a VPN, ensure the VPN's country matches the one in Captain Data, or
  disconnect the VPN when logging in.
</Tip>

### **Linking LinkedIn Accounts to Users**

After adding a user, you will connect an integration account in order to link the LinkedIn account to the user using the
API Endpoint [`POST - Add or Update an Integration Account`](/v3/api-reference/integrations/add-update-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`:

```json
{
  "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"
  }
}
```

<Tip>
  For **LinkedIn Sales Navigator**, include both the `li_a` and `li_at` cookies
  for a more stable and faster connection.
</Tip>

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

```json
{
  "shared_account": true
}
```

<Note>
  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.
</Note>

## **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.

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

### **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**](/v3/linkedin/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](/v3/api-reference/integrations/add-update-account) by passing `li_a` and/or `li_at` cookie values.

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

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

```jsx
/**
 * 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"
  );
});
```

<Note>
  Complete source code is available on
  [GitHub](https://github.com/captaindatatech/chrome-extension-skeleton).
</Note>

## **Smart Limits to Prevent Account Restrictions**

<Tip>
  Captain Data developed a unique **Smart Limits** feature to protect your
  users' LinkedIn accounts. Learn more in this article [LinkedIn Rate
  Limits](/v3/linkedin/limits).
</Tip>

## **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:

| **License**                   | **Captain Data Level** | **Captain Data Compatibility** | **InMails/Month** | **Invitations with Note** | **CRM Integration** |
| ----------------------------- | ---------------------- | ------------------------------ | ----------------- | ------------------------- | ------------------- |
| **LinkedIn Basic**            | Classic                | Yes                            | 0                 | 5/month                   | No                  |
| **LinkedIn Premium Career**   | Classic                | No                             | 5                 | N/A                       | No                  |
| **LinkedIn Premium Business** | Classic                | Yes                            | 15                | 400                       | No                  |
| **Sales Navigator Core**      | Sales Navigator        | Yes                            | 50                | 400                       | No                  |
| **LinkedIn Sales Solutions**  | N/A                    | N/A                            | N/A               | N/A                       | N/A                 |

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

## **Troubleshooting LinkedIn Login Errors**

When connecting a LinkedIn account (via cookies or native login), you may encounter various errors. Below is a guide to the most common error cases, their meanings, and how to resolve them.

### **Common Error Cases**

| **Scenario**                                 | **Message**                                                                                                                                                     | **Status** | **Error**                                                                                                                                                          |
| :------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Invalid credentials                          | Username or password invalid.                                                                                                                                   |     400    | `INVALID_CREDENTIALS`<br /><sub>Check your LinkedIn username and password.<br />[See authentication endpoint](/v3/api-reference/linkedin/add-update-account)</sub> |
| Google login not supported                   | Username or password invalid.                                                                                                                                   |     400    | `INVALID_CREDENTIALS`<br /><sub>Google login is not supported.<br />Use "Forgot password" on LinkedIn to set a password and use that for login.</sub>              |
| Checkpoint code invalid                      | Code invalid.                                                                                                                                                   |     400    | `INVALID_CODE`<br /><sub>The checkpoint (2FA/SMS/email) code is incorrect. Try again.<br />[See checkpoint endpoint](/v3/api-reference/linkedin/checkpoint)</sub>  |
| Failed IP attribution                        | Could not login the account.                                                                                                                                    |     500    | `LOGIN_ACCOUNT_500_ERROR`<br /><sub>Retry logging in. This is a LinkedIn-side issue.</sub>                                                                         |
| IP allocation error                          | IP allocation error. Please retry again in 5 minutes or contact support.                                                                                        |     400    | `IP_ATTRIBUTION_ERROR_400`<br /><sub>Wait 5 minutes and try again, or contact support.</sub>                                                                       |
| IP allocation conflict                       | IP allocation error. Please retry again in 5 minutes or contact support.                                                                                        |     409    | `IP_ATTRIBUTION_CONFLICT_409`<br /><sub>Wait 5 minutes and try again, or contact support.</sub>                                                                    |
| IP rate limit exceeded                       | Rate limit exceeded IP attribution, please try again in five (5) minutes or contact the support.                                                                |     429    | `IP_ATTRIBUTION_RATE_LIMIT_429`<br /><sub>Wait 5 minutes and try again, or contact support.</sub>                                                                  |
| No IP available in timezone                  | No IP available in this timezone. Update your timezone to a neighbouring one or contact support.                                                                |     400    | `IP_TIMEZONE_NOT_SUPPORTED_400`<br /><sub>Change your timezone in Captain Data or contact support.</sub>                                                           |
| Captcha challenge                            | Error while resolving the challenge, the Captcha challenge seem to be pending. Re-send username and password to overcome this.                                  |     500    | `CAPTCHA_CHALLENGE_ERROR`<br /><sub>Retry the authentication with your credentials.</sub>                                                                          |
| Unsupported challenge                        | Unsupported challenge identified, please contact the support and provide it with the user\_uid so we can address it.                                            |     500    | `UNSUPPORTED_CHALLENGE`<br /><sub>Contact support with your user\_uid.</sub>                                                                                       |
| Simple challenge failed                      | Error while solving challenge, retry in 5 minutes, if it persists contact support.                                                                              |     500    | `LOGIN_SIMPLE_CHALLENGE`<br /><sub>Wait and retry, or contact support.</sub>                                                                                       |
| In-app challenge pending                     | Waiting for user to validate in\_app\_challenge                                                                                                                 |     500    | `IN_APP_CHALLENGE_PENDING`<br /><sub>Complete the challenge in your LinkedIn app.</sub>                                                                            |
| In-app challenge expired                     | In\_app\_challenge expired. Please retry the whole process by sending credentials again on /authenticate                                                        |     500    | `IN_APP_CHALLENGE_EXPIRED`<br /><sub>Start the login process again.</sub>                                                                                          |
| 2FA expired                                  | 2FA expired. Please retry the whole process by sending credentials again on /authenticate                                                                       |     500    | `2FA_VALIDATION_EXPIRED`<br /><sub>Start the login process again.</sub>                                                                                            |
| Checkpoint missing data                      | Error while solving the challenge, retry the whole process by sending credentials to /authenticate again                                                        |     500    | `CHECKPOINT_MISSING_DATA`<br /><sub>Start the login process again.</sub>                                                                                           |
| User management not permitted                | User management via the API is not permitted for the current workspace, activate the option on [settings](https://app.captaindata.co/settings/users/parameters) |     403    | `CREATE-ONE-ACCOUNT-403-FORBIDDEN`<br /><sub>Enable user management in your workspace settings.</sub>                                                              |
| Account with same LinkedIn ID already exists | An account with the same Linkedin ID already exists.                                                                                                            |     409    | `CREATE_OR_UPDATE_ACCOUNT_409_CONFLICT`<br /><sub>Use a different LinkedIn account or user.</sub>                                                                  |
| Account already exists on user               | An account already exist on this user                                                                                                                           |     409    | `CREATE_OR_UPDATE_ACCOUNT_409_CONFLICT`<br /><sub>This will be merged in the future.</sub>                                                                         |
| Account link change                          | Please note that your account is different from the one that has already been synchronized.                                                                     |     409    | `CREATE_OR_UPDATE_ACCOUNT_409_CONFLICT`<br /><sub>Use the same LinkedIn account as previously connected.</sub>                                                     |
| Other errors                                 | Error while synchronizing your account, please retry again or contact the support.                                                                              |     500    | -<br /><sub>Retry or contact support.</sub>                                                                                                                        |

### **Notes & Recommendations**

* **Google Login:** If your LinkedIn account uses Google login, you must set a password on LinkedIn (via "Forgot password") to use native login.
* **IP/Location Issues:** Many errors are related to IP allocation or location mismatches. Make sure your timezone and country settings in Captain Data match your actual login location.
* **Challenge/2FA:** If you receive a challenge (SMS, email, in-app), complete it promptly. If it expires, restart the login process.
* **Contact Support:** For persistent or unclear errors, contact support and provide your `identity_uid` for faster resolution.

For more details, see the [LinkedIn authentication](/v3/api-reference/linkedin/add-update-account) and [checkpoint](/v3/api-reference/linkedin/checkpoint) API documentation.

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.com](mailto:support@captaindata.com) 🙌
