{"openapi":"3.1.0","info":{"title":"Alia Public API","version":"1.0.0","description":"The Alia Public API provides programmatic access to your merchant data, event analytics, and campaign configuration.\n\n## Authentication\n\nAll requests require a Bearer token in the `Authorization` header:\n\n```\nAuthorization: Bearer <your-api-key>\n```\n\nAPI keys can be created in the Alia dashboard. Each key is assigned one or more scopes that control which endpoints it can access.\n\n## Scopes\n\n| Scope | Description |\n| --- | --- |\n| `read:merchant` | Read merchant information |\n| `read:events` | Query event stats and distributions |\n| `read:segments` | List campaigns and their popups |\n\n## Rate Limiting\n\nRequests consume tokens from a shared bucket. Each endpoint documents its token cost. When the bucket is exhausted, the API returns `429 Too Many Requests` with a `Retry-After` header. All successful responses include `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers.\n\n### Default Limits\n\nYour token bucket size and refill rate scale with your plan:\n\n| Plan (monthly) | Bucket Size | Refill Rate |\n| --- | --- | --- |\n| $100/mo | 1,000 tokens | 0.5 tokens/sec |\n| $200/mo | 2,000 tokens | 1 token/sec |\n| $400/mo | 4,000 tokens | 2 tokens/sec |\n| ... | ... | ... |\n\nYou can view your current token bucket size and refill rate on your billing page in the Alia dashboard. In rare cases, such as if your plan price in Alia does not reflect your true plan price or relationship tier, we may be able to increase your limits. Please contact your CSM if you believe this is the case."},"servers":[{"url":"https://api.alia-prod.com/v1"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"MerchantMeResponse":{"type":"object","properties":{"id":{"type":"integer","description":"Merchant ID","example":42},"title":{"type":"string","description":"Store name","example":"Acme Co"},"url":{"type":"string","description":"Shopify store URL","example":"acme.myshopify.com"},"createdAt":{"type":"string","format":"date-time","description":"When the merchant was created"}},"required":["id","title","url","createdAt"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable error code"},"message":{"type":"string","description":"Human-readable error message"}},"required":["code","message"]}},"required":["error"]},"StatsResponse":{"type":"object","additionalProperties":{"type":"object","properties":{"series":{"type":"array","items":{"type":"object","properties":{"start":{"type":"string","description":"Interval start (ISO 8601)"},"end":{"type":"string","description":"Interval end (ISO 8601)"},"value":{"type":["number","null"],"description":"Computed stat value for this interval, or null if no data"}},"required":["start","end","value"]},"description":"Time series data points"},"aggregate":{"type":"number","description":"Aggregate stat value across the entire range"}},"required":["series","aggregate"]},"description":"A map from stat key (matching the keys in the request) to the computed result"},"EmailSignupCount":{"type":"object","properties":{"name":{"type":"string","enum":["emailSignupCount"]}},"required":["name"]},"EmailSignupRate":{"type":"object","properties":{"name":{"type":"string","enum":["emailSignupRate"]}},"required":["name"]},"PhoneSignupCount":{"type":"object","properties":{"name":{"type":"string","enum":["phoneSignupCount"]}},"required":["name"]},"PhoneSignupRate":{"type":"object","properties":{"name":{"type":"string","enum":["phoneSignupRate"]}},"required":["name"]},"EmailOptInCount":{"type":"object","properties":{"name":{"type":"string","enum":["emailOptInCount"]}},"required":["name"]},"EmailOptInRate":{"type":"object","properties":{"name":{"type":"string","enum":["emailOptInRate"]}},"required":["name"]},"SmsOptInCount":{"type":"object","properties":{"name":{"type":"string","enum":["smsOptInCount"]}},"required":["name"]},"SmsOptInRate":{"type":"object","properties":{"name":{"type":"string","enum":["smsOptInRate"]}},"required":["name"]},"UsersCount":{"type":"object","properties":{"name":{"type":"string","enum":["usersCount"]}},"required":["name"]},"PopupViewsCount":{"type":"object","properties":{"name":{"type":"string","enum":["popupViewsCount"]}},"required":["name"]},"PopupViewRate":{"type":"object","properties":{"name":{"type":"string","enum":["popupViewRate"]}},"required":["name"]},"BounceRate":{"type":"object","properties":{"name":{"type":"string","enum":["bounceRate"]}},"required":["name"]},"AttributedOrderCount":{"type":"object","properties":{"name":{"type":"string","enum":["attributedOrderCount"]},"maxMsSinceSignup":{"type":"number","description":"Attribution window in milliseconds since signup"}},"required":["name"]},"AttributedSalesSum":{"type":"object","properties":{"name":{"type":"string","enum":["attributedSalesSum"]},"orderValueType":{"type":"string","enum":["pre-discount","post-discount"],"description":"Whether to use pre-discount or post-discount order values"},"maxMsSinceSignup":{"type":"number","description":"Attribution window in milliseconds since signup"}},"required":["name","orderValueType","maxMsSinceSignup"]},"AttributedConversionRate":{"type":"object","properties":{"name":{"type":"string","enum":["attributedConversionRate"]},"maxMsSinceSignup":{"type":"number","description":"Attribution window in milliseconds since signup"}},"required":["name","maxMsSinceSignup"]},"AttributedAOV":{"type":"object","properties":{"name":{"type":"string","enum":["attributedAOV"]},"orderValueType":{"type":"string","enum":["pre-discount","post-discount"],"description":"Whether to use pre-discount or post-discount order values"},"maxMsSinceSignup":{"type":"number","description":"Attribution window in milliseconds since signup"}},"required":["name","orderValueType","maxMsSinceSignup"]},"AttributedLTV":{"type":"object","properties":{"name":{"type":"string","enum":["attributedLTV"]},"orderValueType":{"type":"string","enum":["pre-discount","post-discount"],"description":"Whether to use pre-discount or post-discount order values"}},"required":["name","orderValueType"]},"AttributedRepurchaseRate":{"type":"object","properties":{"name":{"type":"string","enum":["attributedRepurchaseRate"]}},"required":["name"]},"FilterExpression":{"anyOf":[{"$ref":"#/components/schemas/AtomicFilterExpression"},{"$ref":"#/components/schemas/AndFilterExpression"},{"$ref":"#/components/schemas/OrFilterExpression"},{"$ref":"#/components/schemas/NotFilterExpression"}],"description":"Optional filter expression to narrow results"},"AtomicFilterExpression":{"type":"object","properties":{"type":{"type":"string","enum":["atomic"]},"expr":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["comparator"]},"identifier":{"oneOf":[{"$ref":"#/components/schemas/ContextIdentifier"},{"$ref":"#/components/schemas/EntityIdentifier"},{"$ref":"#/components/schemas/PollAnswerIdentifier"},{"$ref":"#/components/schemas/SetPropertyIdentifier"},{"$ref":"#/components/schemas/PrismChoiceIdentifier"},{"$ref":"#/components/schemas/DynamicTimeOnPageChoiceIdentifier"},{"$ref":"#/components/schemas/ClickLabelIdentifier"}],"discriminator":{"propertyName":"type","mapping":{"context":"#/components/schemas/ContextIdentifier","merchantID":"#/components/schemas/EntityIdentifier","segmentID":"#/components/schemas/EntityIdentifier","flowID":"#/components/schemas/EntityIdentifier","claimedRewardID":"#/components/schemas/EntityIdentifier","claimedRewardItemUUID":"#/components/schemas/EntityIdentifier","attributedOrderProduct":"#/components/schemas/EntityIdentifier","attributedOrderVariant":"#/components/schemas/EntityIdentifier","attributedOrderCollection":"#/components/schemas/EntityIdentifier","campaignType":"#/components/schemas/EntityIdentifier","pollAnswer":"#/components/schemas/PollAnswerIdentifier","setProperty":"#/components/schemas/SetPropertyIdentifier","prismChoice":"#/components/schemas/PrismChoiceIdentifier","dynamicTimeOnPageChoice":"#/components/schemas/DynamicTimeOnPageChoiceIdentifier","clickLabel":"#/components/schemas/ClickLabelIdentifier"}},"description":"The dimension to filter on"},"rhs":{"type":"object","properties":{"operator":{"type":"string","enum":["in","notIn","contains","notContains","startsWith","notStartsWith","endsWith","notEndsWith"],"description":"The comparison operator"},"values":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["null"]},"value":{"type":"null"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["string"]},"value":{"type":"string"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["merchantID"]},"value":{"type":"number"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["rewardID"]},"value":{"type":"number"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["rewardItemUUID"]},"value":{"type":"string"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["segmentID"]},"value":{"type":"number"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["flowID"]},"value":{"type":"number"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaignType"]},"value":{"type":"string","enum":["default","embeddedForm","subscriptionUpsell"]}},"required":["type","value"]}]},"description":"Values to compare against"}},"required":["operator","values"],"description":"The comparison operator and values to match against"}},"required":["type","identifier","rhs"],"description":"Compares an identifier's value against a set of values using an operator"},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"operator":{"type":"string","enum":["has","hasNot"],"description":"Whether the user must have or must not have this event"},"event":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["matchedTargeting","viewedPopup","submittedEmail","submittedPhone","optedInEmail","optedInSMS","claimedReward","answeredSurvey","madeAttributedOrder","receivedSmartTrigger"],"description":"The event type to check for"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["clicked"]},"label":{"type":"string","description":"The label the click must match"}},"required":["type","label"]}]}},"required":["type","operator","event"],"description":"Filters users by whether they have (or have not) triggered a specific event"}]}},"required":["type","expr"],"description":"A single filter condition — either a comparator or an event check"},"ContextIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["context"]},"property":{"type":"string","enum":["currentPath","initialPath","domain","utmSource","utmMedium","utmCampaign","browser","os","device","country","region","city","shopifyCountry","shopifyMarket","shopifyLanguage"],"description":"The context property to identify by"}},"required":["type","property"],"description":"Identify by a visitor context property (e.g. country, browser, UTM params)"},"EntityIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["merchantID","segmentID","flowID","claimedRewardID","claimedRewardItemUUID","attributedOrderProduct","attributedOrderVariant","attributedOrderCollection","campaignType"]}},"required":["type"],"description":"Identify by an entity ID (segment, flow, reward, order product, etc.) or by campaign type"},"PollAnswerIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["pollAnswer"]},"questionText":{"type":"string","description":"The poll question text to identify by"}},"required":["type","questionText"],"description":"Identify by poll answer for a specific question"},"SetPropertyIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["setProperty"]},"propertyName":{"type":"string","description":"The custom property name to identify by"}},"required":["type","propertyName"],"description":"Identify by a custom set property value"},"PrismChoiceIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["prismChoice"]},"prismID":{"type":"string","description":"The prism ID to identify by"}},"required":["type","prismID"],"description":"Identify by a prism choice selection"},"DynamicTimeOnPageChoiceIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["dynamicTimeOnPageChoice"]},"triggerID":{"type":"string","description":"The trigger ID to identify by. When omitted, matches all triggers."}},"required":["type"],"description":"Identify by a dynamic-time-on-page delay selection"},"ClickLabelIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["clickLabel"]}},"required":["type"],"description":"Identify by the label on a tracked click"},"AndFilterExpression":{"type":"object","properties":{"type":{"type":"string","enum":["and"]},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/FilterExpression"}}},"required":["type","conditions"],"description":"All conditions must match"},"OrFilterExpression":{"type":"object","properties":{"type":{"type":"string","enum":["or"]},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/FilterExpression"}}},"required":["type","conditions"],"description":"At least one condition must match"},"NotFilterExpression":{"type":"object","properties":{"type":{"type":"string","enum":["not"]},"condition":{"$ref":"#/components/schemas/FilterExpression"}},"required":["type","condition"],"description":"Negates the condition"},"DistributionsResponse":{"type":"array","items":{"type":"object","properties":{"value":{"type":["string","null"],"description":"The distribution value, or null for unknown"},"count":{"type":"number","description":"Number of unique users with this value"}},"required":["value","count"]}},"PollAnswerDistributionsResponse":{"type":"array","items":{"type":"object","properties":{"questionText":{"type":"string","description":"The poll question text"},"answers":{"type":"array","items":{"type":"object","properties":{"value":{"type":["string","null"],"description":"The answer value"},"count":{"type":"number","description":"Number of times this answer was given"}},"required":["value","count"]},"description":"Answer choices and their counts"}},"required":["questionText","answers"]}},"SegmentsResponse":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Campaign ID"},"title":{"type":["string","null"],"description":"Campaign title"},"publishedAt":{"type":["string","null"],"format":"date-time","description":"When the campaign was published (went live), or null if draft"},"unpublishedAt":{"type":["string","null"],"format":"date-time","description":"When the campaign was unpublished (paused), or null if still live"},"createdAt":{"type":"string","format":"date-time","description":"When the campaign was created"},"flows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Flow ID"},"title":{"type":["string","null"],"description":"Flow title"},"deletedAt":{"type":["string","null"],"format":"date-time","description":"When the flow was deleted, or null if active"}},"required":["id","title","deletedAt"]},"description":"Flows belonging to this campaign"}},"required":["id","title","publishedAt","unpublishedAt","createdAt","flows"]}}},"parameters":{}},"paths":{"/merchants/me":{"get":{"tags":["Merchant"],"description":"Returns the authenticated merchant's basic information.\n\n**Scope:** `read:merchant`\n\n**Token cost:** 1 token per request.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"The authenticated merchant","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantMeResponse"}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden — API key lacks the required scope for this endpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded — retry after the duration in the Retry-After header","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/events/stats":{"post":{"tags":["Events"],"description":"Computes aggregated stats over a time range, returning a time series and aggregate for each requested stat.\n\n**Scope:** `read:events`\n\n**Token cost:** `20 × numStats × days` tokens. Halved when filtering by a segment, campaign type, or flow. Minimum cost: 10.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"anyOf":[{"type":"string","pattern":"^.*::.*$"},{"type":"string"}],"description":"Start of the query range. ISO 8601 datetime, optionally with a timezone name separated by `::` (e.g. `2024-01-01T00:00:00-05:00::America/New_York`). Without `::`, the offset in the ISO string is used."},"endDate":{"anyOf":[{"type":"string","pattern":"^.*::.*$"},{"type":"string"}],"description":"End of the query range. ISO 8601 datetime, optionally with a timezone name separated by `::` (e.g. `2024-01-01T00:00:00-05:00::America/New_York`). Without `::`, the offset in the ISO string is used."},"stats":{"type":"object","additionalProperties":{"oneOf":[{"$ref":"#/components/schemas/EmailSignupCount"},{"$ref":"#/components/schemas/EmailSignupRate"},{"$ref":"#/components/schemas/PhoneSignupCount"},{"$ref":"#/components/schemas/PhoneSignupRate"},{"$ref":"#/components/schemas/EmailOptInCount"},{"$ref":"#/components/schemas/EmailOptInRate"},{"$ref":"#/components/schemas/SmsOptInCount"},{"$ref":"#/components/schemas/SmsOptInRate"},{"$ref":"#/components/schemas/UsersCount"},{"$ref":"#/components/schemas/PopupViewsCount"},{"$ref":"#/components/schemas/PopupViewRate"},{"$ref":"#/components/schemas/BounceRate"},{"$ref":"#/components/schemas/AttributedOrderCount"},{"$ref":"#/components/schemas/AttributedSalesSum"},{"$ref":"#/components/schemas/AttributedConversionRate"},{"$ref":"#/components/schemas/AttributedAOV"},{"$ref":"#/components/schemas/AttributedLTV"},{"$ref":"#/components/schemas/AttributedRepurchaseRate"}],"discriminator":{"propertyName":"name","mapping":{"emailSignupCount":"#/components/schemas/EmailSignupCount","emailSignupRate":"#/components/schemas/EmailSignupRate","phoneSignupCount":"#/components/schemas/PhoneSignupCount","phoneSignupRate":"#/components/schemas/PhoneSignupRate","emailOptInCount":"#/components/schemas/EmailOptInCount","emailOptInRate":"#/components/schemas/EmailOptInRate","smsOptInCount":"#/components/schemas/SmsOptInCount","smsOptInRate":"#/components/schemas/SmsOptInRate","usersCount":"#/components/schemas/UsersCount","popupViewsCount":"#/components/schemas/PopupViewsCount","popupViewRate":"#/components/schemas/PopupViewRate","bounceRate":"#/components/schemas/BounceRate","attributedOrderCount":"#/components/schemas/AttributedOrderCount","attributedSalesSum":"#/components/schemas/AttributedSalesSum","attributedConversionRate":"#/components/schemas/AttributedConversionRate","attributedAOV":"#/components/schemas/AttributedAOV","attributedLTV":"#/components/schemas/AttributedLTV","attributedRepurchaseRate":"#/components/schemas/AttributedRepurchaseRate"}},"description":"Identifies which stat to compute. Discriminated by the 'name' field. Some stats accept additional parameters (e.g. maxMsSinceSignup, orderValueType)."},"description":"Map of stat keys to stat identifiers. Keys are arbitrary labels returned in the response."},"groupByInterval":{"type":"string","enum":["minute","hour","day","week","month","entire-range"],"description":"Time interval for grouping the series data. Cutoff times for each day are based on the time zone of the start date."},"filters":{"$ref":"#/components/schemas/FilterExpression"}},"required":["startDate","endDate","stats","groupByInterval"]}}}},"responses":{"200":{"description":"Computed stats with time series and aggregates","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsResponse"}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden — API key lacks the required scope for this endpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded — retry after the duration in the Retry-After header","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/events/distributions":{"post":{"tags":["Events"],"description":"Returns the top value distributions for a given identifier (dimension) within a time range. For example, query distributions by country to see which countries have the most users.\n\n**Scope:** `read:events`\n\n**Token cost:** `20 × 1 × days` tokens. Halved when filtering by a segment, campaign type, or flow. Minimum cost: 10.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"anyOf":[{"type":"string","pattern":"^.*::.*$"},{"type":"string"}],"description":"Start of the query range. ISO 8601 datetime, optionally with a timezone name separated by `::` (e.g. `2024-01-01T00:00:00-05:00::America/New_York`). Without `::`, the offset in the ISO string is used."},"endDate":{"anyOf":[{"type":"string","pattern":"^.*::.*$"},{"type":"string"}],"description":"End of the query range. ISO 8601 datetime, optionally with a timezone name separated by `::` (e.g. `2024-01-01T00:00:00-05:00::America/New_York`). Without `::`, the offset in the ISO string is used."},"limit":{"type":"number","minimum":1,"maximum":1000,"default":100,"description":"Maximum number of distribution values to return. Defaults to 100."},"identifier":{"oneOf":[{"$ref":"#/components/schemas/ContextIdentifier"},{"$ref":"#/components/schemas/EntityIdentifier"},{"$ref":"#/components/schemas/PollAnswerIdentifier"},{"$ref":"#/components/schemas/SetPropertyIdentifier"},{"$ref":"#/components/schemas/PrismChoiceIdentifier"},{"$ref":"#/components/schemas/DynamicTimeOnPageChoiceIdentifier"},{"$ref":"#/components/schemas/ClickLabelIdentifier"}],"discriminator":{"propertyName":"type","mapping":{"context":"#/components/schemas/ContextIdentifier","merchantID":"#/components/schemas/EntityIdentifier","segmentID":"#/components/schemas/EntityIdentifier","flowID":"#/components/schemas/EntityIdentifier","claimedRewardID":"#/components/schemas/EntityIdentifier","claimedRewardItemUUID":"#/components/schemas/EntityIdentifier","attributedOrderProduct":"#/components/schemas/EntityIdentifier","attributedOrderVariant":"#/components/schemas/EntityIdentifier","attributedOrderCollection":"#/components/schemas/EntityIdentifier","campaignType":"#/components/schemas/EntityIdentifier","pollAnswer":"#/components/schemas/PollAnswerIdentifier","setProperty":"#/components/schemas/SetPropertyIdentifier","prismChoice":"#/components/schemas/PrismChoiceIdentifier","dynamicTimeOnPageChoice":"#/components/schemas/DynamicTimeOnPageChoiceIdentifier","clickLabel":"#/components/schemas/ClickLabelIdentifier"}},"description":"The dimension to compute distributions for"},"filters":{"$ref":"#/components/schemas/FilterExpression"}},"required":["startDate","endDate","identifier"]}}}},"responses":{"200":{"description":"Value distributions for a given identifier","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionsResponse"}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden — API key lacks the required scope for this endpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded — retry after the duration in the Retry-After header","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/events/poll-answer-distributions":{"post":{"tags":["Events"],"description":"Returns poll answer distributions grouped by question text. Each question includes its answer values and counts.\n\n**Scope:** `read:events`\n\n**Token cost:** `20 × 1 × days` tokens. Halved when filtering by a segment, campaign type, or flow. Minimum cost: 10.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"anyOf":[{"type":"string","pattern":"^.*::.*$"},{"type":"string"}],"description":"Start of the query range. ISO 8601 datetime, optionally with a timezone name separated by `::` (e.g. `2024-01-01T00:00:00-05:00::America/New_York`). Without `::`, the offset in the ISO string is used."},"endDate":{"anyOf":[{"type":"string","pattern":"^.*::.*$"},{"type":"string"}],"description":"End of the query range. ISO 8601 datetime, optionally with a timezone name separated by `::` (e.g. `2024-01-01T00:00:00-05:00::America/New_York`). Without `::`, the offset in the ISO string is used."},"limit":{"type":"number","minimum":1,"maximum":1000,"default":100,"description":"Maximum number of questions to return. Defaults to 100."},"filters":{"$ref":"#/components/schemas/FilterExpression"}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"Poll answer distributions grouped by question","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PollAnswerDistributionsResponse"}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden — API key lacks the required scope for this endpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded — retry after the duration in the Retry-After header","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/segments":{"get":{"tags":["Campaigns"],"description":"Lists the merchant's campaigns (segments) with their popups (flows). A campaign is live if publishedAt is set and unpublishedAt is null.\n\n**Scope:** `read:segments`\n\n**Token cost:** 5 tokens per request.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["live","notLive","any"],"default":"any","description":"Filter by live status"},"required":false,"description":"Filter by live status","name":"liveStatus","in":"query"},{"schema":{"type":"string","enum":["archived","notArchived","any"],"default":"notArchived","description":"Filter by archived status. Defaults to excluding archived campaigns."},"required":false,"description":"Filter by archived status. Defaults to excluding archived campaigns.","name":"archivedStatus","in":"query"},{"schema":{"type":"string","format":"date-time","description":"ISO 8601 datetime. When provided, only returns campaigns that were live at this point in time."},"required":false,"description":"ISO 8601 datetime. When provided, only returns campaigns that were live at this point in time.","name":"liveOn","in":"query"}],"responses":{"200":{"description":"List of campaigns","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentsResponse"}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden — API key lacks the required scope for this endpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded — retry after the duration in the Retry-After header","headers":{"X-RateLimit-Limit":{"description":"Maximum token bucket size","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Tokens remaining in the bucket","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"webhooks":{}}