# Reset preview environment expiry

Reset the expiry of a preview environment generated by a preview blueprint.

Required permission: Project > PreviewBlueprints > General > Update

**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

**Request body:**

{object}
- `lifetime`: (integer) If provided, the preview environment will expire after this amount of time, in minutes.

**Response body:**

{object}
- `data`: {object}
  - `expiryTime`: (string) (required) The time the preview will expire. (format: date-time)

## API reference

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

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

### Example request

Request body

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

```javascript
const payload = {}

const response = await fetch('https://api.northflank.com/v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/previews/{previewId}/reset', {
  method: 'POST',
  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}/reset"

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

response = requests.request("POST", 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}/reset"

  var jsonStr = []byte(`{}`)
  req, err := http.NewRequest("POST", 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: Response indicating the updated expiry for the preview environment.

```json
undefined
```

## CLI reference

$ northflank reset blueprint-template-preview

Options:

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

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

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

- `-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

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

```json
{}
```

### Example Response

 Response indicating the updated expiry for the preview environment.

```json
undefined
```

## JavaScript client reference

### Example request

Request body

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

### Example Response

 Response indicating the updated expiry for the preview environment.

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

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

Next: [Resume preview environment](/docs/v1/api/project/preview-blueprints/resume-preview-environment)