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

# Create Branch

> Create a new branch for a node, forked from an existing branch.

The new branch starts at the head commit of `base_branch` (defaults to
`main` if not provided) so subsequent pushes build on that history.

Requires **editor** or **owner** role on the organization — viewers cannot
create branches.



## OpenAPI

````yaml post /orgs/{org_id}/nodes/{node_id}/branches
openapi: 3.1.0
info:
  title: Flow API
  description: Content-addressing backend with Git-like versioning
  version: 1.0.0
servers:
  - url: https://api.yertle.com
    description: Production
security: []
paths:
  /orgs/{org_id}/nodes/{node_id}/branches:
    post:
      tags:
        - branches
      summary: Create Branch
      description: >-
        Create a new branch for a node, forked from an existing branch.


        The new branch starts at the head commit of `base_branch` (defaults to

        `main` if not provided) so subsequent pushes build on that history.


        Requires **editor** or **owner** role on the organization — viewers
        cannot

        create branches.
      operationId: create_branch_orgs__org_id__nodes__node_id__branches_post
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
            title: Org Id
        - name: node_id
          in: path
          required: true
          schema:
            type: string
            title: Node Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBranchRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateBranchRequest:
      properties:
        name:
          type: string
          title: Name
          description: Branch name
        base_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Branch
          description: Base branch to fork from
          default: main
      type: object
      required:
        - name
      title: CreateBranchRequest
      description: Request model for creating a branch.
    BranchResponse:
      properties:
        node_id:
          type: string
          title: Node Id
          description: Node ID
        name:
          type: string
          title: Name
          description: Branch name
        head_commit:
          type: string
          title: Head Commit
          description: Head commit ID
        base_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Branch
          description: Base branch name
        created_by:
          type: string
          title: Created By
          description: User who created the branch
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last update timestamp
        head_commit_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Head Commit Message
          description: Head commit message
        last_activity:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Activity
          description: Last activity timestamp
      type: object
      required:
        - node_id
        - name
        - head_commit
        - created_by
        - created_at
        - updated_at
      title: BranchResponse
      description: Response model for branch data.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````