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

# Check Async Task Status - LinkedIn API

> Poll for async task results from the OutX LinkedIn API. Check whether a profile fetch, post retrieval, like, or comment task has completed.

The Get Task Status endpoint lets you check the status and retrieve the output of any async task created by the LinkedIn API. All LinkedIn API endpoints are asynchronous -- they return a task ID immediately, and you poll this endpoint to get results.

## Endpoint

```
GET https://api.outx.ai/linkedin-agent/get-task-status
```

## Query Parameters

<ParamField query="api_agent_task_id" type="string" required>
  The task ID returned by any LinkedIn API endpoint
</ParamField>

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

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="data.id" type="string">
  The task ID
</ResponseField>

<ResponseField name="data.status" type="string">
  Current task status: `pending` or `completed`
</ResponseField>

<ResponseField name="data.task_input" type="object">
  The original input you provided when creating the task
</ResponseField>

<ResponseField name="data.task_output" type="object | null">
  The task result. `null` while status is `pending`, populated when `completed`
</ResponseField>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "status": "completed",
      "task_input": {
        "task_type": "agent_profile_fetch",
        "profile_slug": "williamhgates"
      },
      "task_output": {
        "name": "Bill Gates",
        "headline": "Co-chair, Bill & Melinda Gates Foundation"
      }
    }
  }
  ```
</ResponseExample>

## Status Values

| Status      | Description                                                                      |
| ----------- | -------------------------------------------------------------------------------- |
| `pending`   | The task has been created and is waiting to be picked up by the Chrome extension |
| `completed` | The task has finished and results are available in `task_output`                 |

## Polling Pattern

Since all LinkedIn API tasks are asynchronous, you need to poll this endpoint to get results. Here is the recommended pattern:

1. Call a LinkedIn API endpoint (e.g., `fetch-profile`) to create a task
2. Receive the `api_agent_task_id` in the response
3. Poll `get-task-status` every 5 seconds
4. Stop polling when `status` is `completed`
5. Read the results from `task_output`

<Tip>
  We recommend polling every 5 seconds with a maximum of 30 attempts (about 2.5 minutes total). Most tasks complete well within this window.
</Tip>

## Code Examples

### Basic Polling

<RequestExample>
  ```bash cURL theme={null}
  # One-time status check
  curl -X GET \
    "https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=550e8400-e29b-41d4-a716-446655440000" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  async function waitForTask(taskId, options = {}) {
    const { maxAttempts = 30, delayMs = 5000 } = options;

    for (let attempt = 0; attempt < maxAttempts; attempt++) {
      const response = await fetch(
        `https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=${taskId}`,
        { headers: { "x-api-key": "YOUR_API_KEY" } }
      );

      const result = await response.json();

      if (result.data.status === "completed") {
        return result.data;
      }

      console.log(
        `Attempt ${attempt + 1}/${maxAttempts}: status=${result.data.status}`
      );
      await new Promise((resolve) => setTimeout(resolve, delayMs));
    }

    throw new Error(`Task ${taskId} did not complete after ${maxAttempts} attempts`);
  }

  // Usage
  const task = await waitForTask("550e8400-e29b-41d4-a716-446655440000");
  console.log("Task type:", task.task_input.task_type);
  console.log("Output:", task.task_output);
  ```

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

  def wait_for_task(task_id, max_attempts=30, delay=5):
      """Poll for task completion and return the result."""
      headers = {"x-api-key": "YOUR_API_KEY"}

      for attempt in range(max_attempts):
          response = requests.get(
              "https://api.outx.ai/linkedin-agent/get-task-status",
              headers=headers,
              params={"api_agent_task_id": task_id},
          )
          result = response.json()

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

          print(f"Attempt {attempt + 1}/{max_attempts}: status={result['data']['status']}")
          time.sleep(delay)

      raise TimeoutError(f"Task {task_id} did not complete after {max_attempts} attempts")

  # Usage
  task = wait_for_task("550e8400-e29b-41d4-a716-446655440000")
  print("Task type:", task["task_input"]["task_type"])
  print("Output:", task["task_output"])
  ```
