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

# Set a macro translation

> Replace one macro's translation into one chosen language with your own wording.

Send the translated `title` and `content` (HTML, like a macro body). Keep the macro's `{{variables}}` as written. `options` relabels the macro's options by `id`; leave it out to keep the current translated labels. An option you don't list is sent with its original label.

Your wording is used exactly like a generated translation: agents get it in the inbox for customers in that language. It is kept until the macro's title, content or options change, or a custom variable it uses changes. Then the macro is translated again. [Retranslate a macro](https://docs.open.cx/api-reference/macros/retranslate.md) also replaces it with a generated translation. Each change is recorded in the audit log.

The response is the macro's translations, as returned by [Get macro translations](https://docs.open.cx/api-reference/macros/translations.md). It fails with `400` when the language is not one of the chosen ones, or is the language the macro is written in.


## OpenAPI

````yaml put /macros/{id}/translations/{language}
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /macros/{id}/translations/{language}:
    put:
      summary: Set a macro translation
      description: >-
        Replace one org-wide macro's translation into one selected language with
        your own wording, instead of the generated one. `content` is HTML like a
        macro body; `options` relabels the macro's options by `id` (leave it out
        to keep the current translated labels). It is used like a generated
        translation and kept until the macro's title, content or options (or a
        custom variable it uses) change, which translates it again;
        `retranslateMacro` also replaces it with a generated one. The change is
        recorded in the audit log, and `overridden_by` names who wrote it.
        Returns the macro's translations. Fails with 400 when the language is
        not one of the selected `translation_languages` or is the macro's own
        `source_language`.
      operationId: setMacroTranslation
      parameters:
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          in: path
          name: id
          required: true
          description: Macro ID
        - schema:
            type: string
            pattern: ^[a-z]{2,3}$
          in: path
          name: language
          required: true
          description: >-
            Language code (lower-case, such as `es`), one of the selected
            `translation_languages`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetMacroTranslationDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MacroTranslationsDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    SetMacroTranslationDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SetMacroTranslationDtoInput'
      type: object
      properties:
        title:
          type: string
          minLength: 1
          maxLength: 120
          description: The translated title.
        content:
          type: string
          minLength: 1
          maxLength: 20000
          description: >-
            The translated body, HTML like a macro body (`<p>`, `<br>`,
            `<strong>`, `<em>`, `<s>`, `<a href>`, lists, inline images). Keep
            {{variables}} as written.
        options:
          description: >-
            Translated labels for the macro's options, by option `id` (up to 20
            characters each). Leave out to keep the current translated labels;
            an option not listed is sent with its original label.
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              label:
                type: string
            required:
              - id
              - label
      required:
        - title
        - content
    MacroTranslationsDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/MacroTranslationsDto'
      type: object
      properties:
        saved_reply_id:
          type: string
        source_language:
          type:
            - string
            - 'null'
        items:
          type: array
          items:
            type: object
            properties:
              language:
                type: string
              status:
                type: string
                enum:
                  - pending
                  - ready
                  - failed
              title:
                type: string
              content:
                type: string
              options:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    label:
                      type: string
                  required:
                    - id
                    - label
                  additionalProperties: false
              overridden_by:
                anyOf:
                  - type: object
                    properties:
                      user_id:
                        type:
                          - number
                          - 'null'
                      name:
                        type:
                          - string
                          - 'null'
                    required:
                      - user_id
                      - name
                    additionalProperties: false
                  - type: 'null'
                description: >-
                  Who wrote the text in use, when it is not a generated
                  translation. `user_id` is null when an API key wrote it.
              updated_at:
                type: string
                format: date-time
            required:
              - language
              - status
              - title
              - content
              - options
              - overridden_by
              - updated_at
            additionalProperties: false
      required:
        - saved_reply_id
        - source_language
        - items
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.