:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Standard Subscription serializer.",
"properties": {
"ai_prompt_config": {
"description": "Configuration for AI report subscriptions (analysis window, future knobs). Only valid when resource_type is 'ai_prompt'. Replaced wholesale on writes.",
"properties": {
"window": {
"description": "Analysis window for the report. Omitted = 'since_last_sent' (everything since the previous scheduled delivery).",
"properties": {
"end_days_ago": {
"anyOf": [
{
"maximum": 365,
"minimum": 0,
"type": "number"
},
{
"type": "null"
}
],
"description": "Upper bound of the analysis window, in days before the run (0 = now). Required for 'days_ago_range' and must be less than start_days_ago; ignored for other modes. 0-365."
},
"mode": {
"default": "since_last_sent",
"description": "What the report analyzes each run:\n* `since_last_sent` (default) — everything since the previous successful scheduled delivery (gap-free; test/manual sends don't move the anchor)\n* `last_n_days` — a fixed trailing window of start_days_ago days\n* `days_ago_range` — the explicit range from start_days_ago to end_days_ago days ago\n\n* `since_last_sent` - Since last report\n* `last_n_days` - Last N days\n* `days_ago_range` - Between X and Y days ago",
"enum": ["since_last_sent", "last_n_days", "days_ago_range"],
"type": "string"
},
"start_days_ago": {
"anyOf": [
{
"maximum": 365,
"minimum": 1,
"type": "number"
},
{
"type": "null"
}
],
"description": "Lower bound of the analysis window, in days before the run. Required for 'last_n_days' (the N) and 'days_ago_range'; ignored for 'since_last_sent'. 1-365."
}
},
"type": "object"
}
},
"type": "object"
},
"bysetpos": {
"anyOf": [
{
"maximum": 2147483647,
"minimum": -2147483648,
"type": "number"
},
{
"type": "null"
}
],
"description": "Position within byweekday set for monthly frequency (e.g. 1 for first, -1 for last)."
},
"byweekday": {
"anyOf": [
{
"items": {
"description": "* `monday` - Monday\n* `tuesday` - Tuesday\n* `wednesday` - Wednesday\n* `thursday` - Thursday\n* `friday` - Friday\n* `saturday` - Saturday\n* `sunday` - Sunday",
"enum": ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "Days of week for daily or weekly subscriptions: monday, tuesday, wednesday, thursday, friday, saturday, sunday."
},
"count": {
"anyOf": [
{
"maximum": 2147483647,
"minimum": -2147483648,
"type": "number"
},
{
"type": "null"
}
],
"description": "Total number of deliveries before the subscription stops. Null for unlimited."
},
"dashboard": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "Dashboard ID to subscribe to (mutually exclusive with insight on create)."
},
"dashboard_export_insights": {
"description": "List of insight IDs from the dashboard to include. Required for dashboard subscriptions, max 20.",
"items": {
"type": "number"
},
"type": "array"
},
"delivery_config": {
"description": "Per-delivery rendering options. Every option applies to one subscription kind or delivery target only, and each option's own description says where it applies and whether a mismatch is rejected or ignored. Omit this field unless the user asks for one of the options.",
"properties": {
"include_feedback": {
"description": "Prompt subscriptions only: include report feedback links. Defaults to true when omitted. The request is rejected when the subscription sets insight or dashboard instead of prompt. It does not control the AI summary on an insight or dashboard subscription: use summary_enabled and summary_prompt_guide for that.",
"type": "boolean"
},
"include_images": {
"description": "Prompt subscriptions only: include generated chart images. Defaults to true when omitted. The request is rejected when the subscription sets insight or dashboard instead of prompt. It does not control the AI summary on an insight or dashboard subscription: use summary_enabled and summary_prompt_guide for that.",
"type": "boolean"
},
"include_manage_link": {
"description": "Prompt subscriptions only: include a link to manage the subscription. Defaults to true when omitted. The request is rejected when the subscription sets insight or dashboard instead of prompt. It does not control the AI summary on an insight or dashboard subscription: use summary_enabled and summary_prompt_guide for that.",
"type": "boolean"
},
"include_posthog_hint": {
"description": "Prompt subscriptions only: include PostHog product guidance. Defaults to true when omitted. Only a Slack report renders the guidance. Email and Microsoft Teams reports leave it out and accept the option without an error, unlike post_all_insights_in_main_message. The request is rejected when the subscription sets insight or dashboard instead of prompt. It does not control the AI summary on an insight or dashboard subscription: use summary_enabled and summary_prompt_guide for that.",
"type": "boolean"
},
"post_all_insights_in_main_message": {
"default": false,
"description": "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message.",
"type": "boolean"
}
},
"type": "object"
},
"enabled": {
"description": "Whether the subscription is active. Set to false to pause delivery without deleting. Auto-set to false when the delivery integration becomes invalid.",
"type": "boolean"
},
"frequency": {
"description": "How often to deliver: daily, weekly, monthly, or yearly.\n\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly",
"enum": ["daily", "weekly", "monthly", "yearly"],
"type": "string"
},
"insight": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "Insight ID to subscribe to (mutually exclusive with dashboard on create)."
},
"integration_id": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "ID of a connected Slack integration. Required when target_type is slack."
},
"interval": {
"description": "Interval multiplier (e.g. 2 with weekly frequency means every 2 weeks). Required on create; must be 1 or greater.",
"maximum": 2147483647,
"minimum": 1,
"type": "number"
},
"prompt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Free-text prompt that drives the AI-generated report. Required when resource_type is 'ai_prompt'. Max 4000 characters."
},
"send_test_now": {
"description": "Whether to immediately deliver the subscription once on save so the editor can confirm it looks right. Defaults to true on create. When omitted on update, a delivery is sent only if the edit changed what gets delivered (recipient, channel, source) or re-enabled the subscription. The recurring schedule is unaffected.",
"type": "boolean"
},
"start_date": {
"description": "When to start delivering (ISO 8601 datetime). The date anchors the recurrence and may be in the past. Deliveries run on half-hour cycles at :00 and :30. Other minute values are accepted for backward compatibility, but delivery happens during the next cycle instead of at that exact minute.",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
"type": "string"
},
"summary_enabled": {
"description": "Whether to attach an AI-generated summary to each delivery (insight and dashboard subscriptions only). Requires the organization to have approved AI data processing, and is subject to the org's active-summary cap and AI credit budget; otherwise the write is rejected. Not applicable to prompt subscriptions, which are themselves AI-generated.",
"type": "boolean"
},
"summary_prompt_guide": {
"description": "Optional free-text guidance (max 500 chars) steering the AI summary, e.g. which metrics to emphasize. Only settable when AI summary context is enabled for the organization; clearing it (empty string) is always allowed.",
"maxLength": 500,
"type": "string"
},
"target_type": {
"description": "Delivery channel: email, slack, or teams.\n\n* `email` - Email\n* `slack` - Slack\n* `teams` - Microsoft Teams",
"enum": ["email", "slack", "teams"],
"type": "string"
},
"target_value": {
"description": "Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or a Microsoft Teams webhook URL for teams. A Teams webhook URL is only ever returned as its host, because the URL authorizes a post to the channel by itself. On update, omit the field to keep the stored URL, or send a full URL to replace it.",
"type": "string"
},
"title": {
"anyOf": [
{
"maxLength": 100,
"type": "string"
},
{
"type": "null"
}
],
"description": "Human-readable name for this subscription."
},
"until_date": {
"anyOf": [
{
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
"type": "string"
},
{
"type": "null"
}
],
"description": "When to stop delivering (ISO 8601 datetime). Null for indefinite."
}
},
"required": ["target_type", "target_value", "frequency", "interval", "start_date"],
"type": "object"
}