Skip to main content
POST
/
environments
/
without-template
Create an Environment Without Template
curl --request POST \
  --url https://api.env0.com/environments/without-template \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "deployRequest": {
    "comment": "<string>",
    "triggerName": "user",
    "subEnvironments": {},
    "targets": [
      "<string>"
    ],
    "gitUserData": {
      "gitUser": "<string>",
      "gitAvatarUrl": "<string>",
      "prNumber": "<string>"
    }
  },
  "name": "<string>",
  "projectId": "<string>",
  "workspaceName": "<string>",
  "requiresApproval": true,
  "ttl": {
    "type": "INFINITE",
    "value": "<string>"
  },
  "configurationChanges": {
    "name": "<string>",
    "value": "<string>",
    "id": "<string>",
    "isSensitive": true,
    "isReadonly": true,
    "isRequired": true,
    "regex": "<string>",
    "type": 0,
    "toDelete": true,
    "projectId": "<string>",
    "schema": {
      "type": "<string>",
      "enum": [
        "<any>"
      ],
      "format": "HCL"
    },
    "description": "<string>",
    "isOutput": true
  },
  "configurationSetChanges": {
    "assign": [
      "<string>"
    ],
    "unassign": [
      "<string>"
    ]
  },
  "continuousDeployment": true,
  "pullRequestPlanDeployments": true,
  "vcsPrCommentsEnabled": true,
  "vcsCommandsAlias": "<string>",
  "driftDetectionRequest": {
    "enabled": true,
    "cron": "<string>"
  },
  "autoDeployOnPathChangesOnly": true,
  "autoDeployByCustomGlob": "<string>",
  "terragruntWorkingDirectory": "<string>",
  "isRemoteBackend": true,
  "k8sNamespace": "<string>",
  "preventAutoDeploy": true,
  "isRemoteApplyEnabled": true,
  "organizationId": "<string>",
  "description": "<string>",
  "retry": {
    "onDestroy": {
      "times": 123,
      "errorRegex": "<string>"
    },
    "onDeploy": {
      "times": 123,
      "errorRegex": "<string>"
    }
  },
  "runTestsOnPullRequest": true,
  "isTerragruntRunAll": true,
  "projectIds": [
    "<string>"
  ],
  "tagPrefix": "<string>",
  "repository": "<string>",
  "revision": "<string>",
  "path": "<string>",
  "fileName": "<string>",
  "helmChartName": "<string>",
  "terraformVersion": "<string>",
  "opentofuVersion": "<string>",
  "terragruntVersion": "<string>",
  "terragruntTfBinary": "terraform",
  "pulumiVersion": "<string>",
  "ansibleVersion": "<string>",
  "type": "opentofu",
  "tokenName": "<string>",
  "tokenId": "<string>",
  "sshKeys": [
    {
      "id": "<string>",
      "name": "<string>"
    }
  ],
  "githubInstallationId": 123,
  "bitbucketClientKey": "<string>",
  "isBitbucketServer": true,
  "isGitLabEnterprise": true,
  "isGitHubEnterprise": true,
  "isGitLab": true,
  "isAzureDevOps": true,
  "isHelmRepository": true,
  "vcsConnectionId": "<string>"
}'
{
  "blueprintId": "<string>",
  "id": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "organizationId": "<string>",
  "projectId": "<string>",
  "userId": "<string>",
  "workspaceName": "<string>",
  "user": {
    "email": "<string>",
    "user_id": "<string>",
    "created_at": "<string>",
    "app_metadata": {},
    "picture": "<string>",
    "name": "<string>",
    "last_login": "<string>",
    "given_name": "<string>",
    "family_name": "<string>"
  },
  "requiresApproval": true,
  "status": "CREATED",
  "latestDeploymentLogId": "<string>",
  "latestDeploymentLog": {
    "id": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "type": "deploy",
    "startedBy": "<string>",
    "queuedAt": "2023-11-07T05:31:56Z",
    "startedAt": "2023-11-07T05:31:56Z",
    "finishedAt": "2023-11-07T05:31:56Z",
    "output": {},
    "error": {},
    "failedCommand": "<string>",
    "customEnv0EnvironmentVariables": {
      "environmentId": "<string>",
      "projectId": "<string>",
      "projectName": "<string>",
      "deploymentLogId": "<string>",
      "deploymentType": "deploy",
      "deploymentRevision": "<string>",
      "workspaceName": "<string>",
      "rootDir": "<string>",
      "organizationId": "<string>",
      "templateId": "<string>",
      "templateDir": "<string>",
      "templateName": "<string>",
      "environmentName": "<string>",
      "environmentCreatorName": "<string>",
      "environmentCreatorUserId": "<string>",
      "environmentCreatorEmail": "<string>",
      "deployerName": "<string>",
      "deployerUserId": "<string>",
      "deployerEmail": "<string>",
      "reviewerName": "<string>",
      "reviewerEmail": "<string>",
      "reviewerUserId": "<string>",
      "vcsProvider": "gitlab",
      "prAuthor": "<string>",
      "prNumber": "<string>",
      "prSourceRepository": "<string>",
      "prSourceBranch": "<string>",
      "prTargetBranch": "<string>",
      "commitHash": "<string>",
      "commitUrl": "<string>",
      "oidcToken": "<string>",
      "vcsAccessToken": "<string>",
      "tfPlanJson": "<string>",
      "cliArgsPlan": "<string>",
      "cliArgsApply": "<string>"
    },
    "costEstimation": {
      "totalMonthlyCost": 123,
      "monthlyCostDiff": 123,
      "projects": [
        {
          "diff": {
            "totalMonthlyCost": "<string>"
          }
        }
      ]
    },
    "status": "IN_PROGRESS",
    "blueprintId": "<string>",
    "blueprintName": "<string>",
    "blueprintRepository": "<string>",
    "blueprintRevision": "<string>",
    "blueprintPath": "<string>",
    "blueprintType": "opentofu",
    "comment": "<string>",
    "environmentId": "<string>",
    "resourceCount": 123,
    "resources": [
      {
        "provider": "<string>",
        "type": "<string>",
        "name": "<string>",
        "moduleName": "<string>"
      }
    ],
    "startedByUser": {
      "email": "<string>",
      "user_id": "<string>",
      "created_at": "<string>",
      "app_metadata": {},
      "picture": "<string>",
      "name": "<string>",
      "last_login": "<string>",
      "given_name": "<string>",
      "family_name": "<string>"
    },
    "isScheduledRun": true,
    "abortedBy": "<string>",
    "abortedByUser": {
      "email": "<string>",
      "user_id": "<string>",
      "created_at": "<string>",
      "app_metadata": {},
      "picture": "<string>",
      "name": "<string>",
      "last_login": "<string>",
      "given_name": "<string>",
      "family_name": "<string>"
    },
    "gitUser": "<string>",
    "gitAvatarUrl": "<string>",
    "prNumber": "<string>",
    "triggerName": "user",
    "driftDetected": true,
    "plan": {
      "resourceChanges": [
        {
          "id": "<string>",
          "cloudId": "<string>",
          "moduleName": "<string>",
          "driftByCloud": true,
          "name": "<string>",
          "providerName": "<string>",
          "type": "<string>",
          "path": "<string>",
          "action": "create",
          "attributes": [
            {
              "name": "<string>",
              "before": "<any>",
              "after": "<any>"
            }
          ],
          "importing": {
            "id": "<string>"
          },
          "actionReason": "replace_because_tainted",
          "createBeforeDestroy": true,
          "previousAddress": "<string>"
        }
      ],
      "outputChanges": [
        {
          "moduleName": "<string>",
          "name": "<string>",
          "action": "create",
          "attributes": [
            {
              "name": "<string>",
              "before": "<any>",
              "after": "<any>"
            }
          ]
        }
      ]
    },
    "planSummary": {
      "added": 123,
      "changed": 123,
      "destroyed": 123,
      "imported": 123
    },
    "isSkippedApply": true,
    "workflowDeploymentId": "<string>",
    "workflowFile": {
      "settings": {
        "environmentRemovalStrategy": "destroy"
      },
      "environments": {}
    },
    "workflowDeploymentOptions": {
      "node": "<string>",
      "operation": "run-from-here"
    },
    "stateVersionId": "<string>",
    "reviewersUsers": [
      {
        "user": {
          "email": "<string>",
          "user_id": "<string>",
          "created_at": "<string>",
          "app_metadata": {},
          "picture": "<string>",
          "name": "<string>",
          "last_login": "<string>",
          "given_name": "<string>",
          "family_name": "<string>"
        },
        "action": "approved"
      }
    ],
    "reviewers": [
      {
        "userId": "<string>",
        "action": "approved"
      }
    ],
    "reviewedBy": "<string>",
    "reviewedByUser": {
      "email": "<string>",
      "user_id": "<string>",
      "created_at": "<string>",
      "app_metadata": {},
      "picture": "<string>",
      "name": "<string>",
      "last_login": "<string>",
      "given_name": "<string>",
      "family_name": "<string>"
    },
    "targets": [
      "<string>"
    ],
    "variables": [
      {
        "id": "<string>",
        "name": "<string>",
        "scope": "SET",
        "scopeId": "<string>",
        "value": "<string>",
        "isSensitive": true,
        "type": 0,
        "schema": {
          "type": "<string>",
          "enum": [
            "<string>"
          ],
          "format": "HCL"
        },
        "userId": "<string>",
        "updatedAt": "2023-11-07T05:31:56Z",
        "projectId": "<string>"
      }
    ],
    "gitMetadata": {
      "commit": "<string>",
      "branch": "<string>",
      "timestamp": "2023-11-07T05:31:56Z"
    },
    "providerVersions": {},
    "moduleVersions": {},
    "stateFileHash": {
      "value": "<string>"
    },
    "driftCause": {
      "unappliedCommits": [
        {
          "userEmail": "<string>",
          "timestamp": "2023-11-07T05:31:56Z",
          "commitHash": "<string>"
        }
      ]
    }
  },
  "lifespanEndAt": "2023-11-07T05:31:56Z",
  "markedForAutoDestroy": 0,
  "isArchived": true,
  "nextScheduledDates": {
    "deploy": "2023-11-07T05:31:56Z",
    "destroy": "2023-11-07T05:31:56Z"
  },
  "vcsCommandsAlias": "<string>",
  "vcsPrCommentsEnabled": true,
  "continuousDeployment": true,
  "pullRequestPlanDeployments": true,
  "autoDeployOnPathChangesOnly": true,
  "autoDeployByCustomGlob": "<string>",
  "terragruntWorkingDirectory": "<string>",
  "isSingleUseBlueprint": true,
  "workflowEnvironmentId": "<string>",
  "isRemoteBackend": true,
  "isLocked": true,
  "lockStatus": {
    "reason": "<string>",
    "updatedBy": "<string>",
    "updatedByUser": {
      "email": "<string>",
      "user_id": "<string>",
      "created_at": "<string>",
      "app_metadata": {},
      "picture": "<string>",
      "name": "<string>",
      "last_login": "<string>",
      "given_name": "<string>",
      "family_name": "<string>"
    },
    "updatedAt": "2023-11-07T05:31:56Z"
  },
  "k8sNamespace": "<string>",
  "isRemoteApplyEnabled": true,
  "driftStatus": "ERROR"
}

