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

# Set Translations

> Sets translation content for translatable fields.

Use this API to add new translations or update existing ones as needed.

The request payload has a maximum size of 100 KB.


<RequestExample>
  ```bash Set Translations theme={"system"}
    curl -X POST \
    'https://api.appcharge.com/v1/translations' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'x-publisher-token: <x-publisher-token>' \
    --data '{
      "staticTranslations": [ 
        {
          "key": "ui.loading",
          "locale": "es-ES",
          "value": "Cargando…"
        }
      ],
      "dynamicTranslations": [
        {
          "type": "product",
          "externalId": "SKU-12345",
          "field": "display_name",
          "locale": "es-ES",
          "value": "Espada legendaria"
        }
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Set Translations  theme={"system"}
  {
    "dynamicTranslations": [
      {
        "type": "product",
        "externalId": "SKU-12345",
        "field": "display_name",
        "locale": "es-ES",
        "value": "Espada legendaria"
      },
      {
        "type": "product",
        "externalId": "SKU-12345",
        "field": "display_name",
        "locale": "en-US",
        "value": "Legendary Sword"
      },
      {
        "type": "product",
        "externalId": "SKU-12345",
        "field": "display_name",
        "locale": "pl",
        "value": "Legendarny Miecz"
      },
      {
        "type": "offer_design",
        "externalId": "OD-987",
        "field": "title",
        "locale": "es-ES",
        "value": "Oferta de Verano"
      },
      {
        "type": "offer_design",
        "externalId": "OD-987",
        "field": "title",
        "locale": "en-US",
        "value": "Summer Offer"
      },
      {
        "type": "offer_design",
        "externalId": "OD-987",
        "field": "title",
        "locale": "pl",
        "value": "Letnia Oferta"
      }
    ],
    "staticTranslations": [
      {
        "key": "checkout.pay_button",
        "locale": "es-ES",
        "value": "Pagar ahora"
      },
      {
        "key": "checkout.pay_button",
        "locale": "en-US",
        "value": "Pay Now"
      },
      {
        "key": "checkout.pay_button",
        "locale": "pl",
        "value": "Zapłać teraz"
      },
      {
        "key": "ui.loading",
        "locale": "es-ES",
        "value": "Cargando…"
      },
      {
        "key": "ui.loading",
        "locale": "en-US",
        "value": "Loading…"
      },
      {
        "key": "ui.loading",
        "locale": "pl",
        "value": "Ładowanie…"
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi-translations.json POST /v1/translations
openapi: 3.0.0
info:
  title: Localization API
  description: Localization API for managing dynamic and static translations.
  version: '1.0'
  contact: {}
servers:
  - url: https://api-sandbox.appcharge.com
security: []
tags: []
paths:
  /v1/translations:
    post:
      tags:
        - Localization
      description: |-
        Sets translation content for translatable fields. 
         
         Use this API to add new translations or update existing ones as needed. 
         
         The request payload has a maximum size of 100 KB.
      operationId: set-translations
      parameters:
        - name: x-publisher-token
          required: true
          in: header
          description: The publisher token
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranslationRequest'
      responses:
        '200':
          description: Translations retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranslationResponse'
        '400':
          description: Invalid request payload.
        '401':
          description: Missing or invalid authentication.
        '403':
          description: Insufficient permissions.
components:
  schemas:
    TranslationRequest:
      type: object
      required:
        - dynamicTranslations
        - staticTranslations
      properties:
        dynamicTranslations:
          type: array
          description: >-
            A list of translations for dynamic entities you define such as offer
            and product names.
          items:
            $ref: '#/components/schemas/DynamicTranslation'
        staticTranslations:
          type: array
          description: >-
            A list of translations for static UI elements such as button labels
            and headers.
          items:
            $ref: '#/components/schemas/StaticTranslation'
    TranslationResponse:
      type: object
      properties:
        dynamicTranslations:
          type: array
          description: >-
            A list of translations for dynamic entities you define such as offer
            and product names.
          items:
            $ref: '#/components/schemas/DynamicTranslation'
        staticTranslations:
          type: array
          description: >-
            A list of translations for static UI elements such as button labels
            and headers.
          items:
            $ref: '#/components/schemas/StaticTranslation'
    DynamicTranslation:
      type: object
      properties:
        type:
          type: string
          description: |-
            Entity type. 
             Values include: 'offer', 'offer_design', 'product', 'section', 'builder', 'ribbon'
          example: section
        externalId:
          type: string
          description: The ID as defined in the Publisher Dashboard.
          example: my-bundle-1
        field:
          type: string
          description: |-
            The entity field the translation applies to. 
             Values include: 'display_name', 'description', 'title', 'text', 'prefix', 'suffix'
          example: description
        locale:
          type: string
          description: >-
            The locale code. Both ISO-639 language code and ISO-3166 country
            code formats are supported.
          example: es-ES
        value:
          type: string
          description: The translation text for the specified field and locale.
          example: Hola!
    StaticTranslation:
      type: object
      properties:
        key:
          type: string
          description: The key identifier for the static translation.
          example: checkout.pay_button
        locale:
          type: string
          description: >-
            The locale code. Both ISO-639 language code and ISO-3166 country
            code formats are supported.
          example: es-ES
        value:
          type: string
          description: The translation value associated with the key and locale.
          example: Zapłać teraz

````