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

# Translate Document Api

> Translates document attachments to a target language while preserving formatting. Supports .doc, .docx, .ppt, .xlsx, .pptx files and Google Docs, Sheets, Slides.



## OpenAPI

````yaml https://document-assistant.us.aodocs.app/openapi.json post /assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate
openapi: 3.1.0
info:
  title: Document Assistant API
  description: |
    <p>
      The Document Assistant API enables developers to integrate document-based assistant
      functionalities into their applications using AODocs.
    </p>
    <p>
      The first step is to enable AIDA (AODocs Intelligent Document Assistant) in your tenant.
      The support team will provide you with the necessary information on how to get started.
    </p>
    <p>
      The second step is to enable AIDA on libraries. You need to be an administrator of the
      library to do this.<br />
      AIDA can answer questions only from those documents that are in an AIDA enabled
      library.<br />
      We create a vector store index for these documents. This can take some time. The get
      library API provides the status of the indexation and an estimate of the time
      remaining.<br />
      The content of the index is automatically kept up-to-date near real time with the
      content changes.
    </p>
    <p>
      The third step is to ask questions based on the AODocs documents.<br />
      AIDA automatically filters the results based on the user's permissions.
    </p>
    <p>
      <strong>Authentication:</strong> All API endpoints require a valid OAuth2 token in the
      Authorization header. Ensure the client ID of the OAuth2 token is whitelisted in AODocs.
    </p>
  version: 1.1.0
servers:
  - url: https://document-assistant.us.aodocs.app
    description: Production US
  - url: https://document-assistant.eu.aodocs.app
    description: Production EU
security: []
paths:
  /assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate:
    post:
      tags:
        - translation
      summary: Translate Document Api
      description: >-
        Translates document attachments to a target language while preserving
        formatting. Supports .doc, .docx, .ppt, .xlsx, .pptx files and Google
        Docs, Sheets, Slides.
      operationId: >-
        translate_document_api_assistant_api_v1_tenants__tenant__documents__document_id__content_translate_post
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            description: The document id
            title: Document Id
          description: The document id
        - name: tenant
          in: path
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The domain of the customer
            examples:
              - example.com
            title: Tenant
          description: The domain of the customer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranslateDocumentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranslateDocumentResponse'
        '400':
          description: >-
            Path document_id and body document_id do not match, both
            attachment_ids and attachment_filters were provided, or a filter
            targets an attachment that is not supported for translation
        '403':
          description: Document Translation is not enabled for the tenant or library
        '404':
          description: >-
            A filter targets an attachment ID that does not exist on the
            document
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    TranslateDocumentRequest:
      properties:
        document_id:
          type: string
          title: Document Id
          description: The ID of the document to translate
        target_language:
          type: string
          title: Target Language
          description: >-
            The target language for translation (e.g. 'French', 'German',
            'Spanish')
        attachment_filters:
          anyOf:
            - items:
                $ref: '#/components/schemas/AttachmentFilter'
              type: array
            - type: 'null'
          title: Attachment Filters
          description: >-
            The attachments to translate. If provided, only attachments matching
            one of the filters are translated. If not provided, all supported
            attachments will be translated.
        prompt_extension:
          type: string
          title: Prompt Extension
          description: Optional additional instructions appended to the translation prompt
          default: ''
        pubsub_topic:
          anyOf:
            - type: string
            - type: 'null'
          title: Pubsub Topic
          description: >-
            Fully-qualified Pub/Sub topic ('projects/<project>/topics/<topic>')
            to receive per-attachment completion/failure notifications. If
            omitted, no notifications are sent.
      type: object
      required:
        - document_id
        - target_language
      title: TranslateDocumentRequest
    TranslateDocumentResponse:
      properties:
        translations_started:
          items:
            $ref: '#/components/schemas/TranslationStartedAttachment'
          type: array
          title: Translations Started
          description: List of attachments for which translation has been started
      type: object
      required:
        - translations_started
      title: TranslateDocumentResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AttachmentFilter:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: The name of the attachment to match (it can be a regular expression)
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: The id of the matched attachment
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
          description: The mimetype of the matched attachment
      type: object
      title: AttachmentFilter
      description: Match an attachment by identifier, MIME type, or name expression.
    TranslationStartedAttachment:
      properties:
        job_id:
          type: string
          title: Job Id
          description: >-
            Per-attachment job ID; correlates this started translation with the
            Pub/Sub notification that will be sent on completion or final
            failure.
        attachment_id:
          type: string
          title: Attachment Id
          description: The file ID of the attachment being translated
        attachment_title:
          type: string
          title: Attachment Title
          description: The title of the attachment being translated
      type: object
      required:
        - job_id
        - attachment_id
        - attachment_title
      title: TranslationStartedAttachment
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````