</RequestExample>

### Polling with Bash Loop

```bash theme={null}
TASK_ID="550e8400-e29b-41d4-a716-446655440000"

for i in $(seq 1 30); do
  RESULT=$(curl -s -X GET \
    "https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=$TASK_ID" \
    -H "x-api-key: YOUR_API_KEY")

  STATUS=$(echo $RESULT | jq -r '.data.status')
  echo "Attempt $i: $STATUS"

  if [ "$STATUS" = "completed" ]; then
    echo "Result:"
    echo $RESULT | jq '.data.task_output'
    exit 0
  fi

  sleep 5
done

echo "Task did not complete in time"
exit 1
```

## Team Scoping

Task status queries are scoped to your team. You can only retrieve the status of tasks that were created with your API key. Attempting to check a task that belongs to a different team will return a `404` error.

## Error Responses

| Status | Error                                    | Description                                                                                        |
| ------ | ---------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `400`  | `Missing or invalid 'api_agent_task_id'` | The `api_agent_task_id` query parameter is missing or 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](/docs/api-reference/authentication) |
| `404`  | `Agent task not found`                   | The task ID does not exist or belongs to a different team                                          |

## FAQ

<AccordionGroup>
  <Accordion title="How often should I poll?">
    We recommend polling every 5 seconds. This provides a good balance between responsiveness and avoiding unnecessary requests. Most tasks complete within 10-60 seconds.
  </Accordion>

  <Accordion title="What happens if a task never completes?">
    In rare cases, a task may remain in `pending` status if the Chrome extension is not running or encounters an issue. We recommend setting a timeout of 2-3 minutes. If a task has not completed within that window, check that the Chrome extension is active and try creating a new task.
  </Accordion>

  <Accordion title="Can I check the status of multiple tasks at once?">
    Currently, you can only check one task at a time. If you need to monitor multiple tasks, make separate requests for each task ID.
  </Accordion>

  <Accordion title="Do tasks expire?">
    Task records are persisted in the database. You can check the status of completed tasks at any time to re-read the output.
  </Accordion>

  <Accordion title="What task_type values will I see in task_input?">
    The `task_type` field in `task_input` indicates which endpoint created the task:

    * `agent_profile_fetch` - from [Fetch Profile](/docs/linkedin-api/fetch-profile)
    * `agent_profiles_tracking` - from [Fetch Posts](/docs/linkedin-api/fetch-profiles-posts)
    * `agent_company_fetch` - from [Fetch Company](/docs/linkedin-api/fetch-company)
    * `agent_company_tracking` - from [Fetch Company Posts](/docs/linkedin-api/fetch-company-posts)
    * `agent_like_post` - from [Like Post](/docs/linkedin-api/like-post)
    * `agent_comment_post` - from [Comment on Post](/docs/linkedin-api/comment-post)
    * `agent_send_message` - from [Send Message](/docs/linkedin-api/send-message)
    * `agent_search_profiles` - from [Search Profiles](/docs/linkedin-api/search-profiles)
    * `agent_fetch_connections` - from [Fetch Connections](/docs/linkedin-api/fetch-connections)
  </Accordion>
</AccordionGroup>

## Related

* [Fetch Profile](/docs/linkedin-api/fetch-profile) - Creates profile fetch tasks
* [Fetch Posts](/docs/linkedin-api/fetch-profiles-posts) - Creates post fetch tasks
* [Fetch Company](/docs/linkedin-api/fetch-company) - Creates company fetch tasks
* [Fetch Company Posts](/docs/linkedin-api/fetch-company-posts) - Creates company post fetch tasks
* [Like Post](/docs/linkedin-api/like-post) - Creates like tasks
* [Comment on Post](/docs/linkedin-api/comment-post) - Creates comment tasks
* [Send Message](/docs/linkedin-api/send-message) - Creates message send tasks
* [Search Profiles](/docs/linkedin-api/search-profiles) - Creates profile search tasks
* [Fetch Connections](/docs/linkedin-api/fetch-connections) - Creates connection fetch tasks

***

## 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)
