PT EN

Calendário: Calendário

URL base: $BUSINESS_API

Obter o calendário

Registos

GET /calendar

Read the tenant's time zone, working week and template adoption

Returns the tenant-wide working calendar: time zone, working weekdays (0 = Sunday to 6 = Saturday) and the holiday template it follows, if any. When the tenant has never saved a calendar, the response is the built-in default (the default time zone and Monday to Friday) rather than a 404. Requires the automations:read permission.

Devolve

200 Tenant calendar

Permissões automations:read · Funções: admin, analyst, customer_service, finance, operations, owner

curl -X GET "$BUSINESS_API/calendar" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200

Tenant calendar

Actualizar o calendário

Registos

PUT /calendar

Set the tenant's time zone, working days and holiday template

Saves the calendar that billing due dates, grace periods and scheduled automations are evaluated against. An empty timezone keeps the current one and an omitted working_days keeps the current weekdays, but template_key and template_version are always replaced by the values sent, so omitting them detaches the calendar from its template; sending area_id saves a separate calendar for that service area. Returns 400 for an unknown IANA time zone or for working_days with more than seven entries or values outside 0-6. Requires automations:write.

Corpo application/json

timezonestring · opcional
working_daysarray of integer · opcional
template_keystring · opcional
template_yearinteger · opcional
area_idstring · opcional

Devolve

200 Updated calendar

Erros 400

Permissões automations:write · Funções: admin, finance, operations, owner

curl -X PUT "$BUSINESS_API/calendar" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "timezone": "Africa/Maputo",
  "working_days": [
    0
  ],
  "template_key": "mz",
  "template_year": 1,
  "area_id": "are_2ZTQYjrK63ZImD3sMz1O2BhWeZV"
}'
Resposta 200

Updated calendar

Calcular as ocorrências de um agendamento

Registos

POST /calendar/occurrences

Dry-runs a schedule spec against the tenant calendar and returns its next run times, the same way billing and automations evaluate it, so a rule can be checked before it is saved. The calculation uses the area's calendar (or the tenant-wide one), its working weekdays, dated days, recurring rules and template, looking three years each way around after. count defaults to 5 and is capped at 50, and after defaults to now; an invalid spec returns 400. Requires automations:read.

Corpo application/json

specobject · obrigatório
afterstring (date-time) · opcional
countinteger · opcional
area_idstring · opcional

Devolve

200 Next occurrences

Erros 400

Permissões automations:read · Funções: admin, analyst, customer_service, finance, operations, owner

curl -X POST "$BUSINESS_API/calendar/occurrences" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "spec": {},
  "after": "2026-11-19T09:30:00Z",
  "count": 1,
  "area_id": "are_2ZTQYjrK63ZImD3sMz1O2BhWeZV"
}'
Resposta 200

Next occurrences

Exportar o calendário em iCalendar

Registos

GET /calendar/export.ics

Downloads the tenant's calendar as an iCalendar file (text/calendar attachment) that calendar applications can subscribe to or import. Each dated day becomes an all-day VEVENT, and each recurring rule becomes a VEVENT with a yearly RRULE (BYMONTH with BYMONTHDAY or BYDAY); Easter-relative rules use a non-standard EASTER/OFFSET RRULE that other applications may not understand. Event names use the Portuguese name. Requires automations:read.

Devolve

200 iCalendar document

Permissões automations:read · Funções: admin, analyst, customer_service, finance, operations, owner

curl -X GET "$BUSINESS_API/calendar/export.ics" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200

iCalendar document

Exportar o calendário em CSV

Registos

GET /calendar/export.csv

Downloads every dated day and recurring rule of the tenant as a CSV attachment (text/csv) for review or re-import. The header is date,rule,kind,name_pt,name_en,area,observed,source_reference: day rows fill the date column, and rule rows fill the rule column with semicolon-separated kind, month, day, weekday, position, easter and easter_offset values. All areas are included. Requires automations:read.

Devolve

200 CSV document

Permissões automations:read · Funções: admin, analyst, customer_service, finance, operations, owner

curl -X GET "$BUSINESS_API/calendar/export.csv" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200

CSV document