# POST /websites/:website_id/github

**Resource:** [Websites](./websites.md)  
**MCP tool:** `connect_website_repo`  
**Scopes:** `websites:write`  
**Write operation:** yes

Workspace admins (and the agency): build this website from a GitHub repo. From then on every push to the branch is copied in and built as a preview (pushes within 2 minutes build once), and the first sync starts now. A website with no hosting yet gets it ($5 a month, as for every site). Repos can hold up to 2,000 files and 50 MB; secrets and server code are never copied. The live site only changes when a preview is published, or straight away with auto_publish.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `website_id` | path | string | yes | UUID of the website. Get ids from list_websites. |
| `repo_full_name` | body | string | yes | The GitHub repo the site is built from, as owner/name, for example "smithplumbing/website". list_github_repos lists the ones TrustPager can see. |
| `branch` | body | string | no | The branch to build from. Default: the repo's default branch. |
| `installation_id` | body | number | no | Which connected GitHub account to use (installation_id from list_github_repos). Only needed when two accounts can see the same repo. |
| `auto_publish` | body | boolean | no | true: every preview that builds goes live straight away. false (default): previews wait for publish_website_preview. |
| `build_command` | body | string | no | Build command: "npm run build" or "" (plain HTML, no build). Anything else is refused; put other build steps in package.json's build script. Default: worked out from package.json. |
| `output_dir` | body | string | no | Override the folder the build writes to. Default: worked out from package.json (dist, out, build, public or _site). |
| `start_from_site` | body | boolean | no | true: the repo is new and EMPTY, and the website's current code (the site TrustPager hosts) is copied into it first. How a site TrustPager built moves into your own GitHub. Refused if the repo already has code in it. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/websites/:website_id/github"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"repo_full_name":"...","branch":"...","installation_id":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`