Environment

Update an environment

Changes only the fields supplied; omitted fields are left unchanged. Environment variables are merged, not replaced: Add or change a variable by sending its name with a string value. Remove a variable by sending its name with a null value. Variables you do not name are left unchanged; omit the field entirely to change nothing. Platform-injected variables cannot be added, changed or removed.

patch/v1/environments/{publicId}

Request

  • Base URL: https://api.fortrabbit.com
  • URL: https://api.fortrabbit.com/v1/environments/{publicId}
  • Auth: HTTP bearer

Path parameters

publicIdstring required

Environment identifier

Request body

namestring nullable

New environment name. Omit to leave unchanged.

buildCommandsstring[] nullable

Replaces the environment's build commands. Omit to leave unchanged; send [] to clear.

postDeployCommandsstring[] nullable

Replaces the environment's post-deploy commands. Omit to leave unchanged; send [] to clear.

phpVersionstring nullable

PHP runtime version. Setting it stops the environment from being auto-updated to newer PHP versions. Omit to leave unchanged.

environmentVariablesobject nullable

Add or change a variable by sending its name with a string value. Remove a variable by sending its name with a null value. Variables you do not name are left unchanged; omit the field entirely to change nothing. Platform-injected variables cannot be added, changed or removed.

Example request

{
  "name": "staging",
  "git": {
    "branch": "main",
    "directory": null
  },
  "buildCommands": [
    "composer install --no-dev"
  ],
  "postDeployCommands": [
    "php artisan migrate --force"
  ],
  "phpVersion": "8.4",
  "environmentVariables": {
    "APP_ENV": "production",
    "OLD_FLAG": null
  }
}

Response

Environment resource updated

publicIdstring
namestring
softwareVersionstring nullable
createdAtstring date-time
updatedAtstring date-time
domainsstring[]
componentsobject
phpVersionstring nullable
buildCommandsstring[]
postDeployCommandsstring[]
environmentVariablesobject

Variables set on this environment by its owners, keyed by name.

Example response

{
  "environmentVariables": {
    "APP_ENV": "production"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.