Skip to main content

AI Calendar Integration API Reference

Complete API documentation for AI Calendar Integration endpoints, including authentication, calendar management, preferences, and event creation.

Authentication

All API requests require authentication using your BrainPredict API key:

# Include API key in Authorization header
Authorization: Bearer bp_live_1234567890abcdef1234567890abcdef

# Or use X-User-ID and X-Tenant-ID headers
X-User-ID: user_1234567890
X-Tenant-ID: tenant_1234567890

Calendar Connection

POST /api/v1/calendar/connect

Connect a calendar provider (Google, Microsoft, Apple)

POST /api/v1/calendar/connect
Content-Type: application/json

{
  "provider": "google",
  "authorization_code": "4/0AX4XfWh...",
  "redirect_uri": "https://brainpredict.ai/settings/calendar"
}

GET /api/v1/calendar/integration

Get current calendar integration status

GET /api/v1/calendar/integration

Response:
{
  "id": "cal_1234567890",
  "provider": "google",
  "calendar_id": "primary",
  "is_active": true,
  "created_at": "2025-11-03T10:00:00Z"
}

DELETE /api/v1/calendar/disconnect

Disconnect calendar integration

DELETE /api/v1/calendar/disconnect

Response:
{
  "success": true,
  "message": "Calendar disconnected successfully"
}

Calendar Preferences

GET /api/v1/calendar/preferences

Get user's calendar preferences

GET /api/v1/calendar/preferences

Response:
{
  "id": "pref_1234567890",
  "user_id": "user_1234567890",
  "enabled": true,
  "commerce_enabled": true,
  "supply_enabled": true,
  "people_enabled": false,
  "min_priority": "HIGH",
  "business_hours_only": true,
  "start_hour": 9,
  "end_hour": 18,
  "timezone": "Europe/Brussels",
  "exclude_weekends": true,
  "max_events_per_day": 5,
  "max_events_per_week": 20
}

PUT /api/v1/calendar/preferences

Update calendar preferences

PUT /api/v1/calendar/preferences
Content-Type: application/json

{
  "enabled": true,
  "commerce_enabled": true,
  "min_priority": "HIGH",
  "business_hours_only": true,
  "start_hour": 9,
  "end_hour": 18,
  "max_events_per_day": 5
}

Calendar Events

POST /api/v1/calendar/events

Create a calendar event from AI recommendation

POST /api/v1/calendar/events
Content-Type: application/json

{
  "recommendation_id": "rec_1234567890",
  "title": "Review high-priority customer churn alert",
  "description": "AI detected 85% churn risk for customer ABC Corp",
  "start_time": "2025-11-04T10:00:00Z",
  "end_time": "2025-11-04T10:30:00Z",
  "priority": "HIGH",
  "platform": "commerce"
}

GET /api/v1/calendar/events

List all AI-scheduled calendar events

GET /api/v1/calendar/events?start_date=2025-11-01&end_date=2025-11-30

Response:
{
  "events": [
    {
      "id": "evt_1234567890",
      "recommendation_id": "rec_1234567890",
      "title": "Review high-priority customer churn alert",
      "start_time": "2025-11-04T10:00:00Z",
      "end_time": "2025-11-04T10:30:00Z",
      "status": "scheduled",
      "platform": "commerce"
    }
  ],
  "total": 15
}

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
403Forbidden - AI Calendar add-on not enabled
404Not Found - Resource not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Next Steps