> ## Documentation Index
> Fetch the complete documentation index at: https://www.outx.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LinkedIn API Authentication

> Learn how to authenticate with the OutX LinkedIn API using your API key and the required Chrome extension plugin.

All OutX LinkedIn API endpoints require two things to work: a valid API key and at least one active Chrome extension installation on your team. This page explains both requirements in detail.

## Getting Your API Key

### Option 1: Via Dashboard

1. Log in to your OutX account
2. Visit [mentions.outx.ai/api-doc](https://mentions.outx.ai/api-doc)
3. Click **"Reveal API Key"** to view your key
4. Copy and securely store your API key

### Option 2: Via API (for agents and automation)

Sign up or log in programmatically with two API calls -- no browser needed:

1. [Send OTP](/docs/linkedin-api/auth-send-otp) -- `POST /linkedin-agent/auth-send-otp` with your email
2. [Verify OTP](/docs/linkedin-api/auth-verify-otp) -- `POST /linkedin-agent/auth-verify-otp` with the 6-digit code from your email

The verify response includes your `api_key` directly. This is ideal for AI agents, CLI tools, and MCP servers that need to onboard users without a browser.

<Warning>
  Keep your API key secure and never share it publicly. Treat it like a password. Anyone with your API key can make requests on behalf of your team.
</Warning>

## Using Your API Key

Include your API key in the `x-api-key` header of every request:

```bash theme={null}
x-api-key: YOUR_API_KEY
```

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://api.outx.ai/linkedin-agent/fetch-profile" \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{"profile_slug": "williamhgates"}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.outx.ai/linkedin-agent/fetch-profile",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "x-api-key": "YOUR_API_KEY",
      },
      body: JSON.stringify({ profile_slug: "williamhgates" }),
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.outx.ai/linkedin-agent/fetch-profile"
  headers = {
      "Content-Type": "application/json",
      "x-api-key": "YOUR_API_KEY",
  }
  payload = {"profile_slug": "williamhgates"}

  response = requests.post(url, headers=headers, json=payload)
  print(response.json())
  ```
</CodeGroup>

## Chrome Extension Requirement

<Warning>
  **This is the most important thing to understand about the OutX LinkedIn API.** At least one member of your team must have the OutX Chrome extension installed and have been active within the last 48 hours. Without this, all API calls will return a `403` error.
</Warning>

### Why is the Extension Required?

The OutX LinkedIn API does not scrape LinkedIn or use headless browsers. Instead, it routes API tasks through real browser sessions maintained by the Chrome extension. When you make an API call:

1. The API creates a task in the queue
2. The Chrome extension (running in a team member's browser) picks up the task
3. The extension executes the action within its authenticated LinkedIn session
4. Results are written back to the task, which you retrieve via polling

This approach means LinkedIn sees normal browser activity rather than automated scraping, which is why OutX is more reliable and carries less risk than traditional LinkedIn scraping tools.

### The 48-Hour Window

The API checks whether any team member's Chrome extension has been active (sent a heartbeat) within the last 48 hours. If no extension has been active in that window, all API calls will fail with a `403` error.

To keep the extension active:

* Install the [OutX Chrome extension](https://chromewebstore.google.com/detail/outxai-track-linkedin-pos/epnimaeheelhgeelbppbfkjegklflakj) on at least one team member's browser
* Ensure that team member opens Chrome at least once every 48 hours
* The extension sends heartbeats automatically when Chrome is running

### What Happens Without an Active Extension

If no team member has an active extension, you will receive:

```json theme={null}
{
  "error": "Plugin installation required: Please install the OutX browser extension on at least one team member's account to use the API. The plugin must have been active within the last 48 hours."
}
```

**HTTP Status:** `403 Forbidden`

## Team-Based Access

Your API key is tied to your team account. This means:

* All API requests are scoped to your team
* Tasks created by the API can only be retrieved by the same team
* Engagement actions (like, comment) use the oldest admin team member's LinkedIn account
* All team members share the same API key

## Authentication Errors

### 401 Unauthorized

Returned when the API key is missing or invalid.

**No API key provided:**

```json theme={null}
{
  "error": "Missing API Key"
}
```

**Invalid API key:**

```json theme={null}
{
  "error": "Invalid API Key"
}
```

**Solution:** Verify that you are including a valid API key in the `x-api-key` header.

### 403 Forbidden - Plugin Required

Returned when no team member has an active Chrome extension.

```json theme={null}
{
  "error": "Plugin installation required: Please install the OutX browser extension on at least one team member's account to use the API. The plugin must have been active within the last 48 hours."
}
```

**Solution:** Install the OutX Chrome extension and ensure it has been active within the last 48 hours.

### 405 Method Not Allowed

Returned when you use the wrong HTTP method for an endpoint.

```json theme={null}
{
  "error": "Method GET not allowed"
}
```

**Solution:** Check the endpoint documentation for the correct HTTP method.

## Best Practices

<AccordionGroup>
  <Accordion title="Store API Keys Securely" icon="lock">
    * Never commit API keys to version control
    * Use environment variables or secret management tools
    * Rotate keys if you suspect they have been compromised
  </Accordion>

  <Accordion title="Keep the Extension Active" icon="puzzle-piece">
    * Install the extension on at least two team members' browsers for redundancy
    * Ensure at least one team member opens Chrome daily
    * Monitor for 403 errors as a signal that the extension may need attention
  </Accordion>

  <Accordion title="Handle Errors Gracefully" icon="triangle-exclamation">
    * Implement retry logic with exponential backoff for transient failures
    * Distinguish between 401 (bad key) and 403 (no extension) errors
    * Log error responses for debugging
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/docs/linkedin-api/quickstart">
    Fetch your first LinkedIn profile in 2 minutes
  </Card>

  <Card title="Fetch Profile" icon="user" href="/docs/linkedin-api/fetch-profile">
    Learn the profile fetching endpoint in detail
  </Card>
</CardGroup>

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Is the API key the same for the Social Listening API and LinkedIn API?">
    Yes. The same x-api-key works for both the LinkedIn API and the Social Listening (Intelligence) API. You can find your key at [mentions.outx.ai/api-doc](https://mentions.outx.ai/api-doc).
  </Accordion>

  <Accordion title="What does &#x22;active within 48 hours&#x22; mean for the extension?">
    The Chrome extension sends periodic heartbeats to the OutX server when Chrome is open. If no team member has had Chrome open with the OutX extension running in the last 48 hours, the API considers the extension inactive and all API calls will fail with a 403 error. To stay active, simply keep Chrome open with the extension installed on at least one team member's computer.
  </Accordion>
</AccordionGroup>
