{"openapi":"3.1.0","info":{"title":"OpenHive API","version":"2.0.0","description":"REST API for subscribers, posts, segments, automations, tiers, referrals, polls & surveys, webhooks and more. Authenticate with `Authorization: Bearer <API key>`. Lists use cursor pagination (`limit`, `cursor` → `next_cursor`). Rate limit: 180 requests/minute per key (see X-RateLimit-* headers). You can also use `/api/v2/publication/...` as a shortcut for the key's publication."},"servers":[{"url":"https://hive.lnkbase.com"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}},"paths":{"/api/v2/publications/{pubId}":{"get":{"tags":["Publication"],"summary":"Get the publication this key belongs to","operationId":"getPublication","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/stats":{"get":{"tags":["Stats"],"summary":"Summary: growth, engagement, revenue (plain-English summary included)","operationId":"getStats","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"days","in":"query","required":false,"schema":{"type":"string"},"description":"Period in days (default 30)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/stats/growth":{"get":{"tags":["Stats"],"summary":"Daily subscriber growth and acquisition sources","operationId":"getStatsGrowth","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"days","in":"query","required":false,"schema":{"type":"string"},"description":"Period in days (default 30)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/stats/earnings":{"get":{"tags":["Stats"],"summary":"Earnings report: orders, MRR, network earnings","operationId":"getStatsEarnings","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"days","in":"query","required":false,"schema":{"type":"string"},"description":"Period in days (default 30)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/subscriptions":{"get":{"tags":["Subscriptions"],"summary":"List subscribers (filter by status, tier, email, source, created range)","operationId":"getSubscriptions","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"active|pending|unsubscribed|bounced|complained"},{"name":"tier","in":"query","required":false,"schema":{"type":"string"},"description":"free|premium"},{"name":"source","in":"query","required":false,"schema":{"type":"string"},"description":"Acquisition source"},{"name":"email","in":"query","required":false,"schema":{"type":"string"},"description":"Email contains"},{"name":"tag","in":"query","required":false,"schema":{"type":"string"},"description":"Has tag"},{"name":"created_after","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"created_before","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Subscriptions"],"summary":"Create (or update) a subscriber — validated, double opt-in respected","operationId":"postSubscriptions","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"description":"string (required)"},"name":{"description":"string"},"utm_source":{"description":"string"},"utm_medium":{"description":"string"},"utm_campaign":{"description":"string"},"referral_code":{"description":"Referrer code"},"custom_fields":{"description":"object"},"tags":{"description":"string[]"},"list_ids":{"description":"string[]"},"tier":{"description":"free|premium"},"send_welcome_email":{"description":"boolean (default true)"},"reactivate_existing":{"description":"boolean"},"double_opt_override":{"description":"\"on\"|\"off\" (default: publication setting)"}}}}}}}},"/api/v2/publications/{pubId}/subscriptions/{id}":{"get":{"tags":["Subscriptions"],"summary":"Get a subscriber by id or email (includes tags and recent activity)","operationId":"getSubscriptionsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Subscriptions"],"summary":"Update a subscriber (name, tier, status, custom fields, tags)","operationId":"patchSubscriptionsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"email":{"description":"string"},"tier":{"description":"free|premium"},"status":{"description":"active|unsubscribed"},"custom_fields":{"description":"object (null value deletes a field)"},"add_tags":{"description":"string[]"},"remove_tags":{"description":"string[]"}}}}}}},"delete":{"tags":["Subscriptions"],"summary":"Permanently delete a subscriber","operationId":"deleteSubscriptionsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/subscriptions/{id}/custom_fields":{"get":{"tags":["Custom fields"],"summary":"Read a subscriber's custom field values","operationId":"getSubscriptionsIdCustom_fields","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"put":{"tags":["Custom fields"],"summary":"Write custom field values on a subscriber (merge; null deletes)","operationId":"putSubscriptionsIdCustom_fields","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"custom_fields":{"description":"object {key: value}"}}}}}}}},"/api/v2/publications/{pubId}/subscriptions/{id}/tags":{"get":{"tags":["Tags"],"summary":"List a subscriber's tags","operationId":"getSubscriptionsIdTags","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Tags"],"summary":"Add tags to a subscriber","operationId":"postSubscriptionsIdTags","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"description":"string[]"}}}}}}}},"/api/v2/publications/{pubId}/subscriptions/{id}/tags/{tag}":{"delete":{"tags":["Tags"],"summary":"Remove a tag from a subscriber","operationId":"deleteSubscriptionsIdTagsTag","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"},{"name":"tag","in":"path","required":true,"schema":{"type":"string"},"description":"tag"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/tags":{"get":{"tags":["Tags"],"summary":"All tags with subscriber counts","operationId":"getTags","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/subscriptions/{id}/referrals":{"get":{"tags":["Referral program"],"summary":"A subscriber's referral stats, referred readers and rewards earned","operationId":"getSubscriptionsIdReferrals","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/subscriptions/{id}/insights":{"get":{"tags":["Subscriber intelligence"],"summary":"Value score, lifetime value, purchase likelihood, churn risk and public signals for a subscriber","operationId":"getSubscriptionsIdInsights","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/insights/top_subscribers":{"get":{"tags":["Subscriber intelligence"],"summary":"Most valuable subscribers (sort: value | clv | purchase | churn)","operationId":"getInsightsTop_subscribers","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"value|clv|purchase|churn"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"1-100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/insights/anomalies":{"get":{"tags":["Subscriber intelligence"],"summary":"Unusual changes in the last 24 hours vs the trailing 14 days (undismissed, last 7 days)","operationId":"getInsightsAnomalies","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/insights/next_actions":{"get":{"tags":["Subscriber intelligence"],"summary":"Suggested next steps computed from your data, each with a dashboard link","operationId":"getInsightsNext_actions","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/custom_fields":{"get":{"tags":["Custom fields"],"summary":"List custom field definitions","operationId":"getCustom_fields","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Custom fields"],"summary":"Create a custom field","operationId":"postCustom_fields","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"description":"string"},"label":{"description":"string"},"kind":{"description":"text|number|date|boolean|list"},"options":{"description":"string[] (for list)"}}}}}}}},"/api/v2/publications/{pubId}/custom_fields/{id}":{"patch":{"tags":["Custom fields"],"summary":"Update a custom field label/options","operationId":"patchCustom_fieldsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"description":"string"},"kind":{"description":"string"},"options":{"description":"string[]"}}}}}}},"delete":{"tags":["Custom fields"],"summary":"Delete a custom field definition","operationId":"deleteCustom_fieldsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/segments":{"get":{"tags":["Segments"],"summary":"List segments","operationId":"getSegments","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Segments"],"summary":"Create a segment from rules (dynamic or static)","operationId":"postSegments","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"kind":{"description":"dynamic|static"},"rules":{"description":"RuleGroup {op, rules:[{field, cmp, value}]} — see /docs/api#segments"}}}}}}}},"/api/v2/publications/{pubId}/segments/{id}":{"get":{"tags":["Segments"],"summary":"Get a segment","operationId":"getSegmentsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Segments"],"summary":"Delete a segment","operationId":"deleteSegmentsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/segments/{id}/subscribers":{"get":{"tags":["Segments"],"summary":"List every subscriber in a segment (cursor paginated)","operationId":"getSegmentsIdSubscribers","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"1-500 (default 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"next_cursor"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"\"all\" to include inactive (dynamic segments)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/segments/{id}/recalculate":{"post":{"tags":["Segments"],"summary":"Recalculate a segment now","operationId":"postSegmentsIdRecalculate","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/lists":{"get":{"tags":["Lists"],"summary":"List newsletter lists with member counts","operationId":"getLists","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/lists/{id}/subscribers":{"post":{"tags":["Lists"],"summary":"Add a subscriber (id or email) to a list","operationId":"postListsIdSubscribers","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subscriber_id":{"description":"string"},"email":{"description":"string"}}}}}}}},"/api/v2/publications/{pubId}/lists/{id}/subscribers/{sid}":{"delete":{"tags":["Lists"],"summary":"Remove a subscriber from a list","operationId":"deleteListsIdSubscribersSid","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"sid","in":"path","required":true,"schema":{"type":"string"},"description":"sid"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automations":{"post":{"tags":["Automations"],"summary":"Create an automation (saved as a draft; activate=true publishes it and turns it on)","operationId":"postAutomations","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"allow_reentry":{"description":"boolean"},"trigger":{"description":"{type, config, filter?} — types: signup, confirmed, welcome, tag_added, field_updated, list_subscribed, upgraded, downgraded, purchase, event_registered, survey_submitted, poll_voted, email_opened, link_clicked, referral_milestone, segment_entered, date_field, inactive, api, external_purchase, cart_abandoned, webhook"},"triggers":{"description":"[{type, config, filter?}] — several entry points (subscribers enter when any matches); replaces trigger"},"steps":{"description":"[{id?, type, config, yes?, no?}] — types: send_email, delay, wait_until, condition, ab_split, add_tag, remove_tag, update_field, add_to_list, remove_from_list, webhook, enroll, grant_premium, notify, unsubscribe, exit; send_email config: {subject, markdown | doc | blocks}"},"template":{"description":"string — start from a template key (GET /automation_templates); trigger/steps override it"},"activate":{"description":"boolean"}}}}}}},"get":{"tags":["Automations"],"summary":"List automations with journey counts","operationId":"getAutomations","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automations/{id}":{"patch":{"tags":["Automations"],"summary":"Edit an automation — trigger/steps go to the draft version; the live version keeps running until published","operationId":"patchAutomationsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"allow_reentry":{"description":"boolean"},"trigger":{"description":"{type, config, filter?} — types: signup, confirmed, welcome, tag_added, field_updated, list_subscribed, upgraded, downgraded, purchase, event_registered, survey_submitted, poll_voted, email_opened, link_clicked, referral_milestone, segment_entered, date_field, inactive, api, external_purchase, cart_abandoned, webhook"},"triggers":{"description":"[{type, config, filter?}] — several entry points (subscribers enter when any matches); replaces trigger"},"steps":{"description":"[{id?, type, config, yes?, no?}] — types: send_email, delay, wait_until, condition, ab_split, add_tag, remove_tag, update_field, add_to_list, remove_from_list, webhook, enroll, grant_premium, notify, unsubscribe, exit; send_email config: {subject, markdown | doc | blocks}"}}}}}}},"get":{"tags":["Automations"],"summary":"Get an automation with per-email stats","operationId":"getAutomationsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automations/{id}/publish":{"post":{"tags":["Automations"],"summary":"Publish the draft version (running journeys continue on the new version); activate=true also turns it on","operationId":"postAutomationsIdPublish","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"activate":{"description":"boolean (default false)"}}}}}}}},"/api/v2/publications/{pubId}/automations/{id}/pause":{"post":{"tags":["Automations"],"summary":"Pause an active automation (subscribers wait where they are)","operationId":"postAutomationsIdPause","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automations/{id}/resume":{"post":{"tags":["Automations"],"summary":"Resume a paused automation","operationId":"postAutomationsIdResume","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automations/{id}/journeys":{"post":{"tags":["Automations"],"summary":"Enroll a subscriber (id or email) into an automation","operationId":"postAutomationsIdJourneys","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subscriber_id":{"description":"string"},"email":{"description":"string (created if new)"},"data":{"description":"object passed to the journey"}}}}}}},"get":{"tags":["Automations"],"summary":"List journeys (per-subscriber progress)","operationId":"getAutomationsIdJourneys","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automation_templates":{"get":{"tags":["Automations"],"summary":"List the automation templates library (use the key as `template` when creating an automation)","operationId":"getAutomation_templates","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"string"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/automations/{id}/webhook":{"get":{"tags":["Automations"],"summary":"Get the secret incoming-webhook URL of an automation (POST JSON with an email to it to subscribe + enroll)","operationId":"getAutomationsIdWebhook","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/posts":{"get":{"tags":["Posts"],"summary":"List posts (filter by status; expand=stats includes engagement)","operationId":"getPosts","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"draft|scheduled|published|archived"},{"name":"audience","in":"query","required":false,"schema":{"type":"string"},"description":"all|free|premium"},{"name":"expand","in":"query","required":false,"schema":{"type":"string"},"description":"stats,content"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Posts"],"summary":"Create a draft post (blocks, HTML, or Markdown; optionally from a template)","operationId":"postPosts","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"description":"string"},"subtitle":{"description":"string"},"blocks":{"description":"Block[] (see Editor document)"},"html":{"description":"string (wrapped in an HTML block)"},"markdown":{"description":"string"},"template_id":{"description":"Start from this template (content is copied; its style stays linked)"},"email_subject":{"description":"string"},"preview_text":{"description":"string"},"platform":{"description":"email|web|both"},"audience":{"description":"all|free|premium"},"thumbnail_url":{"description":"string"},"seo":{"description":"object"},"segment_ids":{"description":"string[]"},"author_ids":{"description":"string[]"}}}}}}}},"/api/v2/publications/{pubId}/posts/{id}":{"get":{"tags":["Posts"],"summary":"Get a post with content, stats (opens, clicks, engagement) and provider breakdown","operationId":"getPostsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Posts"],"summary":"Update a post (replacing content creates a version)","operationId":"patchPostsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"description":"string"},"subtitle":{"description":"string"},"blocks":{"description":"Block[]"},"html":{"description":"string"},"markdown":{"description":"string"},"email_subject":{"description":"string"},"preview_text":{"description":"string"},"slug":{"description":"string"},"platform":{"description":"string"},"audience":{"description":"string"},"seo":{"description":"object"},"segment_ids":{"description":"string[]"},"exclude_segment_ids":{"description":"string[]"},"ab_test":{"description":"object|null"}}}}}}},"delete":{"tags":["Posts"],"summary":"Delete a post","operationId":"deletePostsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/posts/{id}/stats":{"get":{"tags":["Posts"],"summary":"Engagement stats for a post (unique, bot-filtered)","operationId":"getPostsIdStats","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/posts/{id}/html":{"get":{"tags":["Posts"],"summary":"Rendered HTML: email vs web, free vs premium","operationId":"getPostsIdHtml","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"email|web (default email)"},{"name":"audience","in":"query","required":false,"schema":{"type":"string"},"description":"free|premium (default free)"},{"name":"raw","in":"query","required":false,"schema":{"type":"string"},"description":"1 = return text/html"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/posts/{id}/content":{"post":{"tags":["Posts"],"summary":"Append or prepend content blocks","operationId":"postPostsIdContent","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"position":{"description":"append|prepend (default append)"},"blocks":{"description":"Block[]"},"html":{"description":"string"},"markdown":{"description":"string"}}}}}}}},"/api/v2/publications/{pubId}/posts/{id}/send":{"post":{"tags":["Send API"],"summary":"Publish/send now or schedule (targeting + subject A/B test)","operationId":"postPostsIdSend","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scheduled_at":{"description":"ISO datetime (omit to send now)"},"segment_ids":{"description":"string[] send to"},"exclude_segment_ids":{"description":"string[]"},"list_id":{"description":"string"},"audience":{"description":"all|free|premium"},"platform":{"description":"email|web|both"},"email_subject":{"description":"string"},"ab_test":{"description":"{subjects: string[2-5] | variants: [{subject?, preview_text?, from_name?, content: a|b}] (2-4), sample_pct, wait_minutes, metric: opens|clicks}"},"alt_markdown":{"description":"string — Variant B content for content tests"},"send_timing":{"description":"{mode: sto} (each subscriber at their usual open hour, within 24h) | {mode: timezone, local_time: \"09:00\"} | null"}}}}}}}},"/api/v2/publications/{pubId}/posts/{id}/unschedule":{"post":{"tags":["Send API"],"summary":"Cancel a scheduled post (back to draft)","operationId":"postPostsIdUnschedule","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/posts/{id}/test":{"post":{"tags":["Send API"],"summary":"Send a test email (optionally as a simulated subscriber for merge tags)","operationId":"postPostsIdTest","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"description":"string[] (max 10)"},"subscriber_id":{"description":"Preview merge tags / dynamic content as this subscriber"}}}}}}}},"/api/v2/publications/{pubId}/posts/{id}/sends":{"get":{"tags":["Send API"],"summary":"Send history for a post","operationId":"getPostsIdSends","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/templates":{"get":{"tags":["Templates"],"summary":"List templates (publication + built-in library)","operationId":"getTemplates","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"kind","in":"query","required":false,"schema":{"type":"string"},"description":"post|welcome|automation|website_page|website_section|website_block"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/templates/{id}":{"get":{"tags":["Templates"],"summary":"Get a template with content and style tokens","operationId":"getTemplatesId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/templates/coded":{"post":{"tags":["Templates"],"summary":"Create a custom-coded template from a full HTML email (sanitized; {{unsubscribe_url}} added when missing)","operationId":"postTemplatesCoded","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"html":{"description":"string (full HTML document or fragment; merge tags + {{unsubscribe_url}}, {{preferences_url}}, {{web_url}})"}}}}}}}},"/api/v2/publications/{pubId}/snippets":{"get":{"tags":["Snippets"],"summary":"List reusable content snippets","operationId":"getSnippets","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Snippets"],"summary":"Create a snippet from editor blocks","operationId":"postSnippets","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"blocks":{"description":"Block[] (editor document blocks)"}}}}}}}},"/api/v2/publications/{pubId}/snippets/{id}":{"get":{"tags":["Snippets"],"summary":"Get a snippet with its blocks. Insert `synced_block` into a post to keep it linked, or copy `content.blocks`","operationId":"getSnippetsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Snippets"],"summary":"Update a snippet (synced copies everywhere pick up the change)","operationId":"patchSnippetsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"blocks":{"description":"Block[]"}}}}}}},"delete":{"tags":["Snippets"],"summary":"Delete a snippet (synced references render nothing afterwards)","operationId":"deleteSnippetsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/subject-line/check":{"post":{"tags":["Posts"],"summary":"Score an email subject line (length, preview text, spam words, caps, emoji, personalization) with per-check advice","operationId":"postSubject-lineCheck","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"description":"string"},"preview_text":{"description":"string"}}}}}}}},"/api/v2/publications/{pubId}/products/recommendations":{"get":{"tags":["Commerce"],"summary":"Personalized product recommendations for a subscriber (what the recommended_products block would show)","operationId":"getProductsRecommendations","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"subscriber_id","in":"query","required":false,"schema":{"type":"string"},"description":"Subscriber id (omit for bestsellers)"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"1-6 (default 3)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/tiers":{"get":{"tags":["Tiers"],"summary":"List paid tiers","operationId":"getTiers","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Tiers"],"summary":"Create a paid tier","operationId":"postTiers","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"description":{"description":"string"},"currency":{"description":"usd|eur|…"},"monthly_cents":{"description":"int"},"annual_cents":{"description":"int"},"trial_days":{"description":"int"},"paid_trial_cents":{"description":"int"},"benefits":{"description":"string[]"}}}}}}}},"/api/v2/publications/{pubId}/tiers/{id}":{"patch":{"tags":["Tiers"],"summary":"Update a tier (status active|paused pauses/resumes sales)","operationId":"patchTiersId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"string"},"monthly_cents":{"description":"int"},"annual_cents":{"description":"int"},"status":{"description":"active|paused"},"benefits":{"description":"string[]"}}}}}}},"delete":{"tags":["Tiers"],"summary":"Archive a tier","operationId":"deleteTiersId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/premium_subscriptions":{"get":{"tags":["Tiers"],"summary":"List premium subscriptions","operationId":"getPremium_subscriptions","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"trialing|active|paused|past_due|canceled"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/subscriptions/{id}/premium":{"post":{"tags":["Tiers"],"summary":"Grant premium (comp) to a subscriber","operationId":"postSubscriptionsIdPremium","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tier_id":{"description":"string (default: first active tier)"},"interval":{"description":"month|year"},"days":{"description":"int (omit for no expiry)"}}}}}}},"delete":{"tags":["Tiers"],"summary":"Cancel premium for a subscriber","operationId":"deleteSubscriptionsIdPremium","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscriber id or email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/referral_program":{"get":{"tags":["Referral program"],"summary":"Rewards/milestones and program totals","operationId":"getReferral_program","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/referral_program/leaderboard":{"get":{"tags":["Referral program"],"summary":"Top referrers","operationId":"getReferral_programLeaderboard","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"1-100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/polls":{"get":{"tags":["Polls & surveys"],"summary":"List polls with vote totals","operationId":"getPolls","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Polls & surveys"],"summary":"Create a poll (or a trivia question) to embed in posts","operationId":"postPolls","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"description":"string"},"options":{"description":"string[] (2-10)"},"purpose":{"description":"general|topic|product|pricing"},"kind":{"description":"standard|trivia"},"correct_option":{"description":"trivia: 1-based option index"},"explanation":{"description":"trivia: shown after voting"}}}}}}}},"/api/v2/publications/{pubId}/polls/{id}":{"get":{"tags":["Polls & surveys"],"summary":"Poll results (live aggregate)","operationId":"getPollsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Polls & surveys"],"summary":"Close or reopen a poll","operationId":"patchPollsId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"closed":{"description":"boolean"}}}}}}}},"/api/v2/publications/{pubId}/polls/{id}/responses":{"get":{"tags":["Polls & surveys"],"summary":"Individual poll votes tied to subscribers","operationId":"getPollsIdResponses","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/surveys":{"get":{"tags":["Polls & surveys"],"summary":"List surveys with response counts","operationId":"getSurveys","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Polls & surveys"],"summary":"Create a survey","operationId":"postSurveys","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"description":"string"},"description":{"description":"string"},"questions":{"description":"[{label, kind: short|long|single|multi|dropdown|rating|nps|date, options?, required?}]"},"thank_you":{"description":"string"},"status":{"description":"active|closed"}}}}}}}},"/api/v2/publications/{pubId}/surveys/{id}":{"get":{"tags":["Polls & surveys"],"summary":"Survey with per-question aggregate results","operationId":"getSurveysId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Polls & surveys"],"summary":"Update a survey (title, description, thank-you message, status, questions)","operationId":"patchSurveysId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"description":"string"},"description":{"description":"string"},"questions":{"description":"array (replaces all)"},"thank_you":{"description":"string"},"status":{"description":"active|closed"}}}}}}}},"/api/v2/publications/{pubId}/surveys/{id}/responses":{"get":{"tags":["Polls & surveys"],"summary":"Individual survey responses","operationId":"getSurveysIdResponses","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/webhooks":{"get":{"tags":["Webhooks"],"summary":"List webhook endpoints","operationId":"getWebhooks","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Webhooks"],"summary":"Create a webhook endpoint (returns the signing secret once)","operationId":"postWebhooks","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"description":"string"},"events":{"description":"string[] (default [\"*\"])"},"description":{"description":"string"},"version":{"description":"payload version (default: latest — see GET /webhooks/versions)"}}}}}}}},"/api/v2/publications/{pubId}/webhooks/versions":{"get":{"tags":["Webhooks"],"summary":"Available payload versions with changelog","operationId":"getWebhooksVersions","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/webhooks/{id}":{"patch":{"tags":["Webhooks"],"summary":"Update an endpoint (url, events, description, active, or upgrade/downgrade its payload version)","operationId":"patchWebhooksId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"description":"string"},"events":{"description":"string[]"},"description":{"description":"string"},"active":{"description":"boolean"},"version":{"description":"payload version"}}}}}}},"delete":{"tags":["Webhooks"],"summary":"Delete a webhook endpoint","operationId":"deleteWebhooksId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"summary":"Delivery log for an endpoint (expand=attempts includes every attempt)","operationId":"getWebhooksIdDeliveries","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"},{"name":"expand","in":"query","required":false,"schema":{"type":"string"},"description":"attempts"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/webhooks/{id}/deliveries/{did}":{"get":{"tags":["Webhooks"],"summary":"One delivery: payload and every attempt (status code, response, latency)","operationId":"getWebhooksIdDeliveriesDid","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"did","in":"path","required":true,"schema":{"type":"string"},"description":"did"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/orders":{"get":{"tags":["Commerce"],"summary":"List orders (subscriptions, products, tickets…)","operationId":"getOrders","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"},{"name":"kind","in":"query","required":false,"schema":{"type":"string"},"description":"subscription|product|ticket|gift|group|sponsorship|replay"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"pending|paid|refunded|failed"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/products":{"get":{"tags":["Commerce"],"summary":"List digital products with sales totals","operationId":"getProducts","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/podcasts":{"get":{"tags":["Podcasts"],"summary":"List podcast shows","operationId":"getPodcasts","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/podcasts/{id}/episodes":{"get":{"tags":["Podcasts"],"summary":"List episodes with download counts","operationId":"getPodcastsIdEpisodes","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Page size 1-100 (default 50)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from next_cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/transactional/send":{"post":{"tags":["Transactional"],"summary":"Send one transactional email (template or subject + html/markdown/text) with merge vars; idempotent with idempotency_key","operationId":"postTransactionalSend","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"description":"Recipient email (required)"},"template_id":{"description":"Template id or slug"},"subject":{"description":"Subject (required without a template)"},"html":{"description":"HTML body"},"markdown":{"description":"Markdown body"},"text":{"description":"Plain-text body"},"merge_vars":{"description":"Object; {{key}} / {{nested.key}} in subject and body"},"reply_to":{"description":"Reply-To address"},"from_name":{"description":"Sender name override"},"attachments":{"description":"[{filename, content (base64), type}] — 5 MB total"},"tags":{"description":"string[] for searching the log"},"idempotency_key":{"description":"Repeat-safe key; a repeat returns the original message"},"track":{"description":"boolean — open/click tracking (default false)"}}}}}}}},"/api/v2/publications/{pubId}/transactional/messages":{"get":{"tags":["Transactional"],"summary":"Search the transactional message log","operationId":"getTransactionalMessages","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Recipient, subject or message id"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"sent|simulated|failed|suppressed|bounced|complained"},{"name":"tag","in":"query","required":false,"schema":{"type":"string"},"description":"Tag"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"1-200 (default 50)"},{"name":"before","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date: older than"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/transactional/messages/{id}":{"get":{"tags":["Transactional"],"summary":"One transactional message with status, opens and clicks","operationId":"getTransactionalMessagesId","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v2/publications/{pubId}/transactional/templates":{"get":{"tags":["Transactional"],"summary":"List transactional templates","operationId":"getTransactionalTemplates","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Transactional"],"summary":"Create or update (pass id) a transactional template","operationId":"postTransactionalTemplates","parameters":[{"name":"pubId","in":"path","required":true,"schema":{"type":"string"},"description":"Publication id or slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"Existing template id (update)"},"name":{"description":"Name"},"slug":{"description":"template_id used in send calls"},"subject":{"description":"Subject with {{merge}} tags"},"body":{"description":"Markdown or HTML"},"format":{"description":"markdown|html"}}}}}}}}}}