You can then aggregate events grouped by any property using the group_by parameter:
const result = await autumn.events.aggregate({ customerId: "cus_123", featureId: "api_calls", range: "7d", groupBy: "properties.model" // Group by the "model" property});
In addition to custom properties, you can group by built-in columns using $-prefixed operators:
$customer_id โ Group results by customer ID. Useful when aggregating across all customers (i.e. no customer_id specified).
$entity_id โ Group results by entity ID. Useful for seeing usage broken down per entity.
// Aggregate across all customers, grouped by customerconst result = await autumn.events.aggregate({ featureId: "api_calls", range: "7d", groupBy: "$customer_id"});// Aggregate for a customer, grouped by entityconst result = await autumn.events.aggregate({ customerId: "cus_123", featureId: "api_calls", range: "7d", groupBy: "$entity_id"});
By default, aggregations answer โhow much usage was tracked?โ. Passing aggregate_on: "deducted" additionally answers โwhich balances did that usage actually come out of?โ โ the response gains a deductions array, keyed by the balance-owning feature rather than the tracked event. The list and total fields are unchanged.A customer_id is required in this mode, since deductions are resolved against a specific customerโs balances.There are two situations where this matters:
A feature can have its own included allowance and feed a credit system โ usage drains the allowance first, then overflows into credits at the featureโs credit cost. The standard aggregation only shows tracked totals, so the overflow is invisible. With aggregate_on: "deducted", the two sides show up separately:
Reading this: the customerโs 1M-event allowance absorbed the tracked usage, and 10,000 events overflowed into the usage_credits pool, burning 0.8 credits at the featureโs credit cost of 0.00008. Each entry is in that balanceโs own unit โ events for the metered feature, credits for the credit system.
credit_cost is only populated when the request pins a single non-credit feature via feature_id, since several features feeding one pool each convert at a different rate. It reflects the credit systemโs current schema.
Case 2: Per-entity balances falling through to a shared pool
When entities (e.g. seats) each carry their own balance and overflow lands on a customer-level shared balance, group by $entity_id to see who spent from where:
Finding each entityโs spillover takes one join between the two halves of the response:
In balances, find the entry whose entity_id is null. Thatโs the customer-level shared balance โ the pool that entities fall through to when their own balance runs out. (Entries with an entity_id are balances owned by that entity.)
Take that entryโs balance_id and look it up in grouped_values. The keys of that object are the entities that spent from the shared pool, and each deducted is exactly how much they overdrew.
Here cus_ent_shared is the shared balance, and grouped_values["cus_ent_shared"] shows seats 3 and 4 each pulled 25 credits from it beyond their own 600-credit seat balances โ the โused 25 extra creditsโ number to show next to each seat.The seat-owned balances appear in grouped_values too, but for them the owner and the spender are the same entity, so the split just restates the balance total.
group_by: "$plan_id" is rejected with aggregate_on โ every balance belongs to exactly one plan, so balances[].plan_id already carries the plan split.
Property to group events by (e.g. "properties.region"), or "$customer_id" / "$entity_id" / "$plan_id" to group by those columns. When aggregate_on is "deducted", "$feature_id" groups deductions by the tracked feature that consumed each balance.
What list reports per bin: "sum" (default) adds up event values; "count" counts events, i.e. how many track requests came in regardless of value. total is unchanged.
Set to "deducted" to additionally return a per-balance breakdown of what each event consumed, under deductions. Purely additive: list and total are unchanged. Requires customer_id.
Per-balance breakdown of what was consumed. Present only when aggregate_on is "deducted".
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Autumn","colors":{"primary":"#8838ff","light":"#9b5cff","dark":"#8838ff"},"logo":{"light":"https://mintcdn.com/autumn-b9b4c0fb/BOEMpWFJsAdGcii1/assets/logo/autumn-dark.svg?fit=max\u0026auto=format\u0026n=BOEMpWFJsAdGcii1\u0026q=85\u0026s=720bd2227c435e77f2c91cbfcbccd274","dark":"https://mintcdn.com/autumn-b9b4c0fb/BOEMpWFJsAdGcii1/assets/logo/autumn-light.svg?fit=max\u0026auto=format\u0026n=BOEMpWFJsAdGcii1\u0026q=85\u0026s=f700b862e5d0ada8c89a5976d27863fe"},"favicon":"https://mintcdn.com/autumn-b9b4c0fb/ihHX49Ug6NamJ10t/favicon.svg?fit=max\u0026auto=format\u0026n=ihHX49Ug6NamJ10t\u0026q=85\u0026s=b1fd8b3e3086e5a3855a8cf8c45dd57a","api":{"playground":{"display":"interactive"},"examples":{"languages":["typescript","python","bash"]}},"appearance":{"default":"system","strict":false},"background":{"color":{"light":"#FFFFFF","dark":"#0A0A0A"}},"navbar":{"primary":{"type":"button","label":"Dashboard","href":"https://app.useautumn.com"}},"footer":{"socials":{"x":"https://x.com/autumnpricing","github":"https://github.com/useautumn","linkedin":"https://linkedin.com/company/useautumn"}},"fonts":{"heading":{"family":"Inter"},"body":{"family":"Inter"}},"contextual":{"options":["copy","cursor","view"],"display":"header"},"interaction":{"drilldown":true},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Discord","icon":"discord","href":"https://discord.gg/STqxY92zuS"},{"anchor":"GitHub","icon":"github","href":"https://github.com/useautumn/autumn"},{"anchor":"Website","icon":"globe","href":"https://useautumn.com"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"autumn-b9b4c0fb","hasAudioNarration":false,"actualSubdomain":"autumn-b9b4c0fb","customDomains":["docs.useautumn.com"],"gitSource":{"type":"github","owner":"useautumn","repo":"autumn","deployBranch":"main","contentDirectory":"apps/docs/mintlify","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adf70683d6319f7be04488b","collectionId":"51110cc0-1315-435c-8118-95f0c05e3ce4","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adf70683d6319f7be04488b"},"feedback":{"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6adfc480ca1d3c49d2cf24bc","clientVersion":"0.0.3971","searchFilterCounts":[{"language":"default","tag":"API Reference","count":101},{"language":"default","tag":"Documentation","count":64},{"language":"default","tag":"Billing","count":20},{"language":"default","tag":"Configure Pricing","count":19},{"language":"default","tag":"Additional Resources","count":16},{"language":"default","tag":"Customers","count":15},{"language":"default","tag":"Rewards \u0026 Referrals","count":13},{"language":"default","tag":"Balances","count":10},{"language":"default","tag":"Webhook Events","count":10},{"language":"default","tag":"Invoices","count":8}],"searchSettings":{"tuning":{"anchor":{"titleCoverageRelabel":true}}}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"language-tabs.css","content":""},{"filePath":"style.css","content":".prose>.api-section{display:none!important}"}],"page":{"pagePath":"api-reference/events/aggregateEvents","slug":"/api-reference/events/aggregateEvents","pageMetadata":{"title":"Aggregate Events","openapi":"openapi POST /v1/events.aggregate","description":"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.","href":"/api-reference/events/aggregateEvents"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const DynamicResponseExample=({json,statusCode=`200`})=>{const{CodeBlock,ResponseExample}=_provideComponents()||{};if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!ResponseExample)_missingMdxReference(`ResponseExample`,true);const toCamelCase=str=>{return str.replace(/_([a-z])/g,(_,c)=>c.toUpperCase())};const convertKeysToCamelCase=obj=>{if(Array.isArray(obj)){return obj.map(item=>convertKeysToCamelCase(item))}if(obj!==null\u0026\u0026typeof obj===`object`){return Object.keys(obj).reduce((acc,key)=>{const camelKey=toCamelCase(key);acc[camelKey]=convertKeysToCamelCase(obj[key]);return acc},{})}return obj};const[isTypeScript,setIsTypeScript]=useState(()=>{if(typeof window!==`undefined`){try{const lang=localStorage.getItem(`code`);return JSON.parse(lang)===`typescript`}catch{return true}}return true});useEffect(()=>{const onMintlifyStorage=event=>{if(event.detail?.key===`code`){try{const value=JSON.parse(event.detail.value);setIsTypeScript(value===`typescript`)}catch{}}};const pollInterval=setInterval(()=>{try{const lang=localStorage.getItem(`code`);const value=JSON.parse(lang);setIsTypeScript(value===`typescript`)}catch{}},300);document.addEventListener(`mintlify-localstorage`,onMintlifyStorage);return()=>{document.removeEventListener(`mintlify-localstorage`,onMintlifyStorage);clearInterval(pollInterval)}},[]);const camelCaseJson=useMemo(()=>convertKeysToCamelCase(json),[json]);const snakeCaseString=JSON.stringify(json,null,2);const camelCaseString=JSON.stringify(camelCaseJson,null,2);return _jsx(ResponseExample,{children:isTypeScript?_jsx(CodeBlock,{language:`json`,filename:statusCode,children:camelCaseString}):_jsx(CodeBlock,{language:`json`,filename:statusCode,children:snakeCaseString})})};const DynamicResponseField=({children,name,...props})=>{const{ResponseField}=_provideComponents()||{};if(!ResponseField)_missingMdxReference(`ResponseField`,true);const convertToCamelCase=str=>{if(typeof str!==`string`)return str;return str.replace(/[_-](\\w)/g,(_,c)=>c.toUpperCase())};const[lang,setLang]=useState(()=>{if(typeof window!==`undefined`){const stored=localStorage.getItem(`code`);return stored||`\"typescript\"`}return`\"typescript\"`});useEffect(()=>{const onMintlifyStorage=event=>{const key=event.detail?.key;if(key===`code`){setLang(event.detail.value)}};const pollInterval=setInterval(()=>{const current=localStorage.getItem(`code`);if(current\u0026\u0026current!==lang){setLang(current)}},500);document.addEventListener(`mintlify-localstorage`,onMintlifyStorage);return()=>{document.removeEventListener(`mintlify-localstorage`,onMintlifyStorage);clearInterval(pollInterval)}},[lang]);const resolvedName=useMemo(()=>{try{const value=JSON.parse(lang);const useCamelCase=value===`typescript`;return useCamelCase?convertToCamelCase(name):name}catch{return name}},[name,lang]);return _jsx(ResponseField,{name:resolvedName,...props,children})};const DynamicParamField=({children,body,path,...props})=>{const{ParamField}=_provideComponents()||{};if(!ParamField)_missingMdxReference(`ParamField`,true);const convertToCamelCase=str=>{if(typeof str!==`string`)return str;return str.replace(/[_-](\\w)/g,(_,c)=>c.toUpperCase())};const[lang,setLang]=useState(()=>{if(typeof window!==`undefined`){const stored=localStorage.getItem(`code`);return stored||`\"typescript\"`}return`\"typescript\"`});useEffect(()=>{const onMintlifyStorage=event=>{const key=event.detail?.key;if(key===`code`){setLang(event.detail.value)}};const pollInterval=setInterval(()=>{const current=localStorage.getItem(`code`);if(current\u0026\u0026current!==lang){setLang(current)}},500);document.addEventListener(`mintlify-localstorage`,onMintlifyStorage);return()=>{document.removeEventListener(`mintlify-localstorage`,onMintlifyStorage);clearInterval(pollInterval)}},[lang]);const resolvedBody=useMemo(()=>{try{const value=JSON.parse(lang);const useCamelCase=value===`typescript`;return useCamelCase?convertToCamelCase(body):body}catch{return body}},[body,lang]);const resolvedPath=useMemo(()=>{try{const value=JSON.parse(lang);const useCamelCase=value===`typescript`;return useCamelCase?convertToCamelCase(path):path}catch{return path}},[path,lang]);return _jsx(ParamField,{body:resolvedBody,path:resolvedPath,...props,children})};function _createMdxContent(props){const _components={annotation:`annotation`,code:`code`,em:`em`,li:`li`,math:`math`,mi:`mi`,mo:`mo`,mrow:`mrow`,msub:`msub`,ol:`ol`,p:`p`,pre:`pre`,semantics:`semantics`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Expandable,Heading,Note,_MdxComponentBoundary}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!_MdxComponentBoundary)_missingMdxReference(`_MdxComponentBoundary`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.`}),`\n`,_jsx(Heading,{level:`2`,id:`working-with-properties`,children:`Working with Properties`}),`\n`,_jsx(_components.p,{children:`When tracking events, you can attach custom properties that can later be used for grouping aggregations:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Track an event with properties`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autumn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` customerId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cus_123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` featureId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` value:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` properties:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"gpt-4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` source:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` region:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"us-east\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`You can then aggregate events grouped by any property using the `,_jsx(_components.code,{children:`group_by`}),` parameter:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autumn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`events`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`aggregate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` customerId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cus_123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` featureId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` range:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"7d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` groupBy:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"properties.model\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Group by the \"model\" property`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`special-group-by-operators`,children:`Special Group By Operators`}),`\n`,_jsxs(_components.p,{children:[`In addition to custom properties, you can group by built-in columns using `,_jsx(_components.code,{children:`$`}),`-prefixed operators:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`$customer_id`}),` โ Group results by customer ID. Useful when aggregating across all customers (i.e. no `,_jsx(_components.code,{children:`customer_id`}),` specified).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`$entity_id`}),` โ Group results by entity ID. Useful for seeing usage broken down per entity.`]}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Aggregate across all customers, grouped by customer`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autumn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`events`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`aggregate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` featureId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` range:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"7d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` groupBy:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"$customer_id\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Aggregate for a customer, grouped by entity`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autumn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`events`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`aggregate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` customerId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cus_123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` featureId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` range:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"7d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` groupBy:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"$entity_id\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`response-format`,children:`Response Format`}),`\n`,_jsxs(_components.p,{children:[`The response structure changes based on whether `,_jsx(_components.code,{children:`group_by`}),` is provided:`]}),`\n`,_jsxs(Heading,{level:`3`,id:`without-group_by-flat-response`,children:[`Without `,_jsx(_components.code,{children:`group_by`}),` (Flat Response)`]}),`\n`,_jsxs(_components.p,{children:[`When no grouping is specified, `,_jsx(_components.code,{children:`values`}),` contains the aggregated sum for each feature:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"list\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1762905600000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`150`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`45`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"sum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`150`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"sum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`45`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`with-group_by-grouped-response`,children:[`With `,_jsx(_components.code,{children:`group_by`}),` (Grouped Response)`]}),`\n`,_jsxs(_components.p,{children:[`When grouping is specified, `,_jsx(_components.code,{children:`values`}),` contains the total sum while `,_jsx(_components.code,{children:`grouped_values`}),` breaks down values by group:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"list\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1762905600000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`150`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"grouped_values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"gpt-4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"gpt-3.5\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`50`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"api_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"sum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`150`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`grouped_values`}),` field is only present when `,_jsx(_components.code,{children:`group_by`}),` is provided in the request.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`deduction-breakdowns`,children:`Deduction Breakdowns`}),`\n`,_jsxs(_components.p,{children:[`By default, aggregations answer `,_jsx(_components.em,{children:`โhow much usage was tracked?โ`}),`. Passing `,_jsx(_components.code,{children:`aggregate_on: \"deducted\"`}),` additionally answers `,_jsx(_components.em,{children:`โwhich balances did that usage actually come out of?โ`}),` โ the response gains a `,_jsx(_components.code,{children:`deductions`}),` array, keyed by the `,_jsx(_components.strong,{children:`balance-owning feature`}),` rather than the tracked event. The `,_jsx(_components.code,{children:`list`}),` and `,_jsx(_components.code,{children:`total`}),` fields are unchanged.`]}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.code,{children:`customer_id`}),` is required in this mode, since deductions are resolved against a specific customerโs balances.`]}),`\n`,_jsx(_components.p,{children:`There are two situations where this matters:`}),`\n`,_jsx(Heading,{level:`3`,id:`case-1-usage-spilling-into-a-credit-system`,children:`Case 1: Usage spilling into a credit system`}),`\n`,_jsxs(_components.p,{children:[`A feature can have its own included allowance `,_jsx(_components.em,{children:`and`}),` feed a credit system โ usage drains the allowance first, then overflows into credits at the featureโs credit cost. The standard aggregation only shows tracked totals, so the overflow is invisible. With `,_jsx(_components.code,{children:`aggregate_on: \"deducted\"`}),`, the two sides show up separately:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autumn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`events`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`aggregate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` customerId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cus_123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` featureId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"observability_events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` range:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"30d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` aggregateOn:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"deducted\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`41`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`41`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deductions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1762905600000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"observability_events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"feature_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"metered\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"balances\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"balance_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cus_ent_abc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"entity_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"plan_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"reset\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"interval\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"month\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"resets_at\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1789218895573`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"credit_cost\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"usage_credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"feature_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"credit_system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"balances\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"balance_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cus_ent_def\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"entity_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"plan_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"reset\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"interval\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"month\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"resets_at\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1789218895573`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"credit_cost\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.00008`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Reading this: the customerโs 1M-event allowance absorbed the tracked usage, and 10,000 events overflowed into the `,_jsx(_components.code,{children:`usage_credits`}),` pool, burning 0.8 credits at the featureโs credit cost of 0.00008. Each entry is in `,_jsx(_components.strong,{children:`that balanceโs own unit`}),` โ events for the metered feature, credits for the credit system.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`credit_cost`}),` is only populated when the request pins a single non-credit feature via `,_jsx(_components.code,{children:`feature_id`}),`, since several features feeding one pool each convert at a different rate. It reflects the credit systemโs current schema.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`case-2-per-entity-balances-falling-through-to-a-shared-pool`,children:`Case 2: Per-entity balances falling through to a shared pool`}),`\n`,_jsxs(_components.p,{children:[`When entities (e.g. seats) each carry their own balance and overflow lands on a customer-level shared balance, group by `,_jsx(_components.code,{children:`$entity_id`}),` to see who spent from where:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autumn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`events`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`aggregate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` customerId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cus_123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` featureId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"ai_credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` range:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"30d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` aggregateOn:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` groupBy:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"$entity_id\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`27`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`27`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deductions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1762905600000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"ai_credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"feature_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"credit_system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1650`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"balances\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"balance_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cus_ent_seat_3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"entity_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"seat_3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"plan_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team_seat\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"balance_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cus_ent_seat_4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"entity_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"seat_4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"plan_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team_seat\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"balance_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cus_ent_shared\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"entity_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"plan_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team_yearly\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`50`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"events\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"grouped_values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"cus_ent_seat_3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"seat_3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"cus_ent_seat_4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"seat_4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"cus_ent_shared\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"seat_3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`25`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"seat_4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"deducted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`25`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Finding each entityโs spillover`}),` takes one join between the two halves of the response:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`In `,_jsx(_components.code,{children:`balances`}),`, find the entry whose `,_jsx(_components.code,{children:`entity_id`}),` is `,_jsx(_components.code,{children:`null`}),`. Thatโs the customer-level shared balance โ the pool that entities fall through to when their own balance runs out. (Entries with an `,_jsx(_components.code,{children:`entity_id`}),` are balances owned by that entity.)`]}),`\n`,_jsxs(_components.li,{children:[`Take that entryโs `,_jsx(_components.code,{children:`balance_id`}),` and look it up in `,_jsx(_components.code,{children:`grouped_values`}),`. The keys of that object are the entities that spent from the shared pool, and each `,_jsx(_components.code,{children:`deducted`}),` is exactly how much they overdrew.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Here `,_jsx(_components.code,{children:`cus_ent_shared`}),` is the shared balance, and `,_jsx(_components.code,{children:`grouped_values[\"cus_ent_shared\"]`}),` shows seats 3 and 4 each pulled 25 credits from it beyond their own 600-credit seat balances โ the โused 25 extra creditsโ number to show next to each seat.`]}),`\n`,_jsxs(_components.p,{children:[`The seat-owned balances appear in `,_jsx(_components.code,{children:`grouped_values`}),` too, but for them the owner and the spender are the same entity, so the split just restates the balance total.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`group_by: \"$plan_id\"`}),` is rejected with `,_jsx(_components.code,{children:`aggregate_on`}),` โ every balance belongs to exactly one plan, so `,_jsx(_components.code,{children:`balances[].plan_id`}),` already carries the plan split.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`body-parameters`,children:`Body Parameters`}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`customer_id`,type:`string`,children:_jsx(_components.p,{children:`Customer ID to aggregate events for`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`entity_id`,type:`string`,children:_jsx(_components.p,{children:`Entity ID to filter aggregated events for (e.g., per-seat or per-resource limits)`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`feature_id`,type:`string`,required:true,children:_jsx(_components.p,{children:`Feature ID(s) to aggregate events for`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`group_by`,type:`string`,children:_jsxs(_components.p,{children:[`Property to group events by (e.g. โproperties.regionโ), or โ`,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`c`}),_jsx(_components.mi,{children:`u`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`o`}),_jsx(_components.mi,{children:`m`}),_jsx(_components.mi,{children:`e`}),_jsxs(_components.msub,{children:[_jsx(_components.mi,{children:`r`}),_jsx(_components.mi,{children:`i`})]}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{mathvariant:`normal`,children:`\"`}),_jsx(_components.mi,{mathvariant:`normal`,children:`/`}),_jsx(_components.mi,{mathvariant:`normal`,children:`\"`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`customer_id\" / \"`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`c`}),_jsx(_components.span,{className:`mord mathnormal`,children:`u`}),_jsx(_components.span,{className:`mord mathnormal`,children:`s`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal`,children:`o`}),_jsx(_components.span,{className:`mord mathnormal`,children:`m`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0278em`},children:`r`}),_jsx(_components.span,{className:`msupsub`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsx(_components.span,{className:`vlist`,style:{height:`0.3117em`},children:_jsxs(_components.span,{style:{top:`-2.55em`,marginLeft:`-0.0278em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mord mathnormal mtight`,children:`i`})})]})}),_jsx(_components.span,{className:`vlist-s`,children:`โ`})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.15em`},children:_jsx(_components.span,{})})})]})})]}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord`,children:`\"/\"`})]})})]}),`entity_idโ / โ`,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`p`}),_jsx(_components.mi,{children:`l`}),_jsx(_components.mi,{children:`a`}),_jsxs(_components.msub,{children:[_jsx(_components.mi,{children:`n`}),_jsx(_components.mi,{children:`i`})]}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{mathvariant:`normal`,children:`\"`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`o`}),_jsx(_components.mi,{children:`g`}),_jsx(_components.mi,{children:`r`}),_jsx(_components.mi,{children:`o`}),_jsx(_components.mi,{children:`u`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mi,{children:`b`}),_jsx(_components.mi,{children:`y`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`h`}),_jsx(_components.mi,{children:`o`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`c`}),_jsx(_components.mi,{children:`o`}),_jsx(_components.mi,{children:`l`}),_jsx(_components.mi,{children:`u`}),_jsx(_components.mi,{children:`m`}),_jsx(_components.mi,{children:`n`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mi,{children:`W`}),_jsx(_components.mi,{children:`h`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`n`}),_jsx(_components.mi,{children:`a`}),_jsx(_components.mi,{children:`g`}),_jsx(_components.mi,{children:`g`}),_jsx(_components.mi,{children:`r`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`g`}),_jsx(_components.mi,{children:`a`}),_jsx(_components.mi,{children:`t`}),_jsxs(_components.msub,{children:[_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`o`})]}),_jsx(_components.mi,{children:`n`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mi,{mathvariant:`normal`,children:`\"`}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{children:`u`}),_jsx(_components.mi,{children:`c`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{mathvariant:`normal`,children:`\"`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mi,{mathvariant:`normal`,children:`\"`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`plan_id\" to group by those columns. When aggregate_on is \"deducted\", \"`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.8889em`,verticalAlign:`-0.1944em`}}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0197em`},children:`pl`}),_jsx(_components.span,{className:`mord mathnormal`,children:`a`}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`n`}),_jsx(_components.span,{className:`msupsub`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsx(_components.span,{className:`vlist`,style:{height:`0.3117em`},children:_jsxs(_components.span,{style:{top:`-2.55em`,marginLeft:`0em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mord mathnormal mtight`,children:`i`})})]})}),_jsx(_components.span,{className:`vlist-s`,children:`โ`})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.15em`},children:_jsx(_components.span,{})})})]})})]}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord`,children:`\"`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal`,children:`o`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`g`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0278em`},children:`r`}),_jsx(_components.span,{className:`mord mathnormal`,children:`o`}),_jsx(_components.span,{className:`mord mathnormal`,children:`u`}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`}),_jsx(_components.span,{className:`mord mathnormal`,children:`b`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`y`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal`,children:`h`}),_jsx(_components.span,{className:`mord mathnormal`,children:`oseco`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0197em`},children:`l`}),_jsx(_components.span,{className:`mord mathnormal`,children:`u`}),_jsx(_components.span,{className:`mord mathnormal`,children:`mn`}),_jsx(_components.span,{className:`mord mathnormal`,children:`s`}),_jsx(_components.span,{className:`mord`,children:`.`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.1389em`},children:`W`}),_jsx(_components.span,{className:`mord mathnormal`,children:`h`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`mord mathnormal`,children:`na`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`g`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`g`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0278em`},children:`r`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`g`}),_jsx(_components.span,{className:`mord mathnormal`,children:`a`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`msupsub`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsx(_components.span,{className:`vlist`,style:{height:`0.1514em`},children:_jsxs(_components.span,{style:{top:`-2.55em`,marginLeft:`0em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mord mathnormal mtight`,children:`o`})})]})}),_jsx(_components.span,{className:`vlist-s`,children:`โ`})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.15em`},children:_jsx(_components.span,{})})})]})})]}),_jsx(_components.span,{className:`mord mathnormal`,children:`ni`}),_jsx(_components.span,{className:`mord mathnormal`,children:`s`}),_jsx(_components.span,{className:`mord`,children:`\"`}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord mathnormal`,children:`u`}),_jsx(_components.span,{className:`mord mathnormal`,children:`c`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord`,children:`\"`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`\"`})]})})]}),`feature_idโ groups deductions by the tracked feature that consumed each balance.`]})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`range`,type:`'24h' | '7d' | '30d' | '90d' | 'last_cycle' | '1bc' | '3bc'`,children:_jsx(_components.p,{children:`Time range to aggregate events for. Either range or custom_range must be provided`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`bin_size`,type:`'day' | 'hour' | 'week' | 'month'`,children:_jsx(_components.p,{children:`Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsxs(DynamicParamField,{body:`custom_range`,type:`object`,children:[_jsx(_components.p,{children:`Custom time range to aggregate events for. If provided, range must not be provided`}),_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`start`,type:`number`,required:true})}),_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`end`,type:`number`,required:true})})]})]})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`timezone`,type:`string`,children:_jsx(_components.p,{children:`IANA timezone (e.g. โAmerica/New_Yorkโ) that day, week and month bins are aligned to. Hour bins are always UTC. Defaults to UTC`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`filter_by.{key}`,type:`string`,children:_jsx(_components.p,{children:`Filter events by property values, e.g. {โmodelโ: โgpt-4โ, โregionโ: โusโ}. Maximum 5 filters.`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`max_groups`,type:`integer`,children:_jsx(_components.p,{children:`Maximum number of distinct group values to return per time bin when using group_by. Remaining values are bundled into an โOtherโ bucket. Defaults to 9`})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`measure`,type:`'sum' | 'count'`,children:_jsxs(_components.p,{children:[`What `,_jsx(_components.code,{children:`list`}),` reports per bin: โsumโ (default) adds up event values; โcountโ counts events, i.e. how many track requests came in regardless of value. `,_jsx(_components.code,{children:`total`}),` is unchanged.`]})})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicParamField`,children:_jsx(DynamicParamField,{body:`aggregate_on`,type:`'deducted'`,children:_jsxs(_components.p,{children:[`Set to โdeductedโ to additionally return a per-balance breakdown of what each event consumed, under `,_jsx(_components.code,{children:`deductions`}),`. Purely additive: `,_jsx(_components.code,{children:`list`}),` and `,_jsx(_components.code,{children:`total`}),` are unchanged. Requires customer_id.`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`response`,children:`Response`}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`list`,type:`object[]`,children:[_jsx(_components.p,{children:`Array of time periods with aggregated values`}),_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`period`,type:`number`,children:_jsx(_components.p,{children:`Unix timestamp (epoch ms) for this time period`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`values.{key}`,type:`number`,children:_jsx(_components.p,{children:`Aggregated values per feature: { [featureId]: number }`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`grouped_values`,type:`object`,children:[_jsx(_components.p,{children:`Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } }`}),_jsx(Expandable,{title:`properties`,children:_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`{key}.{key}`,type:`number`})})})]})})]})]})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`total.{key}`,type:`object`,children:[_jsx(_components.p,{children:`Total aggregations per feature. Keys are feature IDs, values contain count and sum.`}),_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`count`,type:`number`,children:_jsx(_components.p,{children:`Number of events for this feature`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`sum`,type:`number`,children:_jsx(_components.p,{children:`Sum of event values for this feature`})})})]})]})}),`\n`,_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`deductions`,type:`object[]`,children:[_jsx(_components.p,{children:`Per-balance breakdown of what was consumed. Present only when aggregate_on is โdeductedโ.`}),_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`period`,type:`number`,children:_jsxs(_components.p,{children:[`Unix timestamp (epoch ms), same basis as `,_jsx(_components.code,{children:`list`}),`.`]})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`values.{key}`,type:`object`,children:[_jsx(_components.p,{children:`Keyed by the feature that OWNS the balance drawn from, not the feature that was tracked.`}),_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`feature_type`,type:`'metered' | 'credit_system'`,children:_jsxs(_components.p,{children:[`credit_system means `,_jsx(_components.code,{children:`deducted`}),` is credits; metered means it is that featureโs own amount.`]})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`deducted`,type:`number`})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`events`,type:`number`})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`balances`,type:`object[]`,children:_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`balance_id`,type:`string`,children:_jsx(_components.p,{children:`ID of the balance row drawn from (customer_entitlement or rollover).`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`entity_id`,type:`string | null`,children:_jsx(_components.p,{children:`Entity that owns this balance, or null when it is customer-level and shared.`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`plan_id`,type:`string | null`,children:_jsx(_components.p,{children:`Plan the balance came with. Null for balances created outside a plan.`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`reset`,type:`object | null`,children:[_jsx(_components.p,{children:`Reset config for this balance, captured at deduction time.`}),_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`interval`,type:`string`})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`resets_at`,type:`number | null`})})]})]})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`credit_cost`,type:`number | null`,children:_jsx(_components.p,{children:`Multiplier applied converting the tracked feature into this balance. Null when 1:1, or when the query spans sources converting at different rates.`})})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`deducted`,type:`number`})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`events`,type:`number`})})]})})})]})]})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsxs(DynamicResponseField,{name:`grouped_values`,type:`object`,children:[_jsx(_components.p,{children:`Present only when group_by is used. Keyed by balance_id, then by group value โ the only way to attribute a shared balance to the entity that spent from it.`}),_jsx(Expandable,{title:`properties`,children:_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`{key}.{key}`,type:`object`,children:_jsxs(Expandable,{title:`properties`,children:[_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`deducted`,type:`number`})}),_jsx(_MdxComponentBoundary,{name:`DynamicResponseField`,children:_jsx(DynamicResponseField,{name:`credit_cost`,type:`number | null`})})]})})})})]})})]})]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{DynamicResponseExample,DynamicResponseField,DynamicParamField,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Aggregate Events","openapi":"openapi POST /v1/events.aggregate","description":"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.","href":"/api-reference/events/aggregateEvents"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[158,4333,")=>null;const DynamicResponseField=()=>null;const DynamicParamField=()=>null;fun"],[4649,4653,"ResponseExample,_Mdx"],[4888,4903,"ResponseExample)_missingMdxReference(`ResponseExample`,true);if(!_MdxComponentBo"],[89917,90407,",`\n`,_jsx(ResponseExample,{children:_jsx(CodeBlock,{filename:`200`,numberOfLines:`28`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`28`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"list\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1762905600000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sessions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1762992000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"values\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sessions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`13`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sessions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`15`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{DynamicResponseExample,DynamicResponseField,DynamicParamField,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}"]]},"mdxExtracts":{"tableOfContents":[{"title":"Working with Properties","slug":"working-with-properties","depth":2,"children":[{"title":"Special Group By Operators","slug":"special-group-by-operators","depth":3,"children":[]}]},{"title":"Response Format","slug":"response-format","depth":2,"children":[{"title":"Without group_by (Flat Response)","slug":"without-group_by-flat-response","depth":3,"children":[]},{"title":"With group_by (Grouped Response)","slug":"with-group_by-grouped-response","depth":3,"children":[]}]},{"title":"Deduction Breakdowns","slug":"deduction-breakdowns","depth":2,"children":[{"title":"Case 1: Usage spilling into a credit system","slug":"case-1-usage-spilling-into-a-credit-system","depth":3,"children":[]},{"title":"Case 2: Per-entity balances falling through to a shared pool","slug":"case-2-per-entity-balances-falling-through-to-a-shared-pool","depth":3,"children":[]},{"title":"Body Parameters","slug":"body-parameters","depth":3,"children":[]},{"title":"Response","slug":"response","depth":3,"children":[]}]}],"codeExamples":{"response":{"type":"ResponseExample","children":[{"filename":"200","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"json\">\u003ccode language=\"json\" numberOfLines=\"28\">\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"list\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: [\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"period\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">1762905600000\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"values\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"messages\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">10\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"sessions\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">3\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"period\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">1762992000000\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"values\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"messages\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">3\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"sessions\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">12\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> ],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"total\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"messages\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"count\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">2\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"sum\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">13\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"sessions\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"count\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">2\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"sum\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">15\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]}}},"jsLinks":["/_mintlify/custom/autumn-b9b4c0fb/d78b8c063824141d/dynamic-response.js"],"openApiReferenceData":{"operation":{"operationId":"aggregateEvents","description":"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.","tags":["events"],"requestBody":"d7bec3f0-c3f1-4aa2-9cf8-133248553039","responses":{"200":"9b8841a5-29b9-4cc5-9bfb-4d4702c873c4"},"x-speakeasy-name-override":"aggregate","parameters":["4a4b609d-6ce1-487f-b513-681940019d38"],"x-codeSamples":[{"lang":"typescript","label":"Typescript (SDK)","source":"import { Autumn } from 'autumn-js'\n\nconst autumn = new Autumn()\n\nconst result = await autumn.events.aggregate({\n customerId: \"cus_123\",\n featureId: \"api_calls\",\n range: \"30d\",\n});"},{"lang":"python","label":"Python (SDK)","source":"from autumn_sdk import Autumn\n\nautumn = Autumn(secret_key=\"am_sk_test...\")\n\nres = autumn.events.aggregate(\n feature_id=\"api_calls\",\n customer_id=\"cus_123\",\n range=\"30d\",\n bin_size=\"day\",\n)"}],"method":"post","type":"path","servers":["fe6701f7-be5c-40aa-b244-1a6f83c52f58"],"security":["53876c4e-3cd5-4c7e-b82b-fb98671718cb"],"path":"/v1/events.aggregate","baseUrlOptions":["https://api.useautumn.com"],"title":"","codeSamples":[{"label":"Typescript (SDK)","lang":"typescript","source":"import { Autumn } from 'autumn-js'\n\nconst autumn = new Autumn()\n\nconst result = await autumn.events.aggregate({\n customerId: \"cus_123\",\n featureId: \"api_calls\",\n range: \"30d\",\n});"},{"label":"Python (SDK)","lang":"python","source":"from autumn_sdk import Autumn\n\nautumn = Autumn(secret_key=\"am_sk_test...\")\n\nres = autumn.events.aggregate(\n feature_id=\"api_calls\",\n customer_id=\"cus_123\",\n range=\"30d\",\n bin_size=\"day\",\n)"}],"requestExampleLanguages":["typescript","python","bash"],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExamples":[{"dropdown":false,"language":"json","code":{"type":"pre","key":null,"ref":null,"props":{"className":"shiki shiki-themes github-light-default dark-plus","style":{"backgroundColor":"#ffffff","--shiki-dark-bg":"#0B0C0E","color":"#1f2328","--shiki-dark":"#D4D4D4"},"language":"json","children":{"type":"code","key":null,"ref":null,"props":{"language":"json","numberOfLines":"28","children":[{"type":"span","key":"0","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":"{"}}}},"\n",{"type":"span","key":"2","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"list\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": ["}}]}},"\n",{"type":"span","key":"4","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" {"}}}},"\n",{"type":"span","key":"6","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"period\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"1762905600000"}},{"type":"span","key":"3","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":","}}]}},"\n",{"type":"span","key":"8","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"values\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": {"}}]}},"\n",{"type":"span","key":"10","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"messages\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"10"}},{"type":"span","key":"3","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":","}}]}},"\n",{"type":"span","key":"12","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"sessions\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"3"}}]}},"\n",{"type":"span","key":"14","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" }"}}}},"\n",{"type":"span","key":"16","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" },"}}}},"\n",{"type":"span","key":"18","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" {"}}}},"\n",{"type":"span","key":"20","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"period\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"1762992000000"}},{"type":"span","key":"3","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":","}}]}},"\n",{"type":"span","key":"22","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"values\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": {"}}]}},"\n",{"type":"span","key":"24","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"messages\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"3"}},{"type":"span","key":"3","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":","}}]}},"\n",{"type":"span","key":"26","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"sessions\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"12"}}]}},"\n",{"type":"span","key":"28","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" }"}}}},"\n",{"type":"span","key":"30","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" }"}}}},"\n",{"type":"span","key":"32","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" ],"}}}},"\n",{"type":"span","key":"34","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"total\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": {"}}]}},"\n",{"type":"span","key":"36","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"messages\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": {"}}]}},"\n",{"type":"span","key":"38","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"count\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"2"}},{"type":"span","key":"3","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":","}}]}},"\n",{"type":"span","key":"40","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"sum\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"13"}}]}},"\n",{"type":"span","key":"42","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" },"}}}},"\n",{"type":"span","key":"44","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"sessions\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": {"}}]}},"\n",{"type":"span","key":"46","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"count\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"2"}},{"type":"span","key":"3","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":","}}]}},"\n",{"type":"span","key":"48","ref":null,"props":{"className":"line","children":[{"type":"span","key":"0","ref":null,"props":{"style":{"color":"#116329","--shiki-dark":"#9CDCFE"},"children":" \"sum\""}},{"type":"span","key":"1","ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":": "}},{"type":"span","key":"2","ref":null,"props":{"style":{"color":"#0550AE","--shiki-dark":"#B5CEA8"},"children":"15"}}]}},"\n",{"type":"span","key":"50","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" }"}}}},"\n",{"type":"span","key":"52","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":" }"}}}},"\n",{"type":"span","key":"54","ref":null,"props":{"className":"line","children":{"type":"span","key":null,"ref":null,"props":{"style":{"color":"#1F2328","--shiki-dark":"#D4D4D4"},"children":"}"}}}},"\n"]}}}},"filename":"200"}],"responseExampleType":"mdx"},"dependencies":{"parameters":{"4a4b609d-6ce1-487f-b513-681940019d38":{"name":"x-api-version","in":"header","required":true,"schema":{"type":"string","default":"2.6.0","isRequired":true,"uniqueKey":"","typeLabel":"string"},"x-speakeasy-globals-hidden":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"feature_id":{"oneOf":[{"type":"string","description":"Feature ID(s) to aggregate events for","minLength":1,"isRequired":true,"uniqueKey":"feature_id.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"string","minLength":1,"uniqueKey":"feature_id.oneOf.1.items.[INDEX]","typeLabel":"string"},"description":"Feature ID(s) to aggregate events for","isRequired":true,"uniqueKey":"feature_id.oneOf.1","typeLabel":"string[]"}],"isRequired":true,"uniqueKey":"feature_id","typeLabel":"string | string[]"},"customer_id":{"type":"string","minLength":1,"description":"Customer ID to aggregate events for","uniqueKey":"customer_id","typeLabel":"string"},"entity_id":{"type":"string","minLength":1,"description":"Entity ID to filter aggregated events for (e.g., per-seat or per-resource limits)","uniqueKey":"entity_id","typeLabel":"string"},"group_by":{"type":"string","description":"Property to group events by (e.g. \"properties.region\"), or \"$customer_id\" / \"$entity_id\" / \"$plan_id\" to group by those columns. When aggregate_on is \"deducted\", \"$feature_id\" groups deductions by the tracked feature that consumed each balance.","uniqueKey":"group_by","typeLabel":"string"},"range":{"enum":["24h","7d","30d","90d","last_cycle","1bc","3bc"],"type":"string","description":"Time range to aggregate events for. Either range or custom_range must be provided","uniqueKey":"range","typeLabel":"enum\u003cstring>"},"bin_size":{"enum":["day","hour","week","month"],"type":"string","default":"day","description":"Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day","uniqueKey":"bin_size","typeLabel":"enum\u003cstring>"},"custom_range":{"type":"object","properties":{"start":{"type":"number","isRequired":true,"uniqueKey":"custom_range.start","typeLabel":"number"},"end":{"type":"number","isRequired":true,"uniqueKey":"custom_range.end","typeLabel":"number"}},"required":["start","end"],"description":"Custom time range to aggregate events for. If provided, range must not be provided","uniqueKey":"custom_range","typeLabel":"object"},"timezone":{"type":"string","description":"IANA timezone (e.g. \"America/New_York\") that day, week and month bins are aligned to. Hour bins are always UTC. Defaults to UTC","uniqueKey":"timezone","typeLabel":"string"},"filter_by":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"filter_by.additionalProperties","typeLabel":"string"},"description":"Filter events by property values, e.g. {\"model\": \"gpt-4\", \"region\": \"us\"}. Maximum 5 filters.","uniqueKey":"filter_by","typeLabel":"object"},"max_groups":{"type":"integer","minimum":1,"maximum":250,"description":"Maximum number of distinct group values to return per time bin when using group_by. Remaining values are bundled into an 'Other' bucket. Defaults to 9","uniqueKey":"max_groups","typeLabel":"integer"},"measure":{"enum":["sum","count"],"type":"string","description":"What `list` reports per bin: \"sum\" (default) adds up event values; \"count\" counts events, i.e. how many track requests came in regardless of value. `total` is unchanged.","uniqueKey":"measure","typeLabel":"enum\u003cstring>"},"aggregate_on":{"enum":["deducted"],"type":"string","description":"Set to \"deducted\" to additionally return a per-balance breakdown of what each event consumed, under `deductions`. Purely additive: `list` and `total` are unchanged. Requires customer_id.","uniqueKey":"aggregate_on","typeLabel":"enum\u003cstring>"}},"required":["feature_id"],"title":"EventsAggregateParams","examples":[{"customer_id":"cus_123","feature_id":"api_calls","range":"30d","bin_size":"day"},{"customer_id":"cus_123","feature_id":["api_calls","messages"],"range":"7d","group_by":"properties.model"}],"uniqueKey":"","typeLabel":"EventsAggregateParams ยท object"},"example":{"customer_id":"cus_123","feature_id":"api_calls","range":"30d","bin_size":"day"},"examples":{"Example":{"title":"Example","value":{"customer_id":"cus_123","feature_id":"api_calls","range":"30d","bin_size":"day"}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"9b8841a5-29b9-4cc5-9bfb-4d4702c873c4":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"array","items":{"type":"object","properties":{"period":{"type":"number","description":"Unix timestamp (epoch ms) for this time period","isRequired":true,"uniqueKey":"list.items.[INDEX].period","typeLabel":"number"},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number","uniqueKey":"list.items.[INDEX].values.additionalProperties","typeLabel":"number"},"description":"Aggregated values per feature: { [featureId]: number }","isRequired":true,"uniqueKey":"list.items.[INDEX].values","typeLabel":"object"},"grouped_values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number","uniqueKey":"list.items.[INDEX].grouped_values.additionalProperties.additionalProperties","typeLabel":"number"},"uniqueKey":"list.items.[INDEX].grouped_values.additionalProperties","typeLabel":"object"},"description":"Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } }","uniqueKey":"list.items.[INDEX].grouped_values","typeLabel":"object"}},"required":["period","values"],"uniqueKey":"list.items.[INDEX]","typeLabel":"object"},"description":"Array of time periods with aggregated values","isRequired":true,"uniqueKey":"list","typeLabel":"object[]"},"total":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"count":{"type":"number","description":"Number of events for this feature","isRequired":true,"uniqueKey":"total.additionalProperties.count","typeLabel":"number"},"sum":{"type":"number","description":"Sum of event values for this feature","isRequired":true,"uniqueKey":"total.additionalProperties.sum","typeLabel":"number"}},"required":["count","sum"],"uniqueKey":"total.additionalProperties","typeLabel":"object"},"description":"Total aggregations per feature. Keys are feature IDs, values contain count and sum.","isRequired":true,"uniqueKey":"total","typeLabel":"object"},"deductions":{"type":"array","items":{"type":"object","properties":{"period":{"type":"number","description":"Unix timestamp (epoch ms), same basis as `list`.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].period","typeLabel":"number"},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"feature_type":{"enum":["metered","credit_system"],"type":"string","description":"credit_system means `deducted` is credits; metered means it is that feature's own amount.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.feature_type","typeLabel":"enum\u003cstring>"},"deducted":{"type":"number","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.deducted","typeLabel":"number"},"events":{"type":"number","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.events","typeLabel":"number"},"balances":{"type":"array","items":{"type":"object","properties":{"balance_id":{"type":"string","description":"ID of the balance row drawn from (customer_entitlement or rollover).","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].balance_id","typeLabel":"string"},"entity_id":{"oneOf":[{"type":"string","description":"Entity that owns this balance, or null when it is customer-level and shared.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].entity_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"Entity that owns this balance, or null when it is customer-level and shared.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].entity_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].entity_id","typeLabel":"string | null"},"plan_id":{"oneOf":[{"type":"string","description":"Plan the balance came with. Null for balances created outside a plan.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].plan_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"Plan the balance came with. Null for balances created outside a plan.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].plan_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].plan_id","typeLabel":"string | null"},"reset":{"oneOf":[{"type":"object","description":"Reset config for this balance, captured at deduction time.","required":["interval","resets_at"],"properties":{"interval":{"type":"string","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset.oneOf.0.interval","typeLabel":"string"},"resets_at":{"oneOf":[{"type":"number","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset.oneOf.0.resets_at.oneOf.0","typeLabel":"number"},{"type":"null","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset.oneOf.0.resets_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset.oneOf.0.resets_at","typeLabel":"number | null"}},"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset.oneOf.0","typeLabel":"object"},{"type":"null","description":"Reset config for this balance, captured at deduction time.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].reset","typeLabel":"object | null"},"credit_cost":{"oneOf":[{"type":"number","description":"Multiplier applied converting the tracked feature into this balance. Null when 1:1, or when the query spans sources converting at different rates.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].credit_cost.oneOf.0","typeLabel":"number"},{"type":"null","description":"Multiplier applied converting the tracked feature into this balance. Null when 1:1, or when the query spans sources converting at different rates.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].credit_cost.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].credit_cost","typeLabel":"number | null"},"deducted":{"type":"number","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].deducted","typeLabel":"number"},"events":{"type":"number","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX].events","typeLabel":"number"}},"required":["balance_id","entity_id","plan_id","reset","credit_cost","deducted","events"],"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"deductions.items.[INDEX].values.additionalProperties.balances","typeLabel":"object[]"}},"required":["feature_type","deducted","events","balances"],"uniqueKey":"deductions.items.[INDEX].values.additionalProperties","typeLabel":"object"},"description":"Keyed by the feature that OWNS the balance drawn from, not the feature that was tracked.","isRequired":true,"uniqueKey":"deductions.items.[INDEX].values","typeLabel":"object"},"grouped_values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"deducted":{"type":"number","isRequired":true,"uniqueKey":"deductions.items.[INDEX].grouped_values.additionalProperties.additionalProperties.deducted","typeLabel":"number"},"credit_cost":{"oneOf":[{"type":"number","uniqueKey":"deductions.items.[INDEX].grouped_values.additionalProperties.additionalProperties.credit_cost.oneOf.0","typeLabel":"number"},{"type":"null","uniqueKey":"deductions.items.[INDEX].grouped_values.additionalProperties.additionalProperties.credit_cost.oneOf.1","typeLabel":"null"}],"uniqueKey":"deductions.items.[INDEX].grouped_values.additionalProperties.additionalProperties.credit_cost","typeLabel":"number | null"}},"required":["deducted"],"uniqueKey":"deductions.items.[INDEX].grouped_values.additionalProperties.additionalProperties","typeLabel":"object"},"uniqueKey":"deductions.items.[INDEX].grouped_values.additionalProperties","typeLabel":"object"},"description":"Present only when group_by is used. Keyed by balance_id, then by group value โ the only way to attribute a shared balance to the entity that spent from it.","uniqueKey":"deductions.items.[INDEX].grouped_values","typeLabel":"object"}},"required":["period","values"],"uniqueKey":"deductions.items.[INDEX]","typeLabel":"object"},"description":"Per-balance breakdown of what was consumed. Present only when aggregate_on is \"deducted\".","uniqueKey":"deductions","typeLabel":"object[]"}},"required":["list","total"],"examples":[{"list":[{"period":1762905600000,"values":{"messages":10,"sessions":3}},{"period":1762992000000,"values":{"messages":3,"sessions":12}}],"total":{"messages":{"count":2,"sum":13},"sessions":{"count":2,"sum":15}}},{"list":[{"period":1762905600000,"values":{"messages":10,"sessions":3},"grouped_values":{"messages":{"api":5,"web":5},"sessions":{"api":2,"web":1}}},{"period":1762992000000,"values":{"messages":3,"sessions":12},"grouped_values":{"messages":{"api":1,"web":2},"sessions":{"api":10,"web":2}}}],"total":{"messages":{"count":2,"sum":13},"sessions":{"count":2,"sum":15}}}],"uniqueKey":"","typeLabel":"object"},"example":{"list":[{"period":1762905600000,"values":{"messages":10,"sessions":3}},{"period":1762992000000,"values":{"messages":3,"sessions":12}}],"total":{"messages":{"count":2,"sum":13},"sessions":{"count":2,"sum":15}}},"examples":{"Example":{"title":"Example","value":{"list":[{"period":1762905600000,"values":{"messages":10,"sessions":3}},{"period":1762992000000,"values":{"messages":3,"sessions":12}}],"total":{"messages":{"count":2,"sum":13},"sessions":{"count":2,"sum":15}}}}},"exampleType":"examples"}},"exampleType":"examples"}},"security":{"53876c4e-3cd5-4c7e-b82b-fb98671718cb":{"secretKey":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"secretKey"}}},"servers":{"fe6701f7-be5c-40aa-b244-1a6f83c52f58":{"url":"https://api.useautumn.com","description":"Production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"secretKey"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"secretKey","name":"Authorization"}],"title":"secretKey"}]},"originalFileLocation":"api/openapi.yml"},"subdomain":"autumn-b9b4c0fb","siteName":"Autumn","title":"Aggregate Events - Autumn","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-14T16:45:47.126Z","originalFileLocation":"api-reference/events/aggregateEvents.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Autumn\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Aggregate Events - Autumn\">\u003cmeta data-mint-head property=\"og:description\" content=\"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Autumn\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.useautumn.com/api-reference/events/aggregateEvents\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://autumn-b9b4c0fb.mintlify.app/_mintlify/api/og/v2?division=Events\u0026amp;title=Aggregate+Events\u0026amp;description=Aggregate+usage+events+by+time+period.+Returns+usage+totals+grouped+by+feature+and+optionally+by+a+custom+property.\u0026amp;theme=3bf7e6d15826cac91d0b643c\u0026amp;signature=96617deff9a7d9546f79f66790ee686268fecb76091f8183dd04e587e2fa1ea1\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Aggregate Events - Autumn\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://autumn-b9b4c0fb.mintlify.app/_mintlify/api/og/v2?division=Events\u0026amp;title=Aggregate+Events\u0026amp;description=Aggregate+usage+events+by+time+period.+Returns+usage+totals+grouped+by+feature+and+optionally+by+a+custom+property.\u0026amp;theme=3bf7e6d15826cac91d0b643c\u0026amp;signature=96617deff9a7d9546f79f66790ee686268fecb76091f8183dd04e587e2fa1ea1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/autumn-b9b4c0fb/LQO5vXfVIKEXnzb8/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Autumn\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#8838ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.useautumn.com/api-reference/events/aggregateEvents\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/events/aggregateEvents.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.useautumn.com/#organization\",\"name\":\"Autumn\",\"url\":\"https://docs.useautumn.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/autumn-b9b4c0fb/BOEMpWFJsAdGcii1/assets/logo/autumn-dark.svg?fit=max\u0026auto=format\u0026n=BOEMpWFJsAdGcii1\u0026q=85\u0026s=720bd2227c435e77f2c91cbfcbccd274\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.useautumn.com#website\",\"name\":\"Autumn\",\"url\":\"https://docs.useautumn.com\",\"publisher\":{\"@id\":\"https://docs.useautumn.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents#webpage\",\"url\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents\",\"name\":\"Aggregate Events\",\"description\":\"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.\",\"dateModified\":\"2026-10-14T16:45:47.126Z\",\"isPartOf\":{\"@id\":\"https://docs.useautumn.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Events\",\"item\":\"https://docs.useautumn.com/api-reference/events/listEvents\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Aggregate Events\",\"item\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents#apireference\",\"headline\":\"Aggregate Events\",\"name\":\"Aggregate Events\",\"description\":\"Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.\",\"url\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents\",\"mainEntityOfPage\":{\"@id\":\"https://docs.useautumn.com/api-reference/events/aggregateEvents#webpage\"},\"dateModified\":\"2026-10-14T16:45:47.126Z\",\"publisher\":{\"@id\":\"https://docs.useautumn.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.useautumn.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Autumn\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Autumn","nav":{"global":{"anchors":[{"anchor":"Discord","icon":"discord","href":"https://discord.gg/STqxY92zuS"},{"anchor":"GitHub","icon":"github","href":"https://github.com/useautumn/autumn"},{"anchor":"Website","icon":"globe","href":"https://useautumn.com"}]},"tabs":[{"tab":"Documentation","icon":"folder-open","pages":[{"title":"Documentation","href":"/welcome"}]},{"tab":"Examples","icon":"graduation-cap","pages":[{"title":"Examples","href":"/examples/monetary-credits"}]},{"tab":"CLI","icon":"square-terminal","pages":[{"title":"CLI","href":"/cli/getting-started"}]},{"tab":"API Reference","icon":"display-code","groups":[{"group":"Billing","pages":[{"title":"Attach","openapi":"openapi POST /v1/billing.attach","href":"/api-reference/billing/attach"},{"title":"Update Subscription","openapi":"openapi POST /v1/billing.update","href":"/api-reference/billing/billingUpdate"},{"title":"Open Customer Portal","openapi":"openapi POST /v1/billing.open_customer_portal","href":"/api-reference/billing/openCustomerPortal"},{"title":"Setup Payment","openapi":"openapi POST /v1/billing.setup_payment","href":"/api-reference/billing/setupPayment"},{"title":"Multi Attach","openapi":"openapi POST /v1/billing.multi_attach","href":"/api-reference/billing/multiAttach"},{"title":"Multi Update","openapi":"openapi POST /v1/billing.multi_update","href":"/api-reference/billing/multiUpdate"},{"title":"Create Schedule","openapi":"openapi POST /v1/billing.create_schedule","href":"/api-reference/billing/createSchedule"},{"title":"Verify","openapi":"openapi POST /v1/billing.verify","href":"/api-reference/billing/verify"},{"title":"Import","openapi":"openapi POST /v1/billing.import","href":"/api-reference/billing/import"},{"group":"Previews","pages":[{"title":"Preview Attach","openapi":"openapi POST /v1/billing.preview_attach","href":"/api-reference/billing/previewAttach"},{"title":"Preview Update","openapi":"openapi POST /v1/billing.preview_update","href":"/api-reference/billing/previewUpdate"},{"title":"Preview Multi Attach","openapi":"openapi POST /v1/billing.preview_multi_attach","href":"/api-reference/billing/previewMultiAttach"},{"title":"Preview Multi Update","openapi":"openapi POST /v1/billing.preview_multi_update","href":"/api-reference/billing/previewMultiUpdate"}]},{"group":"Licenses","pages":[{"title":"Attach License","openapi":"openapi POST /v1/licenses.attach","href":"/api-reference/licenses/attachLicense"},{"title":"Release License","openapi":"openapi POST /v1/licenses.release","href":"/api-reference/licenses/releaseLicense"},{"title":"List Licenses","openapi":"openapi POST /v1/licenses.list","href":"/api-reference/licenses/listLicenses"},{"title":"List License Assignments","openapi":"openapi POST /v1/licenses.list_assignments","href":"/api-reference/licenses/listLicenseAssignments"}]}]},{"group":"Balances","pages":[{"title":"Check Permissions","openapi":"openapi POST /v1/balances.check","href":"/api-reference/core/check"},{"title":"Track Usage","openapi":"openapi POST /v1/balances.track","href":"/api-reference/core/track"},{"title":"Batch Track Usage","openapi":"openapi POST /v1/balances.batch_track","href":"/api-reference/core/batchTrack"},{"title":"List Balances","openapi":"openapi POST /v1/balances.list","href":"/api-reference/balances/listBalances"},{"title":"Create Balance","openapi":"openapi POST /v1/balances.create","href":"/api-reference/balances/createBalance"},{"title":"Update Balance","openapi":"openapi POST /v1/balances.update","href":"/api-reference/balances/updateBalance"},{"title":"Delete Balance","openapi":"openapi POST /v1/balances.delete","href":"/api-reference/balances/deleteBalance"},{"title":"Finalize Lock","openapi":"openapi POST /v1/balances.finalize","href":"/api-reference/balances/finalizeLock"}]},{"group":"Customers","pages":[{"title":"Get or Create Customer","openapi":"openapi POST /v1/customers.get_or_create","href":"/api-reference/customers/getOrCreateCustomer"},{"title":"Get Customer","openapi":"openapi POST /v1/customers.get","href":"/api-reference/customers/getCustomer"},{"title":"List Customers","openapi":"openapi POST /v1/customers.list","href":"/api-reference/customers/listCustomers"},{"title":"List Subscriptions","openapi":"openapi POST /v1/subscriptions.list","href":"/api-reference/customers/listSubscriptions"},{"title":"List Purchases","openapi":"openapi POST /v1/purchases.list","href":"/api-reference/customers/listPurchases"},{"title":"Update Customer","openapi":"openapi POST /v1/customers.update","href":"/api-reference/customers/updateCustomer"},{"title":"Delete Customer","openapi":"openapi POST /v1/customers.delete","href":"/api-reference/customers/deleteCustomer"}]},{"group":"Invoices","pages":[{"title":"List Invoices","openapi":"openapi POST /v1/invoices.list","href":"/api-reference/invoices/listInvoices"},{"title":"Create Invoice","openapi":"openapi POST /v1/invoices.create","href":"/api-reference/invoices/createInvoice"},{"title":"Mark Invoice as Paid","openapi":"openapi POST /v1/invoices.pay","href":"/api-reference/invoices/payInvoice"},{"title":"Void Invoice","openapi":"openapi POST /v1/invoices.void","href":"/api-reference/invoices/voidInvoice"},{"title":"Reissue Invoice","openapi":"openapi POST /v1/invoices.reissue","href":"/api-reference/invoices/reissueInvoice"},{"title":"Issue Credit Note","openapi":"openapi POST /v1/invoices.issue_credit_note","href":"/api-reference/invoices/issueCreditNote"},{"title":"Backfill Invoices","openapi":"openapi POST /v1/invoices.insert","href":"/api-reference/invoices/insertInvoices"},{"title":"List Invoice Templates","openapi":"openapi POST /v1/invoices.listTemplates","href":"/api-reference/invoices/listInvoiceTemplates"}]},{"group":"Authorization","pages":[{"title":"Mint","openapi":"openapi POST /v1/keys.mint","href":"/api-reference/keys/mintKey"},{"title":"Refresh","openapi":"openapi POST /v1/keys.refresh","href":"/api-reference/keys/refreshKey"},{"title":"Revoke","openapi":"openapi POST /v1/keys.revoke","href":"/api-reference/keys/revokeKey"}]},{"group":"Events","pages":[{"title":"List Events","openapi":"openapi POST /v1/events.list","description":"List usage events for your organization. Filter by customer, feature, or time range.","href":"/api-reference/events/listEvents"},{"title":"Aggregate Events","openapi":"openapi POST /v1/events.aggregate","href":"/api-reference/events/aggregateEvents"}]},{"group":"Logs","pages":[{"title":"Search Request Logs","openapi":"openapi POST /v1/logs.search","description":"Search API requests and incoming Stripe webhooks for your organization and environment.","href":"/api-reference/logs/searchRequestLogs"}]},{"group":"Entities","pages":[{"title":"Get Entity","openapi":"openapi POST /v1/entities.get","href":"/api-reference/entities/getEntity"},{"title":"List Entities","openapi":"openapi POST /v1/entities.list","href":"/api-reference/entities/listEntities"},{"title":"Create Entity","openapi":"openapi POST /v1/entities.create","href":"/api-reference/entities/createEntity"},{"title":"Update Entity","openapi":"openapi POST /v1/entities.update","href":"/api-reference/entities/updateEntity"},{"title":"Delete Entity","openapi":"openapi POST /v1/entities.delete","href":"/api-reference/entities/deleteEntity"}]},{"group":"Accounts","pages":[{"title":"Get Account","openapi":"openapi POST /v1/accounts.get","href":"/api-reference/accounts/getAccount"},{"title":"Update Account","openapi":"openapi POST /v1/accounts.update","href":"/api-reference/accounts/updateAccount"}]},{"group":"Plans","pages":[{"title":"Get a plan","openapi":"openapi POST /v1/plans.get","href":"/api-reference/plans/getPlan"},{"title":"List all plans","openapi":"openapi POST /v1/plans.list","href":"/api-reference/plans/listPlans"},{"title":"Create a plan","openapi":"openapi POST /v1/plans.create","href":"/api-reference/plans/createPlan"},{"title":"Update a plan","openapi":"openapi POST /v1/plans.update","href":"/api-reference/plans/updatePlan"},{"title":"Delete a plan","openapi":"openapi POST /v1/plans.delete","href":"/api-reference/plans/deletePlan"}]},{"group":"Features","pages":[{"title":"Get Feature","openapi":"openapi POST /v1/features.get","href":"/api-reference/features/getFeature"},{"title":"List Features","openapi":"openapi POST /v1/features.list","href":"/api-reference/features/listFeatures"},{"title":"Create Feature","openapi":"openapi POST /v1/features.create","href":"/api-reference/features/createFeature"},{"title":"Update Feature","openapi":"openapi POST /v1/features.update","href":"/api-reference/features/updateFeature"},{"title":"Delete Feature","openapi":"openapi POST /v1/features.delete","href":"/api-reference/features/deleteFeature"}]},{"group":"Rewards \u0026 Referrals","pages":[{"title":"Create Referral Program","openapi":"openapi POST /v1/referral_programs.create","href":"/api-reference/referrals/createReferralProgram"},{"title":"List Referral Programs","openapi":"openapi POST /v1/referral_programs.list","href":"/api-reference/referrals/listReferralPrograms"},{"title":"Get Referral Program","openapi":"openapi POST /v1/referral_programs.get","href":"/api-reference/referrals/getReferralProgram"},{"title":"Update Referral Program","openapi":"openapi POST /v1/referral_programs.update","href":"/api-reference/referrals/updateReferralProgram"},{"title":"Delete Referral Program","openapi":"openapi POST /v1/referral_programs.delete","href":"/api-reference/referrals/deleteReferralProgram"},{"title":"Create Referral Code","openapi":"openapi POST /v1/referrals.create_code","href":"/api-reference/referrals/createReferralCode"},{"title":"Redeem Referral Code","openapi":"openapi POST /v1/referrals.redeem_code","href":"/api-reference/referrals/redeemReferralCode"},{"title":"Create Reward","openapi":"openapi POST /v1/rewards.create","href":"/api-reference/rewards/createReward"},{"title":"List Rewards","openapi":"openapi POST /v1/rewards.list","href":"/api-reference/rewards/listRewards"},{"title":"Get Reward","openapi":"openapi POST /v1/rewards.get","href":"/api-reference/rewards/getReward"},{"title":"Update Reward","openapi":"openapi POST /v1/rewards.update","href":"/api-reference/rewards/updateReward"},{"title":"Delete Reward","openapi":"openapi POST /v1/rewards.delete","href":"/api-reference/rewards/deleteReward"},{"title":"Redeem Reward Code","openapi":"openapi POST /v1/rewards.redeem","href":"/api-reference/rewards/redeemRewardCode"}]},{"group":"Webhooks","pages":[{"title":"Get Webhook","openapi":"openapi POST /v1/webhooks.get","href":"/api-reference/webhooks/getWebhook"},{"title":"List Webhooks","openapi":"openapi POST /v1/webhooks.list","href":"/api-reference/webhooks/listWebhooks"},{"title":"Create Webhook","openapi":"openapi POST /v1/webhooks.create","href":"/api-reference/webhooks/createWebhook"},{"title":"Update Webhook","openapi":"openapi POST /v1/webhooks.update","href":"/api-reference/webhooks/updateWebhook"},{"title":"Delete Webhook","openapi":"openapi POST /v1/webhooks.delete","href":"/api-reference/webhooks/deleteWebhook"},{"title":"Sync Webhooks","openapi":"openapi POST /v1/webhooks.sync","href":"/api-reference/webhooks/syncWebhooks"},{"group":"Previews","pages":[{"title":"Preview Sync Webhooks","openapi":"openapi POST /v1/webhooks.preview_sync","href":"/api-reference/webhooks/previewSyncWebhooks"}]}]},{"group":"Webhook Events","pages":[{"group":"Balances","pages":[{"title":"Usage Alert Triggered","openapi":"api/openapi.yml webhook balances.usage_alert_triggered","href":"/api-reference/webhooks/balancesUsageAlertTriggered"},{"title":"Limit Reached","openapi":"api/openapi.yml webhook balances.limit_reached","href":"/api-reference/webhooks/balancesLimitReached"}]},{"group":"Billing","pages":[{"title":"Auto Top-Up Failed","openapi":"api/openapi.yml webhook billing.auto_topup_failed","href":"/api-reference/webhooks/billingAutoTopupFailed"},{"title":"Auto Top-Up Succeeded","openapi":"api/openapi.yml webhook billing.auto_topup_succeeded","href":"/api-reference/webhooks/billingAutoTopupSucceeded"},{"title":"Plans Updated","openapi":"api/openapi.yml webhook billing.updated","href":"/api-reference/webhooks/billingUpdated"}]},{"group":"Invoice","pages":[{"title":"Invoice Finalized","openapi":"api/openapi.yml webhook invoice.finalized","href":"/api-reference/webhooks/invoiceFinalized"}]},{"group":"Vercel","pages":[{"title":"Resource Deleted","openapi":"api/openapi.yml webhook vercel.resources.deleted","href":"/api-reference/webhooks/vercelResourcesDeleted"},{"title":"Resource Provisioned","openapi":"api/openapi.yml webhook vercel.resources.provisioned","href":"/api-reference/webhooks/vercelResourcesProvisioned"},{"title":"Rotate Secrets","openapi":"api/openapi.yml webhook vercel.resources.rotate_secrets","href":"/api-reference/webhooks/vercelResourcesRotateSecrets"},{"title":"Webhook Event","openapi":"api/openapi.yml webhook vercel.webhooks.event","href":"/api-reference/webhooks/vercelWebhooksEvent"}]}]},{"group":"Platform (Beta)","pages":[{"title":"Overview","href":"/api-reference/platform/overview"},{"title":"Create Organization","openapi":"platform POST /platform/organizations","href":"/api-reference/platform/create-organization"},{"title":"Generate Stripe OAuth URL","openapi":"platform POST /platform/oauth_url","href":"/api-reference/platform/oauth-url"},{"title":"Get Stripe Connection","openapi":"openapi POST /v1/platform.get_stripe_connection","href":"/api-reference/platform/getStripeConnection"},{"title":"Disconnect Stripe","openapi":"openapi POST /v1/platform.disconnect_stripe","href":"/api-reference/platform/disconnectStripe"},{"title":"Update Connected Stripe Account","openapi":"platform POST /platform/organizations/stripe","href":"/api-reference/platform/update-stripe"},{"title":"List Users","openapi":"platform GET /platform/users","href":"/api-reference/platform/list-users"},{"title":"List Organizations","openapi":"platform GET /platform/organizations","href":"/api-reference/platform/list-orgs"}]}]},{"tab":"Changelog","icon":"list-ol","pages":[{"title":"Changelog","href":"/changelog/changelog"}]}]},"title":"Aggregate Events - Autumn","buildId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","deploymentId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-rfhihCWU.js","utils-BmH1XFxk.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-BcNsxPKB.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-BAES3tkd.js","snippetPresets-DCMQBKLP.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-D6l_bzE9.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BOktbnNh.js","shallow-BCs8SgM7.js","getApiPlaygroundDisplay-DEmW5bJB.js","CodeSnippet-CpZOpB9C.js","CodeSnippets-BOBDqibl.js","Page-D5fEM6aW.js","getPastedJson-DH2JBvmr.js","icon-BBJH-kKh.js","MethodPill-D2Sd5NLC.js","DuplicateIcon-CGgfL2qN.js","createIcon-BKudBBzi.js","DynamicMarkdown-85clUA0i.js","SectionHeading-D0JiMgDx.js","axios-vUo_bRtp.js","Markdown-Cfiy0xZO.js","clsx-rL8ZCCw4.js","lib--scc4DXi.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-aeztFa9U.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-BywkCr5C.js"]}