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

# Import a GitHub branch

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Creates a Base44 [branch](/developers/references/app-management/get-started/concepts#branches) from a branch that already exists in the connected GitHub repository.

The two are one line of work. Base44 commits to the GitHub branch you name and never creates a separate branch in the repository.

Name a GitHub branch that already exists and isn't the repository's default branch, which the app's main chat already uses. The name also has to be free among the app's active and merged Base44 branches, so you can import a given GitHub branch once.

If Base44 can't read the branch from GitHub, nothing is created and you can retry.

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time.</Warning>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json post /api/apps/{app_id}/github/branches/import
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/github/branches/import:
    post:
      summary: Import a GitHub branch
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Creates a Base44
        [branch](/developers/references/app-management/get-started/concepts#branches)
        from a branch that already exists in the connected GitHub repository.


        The two are one line of work. Base44 commits to the GitHub branch you
        name and never creates a separate branch in the repository.


        Name a GitHub branch that already exists and isn't the repository's
        default branch, which the app's main chat already uses. The name also
        has to be free among the app's active and merged Base44 branches, so you
        can import a given GitHub branch once.


        If Base44 can't read the branch from GitHub, nothing is created and you
        can retry.


        <Warning>The response includes fields beyond the ones documented here.
        Don't rely on undocumented response fields, as they can change at any
        time.</Warning>
      operationId: import_branch_api_apps__app_id__github_branches_import_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app to import the branch into.
            title: App Id
          description: ID of the app to import the branch into.
          example: 6820f3a4e7b91d003c45a1f2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportBranchRequest'
      responses:
        '200':
          description: The imported branch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportedBranchSummary'
        '400':
          description: >-
            The `branch_name` is the repository's default branch, doesn't exist
            in the repository, or isn't a name Base44 can build on.
        '401':
          description: Missing or invalid credentials.
        '403':
          description: >-
            You don't have access to this app. The code is
            `git_sync_not_supported` when the app's type doesn't support Git
            sync.
        '404':
          description: App not found, or the app has no active GitHub connection.
        '409':
          description: >-
            The app is generating, a branch with this name already exists, or
            the app needs one edit on its main chat before it can use branches.
        '422':
          description: >-
            The request body is missing `branch_name`, or its value is empty or
            longer than 255 characters.
        '502':
          description: >-
            Base44 couldn't read the branch's files from GitHub. Nothing was
            created, so you can retry the request.
        '503':
          description: >-
            Database temporarily unavailable (`database_unavailable`): the data
            cluster did not answer in time. Retry after the `Retry-After`
            seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                database_unavailable:
                  summary: database_unavailable
                  value:
                    error:
                      code: database_unavailable
                      message: Database temporarily unavailable, please retry
                      details: {}
      security:
        - PersonalAccessTokenAuth:
            - full_access
        - WorkspaceApiKeyAuth:
            - full_access
        - WorkspaceApiKeyBearerAuth:
            - full_access
components:
  schemas:
    ImportBranchRequest:
      properties:
        branch_name:
          type: string
          maxLength: 255
          minLength: 1
          title: Branch Name
          description: >-
            Name of the branch to import, as it exists in the connected
            repository. Can't be the repository's default branch.
          example: feature/reporting
      type: object
      required:
        - branch_name
      title: ImportBranchRequest
      description: >-
        Request to import a branch that already exists in the connected
        repository.
    ImportedBranchSummary:
      properties:
        id:
          type: string
          title: Id
          description: ID of the new Base44 branch.
          example: 68b1c0d4e7b91d003c45a1f7
        branch_name:
          type: string
          title: Branch Name
          description: >-
            The GitHub branch name, stored exactly as you sent it. Base44's own
            commits go to this same branch.
          example: feature/reporting
        conversation_id:
          type: string
          title: Conversation Id
          description: >-
            ID of the branch's own conversation with the AI. The branch's chat
            history is separate from the app's main chat.
          example: 68b1c0d4e7b91d003c45a1f8
        base_git_commit_hash:
          type: string
          title: Base Git Commit Hash
          description: Commit where the branch forked off the repository's default branch.
          example: 9f2c1ab7d4e58036bb1f4c0a7de92b41c0d5e8a3
        last_git_commit_hash:
          type: string
          title: Last Git Commit Hash
          description: Head commit of the GitHub branch at the moment it was imported.
          example: 4c7e1f90ab3d5628e1a0f7b24c9d8e6350a1b2c4
        created_date:
          type: string
          title: Created Date
          description: >-
            When the branch was created, in `YYYY-MM-DDTHH:MM:SS.ffffffZ` format
            (UTC).
          example: '2026-08-15T09:10:00.123456Z'
      type: object
      required:
        - id
        - branch_name
        - conversation_id
        - base_git_commit_hash
        - last_git_commit_hash
        - created_date
      title: ImportedBranchSummary
      description: The Base44 branch created from an existing GitHub branch.
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: >-
        Workspace API key, sent as `api_key: <key>`. Each operation that accepts
        one lists what the key needs: a permission, `read_only` or
        `full_access`, like a personal access token, or a scope. A key without
        the scope gets 403 `workspace_api_key_scope_required`.
    WorkspaceApiKeyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, sent as `Authorization: Bearer <key>`. Accepted
        wherever `api_key` is, with the same permission.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.