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

# Fork a branch until its XXX_QUOTED events



## OpenAPI

````yaml /openapi.json post /policies/{policyId}/branches/{branchId}/fork
openapi: 3.0.0
info:
  title: Korint Documentation
  description: Korint API Documentation
  version: 1.0.0
  contact: {}
servers: []
security:
  - bearerAuth: []
tags: []
paths:
  /policies/{policyId}/branches/{branchId}/fork:
    post:
      tags:
        - branch
      summary: Fork a branch until its XXX_QUOTED events
      operationId: BranchController_forkBranch
      parameters:
        - name: policyId
          required: true
          in: path
          schema:
            type: string
        - name: branchId
          required: true
          in: path
          description: Unique identifier for the branch
          schema:
            type: string
        - name: whenAt
          required: false
          in: query
          description: 'Optional: the whenAt datetime'
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForkBranchInputBody'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForkBranchOutput'
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
                  - $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
              examples:
                INVALID_EVENT_CREATION_DATE:
                  $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
          description: ''
        '404':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PolicyNotFoundErrorDto'
                  - $ref: '#/components/schemas/BranchNotFoundErrorDto'
              examples:
                POLICY_NOT_FOUND:
                  $ref: '#/components/schemas/PolicyNotFoundErrorDto'
                BRANCH_NOT_FOUND:
                  $ref: '#/components/schemas/BranchNotFoundErrorDto'
          description: ''
        '409':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ConflictingConfigErrorDto'
                  - $ref: '#/components/schemas/ConflictingBranchTypeErrorDto'
                  - $ref: '#/components/schemas/ConflictingPolicyStatusErrorDto'
              examples:
                CONFLICTING_CONFIG:
                  $ref: '#/components/schemas/ConflictingConfigErrorDto'
                CONFLICTING_BRANCH_TYPE:
                  $ref: '#/components/schemas/ConflictingBranchTypeErrorDto'
                CONFLICTING_POLICY_STATUS:
                  $ref: '#/components/schemas/ConflictingPolicyStatusErrorDto'
          description: ''
      deprecated: true
