Skip to main content
DELETE /api/v1/cloud/environments/{environment_id} Deletes an Environment and returns a deletion confirmation. If the Environment is still referenced by Sessions or tool calls, the API returns 409 and you should archive it instead.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT>

Path parameters

ParameterTypeRequiredDescription
environment_idstringYesEnvironment unique identifier (with the env_ prefix)

Example request

curl -X DELETE 'https://api.qoder.com/api/v1/cloud/environments/env_019e3bb39b6774d8878cd0b9d237574b' \
  -H "Authorization: Bearer $QODER_PAT"

Example response

HTTP 200 OK
{
  "id": "env_019e3bb39b6774d8878cd0b9d237574b",
  "type": "environment_deleted"
}
Successful deletion is signalled by "type": "environment_deleted" in the response body.

Errors

HTTPTypeTrigger
401authentication_errorPAT invalid or expired
403permission_errorNot authorized for this resource
404not_found_errorEnvironment with the given ID does not exist
409invalid_request_errorEnvironment is still referenced by Sessions or tool calls
HTTP 404 Not Found
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "not_found_error",
    "message": "Environment 'env_does_not_exist_0000000000000000000000000000' was not found."
  }
}
HTTP 409 Conflict
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "invalid_request_error",
    "message": "Environment 'env_019e3bb39b6774d8878cd0b9d237574b' is in use and cannot be deleted: 1 session still reference it. Archive the environment instead."
  }
}
See Errors for the full error envelope.

Cloud environment setup

Choose the container, network, and dependencies your agent runs in.