palbaseDocs

Palbase Machines · API

POST/sites/{name}/move

Move a site to another environment of its project

Binds the site to another environment of its project: the platform copies its files and releases to the new environment while it keeps serving where it is, then switches its releases, builds, and custom domains atomically; its address names the new environment from then on (<name>-<the environment's ref>), and it continues answering at its previous address (urls). Its pull requests' previews are closed; a new push opens them in the new environment. Any in-flight build is stopped and rebuilt in the new environment; the GitHub installation it builds through is linked to the new environment when needed. Meanwhile changes are refused (409 site_moving), and moving to its current environment cancels a pending move. The new environment must have capacity for another site (too_many_sites), no site of its name (name_taken) and none of its domains added (domain_in_environment). A suspended site cannot be moved (site_taken_down). It needs the admin role in both environments (environment_role_required); an environment-scoped token or key cannot move resources out of its environment (environment_not_found). A move that cannot be completed is canceled with the reason in move_note.

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

environmentstring · requiredThe ref of the environment of the project the site moves to.
curl
curl -X POST "https://<your-ref>.palbase.studio/sites/<name>/move" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"environment":"string"}'

Responses

200A move to its own environment: the move let go of.

202Moving: the site, moving_to naming the environment it moves to.

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 machine of this name

409The project already has a machine of this name, or has as many machines as it may

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 MoveSite of machines's contract.