Update branch from main

Changed on

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

Brings main's latest changes into an active branch. When main's code changed, Base44 merges it into the branch. Messages sent on main since the branch was created or last updated are added to the branch's conversation as context for the AI. When nothing changed on main, nothing happens and updated is false.

If main's changes conflict with the branch's, the AI resolves the conflicts on the branch before the request returns. That's an AI turn: it uses credits like a chat message, and the request can stay open for several minutes. If the AI needs your input to finish, sync_status.sync_state is needs_input. The branch then stays locked until you answer in the Base44 editor, and it can't be updated, merged, or deleted until then. If the AI can't resolve the conflicts, the request fails and the branch is restored to how it was before the update.

In this response, branch.created_by_name is always null. Get branch returns it.

This endpoint is limited to 10 requests per minute.

<Tip>A 409 response carries an extra_data.reason code that says why the request was refused.</Tip>

<Note>This endpoint accepts a personal API key belonging to a user with editor access to the app. A read-only key is refused, and workspace API keys are not accepted.</Note>

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

post/api/apps/{app_id}/branches/{branch_id}/sync-from-main

Request

  • Base URL: https://app.base44.com
  • URL: https://app.base44.com/api/apps/{app_id}/branches/{branch_id}/sync-from-main
  • Auth: HTTP bearer

Path parameters

branch_idstring required

ID of the branch, as returned by List branches.

app_idstring required

ID of the app the branch belongs to.

Response

The branch after the update.

updatedboolean required

false when the branch was already up to date with main, so nothing changed. true when the update was applied, or when it's waiting for your input (sync_status.sync_state is needs_input).

Example response

{
  "branch": {
    "id": "68f1a2b3c4d5e6f708192a3b",
    "app_id": "6820f3a4e7b91d003c45a1f2",
    "branch_name": "add-contact-form",
    "status": "active",
    "run_state": {
      "state": "ready",
      "details": "Restoring checkpoint",
      "last_updated_date": "2026-09-28T10:18:40"
    },
    "code_state": "changed",
    "base_checkpoint_id": "6886b8d390dc7e2f4a2c91b3",
    "created_by_id": "68a0c1d2e3f4a5b6c7d8e9f0",
    "created_by_name": "Jane Doe",
    "created_date": "2026-09-28T10:15:00",
    "merged_at": "2026-09-29T08:02:11",
    "merged_by_id": "68a0c1d2e3f4a5b6c7d8e9f0",
    "static_preview_url": "https://preview--6820f3a4e7b91d003c45a1f2--b-d8c647b.base44.app"
  },
  "sync_status": {
    "new_main_message_count": 2,
    "main_code_changed": true,
    "conflict_state": "unavailable",
    "sync_state": "idle",
    "blocked_reason": "app_processing"
  },
  "updated": true
}

Changes