Create events
Learn how to create calendar events using Unipile API.
Create a timed event
To create an event with a start and end time, use Create a calendar event and provide date times as start and end:
date_timeshould be an ISO 8601 datetime without timezonetimezoneshould be an IANA time zone ID
import { UnipileCalendar } from "unipile";
const key = process.env.UNIPILE_API_KEY ?? "";
const calendarApi = new UnipileCalendar({ key });
const { data, error } = await calendarApi.createCalendarEvent({
path: {
account_id: "acc_123456789",
calendar_id: "calendar_id",
},
body: {
name: 'Meeting',
start: {
date_time: '2025-05-28T10:00:00',
timezone: 'Europe/Paris',
},
end: {
date_time: '2025-05-28T11:00:00',
timezone: 'Europe/Paris',
},
},
});import unipile
configuration = unipile.Configuration()
configuration.api_key["apiKey"] = "your-api-key"
api_client = unipile.ApiClient(configuration)
calendar_api = unipile.CalendarApi(api_client)
event = calendar_api.create_calendar_event(
"calendar_id",
"acc_123456789",
{
"name": "Meeting",
"start": {
"date_time": "2025-05-28T10:00:00",
"timezone": "Europe/Paris",
},
"end": {
"date_time": "2025-05-28T11:00:00",
"timezone": "Europe/Paris",
},
},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/calendars/calendar_id/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"name": "Meeting",
"start": {
"date_time": "2025-05-28T10:00:00",
"timezone": "Europe/Paris"
},
"end": {
"date_time": "2025-05-28T11:00:00",
"timezone": "Europe/Paris"
}
}
'Create a full day event
To create a full day event, use Create a calendar event and provide dates as start and end (both inclusives, which means the start and end should be the same date for a 1 day event)
dateshould be a YYYY-MM-DD formatted date.
const { data, error } = await calendarApi.createCalendarEvent({
path: {
account_id: "acc_123456789",
calendar_id: "calendar_id",
},
body: {
name: 'Vacation',
start: {
date: '2025-05-28',
},
end: {
date: '2025-05-29',
},
},
});event = calendar_api.create_calendar_event(
"calendar_id",
"acc_123456789",
{
"name": "Vacation",
"start": {"date": "2025-05-28"},
"end": {"date": "2025-05-29"},
},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/calendars/calendar_id/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"name": "Vacation",
"start": {
"date": "2025-05-28"
},
"end": {
"date": "2025-05-29"
}
}
'Create a recurring event
To create a recurring event, use Create a calendar event and add a recurrence array.
Learn more in Recurring events guide.
const { data, error } = await calendarApi.createCalendarEvent({
path: {
account_id: "acc_123456789",
calendar_id: "calendar_id",
},
body: {
name: 'Meeting',
start: {
date_time: '2025-05-28T10:00:00',
timezone: 'Europe/Paris',
},
end: {
date_time: '2025-05-28T11:00:00',
timezone: 'Europe/Paris',
},
recurrence: [
'RRULE:FREQ=WEEKLY;BYDAY=TH;UNTIL=20251218T090000Z'
]
},
});event = calendar_api.create_calendar_event(
"calendar_id",
"acc_123456789",
{
"name": "Meeting",
"start": {
"date_time": "2025-05-28T10:00:00",
"timezone": "Europe/Paris",
},
"end": {
"date_time": "2025-05-28T11:00:00",
"timezone": "Europe/Paris",
},
"recurrence": ["RRULE:FREQ=WEEKLY;BYDAY=TH;UNTIL=20251218T090000Z"],
},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/calendars/calendar_id/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"name": "Meeting",
"start": {
"date_time": "2025-05-28T10:00:00",
"timezone": "Europe/Paris"
},
"end": {
"date_time": "2025-05-28T11:00:00",
"timezone": "Europe/Paris"
},
"recurrence": [
"RRULE:FREQ=WEEKLY;BYDAY=TH;UNTIL=20251218T090000Z"
]
}
'Add a conference to an event
To associate a conference (video meeting) to an event, provide the conference object.
- Unipile does not support the generation of conferences so you must create the meeting on the provider and include the URL in the request.
const { data, error } = await calendarApi.createCalendarEvent({
path: {
account_id: "acc_123456789",
calendar_id: "calendar_id",
},
body: {
name: 'Meeting',
start: {
date_time: '2025-05-28T10:00:00',
timezone: 'Europe/Paris',
},
end: {
date_time: '2025-05-28T11:00:00',
timezone: 'Europe/Paris',
},
conference: {
provider: "google_meet",
url: "http://meet.google.com/xxxx"
}
},
});event = calendar_api.create_calendar_event(
"calendar_id",
"acc_123456789",
{
"name": "Meeting",
"start": {
"date_time": "2025-05-28T10:00:00",
"timezone": "Europe/Paris",
},
"end": {
"date_time": "2025-05-28T11:00:00",
"timezone": "Europe/Paris",
},
"conference": {
"provider": "google_meet",
"url": "http://meet.google.com/xxxx",
},
},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/calendars/calendar_id/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"name": "Meeting",
"start": {
"date_time": "2025-05-28T10:00:00",
"timezone": "Europe/Paris"
},
"end": {
"date_time": "2025-05-28T11:00:00",
"timezone": "Europe/Paris"
},
"conference": {
"provider": "google_meet",
"url": "http://meet.google.com/xxxx"
}
}
'Updated about 1 month ago