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

# Translate an article into one or more languages

> Requires `articleId`, a non-empty `targetLanguages` array and at least one selected field (all fields default to false, so a request without `fields` is rejected). The source language is detected from the article unless `sourceLanguage` is given. If a target language already has a translation for a selected multilingual field and `sourceLanguage` is omitted, the request fails with 409 instead of overwriting.



## OpenAPI

````yaml /api-reference/ai-cms/openapi.json post /ai/translateArticle
openapi: 3.1.0
info:
  title: Blog API
  version: 1.0.0
servers:
  - url: https://api.octaviatech.app/cms
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Tags
    description: Tag management endpoints
paths:
  /ai/translateArticle:
    post:
      tags:
        - AI
      summary: Translate an article into one or more languages
      description: >-
        Requires `articleId`, a non-empty `targetLanguages` array and at least
        one selected field (all fields default to false, so a request without
        `fields` is rejected). The source language is detected from the article
        unless `sourceLanguage` is given. If a target language already has a
        translation for a selected multilingual field and `sourceLanguage` is
        omitted, the request fails with 409 instead of overwriting.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - articleId
                - targetLanguages
                - fields
              properties:
                articleId:
                  type: string
                  example: '{{objectId}}'
                targetLanguages:
                  type: array
                  minItems: 1
                  items:
                    type: string
                  description: >-
                    Target language codes; at least one non-empty entry is
                    required
                  example:
                    - en
                    - es
                sourceLanguage:
                  type: string
                  description: Source language; auto-detected from the article when omitted
                  example: fa
                fields:
                  type: object
                  additionalProperties: false
                  description: >-
                    Which article fields to translate. At least one must be
                    true; every flag defaults to false.
                  properties:
                    mainTitle:
                      type: boolean
                    title2:
                      type: boolean
                    title3:
                      type: boolean
                    summary:
                      type: boolean
                    content:
                      type: boolean
                    tags:
                      type: boolean
            examples:
              Basic:
                value:
                  articleId: '{{objectId}}'
                  targetLanguages:
                    - en
                    - es
                  sourceLanguage: fa
                  fields:
                    mainTitle: true
                    content: true
                    tags: true
      responses:
        '200':
          description: OK (translated)
          content:
            application/json:
              example:
                success: true
                statusCode: 200
                message: Article translated successfully
                data:
                  articleId: '{{objectId}}'
                  sourceLanguage: fa
                  targetLanguages:
                    - en
                    - es
                  translations:
                    en:
                      mainTitle: …
                      summary: …
                      content: <p>…</p>
                      tags:
                        - …
        '400':
          description: >-
            Missing articleId, empty targetLanguages, no field selected, or an
            undetectable source language
        '401':
          description: Unauthorized
        '403':
          description: Forbidden (role not allowed)
        '404':
          description: Article not found
        '409':
          description: >-
            Translations already exist for the target languages and
            sourceLanguage was not provided
        '426':
          description: Upgrade required (ai_tokens limit exceeded)
        '500':
          description: Failed to translate article
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````