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

# Get Analysis Result

> Poll the status and result of a submitted analysis job.

Returns the current status of an analysis job previously created via [`POST /analysis`](/api-reference/analysis/submit).

<Note>
  Task records expire **24 hours** after creation. A `404` response means the task ID is unknown or has expired.
</Note>

### Path parameters

<ParamField path="task_id" type="string" required>
  The `task_id` returned by `POST /analysis`.
</ParamField>

### Response

<ResponseField name="status" type="string" required>
  One of `processing`, `completed`, or `failed`.
</ResponseField>

<ResponseField name="task_id" type="string" required>
  Echo of the task identifier.
</ResponseField>

<ResponseField name="result" type="object">
  Present when `status` is `completed`. Contains the full analysis output.
</ResponseField>

<ResponseField name="error" type="string">
  Present when `status` is `failed`. Human-readable reason the analysis could not be completed.
</ResponseField>

#### Status values

| Value        | Meaning                                                      |
| ------------ | ------------------------------------------------------------ |
| `processing` | Analysis is in progress — keep polling                       |
| `completed`  | Analysis finished; `result` contains the full output         |
| `failed`     | Analysis could not be completed; `error` contains the reason |

<ResponseExample>
  ```json Processing theme={null}
  {
    "status": "processing",
    "task_id": "3f7a1c2e-8b4d-4e9f-a1b2-c3d4e5f60718"
  }
  ```

  ```json Completed theme={null}
  {
    "status": "completed",
    "task_id": "3f7a1c2e-8b4d-4e9f-a1b2-c3d4e5f60718",
    "result": { "...": "..." }
  }
  ```

  ```json Failed theme={null}
  {
    "status": "failed",
    "task_id": "3f7a1c2e-8b4d-4e9f-a1b2-c3d4e5f60718",
    "error": "Unable to process this PDF"
  }
  ```
</ResponseExample>

### Error responses

| Status | Reason                       |
| ------ | ---------------------------- |
| `401`  | Missing or invalid API token |
| `404`  | Task not found or expired    |

### Polling pattern

<CodeGroup>
  ```bash cURL theme={null}
  curl https://gateway.manka.tz/v1/api/analysis/3f7a1c2e-8b4d-4e9f-a1b2-c3d4e5f60718 \
    -H "Authorization: Bearer $MANKA_API_TOKEN"
  ```

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

  while True:
      r = requests.get(
          f"https://gateway.manka.tz/v1/api/analysis/{task_id}",
          headers={"Authorization": f"Bearer {token}"},
      )
      body = r.json()
      if body["status"] in ("completed", "failed"):
          break
      time.sleep(5)
  ```
</CodeGroup>

<Tip>
  Prefer a [callback URL](/api-reference/analysis/callback) over polling when you control a public HTTPS endpoint.
</Tip>
