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

# Base code

> Keep an imported app's main sandbox up to date, run coding tasks on its repository, and track its branches and pull requests with the Base44 Apps API

> [!NOTE]
>
> The Apps API is in beta. Its endpoints and responses may change.

These endpoints work on apps imported from a repository. You can keep the app's main sandbox in step with the branch it was imported from, start coding tasks that the AI runs on the repository and reports back as pull requests, and work with the repository's branches, their uncommitted changes, and their pull requests.

## Rebuild main from CI

The main sandbox is the preview that runs the branch the app was imported from, usually your repository's default branch. When that branch moves, Base44 builds the new commit, checks that its services come up healthy, and then switches the preview to it. The app editor asks for updates while the app is open in it, so a CI pipeline has to ask for them itself.

**To rebuild main after a merge:**

1. Call [Check for main sandbox updates](https://docs.base44.com/api-reference/check-for-main-sandbox-updates-on-an-imported-app.md). The request returns before the update runs.
2. Poll [Get main sandbox update status](https://docs.base44.com/api-reference/get-main-sandbox-update-status-on-an-imported-app.md). The preview serves your merge once the commit in `active_generation` is the one you merged. A `phase` of `idle` alone doesn't mean the update finished.
3. If the commit isn't live after a minute, call check again. A check within a minute of the last time Base44 read your branch does nothing, and reads made while the app is open in the app editor count.
4. If `phase` is `failed`, the update didn't finish. Read `failure` for the step that failed and why.

Both calls use a personal API key or personal access token that belongs to a user with editor access to the app. See [Authentication](https://docs.base44.com/developers/references/apps-api/get-started/authentication.md).

## Endpoints

### Main sandbox updates

* [Check for main sandbox updates](https://docs.base44.com/api-reference/check-for-main-sandbox-updates-on-an-imported-app.md): Ask Base44 to update the main sandbox if the imported branch moved.
* [Get main sandbox update status](https://docs.base44.com/api-reference/get-main-sandbox-update-status-on-an-imported-app.md): Read where an update is and which commit the preview serves.
* [Retry main sandbox update](https://docs.base44.com/api-reference/retry-main-sandbox-update.md): Build the latest commit again after a failed update.
* [Investigate main sandbox update failure](https://docs.base44.com/api-reference/investigate-main-sandbox-update-failure.md): Ask the AI to find and fix why an update failed, on a new branch.

### Coding sessions

* [Launch coding session](https://docs.base44.com/api-reference/launch-coding-session-on-an-imported-app.md): Start a coding task on a branch of the imported repository.
* [List coding sessions](https://docs.base44.com/api-reference/list-coding-sessions-on-an-imported-app.md): List the app's coding sessions, newest first.
* [Get coding session](https://docs.base44.com/api-reference/get-coding-session-on-an-imported-app.md): Read a session's progress and its pull request.
* [Get coding session by launch key](https://docs.base44.com/api-reference/get-coding-session-by-launch-key-on-an-imported-app.md): Recover a session with the `Idempotency-Key` you launched it with.
* [Get latest coding sessions by reference](https://docs.base44.com/api-reference/get-latest-coding-sessions-by-reference-on-an-imported-app.md): Read the latest session for each client reference you pass.
* [Get a coding session's open question](https://docs.base44.com/api-reference/get-a-coding-sessions-open-question-on-an-imported-app.md): Read the question or approval a session is waiting on.
* [Send a message to a coding session](https://docs.base44.com/api-reference/send-a-message-to-a-coding-session-on-an-imported-app.md): Answer a question, approve a request, or send a follow-up.
* [Get a message sent to a coding session](https://docs.base44.com/api-reference/get-a-message-sent-to-a-coding-session-on-an-imported-app.md): Check whether a message was delivered.
* [Cancel coding session](https://docs.base44.com/api-reference/cancel-coding-session-on-an-imported-app.md): Ask a session to stop.
* [Import a Claude Code or Codex session](https://docs.base44.com/api-reference/import-a-claude-code-or-codex-session-on-an-imported-app.md): Continue a local coding agent session as a branch of the app.

### Branches and pull requests

* [Import repository branch](https://docs.base44.com/api-reference/import-repository-branch.md): Add a branch that already exists in the repository as a branch of the app.
* [Get branch git status](https://docs.base44.com/api-reference/get-branch-git-status.md): Read a branch's latest commit and its uncommitted changes.
* [Commit branch changes](https://docs.base44.com/api-reference/commit-branch-changes.md): Commit a branch's uncommitted changes and push them to the repository.
* [Discard branch changes](https://docs.base44.com/api-reference/discard-branch-changes.md): Throw away a branch's uncommitted changes.
* [Get branch pull request](https://docs.base44.com/api-reference/get-branch-pull-request.md): Read a branch's pull request and whether it's ready to merge.
* [Open pull request](https://docs.base44.com/api-reference/open-pull-request.md): Open a pull request from a branch into the branch the app was imported from.
* [Update pull request](https://docs.base44.com/api-reference/update-pull-request.md): Change the title and description of a branch's open pull request.
* [Get pull requests for branches](https://docs.base44.com/api-reference/get-pull-requests-for-branches.md): Read the pull request for each branch you name.
* [List pull requests](https://docs.base44.com/api-reference/list-pull-requests.md): List the repository's pull requests, most recently updated first.


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