For the complete documentation index, see llms.txt.

JavaScript SDK

@vennio/sdk — A lightweight, zero-dependency JavaScript SDK for the Vennio API.

SDK in beta

The JavaScript SDK is in beta. The API surface may change. For production use, you can call the REST API directly.

Installation

npm install @vennio/sdk

Usage

Server-side only

createVennioClient with a secret API key (vennio_sk_live_*) must only be used in server-side code (Node.js, edge functions). Never use it in browser JavaScript or expose your secret key to clients. Use @vennio/react or publishable keys for client-side use.

import { createVennioClient } from '@vennio/sdk'

const client = createVennioClient({
  apiKey: process.env.VENNIO_API_KEY,
  baseUrl: 'https://api.vennio.app', // optional
})

// Query availability
const { slots } = await client.availability.getSlots({
  business_id: 'your-business-id',
  duration_minutes: 30,
  timezone: 'America/New_York',
})

// Create a booking
const { booking } = await client.bookings.create({
  business_id: 'your-business-id',
  customer_email: 'customer@example.com',
  customer_name: 'Jane Doe',
  start_time: slots[0].start,
  end_time: slots[0].end,
})

Embeddable widget

Add a booking widget to any webpage with 2 lines of HTML using @vennio/widget:

<script src="https://unpkg.com/@vennio/widget"></script>
<div data-vennio-booking data-shortcode="your-shortcode"></div>

Or programmatically via npm:

import { init } from '@vennio/widget'

init(document.getElementById('booking-widget'), {
  shortcode: 'your-shortcode',
  onBooked: (data) => console.log(data)
})

For full widget options and gotchas, see the Booking Widget guide.