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

# Get Document Translation Status

> Poll a document translation task until it completes and returns a `run_id`.

Use this endpoint to monitor a document translation task created with [Create Document Translation](https://docs.camb.ai/api-reference/endpoint/create-doc-translation.md). Pass the `task_id` returned by the create request, and the API returns the current task status.

When the status is `SUCCESS`, the response includes a `run_id`. Use that `run_id` with [Get Document Translation Result](https://docs.camb.ai/api-reference/endpoint/get-doc-translation-result.md) to fetch the translated document download URL.

## Status Values

* `PENDING`: the document translation is still queued or processing.
* `SUCCESS`: the document translation completed successfully, and a `run_id` is available.
* `ERROR`: the task failed.
* `TIMEOUT`: the task exceeded the processing timeout.
* `PAYMENT_REQUIRED`: the workspace needs credits or an entitlement change before the task can complete.

## Example

```python [expandable] theme={null}
import time
import requests

API_KEY = "your-api-key"
BASE_URL = "https://client.camb.ai/apis"
TASK_ID = "your-task-id"

headers = {"x-api-key": API_KEY}

while True:
    response = requests.get(
        f"{BASE_URL}/translate-doc/{TASK_ID}",
        headers=headers,
    )
    response.raise_for_status()
    status = response.json()

    if status["status"] == "SUCCESS":
        run_id = status["run_id"]
        print(f"Document translation completed. Run ID: {run_id}")
        break

    if status["status"] in {"ERROR", "TIMEOUT", "PAYMENT_REQUIRED"}:
        raise RuntimeError(f"Document translation did not complete: {status}")

    time.sleep(2)
```

> [!NOTE]
>
> Poll at a reasonable interval, such as every few seconds, and stop when the task reaches a terminal status.


## OpenAPI

````yaml get /translate-doc/{task_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /translate-doc/{task_id}:
    get:
      tags:
        - Apis
        - Document Translation
      summary: Get Document Translation Status
      operationId: get_doc_translation_status_translate_doc__task_id__get
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/TaskIDParam'
            description: >-
              The unique identifier returned when you submitted your document
              translation request. Use it to poll the task status.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrchestratorPipelineResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    TaskIDParam:
      type: string
      title: Task ID
      description: >-
        This parameter represents a unique identifier for a task. It is used in
        various API endpoints to query the status or result of a specific task.
        The `task_id` is typically returned when a task is created.
    OrchestratorPipelineResult:
      properties:
        status:
          $ref: '#/components/schemas/TaskStatus'
        run_id:
          type:
            - integer
            - 'null'
          title: Run ID
      type: object
      title: OrchestratorPipelineResult
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TaskStatus:
      type: string
      enum:
        - SUCCESS
        - PENDING
        - TIMEOUT
        - ERROR
        - PAYMENT_REQUIRED
      title: TaskStatus
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        The `x-api-key` is a custom header required for authenticating requests
        to our API. Include this header in your request with the appropriate API
        key value to securely access our endpoints. You can find your API key(s)
        in the 'API' section of our studio website.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.