Skip to main content
Use these resources for account authentication, instance lifecycle, and billing. For WhatsApp session flows, see Session. For chats, see Chats. For message sending, see Messages. Common fields on instance calls:
FieldTypeRequiredDescription
InstanceIDstringYesInstance ID (path or struct field).
InstanceTokenstringYesInstance token (X-Instance-Token header).
All resource methods accept a context.Context as the first argument.

Auth

Auth.GetAccessToken(ctx)

Gets a JWT with ClientToken and ClientSecret. In most flows, resources do this automatically.
token, err := client.Auth.GetAccessToken(ctx)
fmt.Println(token[:16])
Return: string JWT access token (accessToken from POST /token).

Instances and billing

Instances.Create(ctx, req)

created, err := client.Instances.Create(ctx, vzaps.InstanceCreateRequest{
	Name:            "Support",
	Webhook:         "https://example.com/webhooks/vzaps",
	EventsSubscribe: []string{"Message", "Connected", "Disconnected"},
})
Return: InstancePublicCreateResponseid, name, token, url, webhook, events_subscribe, status, created_at, updated_at.

Instances.List(ctx, req)

instances, err := client.Instances.List(ctx, vzaps.InstanceListRequest{
	Page:     1,
	PageSize: 20,
	Search:   "support",
})
Return: page { page, size, total, total_pages, content[], summary }. Each content item uses the public instance summary shape.

Instances.Get(ctx, instanceID)

Returns one instance in the same public summary format as each row from Instances.List().
instance, err := client.Instances.Get(ctx, "VZ...")
Return: same summary shape as one instances.list() item (id, name, token, url, webhook, status, etc.).

Instances.Update(ctx, instanceID, body, options)

_, err := client.Instances.Update(ctx, "VZ...", map[string]any{
	"name": "Commercial Support",
}, vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
Return: updated instance in the same summary shape as instances.get().

Instances.Restart(ctx, instanceID, options)

_, err := client.Instances.Restart(ctx, "VZ...", vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
Return: InstanceActionResponseinstance_id, status, details.

Instances.Delete(ctx, instanceID, options)

_, err := client.Instances.Delete(ctx, "VZ...", vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
Return: empty body on success (204) or the standard error envelope.

Instances.Subscribe(ctx, instanceID, body, options)

checkout, err := client.Instances.Subscribe(ctx, "VZ...", nil, vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
Return: BillingHostedSessionurl, session_id, mode (direct or checkout), subscription_id.

Instances.ResumeSubscription(ctx, instanceID, options)

_, err := client.Instances.ResumeSubscription(ctx, "VZ...", vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
Return: { status: "ok" }.

Instances.Cancel(ctx, instanceID, options)

_, err := client.Instances.Cancel(ctx, "VZ...", vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
Return: { message } confirming cancellation or scheduled cancel.

Advanced calls

Use client.Request() when you need an operation not yet wrapped by a resource:
err := client.Request(ctx, method, path, vzaps.RequestOptions{}, &out)
For the full HTTP contract, use the API tab.