Calendar

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST
POST
POST

List all calendar sync

Calendar-sync controls for Customer analytics settings. Sync runs on an hourly Temporal schedule; this surface only offers the manual "sync now" escape hatch.

Required API key scopes

account:read

Example request

GET /api/projects/:project_id/calendar_sync
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/calendar_sync/

Example response

Status 200
RESPONSE
{
"integration_id": 0,
"last_synced_at": "2019-08-24T14:15:22Z",
"is_syncing": true,
"sync_interval_minutes": 0
}

Create calendar sync backfill

Start an admin-only Gmail and Google Calendar backfill for an inclusive UTC date range.

Request parameters

  • integration_id
    integer
  • start_date
    string
  • end_date
    string

Response


Example request

POST /api/projects/:project_id/calendar_sync/backfill
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/calendar_sync/backfill/\
-d integration_id="integer",\
-d start_date="string",\
-d end_date="string"

Example response

Status 200
RESPONSE
{
"status": "started"
}

Create calendar sync interval

Calendar-sync controls for Customer analytics settings. Sync runs on an hourly Temporal schedule; this surface only offers the manual "sync now" escape hatch.

Request parameters

  • integration_id
    integer
  • sync_interval_minutes
    integer

Response


Example request

POST /api/projects/:project_id/calendar_sync/interval
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/calendar_sync/interval/\
-d integration_id="integer",\
-d sync_interval_minutes="integer"

Example response

Status 200
RESPONSE
{
"integration_id": 0,
"sync_interval_minutes": 0
}

Create calendar sync sync now

Start a sync run for one connected Google Calendar immediately, outside the hourly schedule.

Request parameters

  • integration_id
    integer

Response


Example request

POST /api/projects/:project_id/calendar_sync/sync_now
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/calendar_sync/sync_now/\
-d integration_id="integer"

Example response

Status 200
RESPONSE
{
"status": "started"
}