> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/lumina-ai-inc/chunkr/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Task

> Retrieve detailed information about a task by its ID, including processing status and output data

## Endpoint

```
GET /api/v1/task/{task_id}
```

## Authentication

This endpoint requires API key authentication via the `Authorization` header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="task_id" type="string" required>
  The unique identifier of the task to retrieve
</ParamField>

## Query Parameters

<ParamField query="base64_urls" type="boolean" default={false}>
  Whether to return base64 encoded URLs. If false, the URLs will be returned as presigned URLs.
</ParamField>

<ParamField query="include_chunks" type="boolean" default={true}>
  Whether to include chunks in the output response. Set to false for faster responses when you only need task metadata.
</ParamField>

## Response

<ResponseField name="task_id" type="string">
  The unique identifier for the task
</ResponseField>

<ResponseField name="status" type="enum">
  The current status of the task:

  * `Starting`: Task is queued and waiting to begin
  * `Processing`: Task is currently being processed
  * `Succeeded`: Task completed successfully
  * `Failed`: Task failed during processing
  * `Cancelled`: Task was cancelled
</ResponseField>

<ResponseField name="created_at" type="string">
  The date and time when the task was created and queued (ISO 8601 format)
</ResponseField>

<ResponseField name="started_at" type="string">
  The date and time when the task started processing (ISO 8601 format)
</ResponseField>

<ResponseField name="finished_at" type="string">
  The date and time when the task was finished (ISO 8601 format)
</ResponseField>

<ResponseField name="expires_at" type="string">
  The date and time when the task will expire (ISO 8601 format)
</ResponseField>

<ResponseField name="message" type="string">
  A message describing the task's status or any errors that occurred
</ResponseField>

<ResponseField name="task_url" type="string">
  The presigned URL of the task
</ResponseField>

<ResponseField name="configuration" type="object">
  The complete task configuration including:

  <Expandable title="properties">
    <ResponseField name="input_file_url" type="string">
      Presigned URL of the input file
    </ResponseField>

    <ResponseField name="ocr_strategy" type="enum">
      OCR strategy used: `All` or `Auto`
    </ResponseField>

    <ResponseField name="segmentation_strategy" type="enum">
      Segmentation strategy used: `LayoutAnalysis` or `Page`
    </ResponseField>

    <ResponseField name="high_resolution" type="boolean">
      Whether high-resolution processing was enabled
    </ResponseField>

    <ResponseField name="expires_in" type="integer">
      Number of seconds until task deletion
    </ResponseField>

    <ResponseField name="error_handling" type="enum">
      Error handling strategy: `Fail` or `Continue`
    </ResponseField>

    <ResponseField name="chunk_processing" type="object">
      Chunking configuration settings
    </ResponseField>

    <ResponseField name="segment_processing" type="object">
      Segment processing configuration for each segment type
    </ResponseField>

    <ResponseField name="llm_processing" type="object">
      LLM configuration settings
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="output" type="object">
  Output data (only present when `status` is `Succeeded` and `include_chunks` is true)

  <Expandable title="properties">
    <ResponseField name="chunks" type="array">
      Array of processed chunks, each containing:

      * `chunk_id`: Unique identifier for the chunk
      * `chunk_index`: Index of the chunk in the document
      * `segments`: Array of segments within the chunk
      * `embed`: Aggregated content based on embed\_sources configuration
    </ResponseField>

    <ResponseField name="file_name" type="string">
      Original file name
    </ResponseField>

    <ResponseField name="page_count" type="integer">
      Total number of pages in the document
    </ResponseField>

    <ResponseField name="pdf_url" type="string">
      Presigned URL (or base64) to access the processed PDF
    </ResponseField>
  </Expandable>
</ResponseField>

## Status Codes

* **200**: Task retrieved successfully
* **404**: Task not found or expired
* **500**: Internal server error

## Examples

<CodeGroup>
  ```bash cURL (Basic) theme={null}
  curl -X GET "https://api.chunkr.ai/api/v1/task/123e4567-e89b-12d3-a456-426614174000" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```bash cURL (Without Chunks) theme={null}
  curl -X GET "https://api.chunkr.ai/api/v1/task/123e4567-e89b-12d3-a456-426614174000?include_chunks=false" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```bash cURL (Base64 URLs) theme={null}
  curl -X GET "https://api.chunkr.ai/api/v1/task/123e4567-e89b-12d3-a456-426614174000?base64_urls=true" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

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

  task_id = "123e4567-e89b-12d3-a456-426614174000"
  url = f"https://api.chunkr.ai/api/v1/task/{task_id}"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

  response = requests.get(url, headers=headers)
  task = response.json()

  print(f"Status: {task['status']}")
  print(f"Message: {task['message']}")

  if task['status'] == 'Succeeded':
      print(f"Page count: {task['output']['page_count']}")
      print(f"Chunks: {len(task['output']['chunks'])}")
  ```

  ```javascript JavaScript theme={null}
  const taskId = '123e4567-e89b-12d3-a456-426614174000';
  const response = await fetch(
    `https://api.chunkr.ai/api/v1/task/${taskId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const task = await response.json();
  console.log('Status:', task.status);
  console.log('Message:', task.message);

  if (task.status === 'Succeeded') {
    console.log('Page count:', task.output.page_count);
    console.log('Chunks:', task.output.chunks.length);
  }
  ```

  ```python Python (Polling) theme={null}
  import requests
  import time

  def poll_task(task_id, api_key, max_attempts=60, interval=2):
      """Poll task status until completion or timeout"""
      url = f"https://api.chunkr.ai/api/v1/task/{task_id}"
      headers = {"Authorization": f"Bearer {api_key}"}
      
      for attempt in range(max_attempts):
          response = requests.get(url, headers=headers)
          task = response.json()
          
          status = task['status']
          print(f"Attempt {attempt + 1}: Status = {status}")
          
          if status in ['Succeeded', 'Failed', 'Cancelled']:
              return task
          
          time.sleep(interval)
      
      raise TimeoutError("Task did not complete in time")

  task_id = "123e4567-e89b-12d3-a456-426614174000"
  result = poll_task(task_id, "YOUR_API_KEY")
  print(f"Final status: {result['status']}")
  ```
</CodeGroup>

## Use Cases

This endpoint can be used to:

1. **Poll task status during processing** - Check if a task has moved from `Starting` → `Processing` → `Succeeded`
2. **Retrieve final output** - Get processed chunks, segments, and metadata once processing is complete
3. **Access task metadata** - Get file information, page count, timestamps, and configuration
4. **Monitor task progress** - Track when tasks were created, started, and finished

## Notes

* Set `include_chunks=false` for faster responses when you only need status information
* The `output` field is only populated when the task status is `Succeeded`
* Expired tasks will return a 404 error
* Use base64\_urls=true if you need to embed resources directly in your application
* For long-running tasks, implement exponential backoff in your polling logic
