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

# Update Translation File

> Updates or creates a translation file for a specific repository, language, and bundle

<Card title="This action is also available via CLI" icon="terminal" href="/tech/cli/prismy-hosted#prismy-push" arrow="true">
  Upload translation files from the command line or CI with **`prismy push`**
  <p>See the [Prismy Hosted CLI guide](/tech/cli/prismy-hosted).</p>
</Card>


## OpenAPI

````yaml POST /api/public/prismy-hosted/{repo_id}/{language}/{bundleName}
openapi: 3.0.0
info:
  title: Prismy API
  description: API for managing translations with Prismy
  version: 1.0.0
servers:
  - url: https://app.prismy.io
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/public/prismy-hosted/{repo_id}/{language}/{bundleName}:
    post:
      tags:
        - Prismy Hosted
      summary: Update translation file
      description: >-
        Updates or creates a translation file for a specific repository,
        language, and bundle
      operationId: updateTranslationFile
      parameters:
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
          description: Repository identifier
          example: 25060c5dfa
        - name: language
          in: path
          required: true
          schema:
            type: string
          description: Language code (e.g., en-US, fr-FR, es-ES)
          example: en-US
        - name: bundleName
          in: path
          required: true
          schema:
            type: string
          description: Bundle name or ID
          example: common
        - name: override
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            If true, completely replaces the file. If false, merges new keys
            only
        - name: auto-translate
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            If true, automatically translates new keys to other languages in the
            bundle
        - name: wait-for-translations
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: If true, waits for translations to complete before responding
        - name: branch
          in: query
          required: false
          schema:
            type: string
          description: >-
            Target branch name. Defaults to the repository's main branch. If the
            branch does not exist, it will be created, by copying the main
            branch and applying the changes.
        - name: user
          in: query
          required: false
          schema:
            type: string
          description: >-
            Username or email to use as author when creating versions. If not
            provided, defaults to 'Prismy API'
          example: john.doe@example.com
        - name: delete-removed-keys-from-all-files
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Use with override=true to synchronize key removal across the bundle.
            When true, any key that exists in the bundle but is missing from
            your upload is removed from all language files (e.g. en, fr, es) in
            that bundle. Useful after cleaning unused keys (e.g. with
            i18n-unused): upload the cleaned source file with override=true and
            this flag to have the same keys removed from every language.
            Deletions are preserved when you merge your branch into main.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTranslationRequest'
      responses:
        '200':
          description: Translation file updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateTranslationResponse'
        '400':
          description: Bad Request - Invalid request body or parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: >-
                  Request body must contain either 'json' object or 'content'
                  string
        '401':
          description: Unauthorized - Invalid or missing API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Invalid API token
        '403':
          description: >-
            Forbidden - Tags feature is not enabled (returned when tags array is
            provided but the Tags feature is disabled for the organization)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Tags feature is not enabled
                  message:
                    type: string
                    description: Instructions to enable the feature
                  enable_url:
                    type: string
                    example: https://app.prismy.io/tags
                    description: URL to enable Tags in Prismy
        '404':
          description: Not Found - Repository not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Repository 'repo123' not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Internal server error
                message: Error details
components:
  schemas:
    UpdateTranslationRequest:
      type: object
      description: >-
        Request body supports two formats: JSON object or file content.
        Optionally include tags to add static tags to newly added or edited keys
        (requires Tags feature enabled at https://app.prismy.io/tags). Existing
        tags are reused by name; new tags are created with auto-assigned colors.
      oneOf:
        - type: object
          required:
            - json
          properties:
            json:
              type: object
              additionalProperties:
                type: string
              example:
                key1: value1
                key2: value2
            tags:
              type: array
              items:
                type: string
              description: >-
                Optional. Static tag names to add to newly added or edited keys.
                Tags are created if they do not exist. Requires Tags feature
                enabled.
              example:
                - urgent
                - review-needed
        - type: object
          required:
            - content
          properties:
            content:
              type: string
              description: Raw file content as string
              example: |-
                welcome: Hello
                goodbye: Goodbye
            fileName:
              type: string
              description: Original filename for format detection
              example: translations.yaml
            originalFormat:
              type: string
              description: Explicit format specification
              enum:
                - json
                - yaml
                - yml
                - po
                - pot
                - resx
                - xml
                - arb
                - xcstrings
                - ts
                - js
              example: yaml
            tags:
              type: array
              items:
                type: string
              description: >-
                Optional. Static tag names to add to newly added or edited keys.
                Tags are created if they do not exist. Requires Tags feature
                enabled.
              example:
                - urgent
                - review-needed
    UpdateTranslationResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Translation file updated successfully
        branch:
          type: string
          example: main
        keys:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              value:
                type: string
              updated:
                type: boolean
        total_keys:
          type: integer
          example: 2
        override:
          type: boolean
          example: false
        delete_removed_keys:
          type: boolean
          description: >-
            True when you used delete-removed-keys-from-all-files and keys were
            actually removed from the bundle. Confirms that unused-key cleanup
            was applied across all language files.
          example: false
        auto_translate:
          type: boolean
          example: true
        wait_for_translations:
          type: boolean
          example: false
        other_translations:
          type: object
          description: Results of translation generation for other languages
          properties:
            success:
              type: boolean
              example: true
            filesUpdated:
              type: integer
              example: 3
            keysAdded:
              type: integer
              example: 2
        tags:
          type: object
          description: >-
            Present when tags array was provided. Results of applying static
            tags to newly added or edited keys.
          properties:
            success:
              type: boolean
              description: Whether tagging completed successfully
            tags_added:
              type: integer
              description: Number of distinct tags applied (including existing ones)
            keys_tagged:
              type: integer
              description: Number of keys that received tags
            added_count:
              type: integer
              description: Number of tag-key associations created
            message:
              type: string
              description: Informational message (e.g. when no valid tag names provided)
            error:
              type: string
              description: Error message if tagging failed
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        message:
          type: string
          description: Additional error details
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API token from your organization settings

````