---
title: "reset(completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlsession/reset(completionhandler:)"
---

# reset(completionHandler:)

Empties all cookies, caches and credential stores, removes disk files, flushes in-progress downloads to disk, and ensures that future requests occur on a new socket.

## Declaration

```swift
func reset(completionHandler: @escaping @Sendable () -> Void)
```

```swift
func reset() async
```

## Parameters

- `completionHandler`: The completion handler to call when the reset operation is complete. This handler is executed on the delegate queue.

## See Also

### Managing the session

- [finishTasksAndInvalidate()](foundation/urlsession/finishtasksandinvalidate().md)
- [flush(completionHandler:)](foundation/urlsession/flush(completionhandler:).md)
- [getTasksWithCompletionHandler(_:)](foundation/urlsession/gettaskswithcompletionhandler(_:).md)
- [getAllTasks(completionHandler:)](foundation/urlsession/getalltasks(completionhandler:).md)
- [invalidateAndCancel()](foundation/urlsession/invalidateandcancel().md)
- [sessionDescription](foundation/urlsession/sessiondescription.md)
