# CalendarJet API Documentation

Build powerful scheduling integrations with our RESTful API. Simple, secure, and developer-friendly.

## Authentication

All API requests require authentication using Bearer tokens. Include your API key in the Authorization header:

```plaintext
Authorization: Bearer cjet_live_YOUR_API_KEY_HERE
```

## Base URL

```plaintext
https://www.calendarjet.com/api/v1
```

## Rate Limits

### Free Plan

- 10 req/month

### Pro Plan

- Unlimited
- 100 req/min

## Error Codes

- `200` Success
- `201` Resource created
- `400` Bad request
- `401` Unauthorized
- `403` Forbidden
- `404` Not found
- `422` Validation error
- `429` Rate limit exceeded
- `500` Server error

## Webhook Payloads

When events occur, CalendarJet sends POST requests to your configured webhook URLs. Each payload includes comprehensive data with HMAC-SHA256 signatures for verification.

### booking.created
When a new booking is created

```json
{
  "id": "evt_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "event": "booking.created",
  "created_at": "2025-01-15T10:00:00.000Z",
  "data": {
    "booking": {
      "id": "book_abc123",
      "scheduled_at": "2025-01-16T14:00:00.000Z",
      "end_time": "2025-01-16T14:30:00.000Z",
      "invitee_name": "John Doe",
      "invitee_email": "john@example.com",
      "invitee_timezone": "America/New_York",
      "status": "pending",
      "reschedule_url": "https://www.calendarjet.com/booking/manage/book_abc123?token=xxx&action=reschedule",
      "cancel_url": "https://www.calendarjet.com/booking/manage/book_abc123?token=xxx&action=cancel"
    },
    "organizer": {
      "id": "user_xyz789",
      "name": "Jane Smith",
      "email": "jane@company.com",
      "timezone": "America/Los_Angeles"
    },
    "event_type": {
      "id": "evt_type_123",
      "name": "30 Minute Meeting",
      "slug": "30min-meeting",
      "duration_minutes": 30
    },
    "metadata": { "api_version": "2.0" }
  }
}
```

### booking.confirmed
When a booking is confirmed

Same structure as `booking.created` with `status: "confirmed"` and `meeting_link` if applicable.

### booking.rescheduled
When a booking is rescheduled

```json
{
  "id": "evt_...",
  "event": "booking.rescheduled",
  "data": {
    "booking": {
      "id": "book_abc123",
      "previous_scheduled_at": "2025-01-16T14:00:00.000Z",
      "previous_end_time": "2025-01-16T14:30:00.000Z",
      "scheduled_at": "2025-01-17T10:00:00.000Z",
      "end_time": "2025-01-17T10:30:00.000Z",
      "status": "confirmed",
      "reschedule_url": "...",
      "cancel_url": "..."
    },
    "rescheduling": {
      "rescheduled_by": "invitee",
      "rescheduled_at": "2025-01-15T12:00:00.000Z"
    }
  }
}
```

### booking.cancelled
When a booking is cancelled

```json
{
  "id": "evt_...",
  "event": "booking.cancelled",
  "data": {
    "booking": { "id": "book_abc123", "status": "cancelled" },
    "cancellation": {
      "cancelled_at": "2025-01-15T15:00:00.000Z",
      "cancelled_by": "invitee",
      "cancellation_reason": "Schedule conflict"
    }
  }
}
```

### booking.reminder
When a reminder is sent before a booking

```json
{
  "id": "evt_...",
  "event": "booking.reminder",
  "data": {
    "booking": { "id": "book_abc123", "meeting_link": "https://zoom.us/j/..." },
    "reminder": {
      "type": "24h",
      "sent_at": "2025-01-15T14:00:00.000Z",
      "hours_before": 24
    },
    "location": {
      "type": "zoom",
      "meeting_url": "https://zoom.us/j/..."
    }
  }
}
```

## Signature Verification

Each webhook includes a `X-Webhook-Signature` header with HMAC-SHA256 signature:

```javascript
const crypto = require('crypto');

function verifySignature(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}
```

### Resources

- [Download Full Documentation](/content/CalendarJet-API-Documentation.md)
- [OpenAPI Specification](/content/openapi.json)
- [API Key Management](/content/settings/index.html)

### Support

- [hello@calendarjet.com](mailto:hello@calendarjet.com)  
- [Support Center](/content/support/index.html)

Built with ❤️ by CalendarJet • API Version 1.0.0
