Importar um calendário
RegistosPOST /calendar/imports
Parses an ICS or CSV calendar, sent inline in content or fetched from url (10 second timeout, 4 MB limit), and stores a preview that lists the days and rules it would add, change or remove, the conflicts with existing days, and the schedules the change may move. Nothing is written to the calendar unless auto_apply is true and the preview has no conflicts; otherwise apply it later with the apply endpoint. ICS input must use all-day events with optional yearly RRULEs; multi-day events, EXDATE and timed starts are rejected with 400. When source_id is given the source must exist and be enabled, and days or rules that the source previously supplied but no longer contains are reported as removals and conflicts. Requires automations:write.
Corpo application/json
formatum de
ics,csvcontenturlsource_idauto_apply
Devolve
201 Import preview with added, changed, removed, conflicts, affected schedules and explicit coverage limitations
Mostrar atributos
idtenant_idsource_idformatum de
ics,csvstatusum de
preview,applied,faileditemsMostrar atributos filhos
kinduiddatemonthdayweekdaypositioneaster_kindum de
western,orthodoxeaster_offsetobservedum de
none,next,previous,nearestvalid_fromvalid_toname_ptname_enkind_of_dayum de
holiday,closure,workingarea_idsource_ref
addedMostrar atributos filhos
kinduiddatemonthdayweekdaypositioneaster_kindum de
western,orthodoxeaster_offsetobservedum de
none,next,previous,nearestvalid_fromvalid_toname_ptname_enkind_of_dayum de
holiday,closure,workingarea_idsource_ref
changedMostrar atributos filhos
kinduiddatemonthdayweekdaypositioneaster_kindum de
western,orthodoxeaster_offsetobservedum de
none,next,previous,nearestvalid_fromvalid_toname_ptname_enkind_of_dayum de
holiday,closure,workingarea_idsource_ref
removedMostrar atributos filhos
kinduiddatemonthdayweekdaypositioneaster_kindum de
western,orthodoxeaster_offsetobservedum de
none,next,previous,nearestvalid_fromvalid_toname_ptname_enkind_of_dayum de
holiday,closure,workingarea_idsource_ref
conflictsMostrar atributos filhos
dateexisting_kindum de
holiday,closure,workingincoming_kindum de
holiday,closure,workingdetail
affectedMostrar atributos filhos
typeidnamefromtocount
affected_limitationsConsumer coverage gaps and date behaviors not recalculated by this preview.
confirmed_byoutcomecreated_atapplied_at
Permissões automations:write · Funções: admin, finance, operations, owner
curl -X POST "$BUSINESS_API/calendar/imports" \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"format": "ics",
"content": "content",
"url": "https://example.org/",
"source_id": "sou_2fjWEpPCsLRCQBV64hz26xd8MF9",
"auto_apply": true
}'
# Sem comando CLI equivalente; use cURL ou HTTP directo.
const res = await fetch("$BUSINESS_API/calendar/imports", {
method: "POST",
headers: {
Authorization: "Bearer sk_test_...",
"Content-Type": "application/json"
},
body: JSON.stringify({
"format": "ics",
"content": "content",
"url": "https://example.org/",
"source_id": "sou_2fjWEpPCsLRCQBV64hz26xd8MF9",
"auto_apply": true
})
});
const data = await res.json();
import requests
res = requests.post(
"$BUSINESS_API/calendar/imports",
headers={
"Authorization": "Bearer sk_test_..."
},
json={
"format": "ics",
"content": "content",
"url": "https://example.org/",
"source_id": "sou_2fjWEpPCsLRCQBV64hz26xd8MF9",
"auto_apply": true
}
)
data = res.json()
body := strings.NewReader(`{
"format": "ics",
"content": "content",
"url": "https://example.org/",
"source_id": "sou_2fjWEpPCsLRCQBV64hz26xd8MF9",
"auto_apply": true
}`)
req, _ := http.NewRequest("POST", "$BUSINESS_API/calendar/imports", body)
req.Header.Set("Authorization", "Bearer sk_test_...")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
{
"id": "cal_26gTtQiVPucb3CyVJaoRD6UlbOQ",
"tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
"source_id": "sou_2fjWEpPCsLRCQBV64hz26xd8MF9",
"format": "ics",
"status": "preview",
"items": [
{
"kind": "active",
"uid": "uid",
"date": "2026-11-19",
"month": 1,
"day": 1,
"weekday": 1,
"position": 1,
"easter_kind": "western",
"easter_offset": 1,
"observed": "none",
"valid_from": "2026-11-19",
"valid_to": "2026-11-19",
"name_pt": "name pt",
"name_en": "name en",
"kind_of_day": "holiday",
"area_id": "are_2ZTQYjrK63ZImD3sMz1O2BhWeZV",
"source_ref": "source ref"
}
],
"added": [
{
"kind": "active",
"uid": "uid",
"date": "2026-11-19",
"month": 1,
"day": 1,
"weekday": 1,
"position": 1,
"easter_kind": "western",
"easter_offset": 1,
"observed": "none",
"valid_from": "2026-11-19",
"valid_to": "2026-11-19",
"name_pt": "name pt",
"name_en": "name en",
"kind_of_day": "holiday",
"area_id": "are_2ZTQYjrK63ZImD3sMz1O2BhWeZV",
"source_ref": "source ref"
}
],
"changed": [
{
"kind": "active",
"uid": "uid",
"date": "2026-11-19",
"month": 1,
"day": 1,
"weekday": 1,
"position": 1,
"easter_kind": "western",
"easter_offset": 1,
"observed": "none",
"valid_from": "2026-11-19",
"valid_to": "2026-11-19",
"name_pt": "name pt",
"name_en": "name en",
"kind_of_day": "holiday",
"area_id": "are_2ZTQYjrK63ZImD3sMz1O2BhWeZV",
"source_ref": "source ref"
}
],
"removed": [
{
"kind": "active",
"uid": "uid",
"date": "2026-11-19",
"month": 1,
"day": 1,
"weekday": 1,
"position": 1,
"easter_kind": "western",
"easter_offset": 1,
"observed": "none",
"valid_from": "2026-11-19",
"valid_to": "2026-11-19",
"name_pt": "name pt",
"name_en": "name en",
"kind_of_day": "holiday",
"area_id": "are_2ZTQYjrK63ZImD3sMz1O2BhWeZV",
"source_ref": "source ref"
}
],
"conflicts": [
{
"date": "2026-11-19",
"existing_kind": "holiday",
"incoming_kind": "holiday",
"detail": "detail"
}
],
"affected": [
{
"type": "active",
"id": "cal_26gTtQiVPucb3CyVJaoRD6UlbOQ",
"name": "Ana Matsinhe",
"from": "2026-11-19T09:30:00Z",
"to": "2026-11-19T09:30:00Z",
"count": 1
}
],
"affected_limitations": [
"affected limitation"
],
"confirmed_by": "confirmed by",
"outcome": "outcome",
"created_at": "2026-11-19T09:30:00Z",
"applied_at": "2026-11-19T09:30:00Z"
}