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

# Merge branch

> Merges a Prismy branch into the main branch for a specific repository



## OpenAPI

````yaml POST /api/public/prismy-hosted/merge-branch
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/merge-branch:
    post:
      tags:
        - Prismy Hosted
      summary: Merge branch into main
      description: Merges a Prismy branch into the main branch for a specific repository
      operationId: mergeBranch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeBranchRequest'
      responses:
        '200':
          description: Branch merged successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeBranchResponse'
        '400':
          description: Bad Request - Invalid request body or merge operation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingFields:
                  summary: Missing required fields
                  value:
                    error: 'Missing required fields: repositoryName, branch'
                mergeMainIntoItself:
                  summary: Cannot merge main branch into itself
                  value:
                    error: Cannot merge main branch 'main' into itself
                mergeFailed:
                  summary: Merge operation failed
                  value:
                    success: false
                    error: Merge failed
        '401':
          description: Unauthorized - Invalid or missing API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Invalid API token
        '404':
          description: Not Found - Repository or Prismy installation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                noInstallation:
                  summary: No Prismy installation found
                  value:
                    error: No Prismy installation found for this organization
                repositoryNotFound:
                  summary: Repository not found
                  value:
                    error: Repository 'my-repo' 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:
    MergeBranchRequest:
      type: object
      required:
        - repositoryName
        - branch
      properties:
        repositoryName:
          type: string
          description: Name of the repository to merge
          example: my-repo
        branch:
          type: string
          description: Name of the branch to merge into main
          example: feature/new-translations
    MergeBranchResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Successfully merged branch 'feature/new-translations' into 'main'
        branch:
          type: string
          example: feature/new-translations
        mainBranch:
          type: string
          example: main
        filesProcessed:
          type: integer
          description: Number of files processed during merge
          example: 5
        successfulMerges:
          type: integer
          description: Number of files successfully merged
          example: 5
        failedMerges:
          type: integer
          description: Number of files that failed to merge
          example: 0
        totalKeysAdded:
          type: integer
          description: Total number of new keys added from branch
          example: 12
        totalKeysUpdated:
          type: integer
          description: Total number of keys updated during merge
          example: 3
        totalKeysKeptFromMain:
          type: integer
          description: Total number of keys kept from main branch
          example: 45
        versionsUpdated:
          type: integer
          description: Number of key versions updated
          example: 15
        results:
          type: array
          description: Detailed results for each file processed
          items:
            type: object
            properties:
              success:
                type: boolean
              filePath:
                type: string
              language:
                type: string
              keysAdded:
                type: integer
              keysUpdated:
                type: integer
              keysKeptFromMain:
                type: integer
    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

````