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

# Preview a branch restore

> The deleted branches a restore of this branch would bring back, root-most ancestor first and this branch last: a branch is its own changes on top of its parent as of when it was created, so a branch whose eligible ancestors are deleted comes back together with them, and the preview shows that chain by name, number, parent and deletion time so same-named branches are told apart. Each row carries `rebase` when restoring it will rebase it onto its parent's current history because the parent was rebased after the row was deleted: the parent's id, name, number and rebase time, and a sentence saying so, so the user confirms that step with the chain. Answers the refusal the restore would answer (400 naming the branch and the reason) 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. 404 when no eligible deleted branch with this id exists in this project.



## OpenAPI

````yaml /openapi/customer-api.json get /project/{projectId}/branch/{id}/restore-preview
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-preview:
    get:
      tags:
        - Branches
      summary: Preview a branch restore
      description: >-
        The deleted branches a restore of this branch would bring back,
        root-most ancestor first and this branch last: a branch is its own
        changes on top of its parent as of when it was created, so a branch
        whose eligible ancestors are deleted comes back together with them, and
        the preview shows that chain by name, number, parent and deletion time
        so same-named branches are told apart. Each row carries `rebase` when
        restoring it will rebase it onto its parent's current history because
        the parent was rebased after the row was deleted: the parent's id, name,
        number and rebase time, and a sentence saying so, so the user confirms
        that step with the chain. Answers the refusal the restore would answer
        (400 naming the branch and the reason) 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. 404 when no eligible
        deleted branch with this id exists in this project.
      operationId: BranchController_previewRestoreBranch
      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
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchRestorePreviewDto'
          description: ''
      security:
        - api-key: []
        - bearer: []
components:
  schemas:
    BranchRestorePreviewDto:
      properties:
        chain:
          items:
            $ref: '#/components/schemas/RestoreChainMemberDto'
          type: array
      required:
        - chain
      type: object
    RestoreChainMemberDto:
      properties:
        deleted_at:
          description: >-
            When the branch was archived: the merge time for a merged branch,
            the delete time for a discarded one.
          type: string
        deleted_by_id:
          description: >-
            Who deleted a discarded branch. Null for a merged branch: the merge
            does not record its actor on the row.
          nullable: true
          type: string
        id:
          type: string
        merged_at:
          description: >-
            Set when a merge archived the branch; null when it was discarded
            through the delete endpoint.
          nullable: true
          type: string
        name:
          type: string
        number:
          description: Project-scoped branch number.
          type: number
        parent_id:
          nullable: true
          type: string
        parent_name:
          description: Name of the parent branch; null when the parent is Base.
          nullable: true
          type: string
        rebase:
          allOf:
            - $ref: '#/components/schemas/RestoreRebaseStepDto'
          description: >-
            Set when restoring this branch rebases it onto its parent's current
            history because the parent was rebased after the branch was deleted;
            null when its fork pointer is intact.
          nullable: true
          type: object
      required:
        - id
        - number
        - name
        - parent_id
        - parent_name
        - merged_at
        - deleted_at
        - deleted_by_id
        - rebase
      type: object
    RestoreRebaseStepDto:
      properties:
        description:
          description: >-
            The step in words, naming both branches by number, as the restore
            will perform it.
          type: string
        parent_id:
          description: The parent whose current history the branch is rebased onto.
          type: string
        parent_name:
          type: string
        parent_number:
          type: number
        parent_rebased_at:
          description: >-
            When the parent was rebased: after this branch was deleted, which is
            why the branch was not carried along then.
          type: string
      required:
        - parent_id
        - parent_name
        - parent_number
        - parent_rebased_at
        - description
      type: object
  securitySchemes:
    api-key:
      in: header
      name: X-API-Key
      type: apiKey
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````