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

# Fetch Task Result

> How to check the status and retrieve the results of your tasks using the REST API.

If you are using the [Python SDK](/sdks/python), task polling is handled automatically for you behind the scenes. However, if you are integrating via the REST API directly, you need to make a `GET` request to retrieve the final result of your task.

## The Polling Flow

1. Create a task via `POST /v2/tasks/create`.
2. The API will respond immediately with a `task_id` and a `status` of `"processing"`.
3. Poll the `GET /v2/tasks/{task_id}` endpoint every 1-3 seconds.
4. When the `status` changes to `"completed"`, the `result` object will be available.

## Endpoint

`GET https://api.scrapely.io/v2/tasks/{task_id}`

### Authentication

You must provide your API key via the `X-API-Key` header or as a query parameter (`?api_key=YOUR_API_KEY`).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.scrapely.io/v2/tasks/52989a12-a43c-4bf9-ba1d-8ab1e1509169 \
    -H "X-API-Key: YOUR_API_KEY"
  ```

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

  api_key = "YOUR_API_KEY"
  task_id = "52989a12-a43c-4bf9-ba1d-8ab1e1509169"

  while True:
      response = requests.get(
          f"https://api.scrapely.io/v2/tasks/{task_id}",
          headers={"X-API-Key": api_key}
      )
      data = response.json()
      
      if data["status"] == "completed":
          print("Result:", data["result"])
          break
      elif data["status"] == "failed":
          print("Task failed!")
          break
          
      print("Task is still processing, waiting 2 seconds...")
      time.sleep(2)
  ```
</CodeGroup>

## Response States

The `status` field can be one of three values: `processing`, `completed`, or `failed`.

### 1. Processing

```json theme={null}
{
  "success": true,
  "task_id": "52989a12-a43c-4bf9-ba1d-8ab1e1509169",
  "status": "processing",
  "created_at": "2026-04-06T10:54:56.652354+00:00"
}
```

### 2. Completed

When completed, the `result` object will be populated with the specific data you requested (HTML, screenshot, CAPTCHA token, etc.), and a `completed_at` timestamp will be added.

```json theme={null}
{
  "success": true,
  "task_id": "52989a12-a43c-4bf9-ba1d-8ab1e1509169",
  "status": "completed",
  "created_at": "2026-04-06T10:54:56.652354+00:00",
  "completed_at": "2026-04-06T10:55:08.312452+00:00",
  "result": {
    "html": "<!DOCTYPE html>..."
  }
}
```
