> ## 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.

# Fine-Tune Image Translation

> Adjusts the wording or look of a single text region with a short prompt.

## Refining a Single Region

If one piece of text isn't quite right, whether the translation or the way it looks, you can adjust just that region without re-running the whole image. Send the `run_id`, the `target_language_id` of the translation you want to change, the `region_id` of the text region, and a `prompt` describing what you want.

You can find region IDs in [Get Image Translation Project](https://docs.camb.ai/api-reference/endpoint/get-image-translation-project.md).

## Writing a Good Prompt

The `prompt` is a short, plain-language instruction that applies to the one region you selected. Be specific about what should change, whether that is the wording or how the text looks: its color, font, size, or shadow. A single sentence is usually enough.

Examples:

* `Change the text color to white`
* `Use a bolder, larger font`
* `Add a soft drop shadow behind the text`
* `Make the text color more vibrant`
* `Shorten the translation so it fits the speech balloon`

Because each prompt only affects one region, send a separate request for each region you want to adjust.

## Applying the Result

The response contains a `task_id` and a `user_message` (the prompt as stored on the run). To see the change in your download:

1. Poll [`/image-translation/{task_id}`](get-end-to-end-image-translation-status) until the status is `SUCCESS`
2. Call [Export Image Translation](https://docs.camb.ai/api-reference/endpoint/export-image-translation.md). A fine-tune doesn't update your download on its own, so this step is required for the change to appear
3. Fetch the updated pages from [`/image-translation/result/{run_id}`](get-image-translation-result)

## Request Example

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

headers = {
    "x-api-key": os.environ["CAMB_API_KEY"],
    "Content-Type": "application/json",
}

response = requests.post(
    "https://client.camb.ai/apis/image-translation/fine-tune",
    headers=headers,
    json={
        "run_id": 12345,
        "target_language_id": 54,
        "region_id": 1,
        "prompt": "Use a bolder font and make the text color more vibrant",
    },
)
response.raise_for_status()
print(response.json()["task_id"])
```


## OpenAPI

````yaml post /image-translation/fine-tune
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /image-translation/fine-tune:
    post:
      tags:
        - Apis
        - Image Translation
      summary: Fine-Tune Image Translation
      description: >-
        Adjust a single text region with a prompt. Poll the returned `task_id`,
        then export again to apply the change.
      operationId: fine_tune_image_translation_image_translation_fine_tune_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FineTuneImageTranslationRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FineTuneImageTranslationOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    FineTuneImageTranslationRequest:
      type: object
      title: FineTuneImageTranslationRequest
      required:
        - run_id
        - target_language_id
        - region_id
        - prompt
      properties:
        run_id:
          type: integer
          title: Run ID
          description: The image translation run that contains the region.
          example: null
        target_language_id:
          type: integer
          title: Target Language ID
          description: Numeric language ID of the translation to edit.
          example: null
        region_id:
          type: integer
          title: Region ID
          description: >-
            ID of the text region to re-render. Get it from `GET
            /image-translation/project/{run_id}`.
          example: null
        prompt:
          type: string
          minLength: 1
          title: Prompt
          description: >-
            A short instruction describing how this region's translation should
            change. Be specific about what should change, either the wording or
            how the text looks, for example `Change the text color to white` or
            `Add a soft drop shadow behind the text`.
          example: Make the text bolder and change the color to a vibrant red
    FineTuneImageTranslationOut:
      type: object
      title: FineTuneImageTranslationOut
      required:
        - task_id
        - user_message
      properties:
        task_id:
          type: string
          title: Task ID
          description: >-
            Poll `GET /image-translation/{task_id}` until SUCCESS, then export
            again.
        user_message:
          $ref: '#/components/schemas/FineTuneImageTranslationUserMessageOut'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FineTuneImageTranslationUserMessageOut:
      type: object
      title: FineTuneImageTranslationUserMessageOut
      required:
        - id
        - role
        - content
        - render_version_id
      properties:
        id:
          type: integer
        role:
          type: string
        content:
          type: string
        render_version_id:
          type: integer
        created_at:
          type:
            - string
            - 'null'
    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.