> ## 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 Translation Result

> Retrieves the final translated texts from a completed translation task using the provided `run_id`.

This endpoint delivers the final product of your translation process: the translated texts themselves. Once your translation task has completed successfully and you've received a `run_id`, this endpoint allows you to retrieve the actual translations that were generated. Think of it as the pickup counter where you collect your finished translations after they've been processed.

## How to Use This Endpoint

To retrieve your translated texts, send a `GET` request to this endpoint with the `run_id` you received when your translation task was marked as completed. This `run_id` serves as your claim ticket for the finished translations. The system will respond with an array containing all your translated texts, preserving the same order as your original input.

## Understanding the Response

When you call this endpoint, you'll receive a response that includes your translated content:

* **`texts`**: An array of strings containing the translated output texts. Each item in this array corresponds to one of the original texts you submitted, maintaining the same order. This makes it easy to match translations with their original content.

The structure of the response follows this format:

```json theme={null}
{
  "texts": [
    "Your first translated text",
    "Your second translated text",
    "Your third translated text"
    // ...and so on for all texts in your original request
  ]
}
```

This straightforward response structure makes it simple to integrate translations into your application workflows. You can directly map each translated text to its corresponding original text by using the same array indices.

## Working with Translation Results

There are several common patterns for handling translation results effectively:

### Direct Integration

For immediate use, you can simply extract the texts array and use the translations in your application:

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

# Your API authentication
headers = {
    "x-api-key": "your-api-key",  # Replace with your actual API key
}

# The run_id from your completed translation task
run_id = 12345  # Replace with your actual run ID

# Retrieve the translations
response = requests.get(
    f"https://client.camb.ai/apis/translation-result/{run_id}",
    headers=headers
)

# Check if the request was successful
response.raise_for_status()

# Extract the translations
result_data = response.json()
translations = result_data["texts"]

# Use the translations in your application
for i, translation in enumerate(translations):
    print(f"Translation {i+1}: {translation}")
```

### Parallel Display

For applications that need to show both original and translated text together, you can zip the arrays:

```python [expandable] theme={null}
# Assuming you've stored your original texts
original_texts = [
    "This is the first sentence to translate.",
    "Here is the second one.",
    "And finally, the third sentence."
]

# And you've retrieved the translations as shown above
translations = result_data["texts"]

# Create parallel display
for original, translated in zip(original_texts, translations):
    print("Original: " + original)
    print("Translated: " + translated)
    print("---")
```

### Saving to Database

For longer-term storage, you might want to save the translation results alongside their originals:

```python [expandable] theme={null}
import sqlite3

# Set up database connection (replace with your actual database logic)
conn = sqlite3.connect("translations.db")
cursor = conn.cursor()

# Create table if it doesn't exist
cursor.execute("""
CREATE TABLE IF NOT EXISTS translations (
    id INTEGER PRIMARY KEY,
    original_text TEXT,
    translated_text TEXT,
    source_language INTEGER,
    target_language INTEGER,
    translation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")

# Insert translations into database
for original, translated in zip(original_texts, translations):
    cursor.execute(
        "INSERT INTO translations (original_text, translated_text, source_language, target_language) VALUES (?, ?, ?, ?)",
        (original, translated, 1, 2)  # Replace with your actual language codes
    )

# Commit the changes
conn.commit()
conn.close()
```

## Next Steps

Once you've retrieved your translations, you can:

1. **Display them** to your users
2. **Store them** for future reference
3. **Process them further** with additional NLP tools
4. **Use them in your application logic** to enable multilingual functionality

The simplicity of the response format makes it easy to integrate translations wherever they're needed in your workflow, whether you're building a multilingual website, an educational app, or an international communication tool.

By understanding how to effectively use this endpoint, you can create smoothly functioning multilingual applications that deliver high-quality translations to your users at exactly the right moment in their journey.


## OpenAPI

````yaml get /translation-result/{run_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /translation-result/{run_id}:
    get:
      tags:
        - Apis
      summary: Get Translation Result
      description: Get the result for your translation only project by using the run_id
      operationId: get_translation_result_translation_result__run_id__get
      parameters:
        - name: run_id
          in: path
          required: true
          description: >-
            The unique identifier for the run, which was generated during the
            translation creation process and returned upon task completion.
          schema:
            $ref: '#/components/schemas/RunIDParam'
            title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranslationResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    RunIDParam:
      type: integer
      title: Run ID
      description: >-
        The unique identifier for the run, which was generated during the
        creation process and returned upon task completion.
    TranslationResult:
      type: object
      properties:
        texts:
          description: >-
            An array of strings containing the translated output texts. Each
            item in the array corresponds to one translated text
          type: array
          items:
            type: string
          title: translated texts
      title: Translation Result
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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.

````