---
title: "Import a GitHub branch"
method: POST
path: "/api/apps/{app_id}/github/branches/import"
---

# Import a GitHub branch

`POST /api/apps/{app_id}/github/branches/import`

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

## Path parameters

- `app_id` string, required — ID of the app to import the branch into.

## Request body

- ImportBranchRequest — Request to import a branch that already exists in the connected repository.
  - `branch_name` string, required — Name of the branch to import, as it exists in the connected repository. Can't be the repository's default branch.

## Response `200`

The imported branch.

- ImportedBranchSummary — The Base44 branch created from an existing GitHub branch.
  - `id` string, required — ID of the new Base44 branch.
  - `branch_name` string, required — The GitHub branch name, stored exactly as you sent it. Base44's own commits go to this same branch.
  - `conversation_id` string, required — ID of the branch's own builder conversation. The branch's chat history is separate from the app's main chat.
  - `base_git_commit_hash` string, required — Commit where the branch forked off the repository's default branch.
  - `last_git_commit_hash` string, required — Head commit of the GitHub branch at the moment it was imported.
  - `created_date` string, required — When the branch was created, in `YYYY-MM-DDTHH:MM:SS.ffffffZ` format (UTC).

## Other responses

- `400` — 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` — Missing or invalid credentials.
- `403` — You don't have access to this app, or you used a workspace API key. These endpoints take a personal API key.
- `404` — App not found, or the app has no active GitHub connection.
- `409` — 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` — The request body is missing `branch_name`, or its value is empty or longer than 255 characters.
- `502` — Base44 couldn't read the branch's files from GitHub. Nothing was created, so you can retry the request.

---

[API](https://skmtc.dev/base44/apis/base44-app-management-api.md) · [All operations](https://skmtc.dev/base44/apis/base44-app-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/base44/base44-app-management-api/revisions/173e4e9c63c2/schema)
