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

# Upsert Content Translation

> Creates or updates a translation for a content item in a specific locale.

This operation doesn't modify translations in other locales or other content fields.

> **Note:** You must first [add the locale in the Publisher Dashboard](/../../guides/translations/add-and-manage-languages) before adding its translation.


<RequestExample>
  ```bash Upsert Content Translation theme={"system"}
  curl -X PUT \
    'https://api.appcharge.com/v1/portal-content/507f1f77bcf86cd799439011/translations/fr-FR' \
    -H 'Content-Type: application/json' \
    -H 'x-publisher-token: <x-publisher-token>' \
    -d '{
      "title": "Bienvenue dans notre jeu",
      "subTitle": "Tout ce que vous devez savoir",
      "bodyText": "Ceci est le contenu principal de l'\''article en français...",
      "headerImage": "https://cdn.example.com/images/header-fr.jpg",
      "thumbnailImage": "https://media.appcharge.com/media/25cb4861ec8924a6b69a0f59/book-shelf1920.jpg",
      "labels": ["tutoriel", "débutant"]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Upsert Content Translation theme={"system"}
  {
    "id": "507f1f77bcf86cd799439011",
    "title": "Welcome to Our Game",
    "subTitle": "Everything you need to know",
    "bodyText": "This is the main content body with detailed information...",
    "headerImage": "https://cdn.example.com/images/header.jpg",
    "thumbnailImage": "https://media.appcharge.com/media/25cb4861ec8924a6b69a0f59/book-shelf1920.jpg",
    "labels": ["tutorial", "beginner"],
    "state": "visible",
    "contentType": "article",
    "slug": "welcome-to-our-game",
    "visibility": "public",
    "tag": "spring2025",
    "createdAt": "2025-10-15T10:30:00.000Z",
    "updatedAt": "2025-10-20T14:45:00.000Z",
    "translations": [
      {
        "isoCode": "fr-FR",
        "title": "Bienvenue dans notre jeu",
        "subTitle": "Tout ce que vous devez savoir",
        "bodyText": "Ceci est le contenu principal de l'article en français...",
        "headerImage": "https://cdn.example.com/images/header-fr.jpg",
        "thumbnailImage": "https://media.appcharge.com/media/25cb4861ec8924a6b69a0f59/book-shelf1920.jpg",
        "labels": ["tutoriel", "débutant"]
      }
    ],
    "pages": [
      {
        "id": "6850249eb5bd5c59b9bab7e2",
        "pageName": "FAQs"
      }
    ]
  }
  ```

  ```json 400 theme={"system"}
  {
    "message": "BAD_REQUEST",
    "requestUrl": "/v1/portal-content/{contentId}/translations/{isoCode}",
    "body": "Invalid request body or validation error."
  }
  ```

  ```json 401 theme={"system"}
  {
    "message": "UNAUTHORIZED",
    "requestUrl": "/v1/portal-content/{contentId}/translations/{isoCode}",
    "body": "Invalid or missing publisher token."
  }
  ```

  ```json 404 theme={"system"}
  {
    "message": "NOT_FOUND",
    "requestUrl": "/v1/portal-content/{contentId}/translations/{isoCode}",
    "body": "Content not found."
  }
  ```

  ```json 409 theme={"system"}
  {
    "message": "CONFLICT",
    "requestUrl": "/v1/portal-content/{contentId}/translations/{isoCode}",
    "body": "Slug already exists."
  }
  ```

  ```json 413 theme={"system"}
  {
    "message": "PAYLOAD_TOO_LARGE",
    "requestUrl": "/v1/portal-content/{contentId}/translations/{isoCode}",
    "body": "Request payload is too large."
  }
  ```

  ```json 500 theme={"system"}
  {
    "message": "INTERNAL_SERVER_ERROR",
    "requestUrl": "/v1/portal-content/{contentId}/translations/{isoCode}",
    "body": "Server error."
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi-portal-content.json PUT /v1/portal-content/{contentId}/translations/{isoCode}
openapi: 3.0.0
info:
  title: Portal Content API
  description: API for managing Game Portal content items.
  version: '1.0'
  contact: {}
servers:
  - url: https://api.appcharge.com
security: []
tags: []
paths:
  /v1/portal-content/{contentId}/translations/{isoCode}:
    put:
      tags:
        - Portal Content
      summary: Upsert Content Translation
      description: >-
        Creates or updates a translation for a content item in a specific
        locale. <br/><br/>This operation doesn't modify translations in other
        locales or other content fields.<br /> <Note>You must first [add the
        locale in the Publisher
        Dashboard](/../../guides/translations/add-and-manage-languages) before
        adding its translation.</Note>
      operationId: upsert-content-translation
      parameters:
        - name: contentId
          required: true
          in: path
          description: Content ID.
          schema:
            type: string
        - name: isoCode
          required: true
          in: path
          description: >-
            The locale code. Both
            [ISO-639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code
            and [ISO-3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country
            code formats are supported.
          schema:
            type: string
        - name: x-publisher-token
          required: true
          in: header
          description: Publisher token.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertContentTranslationRequest'
      responses:
        '200':
          description: >-
            Translation upserted successfully. Returns the full updated content
            item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentItem'
        '400':
          description: Invalid request body or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: BAD_REQUEST
                requestUrl: /v1/portal-content/{contentId}/translations/{isoCode}
                body: Invalid request body or validation error.
        '401':
          description: Invalid or missing publisher token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: UNAUTHORIZED
                requestUrl: /v1/portal-content/{contentId}/translations/{isoCode}
                body: Invalid or missing publisher token.
        '404':
          description: Content not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: NOT_FOUND
                requestUrl: /v1/portal-content/{contentId}/translations/{isoCode}
                body: Content not found.
        '409':
          description: Slug conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: CONFLICT
                requestUrl: /v1/portal-content/{contentId}/translations/{isoCode}
                body: Slug already exists.
        '413':
          description: Request payload is too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: PAYLOAD_TOO_LARGE
                requestUrl: /v1/portal-content/{contentId}/translations/{isoCode}
                body: Request payload is too large.
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: INTERNAL_SERVER_ERROR
                requestUrl: /v1/portal-content/{contentId}/translations/{isoCode}
                body: Server error.
components:
  schemas:
    UpsertContentTranslationRequest:
      type: object
      required:
        - title
        - subTitle
        - bodyText
        - headerImage
        - thumbnailImage
        - labels
      properties:
        title:
          type: string
          description: Translated title.
          example: Bienvenue dans notre jeu
        subTitle:
          type: string
          description: Translated subtitle.
          example: Tout ce que vous devez savoir
        bodyText:
          type: string
          description: Translated body text.
          example: Ceci est le contenu principal de l'article en français...
        headerImage:
          type: string
          description: >-
            Translated header image URL. Can be an external link or the URL of
            an image from the Assets Library.
          example: https://cdn.example.com/images/header-fr.jpg
        thumbnailImage:
          type: string
          description: >-
            Translated thumbnail image URL. Can be an external link or the URL
            of an image from the Assets Library.
          example: >-
            https://media.appcharge.com/media/25cb4861ec8924a6b69a0f59/book-shelf1920.jpg
        labels:
          type: array
          items:
            type: string
          description: Translated labels.
          example:
            - tutoriel
            - débutant
    ContentItem:
      type: object
      properties:
        id:
          type: string
          description: Content ID.
          example: 507f1f77bcf86cd799439011
        title:
          type: string
          description: Content title.
          example: Welcome to Our Game
        subTitle:
          type: string
          description: Content description.
          example: Everything you need to know
        bodyText:
          type: string
          description: Content body text.
          example: This is the main content body with detailed information...
        headerImage:
          type: string
          description: Content header image URL.
          example: https://cdn.example.com/images/header.jpg
        thumbnailImage:
          type: string
          description: Content thumbnail image URL.
          example: >-
            https://media.appcharge.com/media/25cb4861ec8924a6b69a0f59/book-shelf1920.jpg
        labels:
          type: array
          items:
            type: string
          description: List of labels associated with the content.
          example:
            - tutorial
            - beginner
        state:
          type: string
          description: Current state of the content.
          default: hidden
          enum:
            - visible
            - hidden
            - scheduled
          example: hidden
        contentType:
          type: string
          enum:
            - article
            - news
          description: Content type.
          example: article
        publishDate:
          type: string
          format: date-time
          description: Content publish date. Use for scheduling content.
          example: '2025-10-20T00:00:00.000Z'
        slug:
          type: string
          description: Content slug. If not provided, this value is auto-generated.
          example: welcome-to-our-game
        visibility:
          type: string
          enum:
            - public
            - private
          description: Content visibility level.
          default: public
          example: public
        tag:
          type: string
          description: Internal tag for organizing your content. Not visible to players.
          example: spring2025
        createdAt:
          type: string
          format: date-time
          description: Created date.
          example: '2025-10-15T10:30:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: Updated date.
          example: '2025-10-19T14:20:00.000Z'
        translations:
          type: array
          items:
            $ref: '#/components/schemas/TranslationResponse'
          description: >-
            List of translations for the content item. Each object represents a
            locale and its translations.
        pages:
          type: array
          items:
            $ref: '#/components/schemas/Page'
          description: List of pages where this content appears.
          example:
            - id: 68b0249eb5bd5c59b9bab7e2
              pageName: FAQs
            - id: 692eb70d0293e07ab4895518
              pageName: Events
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message.
        requestUrl:
          type: string
          description: URL of the request that caused the error.
        body:
          type: string
          description: Error description.
    TranslationResponse:
      type: object
      properties:
        isoCode:
          type: string
          description: >-
            The locale code. Both
            [ISO-639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code
            and [ISO-3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country
            code formats are supported.
          example: fr-FR
        title:
          type: string
          description: Translated title.
          example: Bienvenue dans notre jeu
        subTitle:
          type: string
          description: Translated description.
          example: Tout ce que vous devez savoir
        bodyText:
          type: string
          description: Translated body text.
          example: Ceci est le contenu principal de l'article en français...
        headerImage:
          type: string
          description: Translated header image URL.
          example: https://cdn.example.com/images/header-fr.jpg
        thumbnailImage:
          type: string
          description: Translated thumbnail image URL.
          example: >-
            https://media.appcharge.com/media/25cb4861ec8924a6b69a0f59/book-shelf1920.jpg
        labels:
          type: array
          items:
            type: string
          description: Translated labels.
          example:
            - tutoriel
            - débutant
    Page:
      type: object
      properties:
        id:
          type: string
          description: Page ID.
          example: 6850249eb5bd5c59b9bab7e2
        pageName:
          type: string
          description: Page name.
          example: faq

````