---
title: "Create Environment"
method: POST
path: "/apps/{appId}/environments"
tags: ["environments"]
---

# Create Environment

`POST /apps/{appId}/environments`

## Request

- Base URL: `https://privatecloud.mendixcloud.com/api/v4`
- URL: `https://privatecloud.mendixcloud.com/api/v4/apps/{appId}/environments`
- Auth: API key in header `Authorization`

Creates a new environment based on a manifest.

## Request body

- EnvironmentManifest: Model for environment manifest.
  - `manifestVersion` string, required
  - `environment` object, required
    - `id` string, required: Model for environmentId.
    - `properties` object, required
      - `name` string, required
      - `production` boolean, required
      - `defaultStudioTarget` boolean, required
      - `secretsStoreEnabled` boolean, required
      - `OverwriteProductTypePCLM` string
      - `environmentPurpose` 'Test' | 'Development' | 'Acceptance' | 'Production': non-editable</br> Model for environmentPurpose.
    - `deployment` object, required
      - `appUrl` string, required
      - `packageId` string, required: PackageId of a Deployment Package. It can be found on the Deployment Package details page in the Portal.
      - `constants` Constant[]
        - `name` string
        - `value` string
      - `scheduledEvents` ScheduledEvent[]
        - `name` string
        - `enabled` boolean
      - `appLogLevels` AppLogLevel[]
        - `name` string
        - `level` 'CRITICAL' | 'NONE' | 'DEBUG' | 'TRACE' | 'INFO' | 'ERROR'
    - `container` object, required
      - `state` 'Ready' | 'Processing' | 'Failed' | 'Unknown'
      - `instances` integer, required
      - `coreResources` object, required
        - `limits` CoreResource, required: Model for resources (limits & requests).
          - `cpu` string, required: The unit of measurement is `Cores` and it will be added automatically.
          - `memory` string, required: The unit of measurement is `Gb` and it will be added automatically.
          - `ephemeralStorage` string: The unit of measurement is `Gb` and it will be added automatically.
        - `requests` CoreResource, required: Model for resources (limits & requests).
          - `cpu` string, required: The unit of measurement is `Cores` and it will be added automatically.
          - `memory` string, required: The unit of measurement is `Gb` and it will be added automatically.
          - `ephemeralStorage` string: The unit of measurement is `Gb` and it will be added automatically.
    - `network` object
      - `outgoingConnectionCertificate` object[]
        - `enabled` boolean
        - `password` string
        - `certificateType` string
        - `key` string
    - `runtime` object
      - `subscriptionSecret` string: If you need to clear the value of this attribute, set it to `LS0t`.
      - `debuggerPassword` string: If you need to disable the debugger set the value of this attribute to `LS0t`.
      - `mxAdminPassword` string: If you need to clear the value of this attribute, set it to `LS0t`.
      - `runtimeVersion` string
      - `environmentVariables` EnvironmentVariable[]
        - `name` string
        - `value` string
      - `customRuntimeSettings` CustomSetting[]
        - `name` string
        - `value` string
    - `provider` object, required
      - `clusterId` string, uuid, required
      - `namespace` string, required: Be aware that you cannot deploy environments to `Main` namespaces of Global Operator Installations.
      - `namespaceId` string, uuid: Model for namespaceId.
    - `annotations` Annotation[]
      - `key` string
      - `value` string
      - `annotationType` 'Pod' | 'Service' | 'Ingress'
    - `services` Service[], required
      - `name` string, required
      - `plan` 'OnDemand' | 'Dedicated', required
      - `config` '{type: \"database\"}' | '{type: \"storage\"}', required
    - `runtimeMetricsConfiguration` object
      - `mode` 'default' | 'native' | 'compatibility'
      - `interval` string
      - `mxAgentConfig` string
      - `mxAgentInstrumentationConfig` string
    - `deploymentStrategy` object
      - `runtimeDeploymentStrategyType` 'Reduced App Downtime' | 'Default': non-editable</br> PreferRolling updates gradually for continuous service(Reduced App Downtime); Recreate stops all Pods before restart(Default).
      - `switchOverthreshold` integer: Percentage point when Kubernetes updates all remaining old Pods.
      - `maxSurge` integer: Maximum percentage of extra Pods allowed above desired count during updates.
      - `maxUnavailable` integer: Maximum percentage of Pods that can be offline during updates.
      - `podDisruptionMinAvailable` integer: Pod Disruption Min Available defines the minimum number or percentage of Pods that must remain available during voluntary disruptions. This setting ensures a baseline level of running Pods is maintained; for example, if set to 50%, Kubernetes will only allow evictions that keep at least 50% of the Pods available.
      - `podDisruptionMaxUnavailable` integer: Pod Disruption Max Unavailable defines the maximum number or percentage of Pods that can be unavailable during voluntary disruptions (evictions or node drains). This setting controls how many existing Pods can be taken offline at once without affecting overall availability. For example, if set to 20%, Kubernetes can allow up to 20% of the Pods to be unavailable during voluntary disruptions.

## Response `202`

The job response returned by a get-job request. The Location header is populated once the job has been created successfully.

- Job: Model for jobs.
  - `id` string, uuid, required: Model for jobId.
  - `status` 'created' | 'running' | 'failed' | 'finished', required: `created` - a job has been created but has not been picked up for processing <br/> `running` - the job is being processed <br/> `finished` - the job has finished processing <br/> `failed` - something went wrong and the job processing failed
  - `details` string
  - `error` ErrorBody: The body of an error object explaining what happened.
    - `code` integer: The HTTP status code.
    - `message` string: Explanation of what happened.

## Other responses

- `400`: The request likely contains invalid data or is missing data. The error response gives additional feedback.
- `401`: There were no usable authentication credentials found. The error response gives additional feedback.
- `403`: Access is denied. The provided credentials are incorrect or the credentials do not have the required level of access. The error response gives additional feedback.

---

[API](https://skmtc.dev/mendix/apis/mendix-for-private-cloud-deploy-api.md) - [All operations](https://skmtc.dev/mendix/apis/mendix-for-private-cloud-deploy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mendix/apis/mendix-for-private-cloud-deploy-api/revisions/ae247dcd18e1?raw)