Authorizations

Authorization
string
header
required

env0 API authentication is done via API keys. An API Key can either be created by an organization administrator, in which case it will not be connected to any specific user, or via Personal API Keys to authenticate as a user.

Creating an API Key with a Specific Role

  • Once you've created your organization, you can set up and manage API Keys.

  • Navigate to the Organization Settings page and click the API Keys tab.

  • Click Add API Key and enter a name for your key in the Name field. This name is for reference purposes only and isn't used directly in authentication.

    ❗️Save Your API Key ID and secret The secret will not be available after you close this window.

Creating a Personal API Key

  • Click on your avatar (located on the top right of the screen)

  • Click on Personal Settings

  • Select the API Keys tab

  • Click Add API Key, and enter a name for your key in the Name field. This name is for reference purposes and isn't used directly in authentication.

    ❗️Save your API Key ID & secret The secret will not be available after you close this window.

Using an API Key to Authenticate

Authentication of the env0 API is done using the Basic Authentication method. Each request made should include the API Key ID as the username, and the API Key secret as the password. For example, when using curl, we can include these parameters via flag --user {API Key ID}:{API Key Secret}.

API Key Permissions

When creating an API key through the organization settings, you will need to choose if you’d like to grant it Organization Admin or User permissions. In case of the latter, you can assign fine-grained permissions per project. Personal API Keys can be created through the user’s profile page and will have the same permissions as the user has.

