curl --request PUT \
--url https://api.env0.com/environments/{id}/template \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"newName": "<string>"
}
'{
"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": {
"type": "deploy",
"startedBy": "<string>",
"queuedAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z",
"output": {},
"error": {},
"costEstimation": {
"totalMonthlyCost": 123,
"monthlyCostDiff": 123,
"projects": [
{
"diff": {
"totalMonthlyCost": "<string>"
}
}
]
},
"status": "IN_PROGRESS",
"blueprintId": "<string>",
"blueprintName": "<string>",
"blueprintRepository": "<string>",
"blueprintRevision": "<string>",
"blueprintPath": "<string>",
"blueprintType": "opentofu",
"environmentId": "<string>",
"resourceCount": 123,
"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>"
},
"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"
}
],
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"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>",
"discoveryRepositoryUrl": "<string>",
"discoveryPrNumber": "<string>",
"discoveryVCS": "gitlab"
},
"comment": "<string>",
"resources": [
{
"provider": "<string>",
"type": "<string>",
"name": "<string>",
"moduleName": "<string>"
}
],
"gitUser": "<string>",
"gitAvatarUrl": "<string>",
"prNumber": "<string>",
"triggerName": "user",
"driftDetected": true,
"plan": {
"resourceChanges": [
{
"name": "<string>",
"providerName": "<string>",
"type": "<string>",
"path": "<string>",
"action": "create",
"attributes": [
{
"name": "<string>",
"before": "<unknown>",
"after": "<unknown>"
}
],
"id": "<string>",
"cloudId": "<string>",
"moduleName": "<string>",
"driftByCloud": true,
"importing": {
"id": "<string>"
},
"actionReason": "replace_because_tainted",
"createBeforeDestroy": true,
"previousAddress": "<string>"
}
],
"outputChanges": [
{
"name": "<string>",
"action": "create",
"attributes": [
{
"name": "<string>",
"before": "<unknown>",
"after": "<unknown>"
}
],
"moduleName": "<string>"
}
]
},
"planSummary": {
"added": 123,
"changed": 123,
"destroyed": 123,
"imported": 123
},
"isSkippedApply": true,
"workflowDeploymentId": "<string>",
"workflowFile": {
"environments": {},
"settings": {
"environmentRemovalStrategy": "destroy"
}
},
"workflowDeploymentOptions": {
"node": "<string>",
"operation": "run-from-here"
},
"stateVersionId": "<string>",
"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": [
{
"name": "<string>",
"scope": "SET",
"type": 0,
"id": "<string>",
"scopeId": "<string>",
"value": "<string>",
"isSensitive": true,
"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"
},
"continuousDeployment": true,
"pullRequestPlanDeployments": true,
"autoDeployOnPathChangesOnly": true,
"isRemoteBackend": true,
"isLocked": true,
"driftStatus": "ERROR",
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"vcsCommandsAlias": "<string>",
"vcsPrCommentsEnabled": true,
"autoDeployByCustomGlob": "<string>",
"terragruntWorkingDirectory": "<string>",
"isSingleUseBlueprint": true,
"workflowEnvironmentId": "<string>",
"lockStatus": {
"updatedBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"reason": "<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>"
}
},
"k8sNamespace": "<string>",
"isRemoteApplyEnabled": true
}curl --request PUT \
--url https://api.env0.com/environments/{id}/template \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"newName": "<string>"
}
'{
"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": {
"type": "deploy",
"startedBy": "<string>",
"queuedAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z",
"output": {},
"error": {},
"costEstimation": {
"totalMonthlyCost": 123,
"monthlyCostDiff": 123,
"projects": [
{
"diff": {
"totalMonthlyCost": "<string>"
}
}
]
},
"status": "IN_PROGRESS",
"blueprintId": "<string>",
"blueprintName": "<string>",
"blueprintRepository": "<string>",
"blueprintRevision": "<string>",
"blueprintPath": "<string>",
"blueprintType": "opentofu",
"environmentId": "<string>",
"resourceCount": 123,
"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>"
},
"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"
}
],
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"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>",
"discoveryRepositoryUrl": "<string>",
"discoveryPrNumber": "<string>",
"discoveryVCS": "gitlab"
},
"comment": "<string>",
"resources": [
{
"provider": "<string>",
"type": "<string>",
"name": "<string>",
"moduleName": "<string>"
}
],
"gitUser": "<string>",
"gitAvatarUrl": "<string>",
"prNumber": "<string>",
"triggerName": "user",
"driftDetected": true,
"plan": {
"resourceChanges": [
{
"name": "<string>",
"providerName": "<string>",
"type": "<string>",
"path": "<string>",
"action": "create",
"attributes": [
{
"name": "<string>",
"before": "<unknown>",
"after": "<unknown>"
}
],
"id": "<string>",
"cloudId": "<string>",
"moduleName": "<string>",
"driftByCloud": true,
"importing": {
"id": "<string>"
},
"actionReason": "replace_because_tainted",
"createBeforeDestroy": true,
"previousAddress": "<string>"
}
],
"outputChanges": [
{
"name": "<string>",
"action": "create",
"attributes": [
{
"name": "<string>",
"before": "<unknown>",
"after": "<unknown>"
}
],
"moduleName": "<string>"
}
]
},
"planSummary": {
"added": 123,
"changed": 123,
"destroyed": 123,
"imported": 123
},
"isSkippedApply": true,
"workflowDeploymentId": "<string>",
"workflowFile": {
"environments": {},
"settings": {
"environmentRemovalStrategy": "destroy"
}
},
"workflowDeploymentOptions": {
"node": "<string>",
"operation": "run-from-here"
},
"stateVersionId": "<string>",
"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": [
{
"name": "<string>",
"scope": "SET",
"type": 0,
"id": "<string>",
"scopeId": "<string>",
"value": "<string>",
"isSensitive": true,
"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"
},
"continuousDeployment": true,
"pullRequestPlanDeployments": true,
"autoDeployOnPathChangesOnly": true,
"isRemoteBackend": true,
"isLocked": true,
"driftStatus": "ERROR",
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"vcsCommandsAlias": "<string>",
"vcsPrCommentsEnabled": true,
"autoDeployByCustomGlob": "<string>",
"terragruntWorkingDirectory": "<string>",
"isSingleUseBlueprint": true,
"workflowEnvironmentId": "<string>",
"lockStatus": {
"updatedBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"reason": "<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>"
}
},
"k8sNamespace": "<string>",
"isRemoteApplyEnabled": true
}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.
❗️Save Your API Key ID and secret The secret will not be available after you close this window.
❗️Save your API Key ID & secret The secret will not be available after you close this window.
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}.
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.
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.
Show child attributes
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 Show child attributes
0, 1, 2, 3, 0, 1, 2, 3 Mark the environment as inactive
Show child attributes
ERROR, DRIFTED, OK, NEVER_RUN, DISABLED, ERROR, DRIFTED, OK, NEVER_RUN, DISABLED, ERROR, DRIFTED, OK, NEVER_RUN, DISABLED Show child attributes
Was this page helpful?