# LibTmux.Session.CreateWindowWithReceiptAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Session.Lifecycle.cs#L304
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-session-createwindowwithreceiptasync/

```
LibTmux.Session.CreateWindowWithReceiptAsync(request: NewWindowRequest?, cancellationToken: CancellationToken) -> Task<WindowCreationResult>
```

Creates a window and returns its initial pane identity.

Rejects <see cref="NewWindowRequest.SelectExisting" /> before dispatch because an
existing window has no creation receipt. The pane identifier comes from creation,
not a later listing; the pane may have moved or disappeared before readback.
A failed readback publishes no receipt or cleanup ownership.

## Parameters

- `request` (`NewWindowRequest?`): The window to create.
- `cancellationToken` (`CancellationToken`): Cancels creation and readback.

## Returns

The created window in this session and its initial pane identifier.

## Raises

- [`ArgumentException`](https://learn.microsoft.com/dotnet/api/system.argumentexception): The request may select an existing window.
- [`LibTmuxException`](/en/csharp/latest/reference/libtmux-libtmuxexception/): Creation or readback failed; a failure after creation has unknown dispatch outcome.
