palbaseDocs

Palbase Machines · API

PATCH/sites/{name}

Change a site

Changes what a site was asked to be: whether a path no file answers is its /index.html (a single-page app), where it is built from (its branch's head is built at once; a repository of "" takes the source away) and what its build runs.

Called by your server, with the project's secret key.

Path

namestring · requiredThe site's name: lowercase letters, digits and dashes, starting with a letter and not ending with a dash, 32 at most.

Request body

spaboolean · optional
sourceobject · optionalA GitHub repository's branch and the site's directory in it: one of the environment's installations reaches the repository (machines/github). In a change, a repository of "" takes the site's source away.
buildobject · optionalWhat a site's build runs; each left empty is found in its source: its lockfile (pnpm, yarn, npm, bun), its package.json's build script, the folder its builder writes (dist, build, out, …). A folder with no package.json is served as it is.
previewsboolean · optionalWhether its pull requests are previewed from now on (Site.previews): the previews open stay until their pull requests close.
preview_forksboolean · optionalWhether a fork's pull requests are previewed (Site.preview_forks).
serverobject · optionalA site's server: the machine of its environment that answers, on every address of the site, the paths `paths` names — each a prefix ending in /, an /api/ of the site's own — as it answers at its own address (woken, held to the environment's limits); none named, every path: a web app that runs on a server (Next.js, Nuxt, SvelteKit, Remix, Express), whose site is its address and domains. A pull request's preview of the site is answered by the machine's own preview of it once that is built. 10 paths at most; `/` is every path.
previews_protectedboolean · optionalWhether its previews are its team's alone from now on.
curl
curl -X PATCH "https://<your-ref>.palbase.studio/sites/<name>" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"spa":false,"source":{"repository":"string"},"build":{"install_command":"string","command":"string","output_dir":"string","env":{}},"previews":false,"preview_forks":false,"server":{"machine":"string","paths":["string"]},"previews_protected":false}'

Responses

200The site, changed

400Validation failed or a required field is missing

401Missing or invalid API key

403Not the project's secret key; or the request requires elevated owner authentication (`owner_only`, `insufficient_user_authentication`).

404The project has no site of this name

409The project already has a site of this name, or as many sites as it may (10)

429Over the project's request limit, or its machine time for this period is used up

503Temporarily unavailable; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation UpdateSite of machines's contract.