{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fortrabbit-com/json-schema/fortrabbit-com-environment-environment-create-api-request-schema.json",
  "title": "Environment.EnvironmentCreateApiRequest",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/fortrabbit-com-api-openapi.json#/components/schemas/Environment.EnvironmentCreateApiRequest",
  "type": "object",
  "properties": {
    "appId": {
      "pattern": "^(([a-z]{2})-[0-9a-z]{6})$",
      "type": [
        "string",
        "null"
      ]
    },
    "name": {
      "minLength": 3,
      "maxLength": 32,
      "pattern": "^([a-z0-9]([a-z0-9-]*[a-z0-9])?)$",
      "type": "string"
    },
    "deployment": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "git": {
          "type": "object",
          "required": [
            "branch"
          ],
          "properties": {
            "branch": {
              "type": "string",
              "maxLength": 255
            },
            "directory": {
              "type": "string",
              "maxLength": 255,
              "default": "/",
              "description": "Deploy directory. Optional; defaults to \"/\". Must not be null or empty when provided."
            }
          }
        },
        "buildCommands": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "postDeployCommands": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "startFirstDeployment": {
          "type": "boolean",
          "description": "Trigger a first deployment right after the environment is created."
        }
      },
      "additionalProperties": false,
      "required": [
        "git"
      ],
      "description": "Deployment configuration. The git field is required to configure deployment; omit the whole object to skip deployment."
    },
    "softwareVersion": {
      "type": [
        "string",
        "null"
      ],
      "description": "Major version only, e.g. \"11\". Optional; defaults to the app software's version."
    },
    "components": {
      "type": "object",
      "description": "Component plans keyed by component slug. The value is a size key (e.g. \"sm\") or \"off\" to disable an optional component.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "autoscaling": {
      "type": "boolean",
      "default": true,
      "description": "Enable autoscaling. Optional; defaults to true."
    },
    "phpVersion": {
      "type": [
        "string",
        "null"
      ],
      "description": "PHP runtime version; defaults to the platform default."
    },
    "sourceEnvironment": {
      "pattern": "^(([a-z]{2})-[0-9a-z]{6})$",
      "type": [
        "string",
        "null"
      ],
      "description": "Public ID of an existing environment to clone component plans and settings from."
    },
    "cloudDomain": {
      "type": [
        "string",
        "null"
      ],
      "description": "Cloud domain label without the root, e.g. \"acme-staging\". Omit to derive one from the cloud domain name of the app (or the app name) and the environment name, e.g. \"acme-shop-staging\"; none is created when that name is invalid, reserved or taken. Set null to create no cloud domain."
    },
    "environmentVariables": {
      "type": "object",
      "description": "Environment variables to set on the new environment, keyed by name.",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "required": [
    "name",
    "autoscaling"
  ]
}