Rate Limits

env0 API allows up to 1K requests per 60 seconds, requests are aggregated by IP, HTTP Method and URI. If you exceed this limit, you will receive a 429 status code.

Body

application/json
name
string
required
projectId
string
required
Minimum length: 1
organizationId
string
required
repository
string
required
type
enum<string>
required
Available options:
opentofu,
terraform,
terragrunt,
pulumi,
k8s,
cloudformation,
helm,
ansible,
workflow,
module,
approval-policy,
custom-flow,
environment-discovery,
discovery-config,
opentofu,
terraform,
terragrunt,
pulumi,
k8s,
cloudformation,
helm,
ansible,
workflow,
module,
approval-policy,
custom-flow,
environment-discovery,
discovery-config,
opentofu,
terraform,
terragrunt,
pulumi,
k8s,
cloudformation,
helm,
ansible,
workflow,
module,
approval-policy,
custom-flow,
environment-discovery,
discovery-config,
opentofu,
terraform,
terragrunt,
pulumi,
k8s,
cloudformation,
helm,
ansible,
workflow,
module,
approval-policy,
custom-flow,
environment-discovery,
discovery-config
deployRequest
object
workspaceName
string
requiresApproval
boolean
ttl
object
configurationChanges

Manage variables in the environment. Either a single variable or an array of variables.

