Create a new calendar event with the specified information.
Request Body
Type of event. One of: meeting
, appointment
, busy
, voice_call
, video_call
.
status
string
default:"scheduled"
Event status. One of: scheduled
, confirmed
.
Notes about the customer or appointment.
Whether to enable video conferencing.
URL for video conferencing.
video_conference_provider
Provider of video conferencing (e.g., Zoom, Google Meet, etc.).
Whether to enable reminders.
How many minutes before the event to send a reminder.
ID of the AI agent to associate with this event.
ID of the team to associate with this event.
Whether this event was created by an AI agent.
Whether to sync this event with connected external calendars.
Whether to send notifications about this event.
Response
URL to download ICS file for this event.
Example Request
curl -X POST 'https://api.klen.ai/api/v1/calendar/events/create' \
-H 'Authorization: Bearer klen_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"title": "Product Demo",
"description": "Product demonstration for potential client",
"start_time": "2025-05-15T14:00:00.000Z",
"end_time": "2025-05-15T15:00:00.000Z",
"event_type": "video_call",
"status": "confirmed",
"customer_name": "Jane Doe",
"customer_email": "[email protected]",
"customer_phone": "+15551234567",
"has_video_conference": true,
"video_conference_provider": "Zoom",
"is_reminder_enabled": true,
"remind_before_minutes": 15
}'
Example Response
{
"id": 456,
"uuid": "a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890",
"title": "Product Demo",
"start_time": "2025-05-15T14:00:00.000Z",
"end_time": "2025-05-15T15:00:00.000Z",
"status": "confirmed",
"ics_url": "/calendar/event/a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890/calendar.ics",
"message": "Event created successfully"
}
Error Responses
Missing Required Parameters (400)
{
"error": "missing_parameter",
"message": "Missing required parameter: title"
}
{
"error": "invalid_datetime_format",
"message": "Invalid datetime format. Expected ISO 8601 format (YYYY-MM-DDTHH:MM:SS)"
}
Invalid Time Range (400)
{
"error": "invalid_time_range",
"message": "End time must be after start time"
}
Agent Not Found (404)
{
"error": "agent_not_found",
"message": "AI agent not found or you do not have access"
}
Team Not Found (404)
{
"error": "team_not_found",
"message": "Team not found or you do not have access"
}
Unauthorized (401)
{
"error": "authentication_required",
"message": "API key is required"
}
Permission Denied (403)
{
"error": "permission_denied",
"message": "This API key does not have can_write_calendar permission"
}
Server Error (500)
{
"error": "server_error",
"message": "An unexpected server error occurred"
}