# LibTmux.Server.CreateSessionWithReceiptAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Server.Lifecycle.cs#L149
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-server-createsessionwithreceiptasync/

```
LibTmux.Server.CreateSessionWithReceiptAsync(request: NewSessionRequest?, cancellationToken: CancellationToken) -> Task<SessionCreationResult>
```

Creates a session and returns its initial window and pane identities.

The returned session is bound to the creating daemon. Its child identifiers are
creation-time facts, not a snapshot or a promise that the children still belong
to the session. A failed readback publishes no receipt or cleanup ownership.

## Parameters

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

## Returns

The created session and child identifiers from the same creation reply.

## Raises

- [`ArgumentException`](https://learn.microsoft.com/dotnet/api/system.argumentexception): The name is invalid, or generation-bound creation requests replacement.
- [`TmuxSessionExistsException`](/en/csharp/latest/reference/libtmux-tmuxsessionexistsexception/): The name is already taken.
- [`LibTmuxException`](/en/csharp/latest/reference/libtmux-libtmuxexception/): Creation or readback failed; a failure after creation has unknown dispatch outcome.