configurationSetChanges
object
continuousDeployment
boolean
pullRequestPlanDeployments
boolean
vcsPrCommentsEnabled
boolean
vcsCommandsAlias
string
driftDetectionRequest
object
autoDeployOnPathChangesOnly
boolean
autoDeployByCustomGlob
string
terragruntWorkingDirectory
string
isRemoteBackend
boolean
k8sNamespace
string
preventAutoDeploy
boolean
isRemoteApplyEnabled
boolean
description
string
retry
object
runTestsOnPullRequest
boolean
isTerragruntRunAll
boolean
projectIds
string[]
tagPrefix
string
revision
string
path
string
fileName
string
helmChartName
string
terraformVersion

A string representing semantic version of Terraform. If set to "RESOLVE_FROM_TERRAFORM_CODE", the version will be determined by using tfenv's 'min-required'. When set to "latest", the version used will be the most recent one available for Terraform.

opentofuVersion
string
terragruntVersion
string
terragruntTfBinary
enum<string>
Available options:
terraform,
opentofu,
terraform,
opentofu,
terraform,
opentofu
pulumiVersion
string
ansibleVersion
string
tokenName
string
tokenId
string
sshKeys
object[]
githubInstallationId
number | null
bitbucketClientKey
string | null
isBitbucketServer
boolean
isGitLabEnterprise
boolean
isGitHubEnterprise
boolean
isGitLab
boolean
isAzureDevOps
boolean
isHelmRepository
boolean
vcsConnectionId
string | null

Response

200 - application/json
blueprintId
string
required
name
string
required
organizationId
string
required
projectId
string
required
userId
string
required
workspaceName
string
required
user
object
required
requiresApproval
boolean
required
status
enum<string>
required
Available options:
CREATED,
INACTIVE,
ACTIVE,
FAILED,
TIMEOUT,
WAITING_FOR_USER,
DEPLOY_IN_PROGRESS,
DESTROY_IN_PROGRESS,
TASK_IN_PROGRESS,
ABORTING,
ABORTED,
NEVER_DEPLOYED,
DRIFTED,
DRY_RUN_IN_PROGRESS,
CREATED,
INACTIVE,
ACTIVE,
FAILED,
TIMEOUT,
WAITING_FOR_USER,
DEPLOY_IN_PROGRESS,
DESTROY_IN_PROGRESS,
TASK_IN_PROGRESS,
ABORTING,
ABORTED,
NEVER_DEPLOYED,
DRIFTED,
DRY_RUN_IN_PROGRESS,
CREATED,
INACTIVE,
ACTIVE,
FAILED,
TIMEOUT,
WAITING_FOR_USER,
DEPLOY_IN_PROGRESS,
DESTROY_IN_PROGRESS,
TASK_IN_PROGRESS,
ABORTING,
ABORTED,
NEVER_DEPLOYED,
DRIFTED,
DRY_RUN_IN_PROGRESS
latestDeploymentLogId
string
required
latestDeploymentLog
object
required
lifespanEndAt
string<date-time>
required
markedForAutoDestroy
enum<number>
required
Available options:
0,
1,
2,
3,
0,
1,
2,
3
isArchived
boolean
required

Mark the environment as inactive

nextScheduledDates
object
required
continuousDeployment
boolean
required
pullRequestPlanDeployments
boolean
required
autoDeployOnPathChangesOnly
boolean
required
isRemoteBackend
boolean
required
isLocked
boolean
required
driftStatus
enum<string>
required
Available options:
ERROR,
DRIFTED,
OK,
NEVER_RUN,
DISABLED,
ERROR,
DRIFTED,
OK,
NEVER_RUN,
DISABLED,
ERROR,
DRIFTED,
OK,
NEVER_RUN,
DISABLED
id
string
createdAt
string<date-time>
updatedAt
string<date-time>
vcsCommandsAlias
string
vcsPrCommentsEnabled
boolean
autoDeployByCustomGlob
string
terragruntWorkingDirectory
string
isSingleUseBlueprint
boolean
workflowEnvironmentId
string
lockStatus
object
k8sNamespace
string
isRemoteApplyEnabled
boolean
I