Cal.com API v2
This skill provides guidance for AI agents to interact with the Cal.com API v2, enabling scheduling automation, booking management, and calendar integrations.
Base URL
All API requests should be made to:
CODEBLOCK0
Authentication
All API requests require authentication via Bearer token in the Authorization header:
CODEBLOCK1
API keys must be prefixed with cal_. You can generate API keys from your Cal.com dashboard under Settings > Developer > API Keys.
Core Concepts
Event Types
Event types define bookable meeting configurations (duration, location, availability rules). Each event type has a unique slug used in booking URLs.
Bookings
Bookings are confirmed appointments created when someone books an event type. Each booking has a unique UID for identification.
Schedules
Schedules define when a user is available for bookings. Users can have multiple schedules with different working hours.
Slots
Slots represent available time windows that can be booked based on event type configuration and user availability.
Common Operations
Check Available Slots
Before creating a booking, check available time slots:
CODEBLOCK2
Query parameters:
- -
startTime (required): ISO 8601 start of range - INLINECODE2 (required): ISO 8601 end of range
- INLINECODE3 or
eventTypeSlug: Identify the event type - INLINECODE5 : Timezone for slot display (default: UTC)
Response contains available slots grouped by date.
Create a Booking
CODEBLOCK3
Required fields:
- -
start: ISO 8601 booking start time - INLINECODE7 : ID of the event type to book
- INLINECODE8 : Attendee's full name
- INLINECODE9 : Attendee's email address
- INLINECODE10 : Attendee's timezone
Get Bookings
List bookings with optional filters:
CODEBLOCK4
Query parameters:
- -
status: Filter by status (upcoming, recurring, past, cancelled, unconfirmed) - INLINECODE12 : Filter by attendee email
- INLINECODE13 : Filter by event type
- INLINECODE14 : Number of results (max 250)
- INLINECODE15 : Pagination offset
Get a Single Booking
CODEBLOCK5
Cancel a Booking
CODEBLOCK6
Reschedule a Booking
CODEBLOCK7
List Event Types
CODEBLOCK8
Returns all event types for the authenticated user.
Get a Single Event Type
CODEBLOCK9
Create an Event Type
CODEBLOCK10
List Schedules
CODEBLOCK11
Get Default Schedule
CODEBLOCK12
Create a Schedule
CODEBLOCK13
Days are 0-indexed (0 = Sunday, 1 = Monday, etc.).
Get Current User
CODEBLOCK14
Returns the authenticated user's profile information.
Team and Organization Endpoints
For team bookings and organization management, use the organization-scoped endpoints:
List Organization Teams
CODEBLOCK15
Get Team Event Types
CODEBLOCK16
Create Team Booking
Team event types support different scheduling modes:
- -
COLLECTIVE: All team members must attend - INLINECODE17 : Distributes bookings among team members
Webhooks
Configure webhooks to receive real-time notifications:
List Webhooks
CODEBLOCK17
Create a Webhook
CODEBLOCK18
Available triggers:
- - INLINECODE18
- INLINECODE19
- INLINECODE20
- INLINECODE21
- INLINECODE22
- INLINECODE23
Calendar Integration
List Connected Calendars
CODEBLOCK19
Check Busy Times
CODEBLOCK20
Error Handling
The API returns standard HTTP status codes:
- -
200: Success - INLINECODE25 : Created
- INLINECODE26 : Bad Request (invalid parameters)
- INLINECODE27 : Unauthorized (invalid or missing API key)
- INLINECODE28 : Forbidden (insufficient permissions)
- INLINECODE29 : Not Found
- INLINECODE30 : Unprocessable Entity (validation error)
- INLINECODE31 : Internal Server Error
Error responses include a message field:
CODEBLOCK21
Rate Limiting
The API implements rate limiting. If you exceed the limit, you'll receive a 429 Too Many Requests response. Implement exponential backoff for retries.
Pagination
List endpoints support pagination via take and skip parameters:
- -
take: Number of items to return (default: 10, max: 250) - INLINECODE36 : Number of items to skip
Best Practices
- 1. Always check slot availability before creating bookings
- Store booking UIDs for future reference (cancel, reschedule)
- Handle timezone conversions carefully - always use ISO 8601 format
- Implement webhook handlers for real-time booking updates
- Cache event type data to reduce API calls
- Use appropriate error handling for all API calls
Additional Resources
Cal.com API v2
此技能为AI代理提供与Cal.com API v2交互的指导,支持日程自动化、预订管理和日历集成。
基础URL
所有API请求应发送至:
https://api.cal.com/v2
身份验证
所有API请求需通过Authorization头中的Bearer令牌进行身份验证:
Authorization: Bearer calapi_key>
API密钥必须以cal_为前缀。您可以在Cal.com仪表板的设置 > 开发者 > API密钥下生成API密钥。
核心概念
事件类型
事件类型定义了可预订的会议配置(时长、地点、可用性规则)。每个事件类型都有一个用于预订URL的唯一标识符。
预订
预订是当有人预订事件类型时创建的已确认预约。每个预订都有一个唯一的UID用于识别。
日程
日程定义了用户何时可以进行预订。用户可以拥有多个具有不同工作时间的日程。
时段
时段代表基于事件类型配置和用户可用性可预订的可用时间窗口。
常见操作
检查可用时段
在创建预订前,检查可用时段:
http
GET /v2/slots?startTime=2024-01-15T00:00:00Z&endTime=2024-01-22T00:00:00Z&eventTypeId=123&eventTypeSlug=30min
查询参数:
- - startTime(必填):ISO 8601格式的时间范围起始
- endTime(必填):ISO 8601格式的时间范围结束
- eventTypeId或eventTypeSlug:标识事件类型
- timeZone:时段显示的时区(默认:UTC)
响应包含按日期分组的可用时段。
创建预订
http
POST /v2/bookings
Content-Type: application/json
{
start: 2024-01-15T10:00:00Z,
eventTypeId: 123,
attendee: {
name: John Doe,
email: john@example.com,
timeZone: America/New_York
},
meetingUrl: https://cal.com/team/meeting,
metadata: {}
}
必填字段:
- - start:ISO 8601格式的预订开始时间
- eventTypeId:要预订的事件类型ID
- attendee.name:参与者的全名
- attendee.email:参与者的电子邮件地址
- attendee.timeZone:参与者的时区
获取预订
列出带有可选过滤条件的预订:
http
GET /v2/bookings?status=upcoming&take=10
查询参数:
- - status:按状态过滤(upcoming、recurring、past、cancelled、unconfirmed)
- attendeeEmail:按参与者电子邮件过滤
- eventTypeId:按事件类型过滤
- take:结果数量(最大250)
- skip:分页偏移量
获取单个预订
http
GET /v2/bookings/{bookingUid}
取消预订
http
POST /v2/bookings/{bookingUid}/cancel
Content-Type: application/json
{
cancellationReason: Schedule conflict
}
重新安排预订
http
POST /v2/bookings/{bookingUid}/reschedule
Content-Type: application/json
{
start: 2024-01-16T14:00:00Z,
reschedulingReason: Conflict with another meeting
}
列出事件类型
http
GET /v2/event-types
返回已验证用户的所有事件类型。
获取单个事件类型
http
GET /v2/event-types/{eventTypeId}
创建事件类型
http
POST /v2/event-types
Content-Type: application/json
{
title: 30 Minute Meeting,
slug: 30min,
lengthInMinutes: 30,
locations: [
{
type: integration,
integration: cal-video
}
]
}
列出日程
http
GET /v2/schedules
获取默认日程
http
GET /v2/schedules/default
创建日程
http
POST /v2/schedules
Content-Type: application/json
{
name: Working Hours,
timeZone: America/New_York,
isDefault: true,
availability: [
{
days: [1, 2, 3, 4, 5],
startTime: 09:00,
endTime: 17:00
}
]
}
天数为0索引(0 = 星期日,1 = 星期一,以此类推)。
获取当前用户
http
GET /v2/me
返回已验证用户的个人资料信息。
团队和组织端点
对于团队预订和组织管理,请使用组织范围端点:
列出组织团队
http
GET /v2/organizations/{orgId}/teams
获取团队事件类型
http
GET /v2/organizations/{orgId}/teams/{teamId}/event-types
创建团队预订
团队事件类型支持不同的日程安排模式:
- - COLLECTIVE:所有团队成员必须参加
- ROUND_ROBIN:在团队成员之间分配预订
Webhooks
配置webhooks以接收实时通知:
列出Webhooks
http
GET /v2/webhooks
创建Webhook
http
POST /v2/webhooks
Content-Type: application/json
{
subscriberUrl: https://your-app.com/webhook,
triggers: [BOOKINGCREATED, BOOKINGCANCELLED],
active: true
}
可用触发器:
- - BOOKINGCREATED
- BOOKINGCANCELLED
- BOOKINGRESCHEDULED
- BOOKINGCONFIRMED
- MEETINGSTARTED
- MEETINGENDED
日历集成
列出已连接的日历
http
GET /v2/calendars
检查忙碌时间
http
GET /v2/calendars/busy-times?startTime=2024-01-15T00:00:00Z&endTime=2024-01-22T00:00:00Z
错误处理
API返回标准HTTP状态码:
- - 200:成功
- 201:已创建
- 400:错误请求(无效参数)
- 401:未授权(无效或缺失API密钥)
- 403:禁止访问(权限不足)
- 404:未找到
- 422:无法处理的实体(验证错误)
- 500:内部服务器错误
错误响应包含消息字段:
json
{
status: error,
message: Booking not found
}
速率限制
API实施速率限制。如果超出限制,您将收到429 Too Many Requests响应。请实现指数退避策略进行重试。
分页
列表端点通过take和skip参数支持分页:
- - take:返回的项目数量(默认:10,最大:250)
- skip:跳过的项目数量
最佳实践
- 1. 在创建预订前始终检查时段可用性
- 存储预订UID以供将来参考(取消、重新安排)
- 谨慎处理时区转换——始终使用ISO 8601格式
- 实现webhook处理程序以获取实时预订更新
- 缓存事件类型数据以减少API调用
- 对所有API调用使用适当的错误处理
其他资源