> ## 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.

# Starter Guide

> Complete first integration flow with the VZaps Java SDK

This guide shows the common Java flow: create the client, validate authentication, list or create an instance, pair the session, configure events, and send a message.

## 1. Create the client

```java theme={null}
try (VZapsClient client = VZapsClient.builder()
    .clientToken(System.getenv("VZAPS_CLIENT_TOKEN"))
    .clientSecret(System.getenv("VZAPS_CLIENT_SECRET"))
    .build()) {
  System.out.println(client.auth().getAccessToken());
}
```

## 2. List instances

```java theme={null}
JsonNode instances = client.instances().list();
System.out.println(instances);
```

## 3. Check session status

```java theme={null}
var options = InstanceRequestOptions.builder()
    .instanceToken(System.getenv("VZAPS_INSTANCE_TOKEN"))
    .build();

SessionStatusResponse status = client.sessions().status(System.getenv("VZAPS_INSTANCE_ID"), options);
System.out.println(status.data().connected());
```

## 4. Send a text message

```java theme={null}
client.messages().sendText(SendTextMessageRequest.builder()
    .instanceId(System.getenv("VZAPS_INSTANCE_ID"))
    .instanceToken(System.getenv("VZAPS_INSTANCE_TOKEN"))
    .phone("5511999999999")
    .message("Hello from Java")
    .build());
```

## 5. Use async when useful

```java theme={null}
try (VZapsAsyncClient client = VZapsAsyncClient.builder()
    .clientToken(System.getenv("VZAPS_CLIENT_TOKEN"))
    .clientSecret(System.getenv("VZAPS_CLIENT_SECRET"))
    .build()) {
  client.instances().list().thenAccept(System.out::println).join();
}
```

See [Messages](/en/sdk/java/messages) for all send types and [Realtime](/en/sdk/java/realtime) for WebSocket subscriptions.
