> ## 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 Posts API - Fetch Posts from Any Profile

> Retrieve LinkedIn posts from one or more profiles using their LinkedIn URNs. The OutX LinkedIn Posts API returns post content, engagement metrics, and metadata.

The Fetch Profiles Posts endpoint creates an async task to retrieve recent posts from one or more LinkedIn profiles. You provide an array of LinkedIn person URNs and receive a task ID to poll for results.

## Endpoint

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

## Request Body

<ParamField body="profile_urns" type="string[]" required>
  Non-empty array of LinkedIn person URNs (e.g., `["urn:li:person:ABC123"]`)
</ParamField>

<Tip>
  **Don't have a profile URN?** If you only have a LinkedIn profile slug (e.g., `williamhgates` from `linkedin.com/in/williamhgates`), use the [Fetch Profile](/docs/linkedin-api/fetch-profile) endpoint first to retrieve the full profile data, which includes the person URN in the response.
</Tip>

## Response

The endpoint returns immediately with a task ID:

<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](/docs/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": "Profiles tracking task created successfully"
  }
  ```
</ResponseExample>

## Polling for Results

Poll the [Get Task Status](/docs/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 posts data:

```json theme={null}
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "completed",
    "task_input": {
      "task_type": "agent_profiles_tracking",
      "profile_urns": ["urn:li:person:ABC123"]
    },
    "task_output": {
      "posts": [
        {
          "linkedin_post_url": "https://www.linkedin.com/feed/update/urn:li:activity:7123456789012345678",
          "linkedin_post_urn": "7123456789012345678",
          "social_urn": "urn:li:activity:7123456789012345678",
          "content": "Excited to share our latest research on...",
          "post_author": {
            "author_slug": "johndoe",
            "author_type": "person",
            "full_name": "John Doe",
            "headline": "CEO at Example Corp",
            "image_url": "https://media.licdn.com/dms/image/..."
          },
          "posted_at": "2025-01-15T10:30:00.000Z",
          "likes_count": 245,
          "shares_count": 12,
          "comments_count": 32,
          "videos": null,
          "image_urls": null
        }
      ]
    }
  }
}
```

## Code Examples

<RequestExample>
  ```bash cURL theme={null}
  # Create the task
  curl -X POST \
    "https://api.outx.ai/linkedin-agent/fetch-profiles-posts" \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{"profile_urns": ["urn:li:person:ABC123"]}'

  # 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 fetchProfilePosts(profileUrns) {
    // Create the task
    const response = await fetch(
      "https://api.outx.ai/linkedin-agent/fetch-profiles-posts",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "x-api-key": "YOUR_API_KEY",
        },
        body: JSON.stringify({ profile_urns: profileUrns }),
      }
    );

    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));
    }
  }

  const posts = await fetchProfilePosts(["urn:li:person:ABC123"]);
  console.log(posts);
  ```

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

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

      # Create the task
      response = requests.post(
          "https://api.outx.ai/linkedin-agent/fetch-profiles-posts",
          headers=headers,
          json={"profile_urns": profile_urns},
      )
      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)

  posts = fetch_profile_posts(["urn:li:person:ABC123"])
  print(posts)
  ```
</RequestExample>

## Error Responses

| Status | Error                                                           | Description                                                                                        |
| ------ | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `400`  | `Missing or invalid 'profile_urns' (must be a non-empty array)` | The `profile_urns` field is missing, not an array, or empty                                        |
| `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](/docs/api-reference/authentication) |

## FAQ

<AccordionGroup>
  <Accordion title="Where do I get LinkedIn person URNs?">
    LinkedIn person URNs (`urn:li:person:ABC123`) can be found in LinkedIn page source, through the LinkedIn API, or from the output of the [Fetch Profile](/docs/linkedin-api/fetch-profile) endpoint. They are unique identifiers for LinkedIn members.
  </Accordion>

  <Accordion title="How many profiles can I fetch posts for in one request?">
    You can pass multiple URNs in a single request. The `profile_urns` array must contain at least one URN. For very large batches, consider splitting into smaller requests to ensure timely processing.
  </Accordion>

  <Accordion title="How far back does the post data go?">
    The API returns recent posts visible on the profile's activity feed. The exact range depends on LinkedIn's own feed rendering and typically covers the most recent posts available on the profile page.
  </Accordion>

  <Accordion title="Can I use this to monitor posts over time?">
    For one-off fetches, use this endpoint. For ongoing monitoring of LinkedIn profiles and their posts, consider the [Intelligence API's People Watchlist](/docs/api-reference/introduction), which automatically tracks profiles and collects new posts on a schedule.
  </Accordion>
</AccordionGroup>

## Related

* [Fetch Profile](/docs/linkedin-api/fetch-profile) - Get profile data (and find person URNs)
* [Like Post](/docs/linkedin-api/like-post) - Like posts you have fetched
* [Comment on Post](/docs/linkedin-api/comment-post) - Comment on posts you have fetched
* [Get Task Status](/docs/linkedin-api/get-task-status) - Poll for task results

***

## Learn More

* [LinkedIn API Guide](https://www.outx.ai/blog/linkedin-api-guide)
* [How to Scrape LinkedIn Data Safely](https://www.outx.ai/blog/scrape-data-linkedin)
* [LinkedIn Monitoring Guide](https://www.outx.ai/blog/linkedin-monitoring-guide-2025)