components:
  schemas:
    ForkBranchInputBody:
      type: object
      properties:
        name:
          type: string
          description: 'Optional: Name of the entity'
        closeOriginalBranch:
          type: boolean
        branchType:
          type: string
          description: Branch type
          enum:
            - BASE
            - NEW_BUSINESS
            - MTA
            - RENEWAL
            - REPRICING
        branchSubType:
          description: Branch sub type
          allOf:
            - $ref: '#/components/schemas/BranchSubType'
        includeAllEvents:
          type: boolean
          description: Include all events from the original branch
    ForkBranchOutput:
      type: object
      properties:
        type:
          type: string
          description: Type of the created object
        id:
          type: string
          description: Unique identifier for the created object
      required:
        - type
        - id
    InvalidEventCreationDateErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_EVENT_CREATION_DATE
        message:
          type: string
          example: >-
            You are trying to push an event that is created on {createdAt}, but
            the creation date should be after the latest event which was created
            on {latestCreatedAt}
        details:
          $ref: '#/components/schemas/InvalidEventCreationDateDetailsDto'
      required:
        - code
        - message
        - details
    PolicyNotFoundErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - POLICY_NOT_FOUND
        message:
          type: string
          example: Policy {policyId} ({branchId}) not found
        details:
          $ref: '#/components/schemas/PolicyNotFoundDetailsDto'
      required:
        - code
        - message
        - details
    BranchNotFoundErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - BRANCH_NOT_FOUND
        message:
          type: string
          example: Branch {branchId} not found
        details:
          $ref: '#/components/schemas/BranchNotFoundDetailsDto'
      required:
        - code
        - message
        - details
    ConflictingConfigErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - CONFLICTING_CONFIG
        message:
          type: string
          example: Config field {configField} {requirement} {value} to perform {action}
        details:
          $ref: '#/components/schemas/ConflictingConfigDetailsDto'
      required:
        - code
        - message
        - details
    ConflictingBranchTypeErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - CONFLICTING_BRANCH_TYPE
        message:
          type: string
          example: Branch type {requirement} {branchType} to perform {action}
        details:
          $ref: '#/components/schemas/ConflictingBranchTypeDetailsDto'
      required:
        - code
        - message
        - details
    ConflictingPolicyStatusErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - CONFLICTING_POLICY_STATUS
        message:
          type: string
          example: '{policyId} status {requirement} {policyStatus} to perform {action}'
        details:
          $ref: '#/components/schemas/ConflictingPolicyStatusDetailsDto'
      required:
        - code
        - message
        - details
    BranchSubType:
      type: string
      enum:
        - CREATE_ADDITIONAL_COMPONENTS
        - DRIVEQUANT
      description: Branch sub type
    InvalidEventCreationDateDetailsDto:
      type: object
      properties:
        createdAt:
          format: date-time
          type: string
        latestCreatedAt:
          format: date-time
          type: string
      required:
        - createdAt
        - latestCreatedAt
    PolicyNotFoundDetailsDto:
      type: object
      properties:
        policyId:
          type: string
        branchId:
          type: string
        whenAt:
          type: string
        simulatedAt:
          type: string
      required:
        - policyId
    BranchNotFoundDetailsDto:
      type: object
      properties:
        branchId:
          type: string
      required:
        - branchId
    ConflictingConfigDetailsDto:
      type: object
      properties:
        configField:
          type: string
        requirement:
          allOf:
            - $ref: '#/components/schemas/OperationRequirement'
        value:
          type: string
        action:
          allOf:
            - $ref: '#/components/schemas/Action'
      required:
        - configField
        - requirement
        - value
        - action
    ConflictingBranchTypeDetailsDto:
      type: object
      properties:
        branchType:
          allOf:
            - $ref: '#/components/schemas/BranchType'
        requirement:
          allOf:
            - $ref: '#/components/schemas/OperationRequirement'
        action:
          allOf:
            - $ref: '#/components/schemas/Action'
      required:
        - branchType
        - requirement
        - action
    ConflictingPolicyStatusDetailsDto:
      type: object
      properties:
        policyStatus:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        policyId:
          type: string
        requirement:
          allOf:
            - $ref: '#/components/schemas/OperationRequirement'
        action:
          allOf:
            - $ref: '#/components/schemas/Action'
        additionalData:
          type: object
          additionalProperties: true
      required:
        - policyStatus
        - policyId
        - requirement
        - action
    OperationRequirement:
      type: string
      enum:
        - must be
        - must NOT be
        - must contain
        - must NOT contain
    Action:
      type: string
      enum:
        - PERFORM THIS ACTION
        - CREATE POLICY
        - CREATE ASSET
        - CREATE ASSET WITH START DATE
        - REPLACE ASSET
        - REMOVE ASSET
        - CHOOSE ASSET OPTIONS
        - STOP ASSET
        - EDIT ASSET
        - EDIT ASSET WITH START DATE
        - CREATE BRANCH
        - CREATE DEROGATION
        - CREATE MTA BRANCH
        - FORK TO NEW MTA BRANCH
        - FORK TO NEW NB BRANCH
        - FORK TO NEW RENEWAL BRANCH
        - FORK TO NEW REPRICING BRANCH
        - DEFINE PARENT POLICY ID
        - INITIALIZE CUSTOMER
        - EDIT CUSTOMER
        - DELETE CUSTOMER FROM POLICY
        - DECLARE CLAIMS HISTORY
        - SIGN
        - EDIT POLICY
        - EDIT POLICY EXTERNAL ID
        - CONFIRM POLICY
        - QUOTE POLICY
        - RETRIEVING QUOTE
        - STOP POLICY
        - SUSPEND POLICY
        - ACTIVATE POLICY
        - GENERATE MANDATE SIGNATURE REQUEST
        - GENERATE PAYMENT METHOD SECRET
        - CREATE CLAIM
        - FINALIZE RENEWAL
        - SEND CONTRACT TO SIGNATURE
        - GENERATE SIGNATURE REQUEST
        - GENERATE DOCUMENTS FOR SIGNATURE
        - APPROVE DISTRIBUTION REQUEST
        - DENY DISTRIBUTION REQUEST
        - REVOKED_DISTRIBUTION_REQUEST
        - DELETE DISTRIBUTION REQUEST
        - WAITING FOR SIGNATURE DISTRIBUTION REQUEST
        - UPDATE POLICY QUOTE
    BranchType:
      type: string
      enum:
        - BASE
        - NEW_BUSINESS
        - MTA
        - RENEWAL
        - REPRICING

````