Connect a GitHub repository
<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>
Creates a new private GitHub repository and connects the app to it.
Only the app's owner can connect a repository, and the workspace plan has to include the GitHub integration. Read List GitHub organizations for the org_name and installation_id to send.
The call holds the connection while it creates the repository, installs the sync webhook, and pushes the app's current code as the first commit, so it takes considerably longer than the other endpoints here. From then on the repository is where the app's code lives: Base44 pushes each change to it, and you bring work done in GitHub back with Pull changes from GitHub.
The repository must not exist yet. Send a repo_name of 1 to 100 characters made of letters, digits, hyphens, underscores or periods, starting and ending with a letter or digit. An app that already has a connection can't connect again, and disconnecting one happens in the builder rather than through this API.
If that first push fails, Base44 undoes the connection, but the repository it already created stays on GitHub. Delete it there or send a different repo_name before you retry, or the retry fails on the repository already existing.
The webhook is best effort. Read webhook_active from Get GitHub connection afterwards: while it is false, GitHub isn't telling Base44 about pushes, so bring commits in with Pull changes from GitHub rather than waiting for them to arrive on their own.
<Note>This endpoint accepts a personal API key. Workspace API keys are not authorized for it and are rejected with a 403.</Note>
Path parameters
ID of the app to connect to a GitHub repository.
ID of the app to connect to a GitHub repository.
Request body
Example request
{
"org_name": "base44",
"repo_name": "lead-tracker",
"installation_id": "58231904",
"description": "Sales lead tracker"
}Response
The repository that was created and connected.
Example response
{
"connection_id": "6890b1c4f2a7e3105d8a4472",
"repo_url": "https://github.com/base44/lead-tracker",
"repo_full_name": "base44/lead-tracker",
"clone_urls": {
"https": "https://github.com/base44/lead-tracker.git",
"ssh": "git@github.com:base44/lead-tracker.git",
"gh_cli": "gh repo clone base44/lead-tracker"
},
"default_branch": "main"
}