> ## 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 Connections API - Fetch Your LinkedIn Connections

> Fetch your LinkedIn 1st-degree connections programmatically using the OutX LinkedIn Connections API. Search by keyword, sort by recently added, and paginate through results.

<script type="application/ld+json">
  {`{
    "@context": "https://schema.org",
    "@type": "WebAPI",
    "name": "OutX LinkedIn Connections API",
    "url": "https://api.outx.ai/linkedin-agent/fetch-connections",
    "description": "Fetch your LinkedIn 1st-degree connections via API. Filter by keyword, sort by recently added, and paginate through results.",
    "documentation": "https://outx.ai/docs/linkedin-api/fetch-connections",
    "provider": {
      "@type": "Organization",
      "name": "OutX.ai",
      "url": "https://www.outx.ai"
    }
    }`}
</script>

The Fetch Connections endpoint creates an async task to retrieve the 1st-degree LinkedIn connections of your team's account. All parameters are optional, you can fetch all connections with pagination, or narrow the results with a keyword search.

## Endpoint

```
POST https://api.outx.ai/linkedin-agent/fetch-connections
```

## Request Body

All fields are optional. Sending an empty body fetches the first page of all connections.

<ParamField body="keyword" type="string">
  Filter connections by name (e.g., `"John"` returns connections whose name contains "John")
</ParamField>

<ParamField body="sort_type" type="string">
  Sort order for results. Pass `"RECENTLY_ADDED"` to get your most recent connections first. Omit for default LinkedIn sort order.
</ParamField>

<ParamField body="start" type="number">
  Pagination offset, the index to start from. Defaults to `0`. Use in combination with `count` to page through large connection lists.
</ParamField>

<ParamField body="count" type="number">
  Number of connections to return per request. Defaults to `40`, maximum `500`. Larger pages mean fewer requests when pulling your full connection list.
</ParamField>

<Tip>
  To paginate through all your connections, keep incrementing `start` by the value of `count` until `total` in the response is less than `count` (or 0), which means you've reached the end.
</Tip>

## Response

The endpoint returns immediately with a task ID. Connections are fetched asynchronously.

<ResponseField name="success" type="boolean">
  Whether the task was created successfully
</ResponseField>

<ResponseField name="api_agent_task_id" type="string">
  UUID to poll for results via [Get Task Status](/linkedin-api/get-task-status)
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable confirmation
</ResponseField>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "api_agent_task_id": "550e8400-e29b-41d4-a716-446655440000",
    "message": "Fetch connections task created successfully"
  }
  ```
</ResponseExample>

## Polling for Results

After creating the task, poll the [Get Task Status](/linkedin-api/get-task-status) endpoint until the status is `completed`:

```
GET https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=550e8400-e29b-41d4-a716-446655440000
```

### Completed Response

When the task finishes, `task_output` contains the cleaned list of connections:

```json theme={null}
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "completed",
    "task_input": {
      "count": 40,
      "start": 0,
      "keyword": "John",
      "sort_type": null,
      "task_type": "agent_fetch_connections"
    },
    "task_output": {
      "total": 2,
      "connections": [
        {
          "name": "John Smith",
          "headline": "VP of Engineering at Acme Corp",
          "last_name": "Smith",
          "entity_urn": "urn:li:fsd_profile:ACoAABCDEFGHIJKLMNOP",
          "first_name": "John",
          "profile_image_url": "https://media.licdn.com/dms/image/v2/...",
          "public_identifier": "john-smith-abc123"
        },
        {
          "name": "John Doe",
          "headline": "Founder at StartupXYZ",
          "last_name": "Doe",
          "entity_urn": "urn:li:fsd_profile:ACoAAHIJKLMNOPQRST",
          "first_name": "John",
          "profile_image_url": null,
          "public_identifier": "johndoe"
        }
      ]
    }
  }
}
```

## Code Examples

<RequestExample>
  ```bash cURL theme={null}
  # Fetch most recent 40 connections
  curl -X POST \
    "https://api.outx.ai/linkedin-agent/fetch-connections" \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{}'

  # Search connections by keyword
  curl -X POST \
    "https://api.outx.ai/linkedin-agent/fetch-connections" \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{"keyword": "John", "sort_type": "RECENTLY_ADDED", "count": 40}'

  # Poll for results
  curl -X GET \
    "https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=TASK_ID" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  async function fetchConnections(options = {}) {
    // Create the task
    const response = await fetch(
      "https://api.outx.ai/linkedin-agent/fetch-connections",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "x-api-key": "YOUR_API_KEY",
        },
        body: JSON.stringify(options),
      }
    );

    const { api_agent_task_id } = await response.json();

    // Poll for results
    while (true) {
      const statusRes = await fetch(
        `https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=${api_agent_task_id}`,
        { headers: { "x-api-key": "YOUR_API_KEY" } }
      );

      const result = await statusRes.json();
      if (result.data.status === "completed") {
        return result.data.task_output;
      }

      await new Promise((r) => setTimeout(r, 5000));
    }
  }

  // All connections (first page)
  const page1 = await fetchConnections({ count: 500 });

  // Search by keyword
  const johns = await fetchConnections({ keyword: "John", sort_type: "RECENTLY_ADDED" });

  // Paginate, get next page
  const page2 = await fetchConnections({ start: 500, count: 500 });

  console.log(page1.connections);
  ```

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

  def fetch_connections(options={}):
      headers = {
          "Content-Type": "application/json",
          "x-api-key": "YOUR_API_KEY",
      }

      # Create the task
      response = requests.post(
          "https://api.outx.ai/linkedin-agent/fetch-connections",
          headers=headers,
          json=options,
      )
      task_id = response.json()["api_agent_task_id"]

      # Poll for results
      while True:
          result = requests.get(
              "https://api.outx.ai/linkedin-agent/get-task-status",
              headers={"x-api-key": "YOUR_API_KEY"},
              params={"api_agent_task_id": task_id},
          ).json()

          if result["data"]["status"] == "completed":
              return result["data"]["task_output"]

          time.sleep(5)

  # All connections (first page)
  page1 = fetch_connections({"count": 500})

  # Search by keyword
  johns = fetch_connections({"keyword": "John", "sort_type": "RECENTLY_ADDED"})

  # Paginate, get next page
  page2 = fetch_connections({"start": 500, "count": 500})

  print(page1["connections"])
  ```
