palbaseDocs

Palbase Machines · API

POST/machines/{name}/move

Move a machine to another environment of its project

Binds the machine to another environment of its project: it takes that environment's settings, secrets and modules from its next start, and its address names it (<name>-<the environment's ref>). The platform moves it out of the environment it leaves and into the new one at the version it serves: the machine says where it is moving (moving_to) until it completes, and the previous environment keeps answering until the new one is up (moved_from; ten minutes at most). It continues to answer at the former address (former_urls). Its custom domains move with it and answer throughout: none of them may already exist in the new environment (domain_in_environment); they are the project's, counted across its environments. Its pull requests' previews are closed; a new push opens them in the new environment. Its database stays where it is kept and remains accessible across environments. Its name must be unique in the target environment (name_taken). 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).

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

Path

namestring · requiredThe machine'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 machine moves to.
curl
curl -X POST "https://<your-ref>.palbase.studio/machines/<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 machine, 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 MoveMachine of machines's contract.