# Delete preview environment

Delete a preview environment generated by a preview blueprint.

Required permission: Project > PipelinesV2 > Previews > Delete

**Path parameters:**

{object}
- `projectId`: (string) (required) ID of the project
- `previewBlueprintId`: (string) (required) ID of the preview blueprint
- `previewId`: (string) (required) ID of the preview

**Query parameters:**

{object}
- `skipTeardown`: (boolean) If `true`, the teardown spec will not be run when deleting the preview environment.

**Request body:**

{object}
- `teardownArgumentOverrides`: {object}

**Response body:**

{object}
- `data`: {object}

## API reference

DELETE /v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}

DELETE /v1/teams/{teamId}/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}

### Example request

Request body

```curl
curl --header "Content-Type: application/json" \
  --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
  --request DELETE \
  --data '{}' \
  https://api.northflank.com/v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}
```

```javascript
const payload = {}

const response = await fetch('https://api.northflank.com/v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${NORTHFLANK_API_TOKEN}`
  },
  body: JSON.stringify(payload)
})

const json = await response.json()
console.log(json)
```

```python
import requests

url = "https://api.northflank.com/v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}"

payload = {}
headers = {"Content-Type": "application/json", "Authorization": "Bearer NORTHFLANK_API_TOKEN"}

response = requests.request("DELETE", url, headers = headers, json = payload)

print(response.json())
```

```go
package main

import (
  "bytes"
  "fmt"
  "io/ioutil"
  "net/http"
)

func main() {
  url := "https://api.northflank.com/v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}"

  var jsonStr = []byte(`{}`)
  req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(jsonStr))
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN")

  client := &http.Client{}
  resp, err := client.Do(req)
  if err != nil {
    panic(err)
  }
  defer resp.Body.Close()

  fmt.Println("Response status:", resp.Status)
  fmt.Println("Response headers:", resp.Header)
  body, _ := ioutil.ReadAll(resp.Body)
  fmt.Println("Response body:", string(body))
}
```

### Example Response

200 OK: The operation was performed successfully.

```json
{
  "data": {}
}
```

## CLI reference

$ northflank delete blueprint-template-preview

Options:

- `--projectId <projectId>`: ID of the project

- `--previewBlueprintId <previewBlueprintId>`: ID of the preview blueprint

- `--previewId <previewId>`: ID of the preview

- `--skipTeardown <skipTeardown>`: If `true`, the teardown spec will not be run when deleting the preview environment.

- `-f --file <file>`: Path to a JSON/YAML resource definition file

- `-i --input <definition>`: JSON/YAML resource definition string (takes precedence over --file)

- `--verbose `: Verbose output

- `--quiet `: No console output

- `--force `: Don't ask for confirmation

- `-o --output <format>`: Output formatting 

```json
{}
```

### Example Response

 The operation was performed successfully.

```json
{}
```

## JavaScript client reference

### Example request

Request body

```javascript
await apiClient.delete.blueprintTemplatePreview({
  parameters: {
    "projectId": "default-project",
    "previewBlueprintId": "development",
    "previewId": "example-preview"
  },
  options: {},
  data: {}
});
```

### Example Response

 The operation was performed successfully.

```json
{
  "data": {},
  "rawResponse": "...",
  "request": "...",
  "error": "..."
}
```

Previous: [List preview environments](/docs/v1/api/project/preview-blueprints/list-preview-environments)

Next: [Pause preview environment](/docs/v1/api/project/preview-blueprints/pause-preview-environment)