</RequestExample>

## Error Responses

| Status | Error                                   | Description                                                                                        |
| ------ | --------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `400`  | `Invalid 'keyword': must be a string`   | The `keyword` field was provided but is not a string                                               |
| `400`  | `Invalid 'sort_type': must be a string` | The `sort_type` field was provided but is not a string                                             |
| `401`  | `Missing API Key` / `Invalid API Key`   | API key is missing or invalid                                                                      |
| `403`  | `Plugin installation required...`       | No team member has an active Chrome extension. See [Authentication](/api-reference/authentication) |

## FAQ

<AccordionGroup>
  <Accordion title="What data does each connection include?">
    Each connection object includes: `name` (full name), `first_name`, `last_name`, `headline` (job title / description), `public_identifier` (LinkedIn profile slug), `entity_urn` (LinkedIn person URN), and `profile_image_url` (profile picture URL or `null`). The `public_identifier` can be passed to [Fetch Profile](/linkedin-api/fetch-profile) and the `entity_urn` can be passed to [Send Message](/linkedin-api/send-message).
  </Accordion>

  <Accordion title="How do I paginate through all my connections?">
    Use `start` and `count` together. Start with `start: 0, count: 500`, then `start: 500, count: 500`, and so on. When the `total` in a response is less than your requested `count`, you have reached the last page. Each request creates a separate async task.
  </Accordion>

  <Accordion title="What does sort_type RECENTLY_ADDED do?">
    Passing `"RECENTLY_ADDED"` as `sort_type` returns connections in reverse chronological order, your most recently connected people appear first. Omitting `sort_type` uses LinkedIn's default relevance-based sort.
  </Accordion>

  <Accordion title="Whose connections are returned?">
    The connections belong to the LinkedIn account running the Chrome extension, specifically your team's oldest admin member's account. This is the same account used for actions like [Like Post](/linkedin-api/like-post), [Comment on Post](/linkedin-api/comment-post), and [Send Message](/linkedin-api/send-message).
  </Accordion>

  <Accordion title="Can I use entity_urn to send a message?">
    Yes. Pass the `entity_urn` from a connection object directly to the [Send Message](/linkedin-api/send-message) endpoint as the `recipient_urn` field. Since connections are 1st-degree, messaging them will always succeed.
  </Accordion>

  <Accordion title="How long does the task take to complete?">
    Most connection fetch tasks complete within seconds to a minute, depending on when the Chrome extension picks up the task. We recommend polling every 5 seconds with a timeout of 2-3 minutes.
  </Accordion>
</AccordionGroup>

## Related

* [Get Task Status](/linkedin-api/get-task-status) - Poll for task results
* [Send Message](/linkedin-api/send-message) - Message a connection using their `entity_urn`
* [Fetch Profile](/linkedin-api/fetch-profile) - Get full profile data using `public_identifier`
* [Search Profiles](/linkedin-api/search-profiles) - Search LinkedIn beyond your connections

***

## Learn More

* [LinkedIn API Guide](https://www.outx.ai/blog/linkedin-api-guide)
* [LinkedIn Automation Safety Guide](https://www.outx.ai/blog/linkedin-automation-safety-guide-best-practices-2026)
