> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Client Setup

> How to configure the NexudusApiClient with authentication and connection options.

# Client Setup

The `NexudusApiClient` is the central object you use to interact with the Nexudus API. It requires an `HttpClient`, an authentication provider, and an optional configuration object.

## Basic setup

```csharp theme={null}
using Nexudus.Sdk;
using Nexudus.Sdk.Auth;
using Nexudus.Sdk.Configuration;

var auth = new BasicAuthProvider("email@example.com", "password");

using var client = new NexudusApiClient(new HttpClient(), auth);
```

## Configuration options

Pass a `NexudusOptions` object to customise the client behaviour:

```csharp theme={null}
var options = new NexudusOptions
{
    BaseUrl = "https://spaces.nexudus.com", // Default
    PageSize = 25,                          // Default page size for listings
    Timeout = TimeSpan.FromSeconds(30)      // HTTP request timeout
};

using var client = new NexudusApiClient(new HttpClient(), auth, options);
```

| Option     | Type       | Default                      | Description                         |
| ---------- | ---------- | ---------------------------- | ----------------------------------- |
| `BaseUrl`  | `string`   | `https://spaces.nexudus.com` | The Nexudus API base URL.           |
| `PageSize` | `int`      | `25`                         | Default number of records per page. |
| `Timeout`  | `TimeSpan` | `30 seconds`                 | HTTP request timeout.               |

## Using environment variables

For scripts and CI/CD pipelines, store credentials in environment variables instead of hard-coding them:

```csharp theme={null}
var email = Environment.GetEnvironmentVariable("NEXUDUS_EMAIL")
    ?? throw new InvalidOperationException("NEXUDUS_EMAIL not set");
var password = Environment.GetEnvironmentVariable("NEXUDUS_PASSWORD")
    ?? throw new InvalidOperationException("NEXUDUS_PASSWORD not set");

var auth = new BasicAuthProvider(email, password);
using var client = new NexudusApiClient(new HttpClient(), auth);
```

Set the variables before running your app:

<Tabs>
  <Tab title="PowerShell">
    ```powershell theme={null}
    $env:NEXUDUS_EMAIL = "you@example.com"
    $env:NEXUDUS_PASSWORD = "your-password"
    ```
  </Tab>

  <Tab title="Bash">
    ```bash theme={null}
    export NEXUDUS_EMAIL="you@example.com"
    export NEXUDUS_PASSWORD="your-password"
    ```
  </Tab>
</Tabs>

<Warning>
  Never commit credentials to source control. Use environment variables, user secrets, or a vault for production deployments.
</Warning>

## Entity endpoints

Once you have a client, create endpoint instances for the entities you need:

```csharp theme={null}
var coworkers  = new CoworkerEndpoint(client);
var bookings   = new BookingEndpoint(client);
var products   = new ProductEndpoint(client);
var businesses = new BusinessEndpoint(client);
```

There are **200+ endpoint classes** available — one for every entity type in the Nexudus API. They all expose the same set of methods described in the following pages.
