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

# Restore a deleted branch

> Reverses a delete of a branch created after this update was deployed: the branch reappears in branch lists and the branch selector with its changes intact, and a Reopened entry joins its review history. Every eligible deleted ancestor it depends on is restored with it, in one transaction, exactly the chain the restore preview lists (a merged ancestor comes back as an open branch that can be merged again; the reviews and description its merge moved onto the baseline stay there). A member whose parent was rebased after the member was deleted is rebased onto its parent's current history as part of the restore, the migration it missed while deleted; the preview names each such member and the restore performs them root-most first. Send the preview's ids as expected_chain_ids and expected_rebase_ids to be refused with 409 if either changed since. Refuses with 400 for the synthetic master branch or a malformed id, 404 when no eligible deleted branch with this id exists in this project, and 400, naming the branch, when the chain cannot be rebuilt: an ancestor row is gone, an ancestor predates restore support, or a member is the copy an extraction undo archived.



## OpenAPI

````yaml /openapi/customer-api.json post /project/{projectId}/branch/{id}/restore
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Flow customer API reference. Start with the [quickstart](/api/quickstart)
    and [authentication guide](/api/authentication).
  title: Customer API
  version: 1.0.0
servers:
  - description: Flow API
    url: https://backend.branch.flowengineering.com
security: []
tags:
  - name: Automations
  - name: Branches
  - name: Comments
  - name: Convert
  - name: Data Model
  - name: Diagrams
  - name: Entities
  - name: Files
  - name: Import
  - name: Notifications
  - name: Projects
  - name: ReqIF
  - name: ReqIF Import
  - name: Shared Access Grants
  - name: User Groups
  - name: Users
paths:
  /project/{projectId}/branch/{id}/restore:
    post:
      tags:
        - Branches
      summary: Restore a deleted branch
      description: >-
        Reverses a delete of a branch created after this update was deployed:
        the branch reappears in branch lists and the branch selector with its
        changes intact, and a Reopened entry joins its review history. Every
        eligible deleted ancestor it depends on is restored with it, in one
        transaction, exactly the chain the restore preview lists (a merged
        ancestor comes back as an open branch that can be merged again; the
        reviews and description its merge moved onto the baseline stay there). A
        member whose parent was rebased after the member was deleted is rebased
        onto its parent's current history as part of the restore, the migration
        it missed while deleted; the preview names each such member and the
        restore performs them root-most first. Send the preview's ids as
        expected_chain_ids and expected_rebase_ids to be refused with 409 if
        either changed since. Refuses with 400 for the synthetic master branch
        or a malformed id, 404 when no eligible deleted branch with this id
        exists in this project, and 400, naming the branch, when the chain
        cannot be rebuilt: an ancestor row is gone, an ancestor predates restore
        support, or a member is the copy an extraction undo archived.
      operationId: BranchController_restoreBranch
      parameters:
        - in: path
          name: projectId
          required: true
          schema:
            description: >-
              Project UUID, not a slug. Resolve a slug with GET
              /project/slug/{slug} using the same workspace and credentials,
              then pass the returned id.
            type: string
        - in: path
          name: id
          required: true
          schema:
            type: string
        - description: Workspace identifier
          in: header
          name: customer
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestoreBranchDto'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchResponseDto'
          description: ''
      security:
        - api-key: []
        - bearer: []
components:
  schemas:
    RestoreBranchDto:
      properties:
        expected_chain_ids:
          description: >-
            The ids of the chain a restore preview showed, in its order. When
            present, the restore refuses with 409 if the chain it would restore
            now differs, so what was confirmed is what happens. Omit to restore
            whatever the chain is now.
          items:
            type: string
          type: array
        expected_rebase_ids:
          description: >-
            The ids of the chain members the preview said would be rebased as
            part of the restore. When present alongside expected_chain_ids, the
            restore refuses with 409 if a different set would be rebased now, so
            a rebase is never performed unseen.
          items:
            type: string
          type: array
      type: object
    BranchResponseDto:
      properties:
        baseline_id:
          nullable: true
          type: string
        branch_extraction_enabled:
          type: boolean
        change_request_diff_summary:
          $ref: '#/components/schemas/ChangeRequestDiffSummaryDto'
        change_request_title:
          nullable: true
          type: string
        comment_count:
          type: number
        created_at:
          type: string
        created_by_id:
          nullable: true
          type: string
        description:
          type: string
        designated_reviewer_ids:
          items:
            type: string
          type: array
        editor_group_ids:
          items:
            type: string
          type: array
        has_children:
          type: boolean
        id:
          type: string
        is_deleted:
          type: boolean
        is_iteration:
          type: boolean
        is_protected:
          type: boolean
        is_variant:
          type: boolean
        labels:
          items:
            $ref: '#/components/schemas/BranchLabelDto'
          type: array
        last_rebased_at:
          nullable: true
          type: string
        last_touched_at:
          nullable: true
          type: string
        merged_at:
          nullable: true
          type: string
        name:
          type: string
        number:
          type: number
        owner_id:
          nullable: true
          type: string
        parent:
          nullable: true
          type: string
        parent_name:
          nullable: true
          type: string
        ready_for_review:
          type: boolean
        require_review:
          type: boolean
        required_reviewer_ids:
          items:
            type: string
          type: array
        reviews:
          items:
            $ref: '#/components/schemas/BranchReviewResponseDto'
          type: array
        updated_at:
          type: string
        updated_by_id:
          nullable: true
          type: string
        upstream_branch_ids:
          items:
            type: string
          type: array
      required:
        - id
        - name
        - number
        - is_iteration
        - description
        - is_variant
        - parent_name
        - created_at
        - updated_at
        - is_protected
        - require_review
        - ready_for_review
        - owner_id
        - created_by_id
        - updated_by_id
        - last_touched_at
        - last_rebased_at
        - required_reviewer_ids
        - editor_group_ids
        - labels
        - upstream_branch_ids
        - merged_at
        - is_deleted
        - has_children
      type: object
    ChangeRequestDiffSummaryDto:
      properties:
        added:
          type: number
        pending:
          type: number
        removed:
          type: number
        updated:
          type: number
      required:
        - added
        - updated
        - removed
        - pending
      type: object
    BranchLabelDto:
      properties:
        color:
          example: '#dbeafe'
          type: string
        symbol:
          description: >-
            Stored symbol. New tags use a fixed Lucide icon name, but reads can
            include legacy symbols.
          maxLength: 32
          type: string
        text:
          maxLength: 64
          type: string
      required:
        - text
        - color
        - symbol
      type: object
    BranchReviewResponseDto:
      properties:
        branch_id:
          type: string
        comment_id:
          nullable: true
          type: string
        created_at:
          type: string
        dismissed_at:
          nullable: true
          type: string
        id:
          type: string
        status:
          enum:
            - Approved
            - Rejected
          type: string
        updated_at:
          type: string
        user_id:
          type: string
      required:
        - id
        - branch_id
        - user_id
        - status
        - comment_id
        - created_at
        - updated_at
        - dismissed_at
      type: object
  securitySchemes:
    api-key:
      in: header
      name: X-API-Key
      type: apiKey
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````