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

# Imported app sessions

> Keep an imported app's main sandbox up to date and run coding tasks on its repository 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, and start coding tasks that the AI runs on the repository and reports back as 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.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.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.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.md): Read where an update is and which commit the preview serves.

### Coding sessions

* [Launch coding session](https://docs.base44.com/api-reference/launch-coding-session.md): Start a coding task on a branch of the imported repository.
* [List coding sessions](https://docs.base44.com/api-reference/list-coding-sessions.md): List the app's coding sessions, newest first.
* [Get coding session](https://docs.base44.com/api-reference/get-coding-session.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.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.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-session-s-open-question): 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.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.md): Check whether a message was delivered.
* [Cancel coding session](https://docs.base44.com/api-reference/cancel-coding-session.md): Ask a session to stop.


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