# DevTunnelResource.WithExpiration

- Module: [Aspire.Hosting.DevTunnels](/reference/api/go/aspire.hosting.devtunnels.md)
- Defined on: [DevTunnelResource](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md)
- Version: `17.0.0`
- Kind: `method`

Configures how long the tunnel can remain unused or unmodified before it expires.

## Remarks

Applies to both new and existing tunnels. This does not limit hosting duration or access-token lifetime.

## Definition

```go
type DevTunnelResource interface {
    // ... omitted for brevity
    WithExpiration(expirationHours float64) DevTunnelResource
}
```

## Signature

```go
WithExpiration(expirationHours float64) DevTunnelResource
```

## Parameters

- `expirationHours` (`float64`) -- The idle expiration period, in whole hours from one hour through 30 days, inclusive.

## Returns

[`DevTunnelResource`](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [DevTunnelResource](/reference/api/go/aspire.hosting.devtunnels/devtunnelresource.md) -- `handle`
