Initialization

import { coss } from '@coss';
coss.scheduling.init({
apiKey: process.env.COSS_KEY,
environment: 'production', // or 'sandbox'
});

Users

// Create a user
await coss.scheduling.users.create({
email: 'jane@example.com',
name: 'Jane Doe',
});
// Retrieve a user
await coss.scheduling.users.retrieve('user_abc123');

Schedules

// Create a schedule
await coss.scheduling.schedules.create({
userId: 'user_abc123',
availability: [
{
day: 'Monday',
start: '09:00',
end: '17:00',
},
// ... other days
],
});
// Retrieve schedules
await coss.scheduling.schedules.list({ userId: 'user_abc123' });

Event Types

// Create an event type
await coss.scheduling.eventTypes.create({
userId: 'user_abc123',
name: 'Consultation',
duration: 30,
scheduleId: 'schedule_abc123',
});
// Retrieve event types
await coss.scheduling.eventTypes.list({ userId: 'user_abc123' });

Bookings

// Create a booking
await coss.scheduling.bookings.create({
eventTypeId: 'eventType_abc123',
attendee: {
name: 'John Smith',
email: 'john@example.com',
},
start: '2025-05-01T15:00:00Z',
});
// Retrieve bookings
await coss.scheduling.bookings.list({ userId: 'user_abc123' });

Webhooks

// Webhook events
coss.scheduling.webhooks.on('booking.created', (event) => {
console.log('New booking:', event.data);
});
coss.scheduling.webhooks.on('booking.cancelled', (event) => {
console.log('Booking cancelled:', event.data);
});

Utilities

// Validate webhook signature
const isValid = coss.scheduling.utils.verifySignature({
payload: req.body,
signature: req.headers['coss-scheduling-signature'],
secret: 'whsec_scheduling_123',
});
Join the waitlistJoin the company