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

# Instances and billing

> Create, list, update instances and billing flows with the SDK

Use these resources for account authentication, instance lifecycle, and billing.

For WhatsApp session flows, see [Session](/en/sdk/dotnet/session). For chats, see [Chats](/en/sdk/dotnet/chats). For message sending, see [Messages](/en/sdk/dotnet/messages).

## Auth

### `client.Auth.GetAccessTokenAsync()`

Gets a JWT using `ClientToken` and `ClientSecret`. The SDK caches and refreshes the token automatically.

```csharp theme={null}
var token = await client.Auth.GetAccessTokenAsync();
```

**Return:** `string` JWT access token (`accessToken` from `POST /token`).

## Instances and billing

### `client.Instances.CreateAsync<TResponse>(request)`

```csharp theme={null}
await client.Instances.CreateAsync<object>(new InstanceCreateRequest
{
    Name = "support",
    Webhook = "https://example.com/webhook",
    EventsSubscribe = new[] { "Message", "Connected" },
});
```

**Return:** `InstancePublicCreateResponse` — `Id`, `Name`, `token`, `Url`, `Webhook`, `EventsSubscribe`, `Status`, `CreatedAt`, `UpdatedAt`.

### `client.Instances.ListAsync<TResponse>(request?)`

```csharp theme={null}
await client.Instances.ListAsync<object>(new InstanceListRequest
{
    Page = 1,
    PageSize = 20,
    Search = "support",
});
```

**Return:** page `{ Page, Size, Total, TotalPages, Content[], Summary }`. Each `content` item uses the public instance summary shape.

### `client.Instances.GetAsync<TResponse>(instanceId)`

```csharp theme={null}
await client.Instances.GetAsync<object>("VZ...");
```

**Return:** same summary shape as one `Instances.List()` item (`Id`, `Name`, `token`, `Url`, `Webhook`, `Status`, etc.).

### `client.Instances.UpdateAsync<TResponse>(instanceId, body, options?)`

```csharp theme={null}
await client.Instances.UpdateAsync<object>(
    "VZ...",
    new { name = "support-updated" },
    new InstanceRequestOptions { InstanceToken = "instance-token" });
```

**Return:** updated instance in the same summary shape as `Instances.Get()`.

### `client.Instances.RestartAsync<TResponse>(instanceId, options?)`

```csharp theme={null}
await client.Instances.RestartAsync<object>("VZ...", new InstanceRequestOptions { InstanceToken = "instance-token" });
```

**Return:** `InstanceActionResponse` — `InstanceId`, `Status`, `Details`.

### `client.Instances.DeleteAsync<TResponse>(instanceId, options?)`

```csharp theme={null}
await client.Instances.DeleteAsync<object>("VZ...", new InstanceRequestOptions { InstanceToken = "instance-token" });
```

**Return:** empty body on success (`204`) or the standard error envelope.

### `client.Instances.SubscribeAsync<TResponse>(instanceId, body?, options?)`

```csharp theme={null}
await client.Instances.SubscribeAsync<object>(
    "VZ...",
    new { plan = "direct" },
    new InstanceRequestOptions { InstanceToken = "instance-token" });
```

**Return:** `BillingHostedSession` — `Url`, `SessionId`, `mode` (`direct` or checkout), `SubscriptionId`.

### `client.Instances.ResumeSubscriptionAsync<TResponse>(instanceId, options?)`

```csharp theme={null}
await client.Instances.ResumeSubscriptionAsync<object>("VZ...", new InstanceRequestOptions { InstanceToken = "instance-token" });
```

**Return:** `{ Status: "ok" }`.

### `client.Instances.CancelAsync<TResponse>(instanceId, options?)`

```csharp theme={null}
await client.Instances.CancelAsync<object>("VZ...", new InstanceRequestOptions { InstanceToken = "instance-token" });
```

**Return:** `{ Message }` confirming cancellation or scheduled cancel.

## Advanced calls

Use `RequestAsync<TResponse>()` when you need a newly released field or endpoint not yet wrapped by a typed method.

```csharp theme={null}
await client.RequestAsync<object>(
    HttpMethod.Post,
    "/instances/VZ.../chat/send/text",
    new VZaps.Http.VZapsRequestOptions
    {
        InstanceToken = "instance-token",
        Body = new { phone = "5511999999999", message = "Hello" },
    });
```
