/** * Labels store metadata of an entity that can be used for filtering an entity list * or for searching across entity types. * * Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", * "mesh", "kic", or "\_". */ export type Labels = Record; /** Determines which page of the collection to retrieve. */ export interface CursorPaginationQueryPage { /** The number of items to include per page. */ size?: number; /** Request the next page of data, starting with the item after this parameter. */ after?: string; /** Request the previous page of data, starting with the item before this parameter. */ before?: string; } /** * Sort query. * * The `asc` suffix is optional as the default sort order is ascending. The `desc` * suffix is used to specify a descending order. */ export interface SortQuery { /** The attribute to sort by. */ by: string; /** The sort order. `asc` for ascending, `desc` for descending. */ order: 'asc' | 'desc'; } /** Event validation errors. */ export interface IngestedEventValidationError { /** The machine readable code of the error. */ code: string; /** The human readable description of the error. */ message: string; /** Additional attributes. */ attributes?: Record; } /** Cursor pagination metadata. */ export interface CursorMetaPage { /** URI to the first page. */ first?: string; /** URI to the last page. */ last?: string; /** URI to the next page. */ next: string | null; /** URI to the previous page. */ previous: string | null; /** Requested page size. */ size: number; } /** Standard error response. */ export interface BaseError { /** Type contains a URI that identifies the problem type. */ type: string; /** * The HTTP status code generated by the origin server for this occurrence of the * problem. */ status: number; /** A a short, human-readable summary of the problem type. */ title: string; /** A human-readable explanation specific to this occurrence of the problem. */ detail: string; /** A URI reference that identifies the specific occurrence of the problem. */ instance: string; [key: string]: unknown; } /** Pagination information. */ export interface PageMeta { /** Page number. */ number: number; /** Page size. */ size: number; /** Total number of items in the collection. */ total: number; } /** * A query filter for a string attribute. Operators are mutually exclusive, only * one operator is allowed at a time. */ export interface QueryFilterString { /** The attribute equals the provided value. */ eq?: string; /** The attribute does not equal the provided value. */ neq?: string; /** The attribute is one of the provided values. */ in?: string[]; /** The attribute is not one of the provided values. */ nin?: string[]; /** The attribute contains the provided value. */ contains?: string; /** The attribute does not contain the provided value. */ ncontains?: string; /** Combines the provided filters with a logical AND. */ and?: QueryFilterString[]; /** Combines the provided filters with a logical OR. */ or?: QueryFilterString[]; } /** Custom text displayed at various stages of the checkout flow. */ export interface AppStripeCheckoutSessionCustomTextParams { /** Text displayed after the payment confirmation button. */ afterSubmit?: { message?: string; }; /** Text displayed alongside shipping address collection. */ shippingAddress?: { message?: string; }; /** Text displayed alongside the payment confirmation button. */ submit?: { message?: string; }; /** Text replacing the default terms of service agreement text. */ termsOfServiceAcceptance?: { message?: string; }; } /** Request to create a Stripe Customer Portal Session. */ export interface AppStripeCreateCustomerPortalSessionOptions { /** * The ID of an existing * [Stripe configuration](https://docs.stripe.com/api/customer_portal/configurations) * to use for this session, describing its functionality and features. If not * specified, the session uses the default configuration. */ configurationId?: string; /** * The IETF * [language tag](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-locale) * of the locale customer portal is displayed in. If blank or `auto`, the * customer's preferred_locales or browser's locale is used. */ locale?: string; /** * The * [URL to redirect](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url) * the customer to after they have completed their requested actions. */ returnUrl?: string; } /** * Labels store metadata of an entity that can be used for filtering an entity list * or for searching across entity types. * * Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", * "mesh", "kic", or "\_". */ export type CreateLabels = Record; /** An integer version comparison. Exactly one operator must be provided. */ export interface CreateVersionFilter { /** Match this exact version. */ eq?: number; /** Match one of these versions. */ oeq?: number[]; /** Match this version and later versions. */ gte?: number; /** Match this version and earlier versions. */ lte?: number; } /** An integer version comparison. Exactly one operator must be provided. */ export interface VersionFilter { /** Match this exact version. */ eq?: number; /** Match one of these versions. */ oeq?: number[]; /** Match this version and later versions. */ gte?: number; /** Match this version and earlier versions. */ lte?: number; } /** Free price. */ export interface PriceFree { /** The type of the price. */ type: 'free'; } /** The entitlement template of a static entitlement. */ export interface RateCardStaticEntitlement { /** The type of the entitlement template. */ type: 'static'; /** * The entitlement config as a JSON object. Returned when checking entitlement * access; useful for configuring fine-grained access settings implemented in your * own system. */ config: unknown; } /** The entitlement template of a boolean entitlement. */ export interface RateCardBooleanEntitlement { /** The type of the entitlement template. */ type: 'boolean'; } /** The tax config for Stripe. */ export interface TaxConfigStripe { /** Product [tax code](https://docs.stripe.com/tax/tax-codes). */ code: string; } /** External invoicing tax config. */ export interface TaxConfigExternalInvoicing { /** The tax code should be interpreted by the external invoicing provider. */ code: string; } /** External identifiers assigned to an invoice by third-party systems. */ export interface InvoiceExternalReferences { /** The ID assigned by the external invoicing app (e.g. Stripe invoice ID). */ invoicingId?: string; /** The ID assigned by the external payment app (e.g. Stripe payment intent ID). */ paymentId?: string; } /** Details about an available invoice action including the resulting state. */ export interface InvoiceAvailableActionDetails { /** The extended status the invoice will transition to after performing this action. */ resultingState: string; } /** * Invoice-level invoicing settings. * * A subset of BillingWorkflowInvoicingSettings limited to fields that are * meaningful per-invoice. progressive_billing is omitted as it is a gather-time / * profile-level decision. */ export interface InvoiceWorkflowInvoicingSettings { /** Whether to automatically issue the invoice after the draft_period has passed. */ autoAdvance: boolean; /** The period for the invoice to be kept in draft status for manual reviews. */ draftPeriod: string; /** The period after which the invoice is considered overdue if not paid. */ dueAfter?: string; } /** * Payment settings for a billing workflow when the collection method is charge * automatically. */ export interface WorkflowPaymentChargeAutomaticallySettings { /** The collection method for the invoice. */ collectionMethod: 'charge_automatically'; } /** * Payment settings for a billing workflow when the collection method is send * invoice. */ export interface WorkflowPaymentSendInvoiceSettings { /** The collection method for the invoice. */ collectionMethod: 'send_invoice'; /** * The period after which the invoice is due. With some payment solutions it's only * applicable for manual collection method. */ dueAfter: string; } /** * Discounts applicable to flat fee charges. * * This is the same as `ProductCatalog.Discounts` but without the `usage` field, * which is not applicable to flat fee charges. */ export interface ChargeFlatFeeDiscounts { /** Percentage discount applied to the price (0–100). */ percentage?: number; } /** Remove a rate card from a phase. */ export interface SubscriptionEditRemoveItem { /** Discriminator for the remove-item operation. */ type: 'remove_item'; /** The key of the phase to remove the item from. */ phaseKey: string; /** The key of the item to remove. */ itemKey: string; } /** * Discard any scheduled edits on the current phase, reverting it to its previously * persisted state. */ export interface SubscriptionEditUnscheduleEdit { /** Discriminator for the unschedule-edit operation. */ type: 'unschedule_edit'; } /** * Labels store metadata of an entity that can be used for filtering an entity list * or for searching across entity types. * * Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", * "mesh", "kic", or "\_". */ export type UpdateLabels = Record; /** * Request to reconcile the app's webhook events with the latest supported event * set. */ export interface AppReconcileWebhookEventsActionRequest { /** The action to execute. */ actionType: 'reconcile_webhook_events'; } /** Model for installing an app from the catalog with an API key. */ export interface InstallAppStripeWithApiKey { /** Type of the app. */ type: 'stripe'; /** Name of the app. */ name: string; /** * If true, a billing profile will be created for the app. The Stripe app will be * also set as the default billing profile if the current default is a Sandbox app. */ createBillingProfile: boolean; /** API key for the app. */ apiKey: string; } /** Base model for installing an app from the catalog. */ export interface InstallAppSandbox { /** Type of the app. */ type: 'sandbox'; /** Name of the app. */ name: string; /** * If true, a billing profile will be created for the app. The Stripe app will be * also set as the default billing profile if the current default is a Sandbox app. */ createBillingProfile: boolean; } /** Model for installing an External Invoicing app from the catalog. */ export interface InstallAppExternalInvoicing { /** Type of the app. */ type: 'external_invoicing'; /** Name of the app. */ name: string; /** * If true, creates the Auto Collection preset with an OpenMeter supplier in the US * (postal code 94114), without replacing the default profile. */ createBillingProfile: boolean; } /** * BillingWorkflowCollectionAlignmentSubscription specifies the alignment for * collecting the pending line items into an invoice. */ export interface WorkflowCollectionAlignmentSubscription { /** The type of alignment. */ type: 'subscription'; } /** External identifiers for an invoice line item assigned by third-party systems. */ export interface InvoiceLineExternalReferences { /** The ID assigned by the external invoicing app. */ invoicingId?: string; } /** * Invoice-level invoicing settings. * * A subset of BillingWorkflowInvoicingSettings limited to fields that are * meaningful per-invoice. progressive_billing is omitted as it is a gather-time / * profile-level decision. */ export interface UpdateBillingInvoiceWorkflowInvoicingSettings { /** Whether to automatically issue the invoice after the draft_period has passed. */ autoAdvance: boolean; /** The period for the invoice to be kept in draft status for manual reviews. */ draftPeriod: string; } /** * Payment settings for a billing workflow when the collection method is charge * automatically. */ export interface UpdateBillingWorkflowPaymentChargeAutomaticallySettings { /** The collection method for the invoice. */ collectionMethod: 'charge_automatically'; } /** * Payment settings for a billing workflow when the collection method is send * invoice. */ export interface UpdateBillingWorkflowPaymentSendInvoiceSettings { /** The collection method for the invoice. */ collectionMethod: 'send_invoice'; /** * The period after which the invoice is due. With some payment solutions it's only * applicable for manual collection method. */ dueAfter: string; } /** Free price. */ export interface UpdatePriceFree { /** The type of the price. */ type: 'free'; } /** LLM Provider */ export interface LlmCostProvider { /** Identifier of the provider, e.g., "openai", "anthropic". */ id: string; /** Name of the provider, e.g., "OpenAI", "Anthropic". */ name: string; } /** LLM Model */ export interface LlmCostModel { /** Identifier of the model, e.g., "gpt-4", "claude-3-5-sonnet". */ id: string; /** Name of the model, e.g., "GPT-4", "Claude 3.5 Sonnet". */ name: string; } /** Validation errors providing detailed description of the issue. */ export interface ProductCatalogValidationError { /** Machine-readable error code. */ code: string; /** Human-readable description of the error. */ message: string; /** Additional structured context. */ attributes?: Record; /** The path to the field. */ field: string; } /** List of customer identifiers to evaluate access for. */ export interface EntitlementAccessQueryRequestCustomers { /** * Each entry can be a customer `key` or a usage-attribution subject `key`. * Identifiers that cannot be resolved to a customer are reported in the response * `errors` array. */ keys: string[]; } /** * Optional list of feature keys to evaluate access for. If omitted, all features * available in the organization are returned. Providing this list is recommended * to reduce the response size and the load on the backend services. */ export interface EntitlementAccessQueryRequestFeatures { /** List of feature keys to evaluate access for. */ keys: string[]; } /** * The response the recipient returned for a delivery attempt. For webhook channels * this is the HTTP response. */ export interface NotificationEventDeliveryAttemptResponse { /** * The HTTP status code returned by the recipient. Absent when no response was * received. */ statusCode?: number; /** The response body returned by the recipient. Empty when no body was received. */ body: string; /** How long the delivery attempt took, in milliseconds. */ durationMs: bigint; /** The URL the event was delivered to. Only set for webhook channels. */ url?: string; } /** * A query filter for an integer attribute. Operators are mutually exclusive, only * one operator is allowed at a time. */ export interface QueryFilterInteger { /** The attribute equals the provided value. */ eq?: number; /** The attribute does not equal the provided value. */ neq?: number; /** The attribute is one of the provided values. */ in?: number[]; /** The attribute is not one of the provided values. */ nin?: number[]; /** The attribute is greater than the provided value. */ gt?: number; /** The attribute is greater than or equal to the provided value. */ gte?: number; /** The attribute is less than the provided value. */ lt?: number; /** The attribute is less than or equal to the provided value. */ lte?: number; /** Combines the provided filters with a logical AND. */ and?: QueryFilterInteger[]; /** Combines the provided filters with a logical OR. */ or?: QueryFilterInteger[]; } /** * A query filter for a float attribute. Operators are mutually exclusive, only one * operator is allowed at a time. */ export interface QueryFilterFloat { /** The attribute is greater than the provided value. */ gt?: number; /** The attribute is greater than or equal to the provided value. */ gte?: number; /** The attribute is less than the provided value. */ lt?: number; /** The attribute is less than or equal to the provided value. */ lte?: number; /** Combines the provided filters with a logical AND. */ and?: QueryFilterFloat[]; /** Combines the provided filters with a logical OR. */ or?: QueryFilterFloat[]; } /** * A query filter for a boolean attribute. Operators are mutually exclusive, only * one operator is allowed at a time. */ export interface QueryFilterBoolean { /** The attribute equals the provided value. */ eq?: boolean; } /** Page pagination query. */ export interface PagePaginationQuery { /** Determines which page of the collection to retrieve. */ page?: { size?: number; number?: number; }; } /** * Public labels store information about an entity that can be used for filtering a * list of objects. */ export type PublicLabels = Record; /** * The system account access token is meant for automations and integrations that * are not directly associated with a human identity. */ export interface SystemAccountAccessToken { /** Http authentication */ type: 'http'; /** bearer auth scheme */ scheme: 'Bearer'; } /** * The personal access token is meant to be used as an alternative to basic-auth * when accessing Konnect via APIs. */ export interface PersonalAccessToken { /** Http authentication */ type: 'http'; /** bearer auth scheme */ scheme: 'Bearer'; } /** * The Konnect access token is meant to be used by the Konnect dashboard and the * decK CLI authenticate with. */ export interface KonnectAccessToken { /** Http authentication */ type: 'http'; /** bearer auth scheme */ scheme: 'Bearer'; } /** Meter update request. */ export interface UpdateMeterRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name?: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * Named JSONPath expressions to extract the group by values from the event data. * * Keys must be unique and consist only alphanumeric and underscore characters. */ dimensions?: Record; } /** Stripe customer data. */ export interface AppCustomerDataStripe { /** The Stripe customer ID used. */ customerId?: string; /** The Stripe default payment method ID. */ defaultPaymentMethodId?: string; /** Labels for this Stripe integration on the customer. */ labels?: Labels; } /** External invoicing customer data. */ export interface AppCustomerDataExternalInvoicing { /** Labels for this external invoicing integration on the customer. */ labels?: Labels; } /** Cost basis resolved at the charge's full service period start. */ export interface CreateChargeCostBasisDynamic { /** Discriminator selecting the cost basis mode. */ type: 'dynamic'; /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency: string; } /** Cost basis resolved at the charge's full service period start. */ export interface ChargeCostBasisDynamic { /** Discriminator selecting the cost basis mode. */ type: 'dynamic'; /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency: string; } /** Currency describes a currency supported by the billing system. */ export interface CurrencyFiat { /** The type of the currency. */ type: 'fiat'; /** * The name of the currency. It should be a human-readable string that represents * the name of the currency, such as "US Dollar" or "Euro". */ name: string; /** * The symbol of the currency. It should be a string that represents the symbol of * the currency, such as "$" for US Dollar or "€" for Euro. */ symbol?: string; /** * The precision of the currency. It should be a number that represents the number * of decimal places used for the currency, such as 2 for US Dollar or Euro. */ precision: number; /** * The decimal mark for the currency. It should be a string that represents the * decimal mark of the currency, such as "." for US Dollar or "," for Euro. */ decimalMark: string; /** * The thousand separator for the currency. It should be a string that represents * the thousand separator of the currency, such as "," for US Dollar or "." for * Euro. */ thousandSeparator: string; code: string; } /** Filter options for listing cost bases. */ export interface ListCostBasesParamsFilter { /** Filter cost bases by fiat currency code. */ fiatCode?: string; } /** CurrencyCustom create request. */ export interface CreateCurrencyCustomRequest { /** * The name of the currency. It should be a human-readable string that represents * the name of the currency, such as "US Dollar" or "Euro". */ name: string; /** * The symbol of the currency. It should be a string that represents the symbol of * the currency, such as "$" for US Dollar or "€" for Euro. */ symbol?: string; /** * The precision of the currency. It should be a number that represents the number * of decimal places used for the currency, such as 2 for US Dollar or Euro. */ precision: number; /** * The decimal mark for the currency. It should be a string that represents the * decimal mark of the currency, such as "." for US Dollar or "," for Euro. */ decimalMark: string; /** * The thousand separator for the currency. It should be a string that represents * the thousand separator of the currency, such as "," for US Dollar or "." for * Euro. */ thousandSeparator: string; code: string; } /** * Balance details of a metered entitlement at the evaluation time, which is the * `at` query parameter when given and the current time otherwise. */ export interface EntitlementAccessValue { /** * The remaining balance of the entitlement in the usage period at the evaluation * time. */ balance: string; /** The usage recorded in the usage period at the evaluation time. */ usage: string; /** * The usage exceeding the available balance in the usage period at the evaluation * time. */ overage: string; /** * The total amount granted and available to the entitlement at the evaluation * time. */ totalAvailableGrantAmount: string; /** The remaining balance of each grant, keyed by grant ID. */ grantBalances: Record; } /** * Usage granted automatically after each reset of a metered entitlement. The * balance returns to `amount` after every reset. */ export interface EntitlementIssueAfterReset { /** The amount granted after each reset, in the feature's unit. */ amount: string; /** * The priority of the grant created after each reset. Lower values have higher * priority. */ priority: number; } /** Entitlement balance at the boundaries of a burndown segment. */ export interface EntitlementBurndownBalance { /** The balance at the start of the segment. */ start: string; /** The balance at the end of the segment. */ end: string; } /** Grant balances at the boundaries of a burndown segment, keyed by grant ID. */ export interface EntitlementBurndownGrantBalances { /** The balance of each active grant at the start of the segment. */ start: Record; /** The balance of each active grant at the end of the segment. */ end: Record; } /** Cost basis with an explicit conversion rate supplied with the charge. */ export interface CreateChargeCostBasisManual { /** Discriminator selecting the cost basis mode. */ type: 'manual'; /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency?: string; /** Fiat amount per one unit of the custom currency. */ rate: string; } /** Cost basis with an explicit conversion rate supplied with the charge. */ export interface ChargeCostBasisManual { /** Discriminator selecting the cost basis mode. */ type: 'manual'; /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency?: string; /** Fiat amount per one unit of the custom currency. */ rate: string; } /** Flat price. */ export interface PriceFlat { /** The type of the price. */ type: 'flat'; /** The amount of the flat price. */ amount: string; } /** * Unit price. * * Charges a fixed rate per billing unit. When UnitConfig is present on the object, * billing units are the converted quantities (e.g. GB instead of bytes). */ export interface PriceUnit { /** The type of the price. */ type: 'unit'; /** The amount of the unit price. */ amount: string; } /** * Spend commitments for a usage-based price. The customer is committed to spend at * least the minimum amount and at most the maximum amount. */ export interface SpendCommitments { /** The customer is committed to spend at least the amount. */ minimumAmount?: string; /** The customer is limited to spend at most the amount. */ maximumAmount?: string; } /** Discount configuration for a rate card. */ export interface RateCardDiscounts { /** Percentage discount applied to the price (0–100). */ percentage?: number; /** * Number of usage units granted free before billing starts. Only applies to * usage-based lines (not flat fees). Usage is treated as zero until this amount is * exhausted. */ usage?: string; } /** Totals contains the summaries of all calculations for a billing resource. */ export interface Totals { /** The total value of the resource before taxes, discounts and commitments. */ amount: string; /** The total tax amount applied to the resource. */ taxesTotal: string; /** The total tax amount already included in the resource amount. */ taxesInclusiveTotal: string; /** The total tax amount added on top of the resource amount. */ taxesExclusiveTotal: string; /** The total amount contributed by additional charges. */ chargesTotal: string; /** The total amount deducted through discounts. */ discountsTotal: string; /** The total amount deducted through credits before taxes are applied. */ creditsTotal: string; /** The final total value of the resource after taxes, discounts and commitments. */ total: string; } /** A credit allocation applied to a charge realization detailed line. */ export interface ChargeRealizationDetailedLineCreditApplied { /** The monetary amount credited. */ amount: string; /** Human-readable description of the credit allocation. */ description?: string; /** The ID of the credit realization (allocation) this credit was applied from. */ creditRealizationId: string; } /** A discount applied to a charge realization detailed line. */ export interface ChargeRealizationAmountDiscount { /** The amount of the discount applied to the charge. */ amount: string; /** The reason for the discount applied to the charge. */ reason: string; /** Optional human-readable description of the discount. */ description?: string; /** * The discount amount applied to the charge, rounded to the nearest cent (or * currency equivalent) and adjusted to compensate for rounding errors across * multiple discounted detail lines. */ roundingAmount?: string; /** Unique reference ID of the discount applied to the charge. */ childUniqueReferenceId: string; } /** A fixed per-unit cost amount. */ export interface FeatureManualUnitCost { /** The type discriminator for manual unit cost. */ type: 'manual'; /** Fixed per-unit cost amount in USD. */ amount: string; } /** Resolved per-token pricing from the LLM cost database. */ export interface FeatureLlmUnitCostPricing { /** Cost per input token in USD. */ inputPerToken: string; /** Cost per output token in USD. */ outputPerToken: string; /** Cost per cache read token in USD. */ cacheReadPerToken?: string; /** Cost per reasoning token in USD. */ reasoningPerToken?: string; /** Cost per cache write token in USD. */ cacheWritePerToken?: string; } /** A credit allocation applied to an invoice line item. */ export interface InvoiceLineCreditsApplied { /** The monetary amount credited. */ amount: string; /** Optional human-readable description of the credit allocation. */ description?: string; } /** * Usage quantity details on an invoice line item when UnitConfig is in effect. * * Provides the full audit trail from raw meter output to the invoiced amount. */ export interface InvoiceUsageQuantityDetail { /** The raw quantity as reported by the meter (native units). */ rawQuantity: string; /** * The net billed quantity for this line in converted units, after rounding and any * usage discounts. */ invoicedQuantity: string; /** The display unit label (e.g., "GB", "hours", "M tokens"). */ displayUnit?: string; } /** Flat price. */ export interface UpdatePriceFlat { /** The type of the price. */ type: 'flat'; /** The amount of the flat price. */ amount: string; } /** * Unit price. * * Charges a fixed rate per billing unit. When UnitConfig is present on the object, * billing units are the converted quantities (e.g. GB instead of bytes). */ export interface UpdatePriceUnit { /** The type of the price. */ type: 'unit'; /** The amount of the unit price. */ amount: string; } /** Discount configuration for a rate card. */ export interface UpdateDiscounts { /** Percentage discount applied to the price (0–100). */ percentage?: number; /** * Number of usage units granted free before billing starts. Only applies to * usage-based lines (not flat fees). Usage is treated as zero until this amount is * exhausted. */ usage?: string; } /** Token pricing for an LLM model, denominated per token. */ export interface LlmCostModelPricing { /** Input price per token (USD). */ inputPerToken: string; /** Output price per token (USD). */ outputPerToken: string; /** Cache read price per token (USD). */ cacheReadPerToken?: string; /** Cache write price per token (USD). */ cacheWritePerToken?: string; /** Reasoning output price per token (USD). */ reasoningPerToken?: string; } /** Monetary amount in a specific fiat currency. */ export interface FiatCurrencyAmount { amount: string; currency: string; } /** * A query filter for a numeric attribute. Operators are mutually exclusive, only * one operator is allowed at a time. */ export interface QueryFilterNumeric { /** The attribute is greater than the provided value. */ gt?: string; /** The attribute is greater than or equal to the provided value. */ gte?: string; /** The attribute is less than the provided value. */ lt?: string; /** The attribute is less than or equal to the provided value. */ lte?: string; /** Combines the provided filters with a logical AND. */ and?: QueryFilterNumeric[]; /** Combines the provided filters with a logical OR. */ or?: QueryFilterNumeric[]; } /** Cursor page query. */ export interface CursorPaginationQuery { page?: CursorPaginationQueryPage; } /** Filter options for listing meters. */ export interface ListMetersParamsFilter { /** Filter meters by key. */ key?: StringFieldFilter; /** Filter meters by name. */ name?: StringFieldFilter; } /** Filter options for listing LLM cost prices. */ export interface ListLlmCostPricesParamsFilter { /** Filter by provider. e.g. ?filter[provider][eq]=openai */ provider?: StringFieldFilter; /** Filter by model ID. e.g. ?filter[model_id][eq]=gpt-4 */ modelId?: StringFieldFilter; /** Filter by model name. e.g. ?filter[model_name][contains]=gpt */ modelName?: StringFieldFilter; /** Filter by currency code. e.g. ?filter[currency][eq]=USD */ currency?: StringFieldFilter; /** Filter by source. e.g. ?filter[source][eq]=system */ source?: StringFieldFilter; } /** * Filters on the resource's `labels` field. * * The schema is a map keyed by the label name; each value is a * `StringFieldFilter`. Both deepObject forms are accepted: * `filter[labels][key]=value` (nested) and `filter[labels.key]=value` * (dot-notation). */ export type LabelsFieldFilter = Record; /** Customer reference. */ export interface CustomerReference { id: string; } /** Billing profile reference. */ export interface ProfileReference { /** The ID of the billing profile. */ id: string; } /** Feature reference. */ export interface FeatureReference { id: string; } /** Usage taken from a single grant. */ export interface EntitlementGrantUsage { /** The ID of the grant. */ grantId: string; /** The usage taken from the grant. */ usage: string; } /** Cost basis pinned to a specific cost basis resource of the custom currency. */ export interface CreateChargeCostBasisPinned { /** Discriminator selecting the cost basis mode. */ type: 'pinned'; /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency: string; /** ID of the custom currency's cost basis resource to pin. */ costBasisId: string; } /** TaxCode reference. */ export interface CreateResourceReference { id: string; } /** Cost basis pinned to a specific cost basis resource of the custom currency. */ export interface ChargeCostBasisPinned { /** Discriminator selecting the cost basis mode. */ type: 'pinned'; /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency: string; /** ID of the custom currency's cost basis resource to pin. */ costBasisId: string; } /** TaxCode reference. */ export interface TaxCodeReference { id: string; } /** Invoice references for the grant. */ export interface CreditGrantInvoiceReference { /** Identifier of the invoice associated with the grant. */ id?: string; /** Identifier of the invoice line associated with the grant. */ line?: { id: string; }; } /** CurrencyCustom reference. */ export interface CurrencyCustomReference { id: string; } /** A cost basis pinned to a custom-currency pair for the subscription. */ export interface SubscriptionCostBasisPin { /** The managed custom currency ID. */ customCurrencyId: string; /** The fiat currency in which the subscription is invoiced. */ invoiceCurrency: string; /** The pinned cost basis resource ID. */ costBasisId: string; } /** * Subscription reference represents a reference to the specific subscription item * this entity represents. */ export interface SubscriptionReference { /** The ID of the subscription. */ id: string; /** * The display name of the subscription. * * Only populated where the referencing endpoint documents a `subscription` expand * that resolves it. */ name?: string; /** The phase of the subscription. */ phase: { id: string; item: { id: string; }; }; } /** App reference. */ export interface AppReference { /** The ID of the app. */ id: string; } /** ChargeRealizationInvoice reference. */ export interface ChargeRealizationInvoiceReference { id: string; } /** Addon reference. */ export interface AddonReference { id: string; } /** Reference to a charge associated with an invoice line. */ export interface ChargeReference { /** Unique identifier for the charge. */ id: string; } /** TaxCode reference. */ export interface UpdateResourceReference { id: string; } /** NotificationChannel reference. */ export interface NotificationChannelReference { id: string; } /** A reference to the feature of an entitlement notification event. */ export interface NotificationEventFeatureReference { /** The unique identifier of the feature. */ id: string; /** The immutable key of the feature. */ key: string; } /** A reference to the invoice of an invoice notification event. */ export interface NotificationEventInvoiceReference { /** The unique identifier of the invoice. */ id: string; /** The human-readable invoice number. */ number: string; } /** Request body for resending a notification event. */ export interface ResendBillingNotificationEventRequest { /** * The channels to resend the event to. When omitted or empty, the event is resent * to every enabled channel of the rule. Channels not targeted by the rule or * disabled are rejected. */ channels?: string[]; } /** Customer reference. */ export interface BillingCustomerReference { /** The ID of the customer. */ id: string; /** * The display name of the customer. * * Only populated where the referencing endpoint documents a `customer` expand that * resolves it. */ name?: string; } /** * The feature associated with a charge. * * `key` is always present and is set at charge creation time. `id` and `name` are * only resolved with the `feature` expand, since resolving them requires an * additional lookup against the feature catalog. */ export interface ChargeFeature { /** The ID of the feature. */ id: string; /** * The key of the feature. * * Requires the `feature` expand. */ key?: string; /** * The display name of the feature. * * Requires the `feature` expand. */ name?: string; } /** Metering event following the CloudEvents specification. */ export interface Event { /** Identifies the event. */ id: string; /** Identifies the context in which an event happened. */ source: string; /** The version of the CloudEvents specification which the event uses. */ specversion: string; /** * Contains a value describing the type of event related to the originating * occurrence. */ type: string; /** * Content type of the CloudEvents data value. Only the value "application/json" is * allowed over HTTP. */ datacontenttype?: 'application/json' | null; /** Identifies the schema that data adheres to. */ dataschema?: string | null; /** * Describes the subject of the event in the context of the event producer * (identified by source). */ subject: string; /** Timestamp of when the occurrence happened. Must adhere to RFC 3339. */ time?: Date | null; /** The event payload. Optional, if present it must be a JSON object. */ data?: Record | null; } /** A row in the result of a meter query. */ export interface MeterQueryRow { /** The aggregated value. */ value: string; /** The start of the time bucket the value is aggregated over. */ from: Date; /** The end of the time bucket the value is aggregated over. */ to: Date; /** * The dimensions the value is aggregated over. `subject` and `customer_id` are * reserved dimensions. */ dimensions: Record; } /** * Result of creating a * [Stripe Customer Portal Session](https://docs.stripe.com/api/customer_portal/sessions/object). * * Contains all the information needed to redirect the customer to the Stripe * Customer Portal. */ export interface AppStripeCreateCustomerPortalSessionResult { /** * The ID of the customer portal session. * * See: * https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-id */ id: string; /** The ID of the stripe customer. */ stripeCustomerId: string; /** * Configuration used to customize the customer portal. * * See: * https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-configuration */ configurationId: string; /** * Livemode. * * See: * https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-livemode */ livemode: boolean; /** * Created at. * * See: * https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-created */ createdAt: Date; /** * Return URL. * * See: * https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-return_url */ returnUrl: string; /** * The IETF language tag of the locale customer portal is displayed in. * * See: * https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-locale */ locale: string; /** * The URL to redirect the customer to after they have completed their requested * actions. */ url: string; } /** * A period with defined start and end dates. * * The period is always inclusive at the start and exclusive at the end. */ export interface ClosedPeriod { /** * The start of the period. * * The period is inclusive at the start. */ from: Date; /** * The end of the period. * * The period is exclusive at the end. */ to: Date; } /** Request body for resetting the usage of a metered entitlement. */ export interface ResetCustomerEntitlementUsageRequest { /** * The time the reset takes effect. Defaults to the current time and cannot be in * the future. Truncated to the minute. */ effectiveAt?: Date; /** * Whether the usage period anchor is kept. When false, the anchor moves to * `effective_at`. */ retainAnchor: boolean; /** * Whether overage carries over into the new usage period. Defaults to the * entitlement's own setting. */ preserveOverage?: boolean; } /** * Fiat conversion rate a custom-currency charge is invoiced at. Present once the * cost basis is resolved; dynamic cost bases are exposed only after the service * period has started. */ export interface ChargeResolvedCostBasis { /** The fiat currency the charge amount is converted into for invoicing. */ fiatCurrency: string; /** Fiat amount per one unit of the custom currency. */ rate: string; /** * ID of the custom currency's cost basis resource the rate was taken from. Absent * for manual cost bases. */ costBasisId?: string; /** When the rate was resolved. */ resolvedAt: Date; } /** A subscription add-on event. */ export interface SubscriptionAddonTimelineSegment { /** An ISO-8601 timestamp representation of the cadence start of the resource. */ activeFrom: Date; /** An ISO-8601 timestamp representation of the cadence end of the resource. */ activeTo?: Date; /** The quantity of the add-on for the given period. */ quantity: number; } /** * A period with defined start and end dates. * * The period is always inclusive at the start and exclusive at the end. */ export interface UpdateClosedPeriod { /** * The start of the period. * * The period is inclusive at the start. */ from: Date; /** * The end of the period. * * The period is exclusive at the end. */ to: Date; } /** Describes currency basis supported by billing system. */ export interface CostBasis { id: string; /** The fiat currency code for the cost basis. */ fiatCode: string; /** The cost rate for the currency. */ rate: string; /** * An ISO-8601 timestamp representation of the date from which the cost basis is * effective. If not provided, it will be effective immediately and will be set to * `now` by the system. */ effectiveFrom?: Date; /** * An ISO-8601 timestamp representation of the date until which the cost basis is * effective. If provided, it must be later than `effective_from`. If not provided, * it remains effective until superseded. */ effectiveTo?: Date; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; } /** CostBasis create request. */ export interface CreateCostBasisRequest { /** The fiat currency code for the cost basis. */ fiatCode: string; /** The cost rate for the currency. */ rate: string; /** * An ISO-8601 timestamp representation of the date from which the cost basis is * effective. If not provided, it will be effective immediately and will be set to * `now` by the system. */ effectiveFrom?: Date; /** * An ISO-8601 timestamp representation of the date until which the cost basis is * effective. If provided, it must be later than `effective_from`. If not provided, * it remains effective until superseded. */ effectiveTo?: Date; } /** A row in the result of a feature cost query. */ export interface FeatureCostQueryRow { /** The metered usage value for the period. */ usage: string; /** * The computed cost amount (usage × unit cost). Null when pricing is not available * for the given combination of dimensions. */ cost: string | null; /** The currency code of the cost amount. */ currency: string; /** * Detail message when cost amount is null, explaining why the cost could not be * resolved. */ detail?: string; /** The start of the time bucket the value is aggregated over. */ from: Date; /** The end of the time bucket the value is aggregated over. */ to: Date; /** * The dimensions the value is aggregated over. `subject` and `customer_id` are * reserved dimensions. */ dimensions: Record; } /** Represents common fields of resources. */ export interface Resource { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; } /** Represents common fields of immutable resources. */ export interface ResourceImmutable { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; } /** * A query filter for a time attribute. Operators are mutually exclusive, only one * operator is allowed at a time. */ export interface QueryFilterDateTime { /** The attribute is greater than the provided value. */ gt?: Date; /** The attribute is greater than or equal to the provided value. */ gte?: Date; /** The attribute is less than the provided value. */ lt?: Date; /** The attribute is less than or equal to the provided value. */ lte?: Date; /** Combines the provided filters with a logical AND. */ and?: QueryFilterDateTime[]; /** Combines the provided filters with a logical OR. */ or?: QueryFilterDateTime[]; } /** Cursor pagination metadata. */ export interface CursorMeta { /** Page metadata. */ page: CursorMetaPage; } /** A parameter that failed a standard validation rule. */ export interface InvalidParameterStandard { /** The name of the field that failed validation. */ field: string; /** The validation rule that was violated. */ rule?: 'required' | 'is_array' | 'is_base64' | 'is_boolean' | 'is_date_time' | 'is_integer' | 'is_null' | 'is_number' | 'is_object' | 'is_string' | 'is_uuid' | 'is_fqdn' | 'is_arn' | 'unknown_property' | 'missing_reference' | 'is_label' | 'matches_regex' | 'invalid' | 'is_supported_network_availability_zone_list' | 'is_supported_network_cidr_block' | 'is_supported_provider_region' | 'type'; /** The part of the request the field came from (e.g. `body`, `query`). */ source?: string; /** A human readable explanation of why the field failed validation. */ reason: string; } /** A parameter that failed a minimum-length (or minimum-value) validation rule. */ export interface InvalidParameterMinimumLength { /** The name of the field that failed validation. */ field: string; /** The minimum validation rule that was violated. */ rule: 'min_length' | 'min_digits' | 'min_lowercase' | 'min_uppercase' | 'min_symbols' | 'min_items' | 'min'; /** The minimum allowed value or length. */ minimum: number; /** The part of the request the field came from (e.g. `body`, `query`). */ source?: string; /** A human readable explanation of why the field failed validation. */ reason: string; } /** A parameter that failed a maximum-length (or maximum-value) validation rule. */ export interface InvalidParameterMaximumLength { /** The name of the field that failed validation. */ field: string; /** The maximum validation rule that was violated. */ rule: 'max_length' | 'max_items' | 'max'; /** The maximum allowed value or length. */ maximum: number; /** The part of the request the field came from (e.g. `body`, `query`). */ source?: string; /** A human readable explanation of why the field failed validation. */ reason: string; } /** A parameter whose value was not one of the allowed choices. */ export interface InvalidParameterChoiceItem { /** The name of the field that failed validation. */ field: string; /** The enum validation rule that was violated. */ rule: 'enum'; /** A human readable explanation of why the field failed validation. */ reason: string; /** The allowed choices for the field. */ choices: unknown[]; /** The part of the request the field came from (e.g. `body`, `query`). */ source?: string; } /** A parameter that failed a dependent-fields validation rule. */ export interface InvalidParameterDependentItem { /** The name of the field that failed validation. */ field: string; /** The dependent-fields validation rule that was violated. */ rule: 'dependent_fields'; /** A human readable explanation of why the field failed validation. */ reason: string; /** The fields that this field depends on. */ dependents: unknown[]; /** The part of the request the field came from (e.g. `body`, `query`). */ source?: string; } /** Unauthorized. */ export interface Unauthorized extends BaseError { } /** Forbidden. */ export interface Forbidden extends BaseError { } /** Not Found. */ export interface NotFound extends BaseError { } /** Gone. */ export interface Gone extends BaseError { } /** Conflict. */ export interface Conflict extends BaseError { } /** Payload Too Large. */ export interface PayloadTooLarge extends BaseError { } /** Unsupported Media Type. */ export interface UnsupportedMediaType extends BaseError { } /** Unprocessable Content. */ export interface UnprocessableContent extends BaseError { } /** Too Many Requests. */ export interface TooManyRequests extends BaseError { } /** Internal Server Error. */ export interface Internal extends BaseError { } /** Not Implemented. */ export interface NotImplemented extends BaseError { } /** Not Available. */ export interface NotAvailable extends BaseError { } /** * A reference to the plan a subscription was created from, pinned to an exact * revision. */ export interface SubscriptionPlanReference { /** The plan ID (exact revision). */ id: string; /** The plan key. References the plan across versions. */ key: string; /** The plan version. */ version: number; } /** PlanAddon upsert request. */ export interface UpsertPlanAddonRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The key of the plan phase from which the add-on becomes available for purchase. */ fromPlanPhase: string; /** * The maximum number of times the add-on can be purchased for the plan. For * single-instance add-ons this field must be omitted. For multi-instance add-ons * when omitted, unlimited quantity can be purchased. */ maxQuantity?: number; } /** Represents common fields of resources with a key. */ export interface ResourceWithKey { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; } /** Meter create request. */ export interface CreateMeterRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** The aggregation type to use for the meter. */ aggregation: MeterAggregation; /** The event type to include in the aggregation. */ eventType: string; /** * The date since the meter should include events. Useful to skip old events. If * not specified, all historical events are included. */ eventsFrom?: Date; /** * JSONPath expression to extract the value from the ingested event's data * property. * * The ingested value for sum, avg, min, and max aggregations is a number or a * string that can be parsed to a number. * * For unique_count aggregation, the ingested value must be a string. For count * aggregation the value_property is ignored. */ valueProperty?: string; /** * Named JSONPath expressions to extract the group by values from the event data. * * Keys must be unique and consist only alphanumeric and underscore characters. */ dimensions?: Record; } /** A meter is a configuration that defines how to match and aggregate events. */ export interface Meter { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; /** The aggregation type to use for the meter. */ aggregation: MeterAggregation; /** The event type to include in the aggregation. */ eventType: string; /** * The date since the meter should include events. Useful to skip old events. If * not specified, all historical events are included. */ eventsFrom?: Date; /** * JSONPath expression to extract the value from the ingested event's data * property. * * The ingested value for sum, avg, min, and max aggregations is a number or a * string that can be parsed to a number. * * For unique_count aggregation, the ingested value must be a string. For count * aggregation the value_property is ignored. */ valueProperty?: string; /** * Named JSONPath expressions to extract the group by values from the event data. * * Keys must be unique and consist only alphanumeric and underscore characters. */ dimensions?: Record; } /** Pagination metadata. */ export interface PaginatedMeta { /** Page metadata. */ page: PageMeta; } /** * A query filter for an item in a string map attribute. Operators are mutually * exclusive, only one operator is allowed at a time. */ export interface QueryFilterStringMapItem { /** The attribute exists. */ exists?: boolean; /** The attribute equals the provided value. */ eq?: string; /** The attribute does not equal the provided value. */ neq?: string; /** The attribute is one of the provided values. */ in?: string[]; /** The attribute is not one of the provided values. */ nin?: string[]; /** The attribute contains the provided value. */ contains?: string; /** The attribute does not contain the provided value. */ ncontains?: string; /** Combines the provided filters with a logical AND. */ and?: QueryFilterString[]; /** Combines the provided filters with a logical OR. */ or?: QueryFilterString[]; } /** Customer reference by external key. */ export interface CustomerKeyReference { /** The external key of the customer. */ key: string; } /** * Mapping to attribute metered usage to the customer. One customer can have zero * or more subjects, but one subject can only belong to one customer. */ export interface CustomerUsageAttribution { /** * The subjects that are attributed to the customer. Can be empty when no usage * event subjects are associated with the customer. */ subjectKeys: string[]; } /** * Mapping to attribute metered usage to the customer. One customer can have zero * or more subjects, but one subject can only belong to one customer. */ export interface UpdateCustomerUsageAttribution { /** * The subjects that are attributed to the customer. Can be empty when no usage * event subjects are associated with the customer. */ subjectKeys: string[]; } /** Address */ export interface Address { /** * Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) * alpha-2 format. */ country?: string; /** Postal code. */ postalCode?: string; /** State or province. */ state?: string; /** City. */ city?: string; /** First line of the address. */ line1?: string; /** Second line of the address. */ line2?: string; /** Phone number. */ phoneNumber?: string; } /** Address */ export interface UpdateAddress { /** * Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) * alpha-2 format. */ country?: string; /** Postal code. */ postalCode?: string; /** State or province. */ state?: string; /** City. */ city?: string; /** First line of the address. */ line1?: string; /** Second line of the address. */ line2?: string; /** Phone number. */ phoneNumber?: string; } /** Controls which customer fields can be updated by the checkout session. */ export interface AppStripeCreateCheckoutSessionCustomerUpdate { /** * Whether to save the billing address to customer.address. * * Defaults to "never". */ address: 'auto' | 'never'; /** * Whether to save the customer name to customer.name. * * Defaults to "never". */ name: 'auto' | 'never'; /** * Whether to save shipping information to customer.shipping. * * Defaults to "never". */ shipping: 'auto' | 'never'; } /** Payment method reuse agreement configuration. */ export interface AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement { /** Position and visibility of the payment method reuse agreement. */ position?: 'auto' | 'hidden'; } /** Tax ID collection configuration for checkout sessions. */ export interface AppStripeCreateCheckoutSessionTaxIdCollection { /** * Enable tax ID collection during checkout. * * Defaults to false. */ enabled: boolean; /** * Whether tax ID collection is required. * * Defaults to "never". */ required: 'if_supported' | 'never'; } /** * Result of creating a Stripe Checkout Session. * * Contains all the information needed to redirect customers to the checkout or * initialize an embedded checkout flow. */ export interface AppStripeCreateCheckoutSessionResult { /** The customer ID in the billing system. */ customerId: string; /** The Stripe customer ID. */ stripeCustomerId: string; /** The Stripe checkout session ID. */ sessionId: string; /** The setup intent ID created for collecting the payment method. */ setupIntentId: string; /** * Client secret for initializing Stripe.js on the client side. * * Required for embedded checkout sessions. See: * https://docs.stripe.com/payments/checkout/custom-success-page */ clientSecret?: string; /** * The client reference ID provided in the request. * * Useful for reconciling the session with your internal systems. */ clientReferenceId?: string; /** Customer's email address if provided to Stripe. */ customerEmail?: string; /** Currency code for the checkout session. */ currency?: string; /** Timestamp when the checkout session was created. */ createdAt: Date; /** Timestamp when the checkout session will expire. */ expiresAt?: Date; /** Metadata attached to the checkout session. */ metadata?: Record; /** * The status of the checkout session. * * See: * https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-status */ status?: string; /** URL to redirect customers to the checkout page (for hosted mode). */ url?: string; /** * Mode of the checkout session. * * Currently only "setup" mode is supported for collecting payment methods. */ mode: 'setup'; /** The cancel URL where customers are redirected if they cancel. */ cancelUrl?: string; /** The success URL where customers are redirected after completion. */ successUrl?: string; /** The return URL for embedded sessions after authentication. */ returnUrl?: string; } /** * Request to create a Stripe Customer Portal Session for the customer. * * Useful to redirect the customer to the Stripe Customer Portal to manage their * payment methods, change their billing address and access their invoice history. * Only returns URL if the customer billing profile is linked to a stripe app and * customer. */ export interface CustomerStripeCreateCustomerPortalSessionRequest { /** Options for configuring the Stripe Customer Portal Session. */ stripeOptions: AppStripeCreateCustomerPortalSessionOptions; } /** Entitlement access check result. */ export interface EntitlementAccessCheckResult { /** * Whether the customer has access to the feature. Always true for `boolean` and * `static` entitlements. Depends on balance for `metered` entitlements. */ hasAccess: boolean; /** * Only available for static entitlements. Config is the JSON parsable * configuration of the entitlement. Useful to describe per customer configuration. */ config?: string; /** * The type of the entitlement. * * If not provided, the feature has no entitlement defined (has access is always * false in this case) */ type?: 'metered' | 'static' | 'boolean'; } /** * Recurring period input. The anchor is optional; the owning resource defines the * default, typically its creation time. */ export interface RecurringPeriodInput { /** The interval duration in ISO 8601 format. */ interval: string; /** A date-time anchor to base the recurring period on. */ anchor?: Date; } /** Recurring period with an anchor and an interval. */ export interface RecurringPeriod { /** A date-time anchor to base the recurring period on. */ anchor: Date; /** The interval duration in ISO 8601 format. */ interval: string; } /** The entitlement template of a metered entitlement. */ export interface RateCardMeteredEntitlement { /** The type of the entitlement template. */ type: 'metered'; /** * If soft limit is true, the subject can use the feature even if the entitlement * is exhausted; access remains granted. */ isSoftLimit: boolean; /** * The amount of usage granted each usage period, in the feature's unit. Usage is * counted against this allowance and the balance resets every usage period. When * `is_soft_limit` is true the subject keeps access after the limit is reached; * otherwise access is denied once the allowance is exhausted. */ limit?: number; /** * The reset interval of the metered entitlement in ISO8601 format. Defaults to the * billing cadence of the rate card. */ usagePeriod?: string; } /** The definition of a new subscription phase to add via an edit. */ export interface SubscriptionPhaseCreate { /** A locally unique identifier for the phase. */ key: string; /** The name of the phase. */ name: string; /** An optional description of the phase. */ description?: string; /** * The ISO-8601 interval after the subscription start at which the phase begins. * When null, the phase starts immediately after the subscription starts. */ startAfter: string | null; /** * The intended ISO-8601 duration of the phase. Required unless the phase will be * the last phase of the subscription. */ duration?: string; } /** Extend the duration of a phase, shifting later phases by the same amount. */ export interface SubscriptionEditStretchPhase { /** Discriminator for the stretch-phase operation. */ type: 'stretch_phase'; /** The key of the phase to stretch. */ phaseKey: string; /** The ISO-8601 duration to extend the phase by. */ extendBy: string; } /** Filter options for getting a credit balance. */ export interface GetCreditBalanceParamsFilter { /** * Filter credit balance by currency code. When historical custom currencies reuse * a code, each managed currency is returned as a separate balance row. */ currency?: StringFieldFilterExact; /** * Filter credit balance by feature key. Omit to return the total portfolio value. * Use `exists=false` to return only unrestricted balance. */ featureKey?: StringFieldFilter; } /** Filter options for listing plans. */ export interface ListPlansParamsFilter { key?: StringFieldFilter; name?: StringFieldFilter; status?: StringFieldFilterExact; currency?: StringFieldFilterExact; } /** A plan key and an optional version constraint for matching credit grants. */ export interface CreateCreditGrantPlanFilter { /** The plan key in the customer's namespace. */ key: string; /** Omission matches all versions, including future versions. */ version?: CreateVersionFilter; } /** * Request body for updating the external payment settlement status of a credit * grant. */ export interface UpdateCreditGrantExternalSettlementRequest { /** The new payment settlement status. */ status: 'pending' | 'authorized' | 'settled'; } /** A plan key and an optional version constraint for matching credit grants. */ export interface CreditGrantPlanFilter { /** The plan key in the customer's namespace. */ key: string; /** Omission matches all versions, including future versions. */ version?: VersionFilter; } /** Filter options for listing credit grants. */ export interface ListCreditGrantsParamsFilter { /** Filter credit grants by status. */ status?: 'pending' | 'active' | 'expired' | 'voided'; /** Filter credit grants by currency. */ currency?: string; /** Filter credit grants by key. */ key?: StringFieldFilter; } /** A validation issue found while processing a billing resource. */ export interface ValidationIssue { /** Machine-readable error code. */ code: string; /** Human-readable description of the error. */ message: string; /** Additional structured context. */ attributes?: Record; /** Severity of the validation issue. */ severity: 'critical' | 'warning'; /** JSON path to the field that caused the validation issue, if applicable. */ field?: string; /** Component that reported the validation issue, if applicable. */ component?: string; } /** Request body for voiding a credit grant. */ export interface VoidCreditGrantRequest { /** * How voiding adjusts payment state related to the grant. * * Currently only `none` is supported: voiding does not adjust invoices, payment * authorization, settlement, payment intents, or external collection state. If * payment later completes, the original invoiced amount may still be collected. */ paymentAdjustment: 'none'; } /** The pro-rating configuration of a subscription. */ export interface SubscriptionProRatingConfig { /** Whether pro-rating is enabled. */ enabled: boolean; /** How pro-rating is calculated when enabled. */ mode: 'no_proration' | 'prorate_prices'; } /** The proration configuration of the rate card. */ export interface RateCardProrationConfiguration { /** The proration mode of the rate card. */ mode: 'no_proration' | 'prorate_prices'; } /** * Unit conversion configuration. * * Transforms raw metered quantities into billing-ready units before pricing and * entitlement evaluation. Stored with a resource's rating configuration so the * same metered feature can be billed in different units across plans and charges. * * Examples: * * - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, * rounding=ceiling, displayUnit="GB" * - Meter seconds, bill hours: operation=divide, conversionFactor=3600, * rounding=ceiling, displayUnit="hours" * - Cost + 20% margin: operation=multiply, conversionFactor=1.2 * - Bill per million tokens: operation=divide, conversionFactor=1e6, * rounding=ceiling, displayUnit="M" * * v1 equivalents: * * - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + * UnitPrice(amount=1) * - PackagePrice(amount, quantityPerPkg): operation=divide, * conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount) */ export interface UnitConfig { /** The arithmetic operation to apply to the raw metered quantity. */ operation: 'divide' | 'multiply'; /** * The factor used in the conversion operation. * * - For `divide`: `converted = raw / conversionFactor`. * - For `multiply`: `converted = raw × conversionFactor`. * * Must be a positive non-zero value. */ conversionFactor: string; /** * The rounding mode applied to the converted quantity for invoicing. * * Defaults to none (no rounding). Entitlement checks always use the precise * (unrounded) value. */ rounding: 'ceiling' | 'floor' | 'half_up' | 'none'; /** * The number of decimal places to retain after rounding. * * Only meaningful when rounding is not "none". Defaults to 0 (round to whole * numbers). */ precision: number; /** * A human-readable label for the converted unit shown on invoices and in the * customer portal (e.g., "GB", "hours", "M tokens"). * * Optional. When omitted, no unit label is rendered. */ displayUnit?: string; } /** * Identity stores the details required to identify an entity for tax purposes in a * specific country. */ export interface PartyTaxIdentity { /** Normalized tax identification code shown on the original identity document. */ code?: string; } /** * Identity stores the details required to identify an entity for tax purposes in a * specific country. */ export interface UpdateBillingPartyTaxIdentity { /** Normalized tax identification code shown on the original identity document. */ code?: string; } /** * The set of state-transition actions available for an invoice in its current * status. * * A field is present only when that action is permitted from the current state. */ export interface InvoiceAvailableActions { /** Advance the invoice to the next workflow step. */ advance?: InvoiceAvailableActionDetails; /** Approve the invoice for issuance. */ approve?: InvoiceAvailableActionDetails; /** Delete the invoice. */ delete?: InvoiceAvailableActionDetails; /** Retry a failed workflow step. */ retry?: InvoiceAvailableActionDetails; /** Snapshot the current usage quantities. */ snapshotQuantities?: InvoiceAvailableActionDetails; } /** Payment state of a charge realization. */ export interface ChargeRealizationPayment { /** The settlement status of the payment. */ status: 'authorized' | 'settled'; } /** Remove a phase from the subscription. */ export interface SubscriptionEditRemovePhase { /** Discriminator for the remove-phase operation. */ type: 'remove_phase'; /** The key of the phase to remove. */ phaseKey: string; /** The direction to shift surrounding phases to fill the removed phase's span. */ shift: 'next' | 'prev'; } /** Mapping of app types to tax codes. */ export interface TaxCodeAppMapping { /** The app type that the tax code is associated with. */ appType: 'sandbox' | 'stripe' | 'external_invoicing'; /** Tax code. */ taxCode: string; } /** App capability describes a function that an App can perform. */ export interface AppCapability { /** Type of the capability. */ type: 'report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments'; /** Key of the capability. */ key: string; /** Name of the capability. */ name: string; /** Description of the capability. */ description: string; } /** An action the operator should take on an installed app. */ export interface AppAction { /** The action type. */ type: 'reconcile_webhook_events'; /** Human readable explanation of why the action is needed. */ description: string; } /** AppStripe update request. */ export interface UpdateAppStripeRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: UpdateLabels; /** The app type. */ type: 'stripe'; /** The Stripe secret API key used to authenticate API requests. */ secretApiKey?: string; } /** AppSandbox update request. */ export interface UpdateAppSandboxRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: UpdateLabels; /** The app type. */ type: 'sandbox'; } /** AppExternalInvoicing update request. */ export interface UpdateAppExternalInvoicingRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: UpdateLabels; /** The app type. */ type: 'external_invoicing'; /** * Enable draft synchronization hook. * * When enabled, invoices will pause at the draft state and wait for the * integration to call the draft synchronized endpoint before progressing to the * issuing state. This allows the external system to validate and prepare the * invoice data. * * When disabled, invoices automatically progress through the draft state based on * the configured workflow timing. */ enableDraftSyncHook: boolean; /** * Enable issuing synchronization hook. * * When enabled, invoices will pause at the issuing state and wait for the * integration to call the issuing synchronized endpoint before progressing to the * issued state. This ensures the external invoicing system has successfully * created and finalized the invoice before it is marked as issued. * * When disabled, invoices automatically progress through the issuing state and are * immediately marked as issued. */ enableIssuingSyncHook: boolean; } /** Invoice settings for a billing workflow. */ export interface WorkflowInvoicingSettings { /** Whether to automatically issue the invoice after the draftPeriod has passed. */ autoAdvance: boolean; /** The period for the invoice to be kept in draft status for manual reviews. */ draftPeriod: string; /** Should progressive billing be allowed for this workflow? */ progressiveBilling: boolean; /** Controls how subscription-ending shortened service periods are billed. */ subscriptionEndProrationMode: 'bill_full_period' | 'bill_actual_period'; } /** A monetary amount discount applied to an invoice line item. */ export interface InvoiceLineAmountDiscount { /** Unique identifier for the discount. */ id: string; /** The reason this discount was applied. */ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage'; /** Optional human-readable description of the discount. */ description?: string; /** External identifiers for this discount. */ externalReferences?: InvoiceLineExternalReferences; /** The monetary amount deducted. */ amount: string; } /** A usage quantity discount applied to an invoice line item. */ export interface InvoiceLineUsageDiscount { /** Unique identifier for the discount. */ id: string; /** The reason this discount was applied. */ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage'; /** Optional human-readable description of the discount. */ description?: string; /** External identifiers for this discount. */ externalReferences?: InvoiceLineExternalReferences; /** The usage quantity deducted (in billing units). */ quantity: string; } /** Base fields shared by all invoice line item discounts. */ export interface InvoiceLineBaseDiscount { /** Unique identifier for the discount. */ id: string; /** The reason this discount was applied. */ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage'; /** Optional human-readable description of the discount. */ description?: string; /** External identifiers for this discount. */ externalReferences?: InvoiceLineExternalReferences; } /** Filter options for listing currencies. */ export interface ListCurrenciesParamsFilter { type?: 'fiat' | 'custom'; code?: StringFieldFilter; } /** Query to evaluate feature access for a list of customers. */ export interface EntitlementAccessQueryRequest { /** * Whether to include credit balance availability for each resolved customer. When * true, each feature evaluation includes credit balance checks. * * Defaults to `false`. */ includeCredits: boolean; customer: EntitlementAccessQueryRequestCustomers; feature?: EntitlementAccessQueryRequestFeatures; } /** Reason a feature is not accessible to a customer. */ export interface EntitlementFeatureAccessReason { /** Machine-readable error code. */ code: 'unknown' | 'usage_limit_reached' | 'feature_unavailable' | 'feature_not_found' | 'no_credit_available'; /** Human-readable description of the error. */ message: string; /** Additional structured context. */ attributes?: Record; } /** Query error within a partially successful entitlement access query response. */ export interface EntitlementAccessQueryError { /** Machine-readable error code. */ code: 'unknown' | 'customer_not_found'; /** Human-readable description of the error. */ message: string; /** Additional structured context. */ attributes?: Record; /** The customer identifier from the request that produced this error. */ customer?: string; } /** * A notification channel delivers notification events, such as entitlement balance * threshold crossings, to an external system. Today the only supported channel * type is a webhook delivered via Svix. */ export interface NotificationChannel { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the channel. Immutable after creation. */ type: 'webhook'; /** * Whether the channel is disabled. Disabled channels do not receive notification * events. */ disabled: boolean; /** The URL that webhook notification events are delivered to. */ url: string; /** * Custom HTTP headers to include on every webhook delivery request, keyed by * header name. */ customHeaders?: Record; /** * Secret used to sign outgoing webhook payloads so recipients can verify their * authenticity. If omitted on create, a secret is generated automatically by the * delivery provider. This is a sensitive credential returned in responses (unlike * most secrets) specifically so clients can retrieve a server-generated value and * verify webhook signatures; handle it with the same care as any other credential. */ signingSecret?: string; } /** NotificationChannel create request. */ export interface CreateNotificationChannelRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of the channel. Immutable after creation. */ type: 'webhook'; /** * Whether the channel is disabled. Disabled channels do not receive notification * events. */ disabled: boolean; /** The URL that webhook notification events are delivered to. */ url: string; /** * Custom HTTP headers to include on every webhook delivery request, keyed by * header name. */ customHeaders?: Record; /** * Secret used to sign outgoing webhook payloads so recipients can verify their * authenticity. If omitted on create, a secret is generated automatically by the * delivery provider. This is a sensitive credential returned in responses (unlike * most secrets) specifically so clients can retrieve a server-generated value and * verify webhook signatures; handle it with the same care as any other credential. */ signingSecret?: string; } /** * Request body for updating a notification channel. Updates replace the channel's * mutable state rather than merging it: `type`, `name`, and `url` must always be * provided, and omitting `disabled`, `labels`, or `custom_headers` resets them to * their defaults (enabled, no labels, no custom headers). `signing_secret` is the * one exception: omitting it keeps the channel's current signing secret instead of * clearing the credential. */ export interface UpdateBillingNotificationChannelRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** The type of the channel. Immutable after creation. */ type: 'webhook'; /** The URL that webhook notification events are delivered to. */ url: string; labels?: Labels; /** * Whether the channel is disabled. Disabled channels do not receive notification * events. */ disabled: boolean; /** * Custom HTTP headers to include on every webhook delivery request, keyed by * header name. */ customHeaders?: Record; /** * Secret used to sign outgoing webhook payloads so recipients can verify their * authenticity. If omitted on create, a secret is generated automatically by the * delivery provider. This is a sensitive credential returned in responses (unlike * most secrets) specifically so clients can retrieve a server-generated value and * verify webhook signatures; handle it with the same care as any other credential. */ signingSecret?: string; } /** * A balance threshold of a notification rule. Crossing it generates an * `entitlements.balance.threshold` event. */ export interface NotificationBalanceThreshold { /** What the threshold value is measured against. */ type: 'balance_value' | 'usage_percentage' | 'usage_value'; /** The threshold value. */ value: number; } /** A reference to the notification rule that generated an event. */ export interface NotificationRuleReference { /** The unique identifier of the rule. */ id: string; /** The type of event the rule generates. */ type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated'; /** The user-provided name of the rule. */ name: string; } /** A single delivery attempt to a channel. */ export interface NotificationEventDeliveryAttempt { /** The delivery state reached by this attempt. */ state: 'success' | 'failed' | 'sending' | 'pending' | 'resending'; /** The response returned by the recipient. */ response: NotificationEventDeliveryAttemptResponse; /** When the attempt was made. */ timestamp: Date; } /** App customer data. */ export interface AppCustomerData { /** * Used if the customer has a linked Stripe app. * * Set to `null` to remove the Stripe data of the customer; omit to leave it * unchanged. */ stripe?: AppCustomerDataStripe | null; /** * Used if the customer has a linked external invoicing app. * * Set to `null` to remove the external invoicing data of the customer; omit to * leave it unchanged. */ externalInvoicing?: AppCustomerDataExternalInvoicing | null; } /** AppCustomerData upsert request. */ export interface UpsertAppCustomerDataRequest { /** * Used if the customer has a linked Stripe app. * * Set to `null` to remove the Stripe data of the customer; omit to leave it * unchanged. */ stripe?: AppCustomerDataStripe | null; /** * Used if the customer has a linked external invoicing app. * * Set to `null` to remove the external invoicing data of the customer; omit to * leave it unchanged. */ externalInvoicing?: AppCustomerDataExternalInvoicing | null; } /** * A credit adjustment can be used to make manual adjustments to a customer's * credit balance. * * Supported use-cases: * * - Usage correction */ export interface CreditAdjustment { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; } /** CreditAdjustment create request. */ export interface CreateCreditAdjustmentRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The currency of the granted credits. */ currency: BillingCurrencyCode; /** Granted credit amount. */ amount: string; } /** Filter options for listing credit transactions. */ export interface ListCreditTransactionsParamsFilter { /** Filter credit transactions by type. */ type?: 'funded' | 'consumed' | 'expired' | 'voided'; /** * Filter credit transactions by currency code. Custom-currency rows retain their * managed currency identifier. */ currency?: BillingCurrencyCode; /** * Filter credit transactions by feature key. Omit to return all credit * transactions. Use `exists=false` to return only unrestricted credit * transactions. */ featureKey?: StringFieldFilter; } /** Monetary amount in a fiat or custom currency. */ export interface CurrencyAmount { /** The amount as an arbitrary-precision decimal string. */ amount: string; /** The fiat or custom currency code of the amount. */ currency: BillingCurrencyCode; } /** Entitlement value result. */ export interface EntitlementValueResult { /** The type of the entitlement. */ type: 'metered' | 'static' | 'boolean'; /** The feature key being evaluated. */ featureKey: string; /** * Whether the customer has access to the feature. Always true for `boolean` and * `static` entitlements. Depends on balance for `metered` entitlements. */ hasAccess: boolean; /** * Only available for static entitlements. Config is the JSON parsable * configuration of the entitlement. Useful to describe per customer configuration. */ config?: string; /** * Only available for metered entitlements. The balance details of the entitlement * at the evaluation time. Requires the `value` expand. */ value?: EntitlementAccessValue; } /** * Entitlement value looked up by feature key. A missing entitlement has no type * and does not grant access. */ export interface EntitlementFeatureValueResult { /** The feature key being evaluated. */ featureKey: string; /** * Whether the customer has access to the feature. Always true for `boolean` and * `static` entitlements. Depends on balance for `metered` entitlements. */ hasAccess: boolean; /** * Only available for static entitlements. Config is the JSON parsable * configuration of the entitlement. Useful to describe per customer configuration. */ config?: string; /** * Only available for metered entitlements. The balance details of the entitlement * at the evaluation time. Requires the `value` expand. */ value?: EntitlementAccessValue; /** * The type of the entitlement. * * If not provided, the feature has no entitlement defined (has access is always * false in this case) */ type?: 'metered' | 'static' | 'boolean'; } /** * A price tier used in graduated and volume pricing. * * At least one price component (flat_price or unit_price) must be set. When * UnitConfig is present on the containing resource, up_to_amount is expressed in * converted billing units. */ export interface PriceTier { /** * Up to and including this quantity will be contained in the tier. If undefined, * the tier is open-ended (the last tier). */ upToAmount?: string; /** The flat price component of the tier. Charged once when the tier is entered. */ flatPrice?: PriceFlat; /** The unit price component of the tier. Charged per billing unit within the tier. */ unitPrice?: PriceUnit; } /** * The totals of a charge. * * `realtime` is only populated when the `real_time_usage` expand is used. */ export interface ChargeTotals { /** The amount of the charge already booked to the internal accounting system. */ booked: Totals; /** * The realtime amount of the charge, i.e. the whole usage rated at the charge's * price for its full service period, ignoring what has already been booked to a * realization. This differs from the `usage` of a realization with type * `outstanding`, which only covers the quantity not yet booked. * * Requires the `real_time_usage` expand. */ realtime?: Totals; } /** * LLM cost lookup configuration. Each dimension (provider, model, token type) can * be specified as either a static value or a meter group-by property name * (mutually exclusive). */ export interface FeatureLlmUnitCost { /** The type discriminator for LLM unit cost. */ type: 'llm'; /** * Meter group-by property that holds the LLM provider. Use this when the meter has * a group-by dimension for provider. Mutually exclusive with `provider`. */ providerProperty?: string; /** * Static LLM provider value (e.g., "openai", "anthropic"). Use this when the * feature tracks a single provider. Mutually exclusive with `provider_property`. */ provider?: string; /** * Meter group-by property that holds the model ID. Use this when the meter has a * group-by dimension for model. Mutually exclusive with `model`. */ modelProperty?: string; /** * Static model ID value (e.g., "gpt-4", "claude-3-5-sonnet"). Use this when the * feature tracks a single model. Mutually exclusive with `model_property`. */ model?: string; /** * Meter group-by property that holds the token type. Use this when the meter has a * group-by dimension for token type. Mutually exclusive with `token_type`. */ tokenTypeProperty?: string; /** * Static token type value. Use this when the feature tracks a single token type * (e.g., only input tokens). `request` is an alias for `input`, `response` is an * alias for `output`. Mutually exclusive with `token_type_property`. */ tokenType?: 'input' | 'output' | 'cache_read' | 'cache_write' | 'reasoning' | 'request' | 'response'; /** * Resolved per-token pricing from the LLM cost database. Populated in responses * when the provider and model can be determined, either from static values or from * meter group-by filters with exact matches. */ pricing?: FeatureLlmUnitCostPricing; } /** * A price tier used in graduated and volume pricing. * * At least one price component (flat_price or unit_price) must be set. When * UnitConfig is present on the containing resource, up_to_amount is expressed in * converted billing units. */ export interface UpdatePriceTier { /** * Up to and including this quantity will be contained in the tier. If undefined, * the tier is open-ended (the last tier). */ upToAmount?: string; /** The flat price component of the tier. Charged once when the tier is entered. */ flatPrice?: UpdatePriceFlat; /** The unit price component of the tier. Charged per billing unit within the tier. */ unitPrice?: UpdatePriceUnit; } /** * An LLM cost price record, representing the cost per token for a specific model * from a specific provider. */ export interface LlmCostPrice { /** Unique identifier. */ id: string; /** Provider of the model. */ provider: LlmCostProvider; /** The model. */ model: LlmCostModel; /** Token pricing data. */ pricing: LlmCostModelPricing; /** Currency code (currently always "USD"). */ currency: string; /** Where this price came from. */ source: 'manual' | 'system'; /** When this price becomes effective. */ effectiveFrom: Date; /** When this price expires. Omitted when the price is currently effective. */ effectiveTo?: Date; /** Creation timestamp. */ createdAt: Date; /** Last update timestamp. */ updatedAt: Date; } /** * Input for creating a per-namespace price override. Unique per provider, model * and currency. If an override already exists for the given provider, model and * currency, it will be updated. If an override does not exist, it will be created. */ export interface LlmCostOverrideCreate { /** Provider/vendor of the model. */ provider: string; /** Canonical model identifier. */ modelId: string; /** Human-readable model name. */ modelName?: string; /** Token pricing data. */ pricing: LlmCostModelPricing; /** Currency code. */ currency: string; /** When this override becomes effective. */ effectiveFrom: Date; /** When this override expires. */ effectiveTo?: Date; } /** Filter options for listing customers. */ export interface ListCustomersParamsFilter { key?: StringFieldFilter; name?: StringFieldFilter; primaryEmail?: StringFieldFilter; usageAttributionSubjectKey?: StringFieldFilter; planKey?: StringFieldFilter; billingProfileId?: UlidFieldFilter; } /** Filter options for listing customer entitlements. */ export interface ListCustomerEntitlementsParamsFilter { /** Filter entitlements by feature ID. */ featureId?: UlidFieldFilter; /** Filter entitlements by feature key. */ featureKey?: StringFieldFilterExact; /** Filter entitlements by type (`metered`, `static` or `boolean`). */ type?: StringFieldFilterExact; } /** Filter options for listing entitlements. */ export interface ListEntitlementsParamsFilter { /** Filter entitlements by feature ID. */ featureId?: UlidFieldFilter; /** Filter entitlements by feature key. */ featureKey?: StringFieldFilterExact; /** Filter entitlements by type (`metered`, `static` or `boolean`). */ type?: StringFieldFilterExact; /** Filter entitlements by customer ID. */ customerId?: UlidFieldFilter; } /** Filter options for listing grants. */ export interface ListGrantsParamsFilter { /** Filter grants by the ID of the customer that owns the entitlement. */ customerId?: UlidFieldFilter; /** Filter grants by the ID of the entitlement's feature. */ featureId?: UlidFieldFilter; } /** Filter options for listing subscriptions. */ export interface ListSubscriptionsParamsFilter { id?: UlidFieldFilter; customerId?: UlidFieldFilter; status?: StringFieldFilterExact; planId?: UlidFieldFilter; planKey?: StringFieldFilterExact; } /** Filter options for listing apps. */ export interface ListAppsParamsFilter { id?: UlidFieldFilter; name?: StringFieldFilter; type?: StringFieldFilterExact; status?: StringFieldFilterExact; } /** Filter options for listing billing profiles. */ export interface ListBillingProfilesParamsFilter { id?: UlidFieldFilter; name?: StringFieldFilter; } /** Filter options for listing features. */ export interface ListFeatureParamsFilter { meterId?: UlidFieldFilter; key?: StringFieldFilter; name?: StringFieldFilter; } /** Filter options for listing add-ons. */ export interface ListAddonsParamsFilter { id?: UlidFieldFilter; key?: StringFieldFilter; name?: StringFieldFilter; status?: StringFieldFilterExact; currency?: StringFieldFilterExact; } /** Filter options for listing plan add-ons. */ export interface ListPlanAddonsParamsFilter { id?: UlidFieldFilter; planKey?: StringFieldFilter; addonId?: UlidFieldFilter; addonKey?: StringFieldFilter; addonName?: StringFieldFilter; planCurrency?: StringFieldFilter; } /** * Tax configuration for a billable resource. * * Applies a tax code and tax behavior to the resulting invoice line items. When * not set, the applicable default is used: the billing profile default tax * configuration, then the organization default tax code. */ export interface CreateTaxCodeConfig { /** * Tax behavior. * * This enum is used to specify whether tax is included in the price or excluded * from the price. If not specified, the billing profile is used to determine the * tax behavior. If not specified in the billing profile, the provider's default * behavior is used. */ behavior?: 'inclusive' | 'exclusive'; /** Tax code applied to the invoice line item. */ code?: CreateResourceReference; } /** * Tax configuration for a billable resource. * * Applies a tax code and tax behavior to the resulting invoice line items. When * not set, the applicable default is used: the billing profile default tax * configuration, then the organization default tax code. */ export interface TaxCodeConfig { /** * Tax behavior. * * This enum is used to specify whether tax is included in the price or excluded * from the price. If not specified, the billing profile is used to determine the * tax behavior. If not specified in the billing profile, the provider's default * behavior is used. */ behavior?: 'inclusive' | 'exclusive'; /** Tax code applied to the invoice line item. */ code?: TaxCodeReference; } /** Set of provider specific tax configs. */ export interface TaxConfig { /** * Tax behavior. * * If not specified the billing profile is used to determine the tax behavior. If * not specified in the billing profile, the provider's default behavior is used. */ behavior?: 'inclusive' | 'exclusive'; /** Stripe tax config. */ stripe?: TaxConfigStripe; /** External invoicing tax config. */ externalInvoicing?: TaxConfigExternalInvoicing; /** Tax code ID. */ taxCodeId?: string; /** * Tax code reference. * * When both `tax_code` and `tax_code_id` are provided, `tax_code` takes * precedence. When `stripe.code` is also provided, `tax_code` still wins and * `stripe.code` is ignored. */ taxCode?: TaxCodeReference; } /** * Organization-level default tax code references. * * Stores the default tax codes applied to specific billing contexts for this * organization. Provisioned automatically when the organization is created. */ export interface OrganizationDefaultTaxCodes { /** Default tax code for invoicing. */ invoicingTaxCode: TaxCodeReference; /** Default tax code for credit grants. */ creditGrantTaxCode: TaxCodeReference; /** Timestamp of creation. */ createdAt: Date; /** Timestamp of last update. */ updatedAt: Date; } /** OrganizationDefaultTaxCodes update request. */ export interface UpdateOrganizationDefaultTaxCodesRequest { /** Default tax code for invoicing. */ invoicingTaxCode?: TaxCodeReference; /** Default tax code for credit grants. */ creditGrantTaxCode?: TaxCodeReference; } /** The credit balance by currency. */ export interface CreditBalance { currency: BillingCurrencyCode; /** Managed currency reference. Present only for custom currencies. */ customCurrency?: CurrencyCustomReference; /** * Credits available after applying currently live charge impacts. * * Always zero for historical balance queries using the `timestamp` parameter * because live charge impacts cannot be reconstructed historically. */ live: string; /** Credits that have been booked on the ledger as of the balance timestamp. */ settled: string; /** * Credits that have been granted but are not yet written to the ledger, or are * written to the ledger with a future booked time. */ pending: string; } /** * A credit transaction represents a single credit movement on the customer's * balance. * * Credit transactions are immutable. */ export interface CreditTransaction { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** The date and time the transaction was booked. */ bookedAt: Date; /** The type of credit transaction. */ type: 'funded' | 'consumed' | 'expired' | 'voided'; /** Currency of the balance affected by the transaction. */ currency: BillingCurrencyCode; /** Managed currency reference. Present only for custom currencies. */ customCurrency?: CurrencyCustomReference; /** * Signed amount of the credit movement. Positive values add balance, negative * values reduce balance. */ amount: string; /** The available balance before and after the transaction. */ availableBalance: { before: string; after: string; }; } /** * BillingInvoiceWorkflowAppsReferences represents the references (id) to the apps * used by a billing profile */ export interface InvoiceWorkflowAppsReferences { /** The tax app used for this workflow */ tax: AppReference; /** The invoicing app used for this workflow */ invoicing: AppReference; /** The payment app used for this workflow */ payment: AppReference; } /** References to the applications used by a billing profile. */ export interface ProfileAppReferences { /** The tax app used for this workflow. */ tax: AppReference; /** The invoicing app used for this workflow. */ invoicing: AppReference; /** The payment app used for this workflow. */ payment: AppReference; } /** * PlanAddon represents an association between a plan and an add-on, controlling * which add-ons are available for purchase within a plan. */ export interface PlanAddon { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The add-on associated with the plan. */ addon: AddonReference; /** The key of the plan phase from which the add-on becomes available for purchase. */ fromPlanPhase: string; /** * The maximum number of times the add-on can be purchased for the plan. For * single-instance add-ons this field must be omitted. For multi-instance add-ons * when omitted, unlimited quantity can be purchased. */ maxQuantity?: number; /** List of validation errors. */ validationErrors?: ProductCatalogValidationError[]; } /** PlanAddon create request. */ export interface CreatePlanAddonRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The add-on associated with the plan. */ addon: AddonReference; /** The key of the plan phase from which the add-on becomes available for purchase. */ fromPlanPhase: string; /** * The maximum number of times the add-on can be purchased for the plan. For * single-instance add-ons this field must be omitted. For multi-instance add-ons * when omitted, unlimited quantity can be purchased. */ maxQuantity?: number; } /** * Tax configuration for a billable resource. * * Applies a tax code and tax behavior to the resulting invoice line items. When * not set, the applicable default is used: the billing profile default tax * configuration, then the organization default tax code. */ export interface UpdateTaxCodeConfig { /** * Tax behavior. * * This enum is used to specify whether tax is included in the price or excluded * from the price. If not specified, the billing profile is used to determine the * tax behavior. If not specified in the billing profile, the provider's default * behavior is used. */ behavior?: 'inclusive' | 'exclusive'; /** Tax code applied to the invoice line item. */ code?: UpdateResourceReference; } /** A rule that generates an event when an entitlement usage period is reset. */ export interface NotificationRuleEntitlementReset { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.reset'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** A rule that generates an event when an invoice is created. */ export interface NotificationRuleInvoiceCreated { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.created'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** A rule that generates an event when an invoice is updated. */ export interface NotificationRuleInvoiceUpdated { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.updated'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** Request body for an entitlement reset rule. */ export interface NotificationRuleEntitlementResetRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.reset'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** Request body for an invoice created rule. */ export interface NotificationRuleInvoiceCreatedRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.created'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** Request body for an invoice updated rule. */ export interface NotificationRuleInvoiceUpdatedRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.updated'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** The invoice an invoice notification event refers to. */ export interface NotificationEventInvoiceData { /** The invoice the event was generated for. */ invoice: NotificationEventInvoiceReference; /** The identifier of the customer the invoice was issued to. */ customerId?: string; /** The currency the invoice is denominated in. */ currency: string; /** The status of the invoice at the time the event was generated. */ status: string; /** The invoice total, including taxes, at the time the event was generated. */ total: string; } /** Filter options for listing ingested events. */ export interface ListEventsParamsFilter { /** Filter events by ID. */ id?: StringFieldFilter; /** Filter events by source. */ source?: StringFieldFilter; /** Filter events by subject. */ subject?: StringFieldFilter; /** Filter events by type. */ type?: StringFieldFilter; /** Filter events by the associated customer ID. */ customerId?: UlidFieldFilter; /** Filter events by event time. */ time?: DateTimeFieldFilter; /** Filter events by the time the event was ingested. */ ingestedAt?: DateTimeFieldFilter; /** Filter events by the time the event was stored. */ storedAt?: DateTimeFieldFilter; } /** Filter options for listing charges. */ export interface ListCustomerChargesParamsFilter { /** * Filter charges by status. * * Supported statuses are: * * - `created` * - `active` * - `final` * - `deleted` * * If omitted, all statuses are returned except for `deleted`. */ status?: StringFieldFilterExact; /** Filter charges by the ID of their associated feature. */ featureId?: UlidFieldFilter; /** Filter charges by the key of their associated feature. */ featureKey?: StringFieldFilterExact; /** Filter charges by the start of their service period. */ servicePeriodFrom?: DateTimeFieldFilter; /** Filter charges by the end of their service period. */ servicePeriodTo?: DateTimeFieldFilter; } /** Filter options for listing invoices. */ export interface ListInvoicesParamsFilter { /** Filter by invoice status. */ status?: StringFieldFilterExact; /** Filter by customer ID. */ customerId?: UlidFieldFilter; /** Filter by the time the invoice was issued. */ issuedAt?: DateTimeFieldFilter; /** Filter by service period start. */ servicePeriodStart?: DateTimeFieldFilter; /** Filter by invoice creation time. */ createdAt?: DateTimeFieldFilter; } /** Filter options for listing charges across customers. */ export interface ListChargesParamsFilter { /** * Filter charges by status. * * Supported statuses are: * * - `created` * - `active` * - `final` * - `deleted` * * If omitted, all statuses are returned except for `deleted`. */ status?: StringFieldFilterExact; /** Filter charges by the ID of their associated feature. */ featureId?: UlidFieldFilter; /** Filter charges by the key of their associated feature. */ featureKey?: StringFieldFilterExact; /** Filter charges by the start of their service period. */ servicePeriodFrom?: DateTimeFieldFilter; /** Filter charges by the end of their service period. */ servicePeriodTo?: DateTimeFieldFilter; /** Filter charges by the ID of their customer. */ customerId?: UlidFieldFilter; } /** Filter options for listing notification channels. */ export interface ListNotificationChannelsParamsFilter { id?: UlidFieldFilter; name?: StringFieldFilter; type?: StringFieldFilterExact; disabled?: BooleanFieldFilter; createdAt?: DateTimeFieldFilter; updatedAt?: DateTimeFieldFilter; } /** Filter options for listing notification rules. */ export interface ListNotificationRulesParamsFilter { id?: UlidFieldFilter; name?: StringFieldFilter; type?: StringFieldFilterExact; disabled?: BooleanFieldFilter; createdAt?: DateTimeFieldFilter; updatedAt?: DateTimeFieldFilter; /** * Filter by an assigned channel. Matches rules that deliver to at least one of the * given channels. Only `eq` and `oeq` are supported. */ channelId?: UlidFieldFilter; } /** Filter options for listing notification events. */ export interface ListNotificationEventsParamsFilter { id?: UlidFieldFilter; type?: StringFieldFilterExact; createdAt?: DateTimeFieldFilter; ruleId?: UlidFieldFilter; /** * Filter by a channel of the generating rule. Matches events whose rule targets at * least one of the given channels. Only `eq` and `oeq` are supported. */ channelId?: UlidFieldFilter; /** * Filter by delivery state. Matches events where delivery to at least one channel * is in one of the given states. Only `eq` and `oeq` are supported. */ deliveryStatus?: StringFieldFilterExact; /** * Filter by the key of the subject the event refers to. Events without a subject * never match, not even with `neq`. */ subjectKey?: StringFieldFilterExact; /** * Filter by the id of the subject the event refers to. Events without a subject * never match, not even with `neq`. */ subjectId?: UlidFieldFilter; /** * Filter by the key of the feature the event refers to. Events without a feature * never match, not even with `neq`. */ featureKey?: StringFieldFilterExact; /** * Filter by the id of the feature the event refers to. Events without a feature * never match, not even with `neq`. */ featureId?: UlidFieldFilter; } /** Resource filters. */ export interface ResourceFilters { name?: StringFieldFilter; labels?: LabelsFieldFilter; publicLabels?: LabelsFieldFilter; createdAt?: DateTimeFieldFilter; updatedAt?: DateTimeFieldFilter; deletedAt?: DateTimeFieldFilter; } /** Field filters with all supported types. */ export interface FieldFilters { boolean?: BooleanFieldFilter; numeric?: number | { eq?: number; neq?: number; oeq?: number[]; lt?: number; lte?: number; gt?: number; gte?: number; }; string?: StringFieldFilter; stringExact?: StringFieldFilterExact; ulid?: UlidFieldFilter; datetime?: DateTimeFieldFilter; labels?: LabelsFieldFilter; } /** An ingested metering event with ingestion metadata. */ export interface IngestedEvent { /** The original event ingested. */ event: Event; /** The customer if the event is associated with a customer. */ customer?: CustomerReference; /** The date and time the event was ingested and its processing started. */ ingestedAt: Date; /** The date and time the event was stored in the database. */ storedAt: Date; /** The validation errors of the ingested event. */ validationErrors?: IngestedEventValidationError[]; } /** Meter query result. */ export interface MeterQueryResult { /** The start of the period the usage is queried from. */ from?: Date; /** The end of the period the usage is queried to. */ to?: Date; /** The usage data. If no data is available, an empty array is returned. */ data: MeterQueryRow[]; } /** Usage and balance of a single history window. */ export interface EntitlementHistoryWindow { /** The period the window covers. */ period: ClosedPeriod; /** The usage recorded in the window. */ usage: string; /** The entitlement balance at the start of the window. */ balanceAtStart: string; } /** A period in which grants were consumed in a fixed order. */ export interface EntitlementBurndownSegment { /** The period the segment covers. */ period: ClosedPeriod; /** The usage recorded in the segment. */ usage: string; /** The usage in the segment not covered by any grant. */ overage: string; /** The entitlement balance at the start and at the end of the segment. */ balance: EntitlementBurndownBalance; /** * The balance of each active grant at the start and at the end of the segment, * keyed by grant ID. */ grantBalances: EntitlementBurndownGrantBalances; /** The grants consumed in the segment and the usage taken from each. */ grantUsages: EntitlementGrantUsage[]; } /** A detailed line produced by a flat fee charge's realization run. */ export interface ChargeRealizationDetailedLineFlatFee { id: string; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the charge the realization belongs to. */ type: 'flat_fee'; /** The service period covered by this detailed line. */ servicePeriod: ClosedPeriod; /** Aggregated financial totals for the detailed line. */ totals: Totals; /** The cost category of this detailed line. */ category: 'regular' | 'commitment'; /** Credits applied to this detailed line. */ creditsApplied?: ChargeRealizationDetailedLineCreditApplied[]; /** The unit price of the detailed line. */ unitPrice: string; /** The amount discounts applied to the detailed line. */ amountDiscounts: ChargeRealizationAmountDiscount[]; } /** A detailed line produced by a usage-based charge's realization run. */ export interface ChargeRealizationDetailedLineUsageBased { id: string; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the charge the realization belongs to. */ type: 'usage_based'; /** The service period covered by this detailed line. */ servicePeriod: ClosedPeriod; /** Aggregated financial totals for the detailed line. */ totals: Totals; /** The cost category of this detailed line. */ category: 'regular' | 'commitment'; /** Credits applied to this detailed line. */ creditsApplied?: ChargeRealizationDetailedLineCreditApplied[]; /** The unit price of the detailed line. */ unitPrice: string; /** The amount discounts applied to the detailed line. */ amountDiscounts: ChargeRealizationAmountDiscount[]; /** The quantity of the detailed line. */ quantity: string; /** * The ID of a prior realization run this detailed line corrects. Only set if the * detailed line's totals are negative. */ correctsRunId?: string; } /** Describes custom currency. */ export interface CurrencyCustom { /** The type of the currency. */ type: 'custom'; /** * The name of the currency. It should be a human-readable string that represents * the name of the currency, such as "US Dollar" or "Euro". */ name: string; /** * The symbol of the currency. It should be a string that represents the symbol of * the currency, such as "$" for US Dollar or "€" for Euro. */ symbol?: string; /** * The precision of the currency. It should be a number that represents the number * of decimal places used for the currency, such as 2 for US Dollar or Euro. */ precision: number; /** * The decimal mark for the currency. It should be a string that represents the * decimal mark of the currency, such as "." for US Dollar or "," for Euro. */ decimalMark: string; /** * The thousand separator for the currency. It should be a string that represents * the thousand separator of the currency, such as "," for US Dollar or "." for * Euro. */ thousandSeparator: string; id: string; code: string; /** An ISO-8601 timestamp representation of the custom currency creation date. */ createdAt: Date; /** * The list of active and scheduled cost bases for the custom currency. Expired and * deleted cost bases are excluded. */ costBasis?: CostBasis[]; } /** Result of a feature cost query. */ export interface FeatureCostQueryResult { /** Start of the queried period. */ from?: Date; /** End of the queried period. */ to?: Date; /** The cost data rows. */ data: FeatureCostQueryRow[]; } /** Page paginated response. */ export interface MeterPagePaginatedResponse { data: Meter[]; meta: PaginatedMeta; } /** Page paginated response. */ export interface CostBasisPagePaginatedResponse { data: CostBasis[]; meta: PaginatedMeta; } /** Filters to apply to a meter query. */ export interface MeterQueryFilters { /** * Filters to apply to the dimensions of the query. For `subject` and `customer_id` * only equals ("eq", "in") comparisons are supported. */ dimensions?: Record; } /** Reference to a meter associated with a feature. */ export interface FeatureMeterReference { /** The ID of the meter to associate with this feature. */ id: string; /** Filters to apply to the dimensions of the meter. */ filters?: Record; } /** Customer create request. */ export interface CreateCustomerRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** Mapping to attribute metered usage to the customer by the event subject. */ usageAttribution?: CustomerUsageAttribution; /** The primary email address of the customer. */ primaryEmail?: string; /** Currency of the customer. Used for billing, tax and invoicing. */ currency?: string; /** The billing address of the customer. Used for tax and invoicing. */ billingAddress?: Address; } /** * Customers can be individuals or organizations that can subscribe to plans and * have access to features. */ export interface Customer { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; /** Mapping to attribute metered usage to the customer by the event subject. */ usageAttribution?: CustomerUsageAttribution; /** The primary email address of the customer. */ primaryEmail?: string; /** Currency of the customer. Used for billing, tax and invoicing. */ currency?: string; /** The billing address of the customer. Used for tax and invoicing. */ billingAddress?: Address; } /** Customer upsert request. */ export interface UpsertCustomerRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** Mapping to attribute metered usage to the customer by the event subject. */ usageAttribution?: CustomerUsageAttribution; /** The primary email address of the customer. */ primaryEmail?: string; /** Currency of the customer. Used for billing, tax and invoicing. */ currency?: string; /** The billing address of the customer. Used for tax and invoicing. */ billingAddress?: Address; } /** A collection of addresses for the party. */ export interface PartyAddresses { /** Billing address. */ billingAddress: Address; } /** Snapshot of the customer's information at the time the invoice was issued. */ export interface InvoiceCustomer { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** Mapping to attribute metered usage to the customer by the event subject. */ usageAttribution?: CustomerUsageAttribution; /** The billing address of the customer. Used for tax and invoicing. */ billingAddress?: Address; id: string; /** * Optional external resource key for the customer. * * Omitted when the customer was created without a key. Unlike on the customer * resource itself, the key is optional here because the invoice snapshot may * predate or omit it. */ key?: string; } /** A collection of addresses for the party. */ export interface UpdateBillingPartyAddresses { /** Billing address. */ billingAddress: UpdateAddress; } /** Snapshot of the customer's information at the time the invoice was issued. */ export interface UpdateInvoiceCustomer { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** Mapping to attribute metered usage to the customer by the event subject. */ usageAttribution?: UpdateCustomerUsageAttribution; /** The billing address of the customer. Used for tax and invoicing. */ billingAddress?: UpdateAddress; id: string; /** * Optional external resource key for the customer. * * Omitted when the customer was created without a key. Unlike on the customer * resource itself, the key is optional here because the invoice snapshot may * predate or omit it. */ key?: string; } /** Checkout Session consent collection configuration. */ export interface AppStripeCreateCheckoutSessionConsentCollection { /** Controls the visibility of payment method reuse agreement. */ paymentMethodReuseAgreement?: AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement; /** * Enables collection of promotional communication consent. * * Only available to US merchants. When set to "auto", Checkout determines whether * to show the option based on the customer's locale. */ promotions?: 'auto' | 'none'; /** * Requires customers to accept terms of service before payment. * * Requires a valid terms of service URL in your Stripe Dashboard settings. */ termsOfService?: 'none' | 'required'; } /** A grant to issue for a metered entitlement. */ export interface EntitlementGrantCreateRequest { /** The amount to grant, in the feature's unit. Must be positive. */ amount: string; /** * The priority of the grant. Lower values have higher priority. Grants are * consumed in priority order, then by closest expiration, then by earliest * creation. */ priority?: number; /** * The time the grant becomes effective and the anchor for recurring grants. The * value is truncated to the start of the minute. */ effectiveAt: Date; /** * The duration after which the grant expires, counted from `effective_at`. Only * single-unit durations are accepted, such as `PT12H`, `P7D`, `P2W`, `P3M`, or * `P1Y`. If omitted, the grant never expires. */ expiresAfter?: string; /** * The maximum balance carried over at reset. The balance after a reset is * `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`. * Defaults to `amount`. */ maxRolloverAmount?: string; /** * The minimum balance carried over at reset. The balance after a reset is * `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`. * Defaults to `0`. */ minRolloverAmount?: string; labels?: Labels; /** * The recurrence of the grant. When set, the amount is issued again every * interval. The anchor defaults to `effective_at`. */ recurrence?: RecurringPeriodInput; } /** Static entitlement create request. */ export interface CreateEntitlementStaticRequest { /** The type of the entitlement. */ type: 'static'; /** The feature the customer is entitled to use. */ feature: FeatureReference; labels?: Labels; /** * The entitlement configuration as a JSON value. Returned when checking * entitlement access. */ config: unknown; /** * The usage period of the entitlement. The anchor defaults to the entitlement * creation time. */ usagePeriod?: RecurringPeriodInput; } /** Boolean entitlement create request. */ export interface CreateEntitlementBooleanRequest { /** The type of the entitlement. */ type: 'boolean'; /** The feature the customer is entitled to use. */ feature: FeatureReference; labels?: Labels; /** * The usage period of the entitlement. The anchor defaults to the entitlement * creation time. */ usagePeriod?: RecurringPeriodInput; } /** * A metered entitlement grants a usage allowance for a feature. Access is * determined by the balance: the allowance provided by grants is burnt down by * usage. */ export interface EntitlementMetered { id: string; /** The type of the entitlement. */ type: 'metered'; /** The feature the customer is entitled to use. */ feature: FeatureReference; /** The customer the entitlement belongs to. */ customer: CustomerReference; labels?: Labels; /** The time from which the entitlement is active. */ activeFrom: Date; /** * The time until which the entitlement is active. If not set, the entitlement is * active until deleted. */ activeTo?: Date; /** The time the entitlement was created. */ createdAt: Date; /** The time the entitlement was last updated. */ updatedAt: Date; /** The time the entitlement was deleted. */ deletedAt?: Date; /** * The usage period of the entitlement. The balance resets at the start of every * period. */ usagePeriod: RecurringPeriod; /** The current usage period of the entitlement. */ currentUsagePeriod: ClosedPeriod; /** * If true, the customer keeps access to the feature after the balance is * exhausted. */ isSoftLimit: boolean; /** Usage granted automatically after each reset. Cannot be combined with `grants`. */ issue?: EntitlementIssueAfterReset; /** The amount granted automatically after each reset. */ issueAfterReset?: string; /** The priority of the grant created after each reset. */ issueAfterResetPriority: number; /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */ preserveOverageAtReset: boolean; /** The time from which usage is measured. */ measureUsageFrom: Date; /** The time of the last reset. */ lastReset: Date; } /** A static entitlement grants access to a feature together with a configuration. */ export interface EntitlementStatic { id: string; /** The type of the entitlement. */ type: 'static'; /** The feature the customer is entitled to use. */ feature: FeatureReference; /** The customer the entitlement belongs to. */ customer: CustomerReference; labels?: Labels; /** The usage period of the entitlement. */ usagePeriod?: RecurringPeriod; /** The current usage period of the entitlement. */ currentUsagePeriod?: ClosedPeriod; /** The time from which the entitlement is active. */ activeFrom: Date; /** * The time until which the entitlement is active. If not set, the entitlement is * active until deleted. */ activeTo?: Date; /** The time the entitlement was created. */ createdAt: Date; /** The time the entitlement was last updated. */ updatedAt: Date; /** The time the entitlement was deleted. */ deletedAt?: Date; /** * The entitlement configuration as a JSON value. Returned when checking * entitlement access. */ config: unknown; } /** A boolean entitlement grants access to a feature. */ export interface EntitlementBoolean { id: string; /** The type of the entitlement. */ type: 'boolean'; /** The feature the customer is entitled to use. */ feature: FeatureReference; /** The customer the entitlement belongs to. */ customer: CustomerReference; labels?: Labels; /** The usage period of the entitlement. */ usagePeriod?: RecurringPeriod; /** The current usage period of the entitlement. */ currentUsagePeriod?: ClosedPeriod; /** The time from which the entitlement is active. */ activeFrom: Date; /** * The time until which the entitlement is active. If not set, the entitlement is * active until deleted. */ activeTo?: Date; /** The time the entitlement was created. */ createdAt: Date; /** The time the entitlement was last updated. */ updatedAt: Date; /** The time the entitlement was deleted. */ deletedAt?: Date; } /** * A grant issued for a metered entitlement. Each grant adds its amount to the * entitlement's balance from its effective time until it expires, and usage is * deducted from the grants in priority order. * * Grants are immutable, so the balance is deterministic regardless of when it is * queried. Deleting a grant ends it at the time of the deletion. */ export interface EntitlementGrant { id: string; /** The ID of the entitlement the grant belongs to. */ entitlementId: string; /** The ID of the customer the grant belongs to. */ customerId?: string; /** The granted amount, in the feature's unit. */ amount: string; /** * The priority of the grant. Lower values are consumed first: a grant with * priority 1 is consumed before one with priority 2. Among equal priorities, the * grant closest to expiration is consumed first, then the earliest created. */ priority: number; /** The time the grant takes effect. */ effectiveAt: Date; /** * The duration after which the grant expires, counted from `effective_at`. Always * a single-unit duration (for example `PT12H`, `P7D`, `P2W`, `P3M`, `P1Y`). Absent * when the grant never expires. */ expiresAfter?: string; /** * The time the grant expires, calculated from `effective_at` and `expires_after`. * The grant is no longer in effect from this time. Absent when the grant never * expires. */ expiresAt?: Date; /** * The maximum balance the grant carries over at reset. The balance after a reset * is `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`. */ maxRolloverAmount: string; /** * The minimum balance the grant carries over at reset. The balance after a reset * is `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`. */ minRolloverAmount: string; /** * The recurrence of the grant. When set, the grant amount is re-issued every * interval from the anchor, which defaults to `effective_at`. Absent for * non-recurring grants. */ recurrence?: RecurringPeriod; /** The next time the grant recurs. Absent for non-recurring grants. */ nextRecurrence?: Date; /** * The time the grant was voided. A voided grant is no longer in effect from this * time. */ voidedAt?: Date; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; } /** * BillingWorkflowCollectionAlignmentAnchored specifies the alignment for * collecting the pending line items into an invoice. */ export interface WorkflowCollectionAlignmentAnchored { /** The type of alignment. */ type: 'anchored'; /** The recurring period for the alignment. */ recurringPeriod: RecurringPeriod; } /** * Add a new phase to the subscription. The phase is created without items; use * add-item operations to populate it. */ export interface SubscriptionEditAddPhase { /** Discriminator for the add-phase operation. */ type: 'add_phase'; /** The phase to add. */ phase: SubscriptionPhaseCreate; } /** Filters for the credit grant. */ export interface CreateCreditGrantFilters { /** * Limit the credit grant to specific features. If no features are specified, the * credit grant can be used for any feature. */ features?: string[]; /** * Limit credits to charges from these plans. Entries are alternatives; when * features are also specified, both dimensions must match. Omission or an empty * list leaves plans unrestricted. */ plans?: CreateCreditGrantPlanFilter[]; } /** Filters for the credit grant. */ export interface CreditGrantFilters { /** * Limit the credit grant to specific features. If no features are specified, the * credit grant can be used for any feature. */ features?: string[]; /** * Limit credits to charges from these plans. Entries are alternatives; when * features are also specified, both dimensions must match. Omission or an empty * list leaves plans unrestricted. */ plans?: CreditGrantPlanFilter[]; } /** Subscription fields without phases or the current billing period. */ export interface SubscriptionBase { id: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * Display name of the subscription. Defaults to the plan name when the * subscription is created from a plan. */ name: string; /** Optional description of the subscription. */ description?: string; /** * An ISO-8601 timestamp representation of when the subscription became (or will * become) active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when the subscription stops being * active. Open-ended when not set. */ activeTo?: Date; /** The customer ID of the subscription. */ customerId: string; /** The plan ID of the subscription. Set if subscription is created from a plan. */ planId?: string; /** * The plan the subscription was created from, if any. Includes the plan key and * version so clients can resolve the exact plan revision. */ plan?: SubscriptionPlanReference; /** The fiat currency in which the subscription is invoiced. */ invoiceCurrency: string; /** * Controls whether custom-currency cost bases are resolved dynamically or pinned * when their currency pair is introduced to the subscription. */ costBasisMode: 'dynamic' | 'pinned'; /** Cost bases pinned to custom-currency pairs for this subscription. */ costBasisPins: SubscriptionCostBasisPin[]; /** * The billing cadence of the subscription in ISO-8601 duration format. Defines how * often the customer is billed. Examples: `P1M` (monthly), `P3M` (quarterly), * `P1Y` (annually). */ billingCadence: string; /** The pro-rating configuration of the subscription. */ proRatingConfig?: SubscriptionProRatingConfig; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) */ billingAnchor: Date; /** The status of the subscription. */ status: 'active' | 'inactive' | 'canceled' | 'scheduled'; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; } /** Detailed status information for a standard invoice. */ export interface InvoiceStatusDetails { /** Whether the invoice is immutable (i.e. cannot be modified or deleted). */ immutable: boolean; /** Whether the invoice is in a failed state. */ failed: boolean; /** * Fine-grained internal status string providing additional workflow detail beyond * the top-level status enum. */ extendedStatus: string; /** The set of state-transition actions currently available for this invoice. */ availableActions: InvoiceAvailableActions; } /** * Invoice-level snapshot of the workflow configuration. * * Contains only the settings that are meaningful for an already-created invoice: * invoicing behaviour and payment settings. Collection alignment and tax policy * are gather-time / profile-wide concerns and are not included. */ export interface InvoiceWorkflow { /** Invoicing settings for this invoice. */ invoicing?: InvoiceWorkflowInvoicingSettings; /** Payment settings for this invoice. */ payment?: WorkflowPaymentSettings; } /** Request for canceling a subscription. */ export interface SubscriptionCancel { /** If not provided the subscription is canceled immediately. */ timing: SubscriptionEditTiming; } /** Request for migrating to a later version of the subscription's current plan. */ export interface SubscriptionMigrate { /** * When the migration takes effect: immediately (default), at the next billing * cycle, or at an explicit billing-aligned timestamp. In-place migrations may * target a later phase when the phase timelines match. The target plan reference * is saved now; changed items take effect at the requested time. */ timing: SubscriptionEditTiming; /** A strictly later version of the current plan. Omit to use its latest version. */ targetVersion?: number; /** * Explicitly replace the subscription, starting in this target plan phase. Always * selects replacement, even when the phase matches the current one. Replacement * may produce billing adjustments and does not transfer addons. */ startingPhase?: string; /** * Providing a different billing anchor explicitly replaces the subscription. The * supplied anchor is preserved and may be before or after the replacement's start * time. Omit to retain the existing anchor. */ billingAnchor?: Date; } /** SubscriptionAddon create request. */ export interface CreateSubscriptionAddonRequest { labels?: Labels; /** The add-on associated with the subscription. */ addon: AddonReference; /** The quantity of the add-on. Always 1 for single instance add-ons. */ quantity: number; /** * The timing of the operation. After the create or update, a new entry will be * created in the timeline. */ timing: SubscriptionEditTiming; } /** * Request for updating a subscription add-on. Only the quantity can be changed; * the timing controls when the new quantity takes effect. */ export interface SubscriptionAddonUpdate { /** * The new quantity of the add-on. Must be at least 0. A quantity of 0 removes the * add-on from the point the timing resolves to. */ quantity: number; /** * The timing of the update. A new entry is appended to the add-on's timeline at * this point. */ timing: SubscriptionEditTiming; } /** TaxCode create request. */ export interface CreateTaxCodeRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** Mapping of app types to tax codes. */ appMappings: TaxCodeAppMapping[]; } /** Tax codes by provider. */ export interface TaxCode { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; /** Mapping of app types to tax codes. */ appMappings: TaxCodeAppMapping[]; } /** TaxCode upsert request. */ export interface UpsertTaxCodeRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** Mapping of app types to tax codes. */ appMappings: TaxCodeAppMapping[]; } /** * Available apps for billing integrations to connect with third-party services. * Apps can have various capabilities like syncing data from or to external * systems, integrating with third-party services for tax calculation, delivery of * invoices, collection of payments, etc. */ export interface AppCatalogItem { /** Type of the app. */ type: 'sandbox' | 'stripe' | 'external_invoicing'; /** Name of the app. */ name: string; /** Description of the app. */ description: string; /** Capabilities of the app. */ capabilities: AppCapability[]; /** Available install methods of the app. */ installMethods: ('with_oauth2' | 'with_api_key' | 'no_credentials_required')[]; } /** Discounts applied to an invoice line item. */ export interface InvoiceLineDiscounts { /** Monetary amount discounts (e.g. from maximum spend commitments). */ amount?: InvoiceLineAmountDiscount[]; /** Usage quantity discounts (e.g. free tier usage allowances). */ usage?: InvoiceLineUsageDiscount[]; } /** * Invoice-level snapshot of the workflow configuration. * * Contains only the settings that are meaningful for an already-created invoice: * invoicing behaviour and payment settings. Collection alignment and tax policy * are gather-time / profile-wide concerns and are not included. */ export interface UpdateBillingInvoiceWorkflow { /** Invoicing settings for this invoice. */ invoicing?: UpdateBillingInvoiceWorkflowInvoicingSettings; /** Payment settings for this invoice. */ payment?: UpdateBillingWorkflowPaymentSettings; } /** Access status for a single feature. */ export interface EntitlementFeatureAccess { /** * Whether the customer currently has access to the feature. * * `true` for boolean and static entitlements that are available, and for metered * entitlements with remaining balance. `false` when the feature is unavailable, * the usage limit has been reached, or (when applicable) credits have been * exhausted. */ hasAccess: boolean; /** * Optional reason when the customer does not have access to the feature. Populated * when `has_access` is `false`. */ reason?: EntitlementFeatureAccessReason; } /** Page paginated response. */ export interface NotificationChannelPagePaginatedResponse { data: NotificationChannel[]; meta: PaginatedMeta; } /** * A rule that generates an event when an entitlement balance crosses one of its * thresholds. */ export interface NotificationRuleBalanceThreshold { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.balance.threshold'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** The thresholds that generate an event when crossed. */ thresholds: NotificationBalanceThreshold[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** Request body for a balance threshold rule. */ export interface NotificationRuleBalanceThresholdRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.balance.threshold'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** The thresholds that generate an event when crossed. */ thresholds: NotificationBalanceThreshold[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** * The delivery status of a notification event for one channel of the generating * rule. */ export interface NotificationEventDeliveryStatus { /** The identifier of the channel this delivery status belongs to. */ channelId: string; /** The current delivery state. */ state: 'success' | 'failed' | 'sending' | 'pending' | 'resending'; /** The reason for the last state change. Empty for successful deliveries. */ reason: string; /** When the delivery state was last updated. */ updatedAt: Date; /** * When the next delivery attempt is scheduled. Absent when no further attempts * will be made. */ nextAttempt?: Date; /** The delivery attempts made so far, most recent first. */ attempts: NotificationEventDeliveryAttempt[]; } /** Billing customer data. */ export interface CustomerData { /** * The billing profile for the customer. * * If not provided, the default billing profile will be used. */ billingProfile?: ProfileReference; /** App customer data. */ appData?: AppCustomerData; } /** CustomerBillingData upsert request. */ export interface UpsertCustomerBillingDataRequest { /** * The billing profile for the customer. * * If not provided, the default billing profile will be used. */ billingProfile?: ProfileReference; /** App customer data. */ appData?: AppCustomerData; } /** * Flat fee intent fields from the system lifecycle controller shadowed by a manual * override. */ export interface ChargeFlatFeeSystemIntent { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** Payment term of the flat fee charge. */ paymentTerm: PricePaymentTerm; /** The discounts applied to the charge. */ discounts?: ChargeFlatFeeDiscounts; /** The proration configuration of the charge. */ prorationConfiguration: RateCardProrationConfiguration; /** The amount before proration of the system lifecycle controller flat fee intent. */ amountBeforeProration: CurrencyAmount; /** * The timestamp when the system lifecycle controller intent was deleted. The * effective charge can remain visible while a manual override is active. */ deletedAt?: Date; } /** List customer entitlement access response data. */ export interface ListCustomerEntitlementAccessResponseData { /** The list of entitlement access results. */ data: EntitlementValueResult[]; } /** The entities and threshold a balance threshold event refers to. */ export interface NotificationEventBalanceThresholdData { /** The identifier of the entitlement that triggered the event. */ entitlementId: string; /** The feature the entitlement grants access to. */ feature: NotificationEventFeatureReference; /** The key of the subject the entitlement belongs to. */ subjectKey: string; /** The identifier of the customer the subject belongs to, if any. */ customerId?: string; /** The entitlement value at the time the event was generated. */ value: EntitlementValueResult; /** The threshold the balance crossed. */ threshold: NotificationBalanceThreshold; } /** * The entitlement, feature, and subject an entitlement notification event refers * to. */ export interface NotificationEventEntitlementData { /** The identifier of the entitlement that triggered the event. */ entitlementId: string; /** The feature the entitlement grants access to. */ feature: NotificationEventFeatureReference; /** The key of the subject the entitlement belongs to. */ subjectKey: string; /** The identifier of the customer the subject belongs to, if any. */ customerId?: string; /** The entitlement value at the time the event was generated. */ value: EntitlementValueResult; } /** * Graduated tiered price. * * Each tier's rate applies only to the usage within that tier. Pricing can change * as cumulative usage crosses tier boundaries. * * When UnitConfig is present on the containing resource, tier boundaries * (up_to_amount) are expressed in converted billing units. */ export interface PriceGraduated { /** The type of the price. */ type: 'graduated'; /** The tiers of the graduated price. At least one tier is required. */ tiers: PriceTier[]; } /** * Volume tiered price. * * The maximum quantity within a period determines the per-unit price for all units * in that period. * * When UnitConfig is present on the containing resource, tier boundaries * (up_to_amount) are expressed in converted billing units. */ export interface PriceVolume { /** The type of the price. */ type: 'volume'; /** The tiers of the volume price. At least one tier is required. */ tiers: PriceTier[]; } /** * Graduated tiered price. * * Each tier's rate applies only to the usage within that tier. Pricing can change * as cumulative usage crosses tier boundaries. * * When UnitConfig is present on the containing resource, tier boundaries * (up_to_amount) are expressed in converted billing units. */ export interface UpdatePriceGraduated { /** The type of the price. */ type: 'graduated'; /** The tiers of the graduated price. At least one tier is required. */ tiers: UpdatePriceTier[]; } /** * Volume tiered price. * * The maximum quantity within a period determines the per-unit price for all units * in that period. * * When UnitConfig is present on the containing resource, tier boundaries * (up_to_amount) are expressed in converted billing units. */ export interface UpdatePriceVolume { /** The type of the price. */ type: 'volume'; /** The tiers of the volume price. At least one tier is required. */ tiers: UpdatePriceTier[]; } /** Page paginated response. */ export interface PricePagePaginatedResponse { data: LlmCostPrice[]; meta: PaginatedMeta; } /** Purchase and payment terms of the grant. */ export interface CreateCreditGrantPurchase { /** * Fiat currency the purchase is settled in. * * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency` * for custom-currency grants. */ currency: string; /** * Fiat cost basis per credit unit of a fiat-currency grant. * * If `per_unit_cost_basis` is 0.50 and credit amount is * $100.00, the total * charge is $50.00. The value must be greater than 0. If the * cost basis is 0, use `funding_method=none` instead. * * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults * to 1.0 when neither is provided. */ perUnitCostBasis?: string; /** * Defines how custom-currency credits are priced in the purchase `currency`; the * resolved rate is exposed through `resolved_cost_basis`. * * Fiat grants accept only a `manual` cost basis without `fiat_currency`, where * `rate` is the fiat cost per credit unit. Custom-currency grants require a cost * basis of any type with `fiat_currency` set and equal to the purchase `currency`. * A `dynamic` cost basis is resolved at the grant's effective time, so the * currency cost basis must be effective by then. Cannot be combined with * `per_unit_cost_basis`. */ costBasis?: CreateChargeCostBasis; /** * Controls when credits become available for consumption. * * Defaults to `on_creation`. */ availabilityPolicy: 'on_creation'; } /** Purchase and payment terms of the grant. */ export interface CreditGrantPurchase { /** * Fiat currency the purchase is settled in. * * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency` * for custom-currency grants. */ currency: string; /** * Fiat cost basis per credit unit of a fiat-currency grant. * * If `per_unit_cost_basis` is 0.50 and credit amount is * $100.00, the total * charge is $50.00. The value must be greater than 0. If the * cost basis is 0, use `funding_method=none` instead. * * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults * to 1.0 when neither is provided. */ perUnitCostBasis?: string; /** * The rate the purchase is settled at in the purchase `currency`. Present once the * cost basis is resolved. */ resolvedCostBasis?: ChargeResolvedCostBasis; /** * The purchase amount, calculated from the resolved cost basis and credit * `amount`. Present once the cost basis is resolved. */ amount?: string; /** * Controls when credits become available for consumption. * * Defaults to `on_creation`. */ availabilityPolicy: 'on_creation'; /** Current payment settlement status. */ settlementStatus?: 'pending' | 'authorized' | 'settled'; } /** Flat fee charge create request. */ export interface CreateChargeFlatFeeRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The type of the charge. */ type: 'flat_fee'; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * Defines how a custom-currency charge is converted into its fiat invoice * currency; the resolved rate is exposed through `resolved_cost_basis`. Required * when `currency` is custom and the charge settles as `credit_then_invoice`; must * be omitted otherwise. */ costBasis?: ChargeCostBasis; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** Payment term of the flat fee charge. */ paymentTerm: PricePaymentTerm; /** The discounts applied to the charge. */ discounts?: ChargeFlatFeeDiscounts; /** The proration configuration of the charge. */ prorationConfiguration: RateCardProrationConfiguration; /** The amount before proration of the charge. */ amountBeforeProration: CurrencyAmount; /** A reference to the feature associated with the charge, when applicable. */ feature?: FeatureReference; /** The full, unprorated service period of the charge. */ fullServicePeriod?: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod?: ClosedPeriod; } /** Tax settings for a billing workflow. */ export interface WorkflowTaxSettings { /** * Enable automatic tax calculation when tax is supported by the app. For example, * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax. */ enabled: boolean; /** * Enforce tax calculation when tax is supported by the app. When enabled, the * billing system will not allow to create an invoice without tax calculation. * Enforcement is different per apps, for example, Stripe app requires customer to * have a tax location when starting a paid subscription. */ enforced: boolean; /** * Default tax configuration to apply to the invoices for line items. * * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax * config is deprecated and can no longer be added or changed: the organization * default tax code is used instead. Existing tax-code values may still be removed, * and `behavior` remains fully supported. */ defaultTaxConfig?: TaxConfig; } /** The balances of the credits of a customer. */ export interface CreditBalances { /** The timestamp of the balance retrieval. */ retrievedAt: Date; /** The balances by currencies. */ balances: CreditBalance[]; } /** Cursor paginated response. */ export interface CreditTransactionPaginatedResponse { data: CreditTransaction[]; meta: CursorMeta; } /** Page paginated response. */ export interface PlanAddonPagePaginatedResponse { data: PlanAddon[]; meta: PaginatedMeta; } /** An invoice created notification event payload. */ export interface NotificationEventInvoiceCreatedPayload { /** The identifier of the event the payload belongs to. */ id: string; /** The type of the event. */ type: 'invoice.created'; /** When the event was generated. */ timestamp: Date; /** The invoice the event refers to. */ data: NotificationEventInvoiceData; } /** An invoice updated notification event payload. */ export interface NotificationEventInvoiceUpdatedPayload { /** The identifier of the event the payload belongs to. */ id: string; /** The type of the event. */ type: 'invoice.updated'; /** When the event was generated. */ timestamp: Date; /** The invoice the event refers to. */ data: NotificationEventInvoiceData; } /** Cursor paginated response. */ export interface IngestedEventPaginatedResponse { data: IngestedEvent[]; meta: CursorMeta; } /** Balance and usage history of a metered entitlement. */ export interface EntitlementHistory { /** * Usage in half-open windows of the requested size, aligned to the requested time * zone. Empty windows are included; windows before usage measurement began are * omitted. */ windowedHistory: EntitlementHistoryWindow[]; /** * Periods in which grants were consumed in a fixed order. A new segment starts * whenever grant priorities change or a usage period starts. */ burndownHistory: EntitlementBurndownSegment[]; } /** The list of parameters that failed validation. */ export type InvalidParameters = InvalidParameter[]; /** A meter query request. */ export interface MeterQueryRequest { /** The start of the period the usage is queried from. */ from?: Date; /** The end of the period the usage is queried to. */ to?: Date; /** * The size of the time buckets to group the usage into. If not specified, the * usage is aggregated over the entire period. */ granularity?: MeterQueryGranularity; /** * The value is the name of the time zone as defined in the IANA Time Zone Database * (http://www.iana.org/time-zones). The time zone is used to determine the start * and end of the time buckets. If not specified, the UTC timezone will be used. */ timeZone: string; /** The dimensions to group the results by. */ groupByDimensions?: string[]; /** Filters to apply to the query. */ filters?: MeterQueryFilters; } /** Page paginated response. */ export interface CustomerPagePaginatedResponse { data: Customer[]; meta: PaginatedMeta; } /** * Snapshot of the supplier's information at the time the invoice was issued. * * Structurally a read-only subset of `BillingParty` (the type configured on the * billing profile), so the snapshot stays aligned with the source. `key` is * omitted because it is not part of the snapshotted supplier data. */ export interface Supplier { /** Legal name or representation of the party. */ name?: string; /** * The entity's legal identification used for tax purposes. They may have other * numbers, but we're only interested in those valid for tax purposes. */ taxId?: PartyTaxIdentity; /** Address for where information should be sent if needed. */ addresses?: PartyAddresses; /** Unique identifier for the party. */ id?: string; } /** Party represents a person or business entity. */ export interface Party { /** Unique identifier for the party. */ id?: string; /** An optional unique key of the party. */ key?: string; /** Legal name or representation of the party. */ name?: string; /** * The entity's legal identification used for tax purposes. They may have other * numbers, but we're only interested in those valid for tax purposes. */ taxId?: PartyTaxIdentity; /** Address for where information should be sent if needed. */ addresses?: PartyAddresses; } /** * Snapshot of the supplier's information at the time the invoice was issued. * * Structurally a read-only subset of `BillingParty` (the type configured on the * billing profile), so the snapshot stays aligned with the source. `key` is * omitted because it is not part of the snapshotted supplier data. */ export interface UpdateSupplier { /** Legal name or representation of the party. */ name?: string; /** * The entity's legal identification used for tax purposes. They may have other * numbers, but we're only interested in those valid for tax purposes. */ taxId?: UpdateBillingPartyTaxIdentity; /** Address for where information should be sent if needed. */ addresses?: UpdateBillingPartyAddresses; /** Unique identifier for the party. */ id?: string; } /** * Configuration options for creating a Stripe Checkout Session. * * Based on Stripe's * [Checkout Session API parameters](https://docs.stripe.com/api/checkout/sessions/create). */ export interface AppStripeCreateCheckoutSessionRequestOptions { /** * Whether to collect the customer's billing address. * * Defaults to auto, which only collects the address when necessary for tax * calculation. */ billingAddressCollection: 'auto' | 'required'; /** * URL to redirect customers who cancel the checkout session. * * Not allowed when ui_mode is "embedded". */ cancelUrl?: string; /** * Unique reference string for reconciling sessions with internal systems. * * Can be a customer ID, cart ID, or any other identifier. */ clientReferenceId?: string; /** Controls which customer fields can be updated by the checkout session. */ customerUpdate?: AppStripeCreateCheckoutSessionCustomerUpdate; /** Configuration for collecting customer consent during checkout. */ consentCollection?: AppStripeCreateCheckoutSessionConsentCollection; /** * Three-letter ISO 4217 currency code in uppercase. * * Required for payment mode sessions. Optional for setup mode sessions. */ currency?: string; /** Custom text to display during checkout at various stages. */ customText?: AppStripeCheckoutSessionCustomTextParams; /** * Unix timestamp when the checkout session expires. * * Can be 30 minutes to 24 hours from creation. Defaults to 24 hours. */ expiresAt?: bigint; /** * IETF language tag for the checkout UI locale. * * If blank or "auto", uses the browser's locale. Example: "en", "fr", "de". */ locale?: string; /** * Set of key-value pairs to attach to the checkout session. * * Useful for storing additional structured information. */ metadata?: Record; /** * Return URL for embedded checkout sessions after payment authentication. * * Required if ui_mode is "embedded" and redirect-based payment methods are * enabled. */ returnUrl?: string; /** * Success URL to redirect customers after completing payment or setup. * * Not allowed when ui_mode is "embedded". See: * https://docs.stripe.com/payments/checkout/custom-success-page */ successUrl?: string; /** * The UI mode for the checkout session. * * "hosted" displays a Stripe-hosted page. "embedded" integrates directly into your * app. Defaults to "hosted". */ uiMode: 'embedded' | 'hosted'; /** * List of payment method types to enable (e.g., "card", "us_bank_account"). * * If not specified, Stripe enables all relevant payment methods. */ paymentMethodTypes?: string[]; /** * Redirect behavior for embedded checkout sessions. * * Controls when to redirect users after completion. See: * https://docs.stripe.com/payments/checkout/custom-success-page?payment-ui=embedded-form */ redirectOnCompletion?: 'always' | 'if_required' | 'never'; /** Configuration for collecting tax IDs during checkout. */ taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollection; } /** Metered entitlement create request. */ export interface CreateEntitlementMeteredRequest { /** The type of the entitlement. */ type: 'metered'; /** The feature the customer is entitled to use. */ feature: FeatureReference; labels?: Labels; /** * If true, the customer keeps access to the feature after the balance is * exhausted. */ isSoftLimit: boolean; /** Usage granted automatically after each reset. Cannot be combined with `grants`. */ issue?: EntitlementIssueAfterReset; /** The amount granted automatically after each reset. */ issueAfterReset?: string; /** The priority of the grant created after each reset. */ issueAfterResetPriority: number; /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */ preserveOverageAtReset: boolean; /** * The usage period of the entitlement. The balance resets at the start of every * period. The anchor defaults to the entitlement creation time. */ usagePeriod: RecurringPeriodInput; /** * The time from which usage is measured. Defaults to the entitlement creation * time. */ measureUsageFrom?: EntitlementMeasureUsageFrom; /** Grants created together with the entitlement. Cannot be combined with `issue`. */ grants?: EntitlementGrantCreateRequest[]; } /** Page paginated response. */ export interface EntitlementGrantPagePaginatedResponse { data: EntitlementGrant[]; meta: PaginatedMeta; } /** Snapshot of the billing workflow configuration captured at invoice creation. */ export interface InvoiceWorkflowSettings { /** The apps that will be used to orchestrate the invoice's workflow. */ apps?: InvoiceWorkflowAppsReferences; /** The billing profile that was the source of this workflow snapshot. */ sourceBillingProfile: ProfileReference; /** * The workflow configuration that was active when the invoice was created. * * Only the fields that are meaningful at the per-invoice level are included: * invoicing behaviour (auto-advance, draft period) and payment settings * (collection method, due date). Profile-wide settings such as collection * alignment, progressive billing, and tax policy are omitted. */ workflow: InvoiceWorkflow; } /** Page paginated response. */ export interface TaxCodePagePaginatedResponse { data: TaxCode[]; meta: PaginatedMeta; } /** Stripe app. */ export interface AppStripe { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The app type. */ type: 'stripe'; /** The app catalog definition that this installed app is based on. */ definition: AppCatalogItem; /** Status of the app connection. */ status: 'ready' | 'unauthorized'; /** * Actions the operator should take to bring the app up to date. Omitted when no * action is required. */ actions?: AppAction[]; /** The Stripe account ID associated with the connected Stripe account. */ accountId: string; /** Indicates whether the app is connected to a live Stripe account. */ livemode: boolean; /** The masked Stripe API key that only exposes the first and last few characters. */ maskedApiKey: string; } /** Sandbox app can be used for testing billing features. */ export interface AppSandbox { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The app type. */ type: 'sandbox'; /** The app catalog definition that this installed app is based on. */ definition: AppCatalogItem; /** Status of the app connection. */ status: 'ready' | 'unauthorized'; /** * Actions the operator should take to bring the app up to date. Omitted when no * action is required. */ actions?: AppAction[]; } /** * External Invoicing app enables integration with third-party invoicing or payment * system. * * The app supports a bi-directional synchronization pattern where OpenMeter * Billing manages the invoice lifecycle while the external system handles invoice * presentation and payment collection. * * Integration workflow: * * 1. The billing system creates invoices and transitions them through lifecycle * states (draft → issuing → issued) * 2. The integration receives webhook notifications about invoice state changes * 3. The integration calls back to provide external system IDs and metadata * 4. The integration reports payment events back via the payment status API * * State synchronization is controlled by hooks that pause invoice progression * until the external system confirms synchronization via API callbacks. */ export interface AppExternalInvoicing { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The app type. */ type: 'external_invoicing'; /** The app catalog definition that this installed app is based on. */ definition: AppCatalogItem; /** Status of the app connection. */ status: 'ready' | 'unauthorized'; /** * Actions the operator should take to bring the app up to date. Omitted when no * action is required. */ actions?: AppAction[]; /** * Enable draft synchronization hook. * * When enabled, invoices will pause at the draft state and wait for the * integration to call the draft synchronized endpoint before progressing to the * issuing state. This allows the external system to validate and prepare the * invoice data. * * When disabled, invoices automatically progress through the draft state based on * the configured workflow timing. */ enableDraftSyncHook: boolean; /** * Enable issuing synchronization hook. * * When enabled, invoices will pause at the issuing state and wait for the * integration to call the issuing synchronized endpoint before progressing to the * issued state. This ensures the external invoicing system has successfully * created and finalized the invoice before it is marked as issued. * * When disabled, invoices automatically progress through the issuing state and are * immediately marked as issued. */ enableIssuingSyncHook: boolean; } /** Page paginated response. */ export interface AppCatalogItemPagePaginatedResponse { data: AppCatalogItem[]; meta: PaginatedMeta; } /** Response of an installed app. */ export interface InstalledAppStripe { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The app type. */ type: 'stripe'; /** The app catalog definition that this installed app is based on. */ definition: AppCatalogItem; /** Status of the app connection. */ status: 'ready' | 'unauthorized'; /** * Actions the operator should take to bring the app up to date. Omitted when no * action is required. */ actions?: AppAction[]; /** The Stripe account ID associated with the connected Stripe account. */ accountId: string; /** Indicates whether the app is connected to a live Stripe account. */ livemode: boolean; /** The masked Stripe API key that only exposes the first and last few characters. */ maskedApiKey: string; /** Default capabilities of the installed app. */ defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[]; } /** Response of an installed app. */ export interface InstalledAppSandbox { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The app type. */ type: 'sandbox'; /** The app catalog definition that this installed app is based on. */ definition: AppCatalogItem; /** Status of the app connection. */ status: 'ready' | 'unauthorized'; /** * Actions the operator should take to bring the app up to date. Omitted when no * action is required. */ actions?: AppAction[]; /** Default capabilities of the installed app. */ defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[]; } /** Response of an installed app. */ export interface InstalledAppExternalInvoicing { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The app type. */ type: 'external_invoicing'; /** The app catalog definition that this installed app is based on. */ definition: AppCatalogItem; /** Status of the app connection. */ status: 'ready' | 'unauthorized'; /** * Actions the operator should take to bring the app up to date. Omitted when no * action is required. */ actions?: AppAction[]; /** * Enable draft synchronization hook. * * When enabled, invoices will pause at the draft state and wait for the * integration to call the draft synchronized endpoint before progressing to the * issuing state. This allows the external system to validate and prepare the * invoice data. * * When disabled, invoices automatically progress through the draft state based on * the configured workflow timing. */ enableDraftSyncHook: boolean; /** * Enable issuing synchronization hook. * * When enabled, invoices will pause at the issuing state and wait for the * integration to call the issuing synchronized endpoint before progressing to the * issued state. This ensures the external invoicing system has successfully * created and finalized the invoice before it is marked as issued. * * When disabled, invoices automatically progress through the issuing state and are * immediately marked as issued. */ enableIssuingSyncHook: boolean; /** Default capabilities of the installed app. */ defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[]; } /** * A detailed (child) sub-line belonging to a parent invoice line. * * Detailed lines represent the individual flat-fee components that make up a * usage-based parent line after quantity snapshotting. */ export interface InvoiceDetailedLine { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The service period covered by this detailed line. */ servicePeriod: ClosedPeriod; /** Aggregated financial totals for the detailed line. */ totals: Totals; /** The cost category of this detailed line. */ category: 'regular' | 'commitment'; /** Discounts applied to this detailed line. */ discounts?: InvoiceLineDiscounts; /** Credit applied to this detailed line. */ creditsApplied?: InvoiceLineCreditsApplied[]; /** External identifiers for this detailed line. */ externalReferences?: InvoiceLineExternalReferences; /** The quantity of the detailed line. */ quantity: string; /** The unit price of the detailed line. */ unitPrice: string; } /** Snapshot of the billing workflow configuration captured at invoice creation. */ export interface UpdateInvoiceWorkflowSettings { /** * The workflow configuration that was active when the invoice was created. * * Only the fields that are meaningful at the per-invoice level are included: * invoicing behaviour (auto-advance, draft period) and payment settings * (collection method, due date). Profile-wide settings such as collection * alignment, progressive billing, and tax policy are omitted. */ workflow: UpdateBillingInvoiceWorkflow; } /** Access evaluation result for a single resolved customer. */ export interface EntitlementAccessQueryResult { /** * The list of identifiers from the request that resolved to this customer. Each * entry is either the customer `key` or one of its usage-attribution subject * `key`s. * * Duplicate or aliased identifiers that resolve to the same customer collapse to a * single result entry, with every requested identifier listed here. */ matched: string[]; /** The customer the matched identifiers resolved to. */ customer: Customer; /** * Map of features with their access status. * * Map keys are the feature keys requested in `feature.keys`, or every feature * `key` available in the organization when the feature filter was omitted. */ features: Record; /** * Timestamp of the most recent change to the customer's access state reflected in * this result. */ updatedAt: Date; } /** A balance threshold notification event payload. */ export interface NotificationEventBalanceThresholdPayload { /** The identifier of the event the payload belongs to. */ id: string; /** The type of the event. */ type: 'entitlements.balance.threshold'; /** When the event was generated. */ timestamp: Date; /** The entities and threshold the event refers to. */ data: NotificationEventBalanceThresholdData; } /** An entitlement reset notification event payload. */ export interface NotificationEventResetPayload { /** The identifier of the event the payload belongs to. */ id: string; /** The type of the event. */ type: 'entitlements.reset'; /** When the event was generated. */ timestamp: Date; /** The entities the event refers to. */ data: NotificationEventEntitlementData; } /** A capability or billable dimension offered by a provider. */ export interface Feature { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; /** * The meter that the feature is associated with and based on which usage is * calculated. If not specified, the feature is static. */ meter?: FeatureMeterReference; /** * Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or * "llm" to look up cost from the LLM cost database based on meter group-by * properties. */ unitCost?: FeatureUnitCost; } /** Feature create request. */ export interface CreateFeatureRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** * The meter that the feature is associated with and based on which usage is * calculated. If not specified, the feature is static. */ meter?: FeatureMeterReference; /** * Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or * "llm" to look up cost from the LLM cost database based on meter group-by * properties. */ unitCost?: FeatureUnitCost; } /** * Request body for updating a feature. Currently only the unit_cost field can be * updated. */ export interface UpdateFeatureRequest { /** * Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or * "llm" to look up cost from the LLM cost database based on meter group-by * properties. Set to `null` to clear the existing unit cost; omit to leave it * unchanged. */ unitCost?: FeatureUnitCost | null; } /** CreditGrant create request. */ export interface CreateCreditGrantRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: CreateLabels; /** Funding method of the grant. */ fundingMethod: 'none' | 'invoice' | 'external'; /** * The fiat or custom currency of the granted credits. * * Funded custom-currency grants must define `purchase.cost_basis` to settle in a * fiat currency. */ currency: CreateCurrencyCode; /** Granted credit amount. */ amount: string; /** Present when a funding workflow applies (funding_method is not `none`). */ purchase?: CreateCreditGrantPurchase; /** * Tax configuration for the grant. * * For `invoice` and `external` funding methods, tax configuration should be * provided to ensure correct revenue recognition. When not provided, the default * credit grant tax code is applied, if that's not set the global default taxcode * is used. */ taxConfig?: CreateTaxCodeConfig; filters?: CreateCreditGrantFilters; /** Draw-down priority of the grant. Lower values have higher priority. */ priority: number; /** * The timestamp when the credit grant becomes effective. * * Defaults to the current date and time. */ effectiveAt?: Date; /** * The duration after which the credit grant expires. * * Defaults to never expiring. */ expiresAfter?: string; /** * Idempotency key for the credit grant creation request. * * Unique per customer: reusing the same key for the same customer returns an HTTP * 409 Conflict instead of creating a duplicate grant, which makes create requests * safe to retry. The same key may be reused across different customers. */ key?: string; } /** * A credit grant allocates credits to a customer. * * Credits are drawn down against charges according to the settlement mode * configured on the rate card. */ export interface CreditGrant { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Funding method of the grant. */ fundingMethod: 'none' | 'invoice' | 'external'; /** * The fiat or custom currency of the granted credits. * * Funded custom-currency grants must define `purchase.cost_basis` to settle in a * fiat currency. */ currency: BillingCurrencyCode; /** Granted credit amount. */ amount: string; /** Present when a funding workflow applies (funding_method is not `none`). */ purchase?: CreditGrantPurchase; /** * Tax configuration for the grant. * * For `invoice` and `external` funding methods, tax configuration should be * provided to ensure correct revenue recognition. When not provided, the default * credit grant tax code is applied, if that's not set the global default taxcode * is used. */ taxConfig?: TaxCodeConfig; /** Available when `funding_method` is `invoice`. */ invoice?: CreditGrantInvoiceReference; filters?: CreditGrantFilters; /** Draw-down priority of the grant. Lower values have higher priority. */ priority: number; /** * The timestamp when the credit grant becomes effective. * * Defaults to the current date and time. */ effectiveAt?: Date; /** * Idempotency key for the credit grant creation request. * * Unique per customer: reusing the same key for the same customer returns an HTTP * 409 Conflict instead of creating a duplicate grant, which makes create requests * safe to retry. The same key may be reused across different customers. */ key?: string; /** * The timestamp when the credit grant expires. * * Calculated from the grant effective time and `expires_after` if provided. */ expiresAt?: Date; /** Timestamp when the grant was voided. */ voidedAt?: Date; /** Current lifecycle status of the grant. */ status: 'pending' | 'active' | 'expired' | 'voided'; /** * Validation issues found while processing the credit grant. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; } /** Page paginated response. */ export interface CurrencyPagePaginatedResponse { data: Currency[]; meta: PaginatedMeta; } /** Bad Request. */ export interface BadRequest extends BaseError { /** The list of parameters that failed validation. */ invalidParameters: InvalidParameter[]; } /** * Base fields shared by all invoice types. * * Spread this model into each concrete invoice variant. */ export interface InvoiceBase { id: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Human-readable invoice number generated by the invoicing app. */ number: string; /** Three-letter ISO 4217 currency code for the invoice. */ currency: string; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: Supplier; /** Snapshot of the customer's information at the time the invoice was issued. */ customer: InvoiceCustomer; /** Aggregated financial totals for the invoice. */ totals: Totals; /** * The service period covered by this invoice. * * For flat fee the service period can be empty which means `from` will be equals * to `to`. In other cases those fields will be filled with the actual service * period. */ servicePeriod: ClosedPeriod; /** * Validation issues found during invoice processing. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** External identifiers assigned to this invoice by third-party systems. */ externalReferences?: InvoiceExternalReferences; } /** * Request to create a Stripe Checkout Session for the customer. * * Checkout Sessions are used to collect payment method information from customers * in a secure, Stripe-hosted interface. This integration uses setup mode to * collect payment methods that can be charged later for subscription billing. */ export interface CustomerStripeCreateCheckoutSessionRequest { /** * Options for configuring the Stripe Checkout Session. * * These options are passed directly to Stripe's * [checkout session creation API](https://docs.stripe.com/api/checkout/sessions/create). */ stripeOptions: AppStripeCreateCheckoutSessionRequestOptions; } /** Page paginated response. */ export interface EntitlementPagePaginatedResponse { data: Entitlement[]; meta: PaginatedMeta; } /** * Workflow collection specifies how to collect the pending line items for an * invoice. */ export interface WorkflowCollectionSettings { /** The alignment for collecting the pending line items into an invoice. */ alignment: WorkflowCollectionAlignment; /** * This grace period can be used to delay the collection of the pending line items * specified in alignment. * * This is useful, in case of multiple subscriptions having slightly different * billing periods. */ interval: string; } /** * The invoice a charge realization was booked to, embedded as a header. * * Matches the standard invoice entity, except that it carries no `customer` * snapshot (the charge context already identifies the customer) and `lines` are * never populated (the realization itself is the line-level breakdown). The shared * invoice contract stays untouched: this model exists so the charges API can slim * the embedding without loosening the invoices API. */ export interface ChargeRealizationInvoice { id: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Human-readable invoice number generated by the invoicing app. */ number: string; /** Three-letter ISO 4217 currency code for the invoice. */ currency: string; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: Supplier; /** Aggregated financial totals for the invoice. */ totals: Totals; /** * The service period covered by this invoice. * * For flat fee the service period can be empty which means `from` will be equals * to `to`. In other cases those fields will be filled with the actual service * period. */ servicePeriod: ClosedPeriod; /** * Validation issues found during invoice processing. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** External identifiers assigned to this invoice by third-party systems. */ externalReferences?: InvoiceExternalReferences; /** Discriminator field identifying this as a standard invoice. */ type: 'standard'; /** Current lifecycle status of the invoice. */ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided'; /** Detailed status information including available actions and workflow state. */ statusDetails: InvoiceStatusDetails; /** Timestamp when the invoice was issued to the customer. */ issuedAt?: Date; /** * Timestamp until which the invoice remains in draft state. * * The invoice advances automatically once this time is reached. */ draftUntil?: Date; /** Timestamp when usage quantities were last snapshotted for this invoice. */ quantitySnapshottedAt?: Date; /** Timestamp when collection was initiated for this invoice. */ collectionAt?: Date; /** Timestamp when payment is due. */ dueAt?: Date; /** Timestamp when the invoice was sent to the customer. */ sentToCustomerAt?: Date; /** Workflow configuration snapshot captured at invoice creation time. */ workflow: InvoiceWorkflowSettings; } /** Response of the entitlement access query. */ export interface EntitlementAccessQueryResponse { /** Access evaluation results, one entry per resolved customer. */ data: EntitlementAccessQueryResult[]; /** Partial errors encountered while processing the request. */ errors: EntitlementAccessQueryError[]; /** * Pagination metadata. The endpoint may return a partial response if the full * response would exceed server-side limits. */ meta: CursorMeta; } /** Page paginated response. */ export interface NotificationRulePagePaginatedResponse { data: NotificationRule[]; meta: PaginatedMeta; } /** A rate card defines the pricing and entitlement of a feature or service. */ export interface RateCard { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** The feature associated with the rate card. */ feature?: FeatureReference; /** * Overrides the containing plan or add-on currency for this rate card. When * omitted, the containing resource currency applies. */ currency?: BillingCurrencyCode; /** * The billing cadence of the rate card. When null, the charge is one-time * (non-recurring). Only valid for flat prices. */ billingCadence?: string; /** The price of the rate card. */ price: Price; /** * Unit conversion configuration for the rate card. * * Synthesized on read for plans authored with v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create and update only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfig; /** * The payment term of the rate card. In advance payment term can only be used for * flat prices. */ paymentTerm: PricePaymentTerm; /** * Spend commitments for this rate card. Only applicable to usage-based prices * (unit, graduated, volume). */ commitments?: SpendCommitments; /** The discounts of the rate card. */ discounts?: RateCardDiscounts; /** The tax config of the rate card. */ taxConfig?: TaxCodeConfig; /** * The entitlement template granted to subscribers of a plan or addon containing * this rate card. Requires `feature` to be set. */ entitlement?: RateCardEntitlement; } /** Rate card configuration snapshot for a usage-based invoice line. */ export interface InvoiceLineRateCard { /** The price definition used to calculate charges for this line. */ price: Price; /** Tax configuration snapshot for this line. */ taxConfig?: TaxCodeConfig; /** The feature key associated with this line's rate card. */ featureKey?: string; /** Discount configuration from the rate card. */ discounts?: RateCardDiscounts; /** * Unit config snapshot applied when this line was billed, converting the raw * metered quantity into the billed quantity. Frozen at billing time; read-only. */ unitConfig?: UnitConfig; } /** * Usage-based intent fields from the system lifecycle controller shadowed by a * manual override. */ export interface ChargeUsageBasedSystemIntent { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** Discounts applied to the usage-based charge. */ discounts?: RateCardDiscounts; /** * The price of the charge. * * `free` prices are rejected on create: a usage-based charge always carries a * concrete price. */ price: PriceUsageBased; /** Spend commitments for the charge. */ commitments?: SpendCommitments; /** * Unit conversion configuration for the charge. * * Synthesized on read for charges created from v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfig; /** * The timestamp when the system lifecycle controller intent was deleted. The * effective charge can remain visible while a manual override is active. */ deletedAt?: Date; } /** Usage-based charge create request. */ export interface CreateChargeUsageBasedRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The type of the charge. */ type: 'usage_based'; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * Defines how a custom-currency charge is converted into its fiat invoice * currency; the resolved rate is exposed through `resolved_cost_basis`. Required * when `currency` is custom and the charge settles as `credit_then_invoice`; must * be omitted otherwise. */ costBasis?: ChargeCostBasis; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** Discounts applied to the usage-based charge. */ discounts?: RateCardDiscounts; /** * The price of the charge. * * `free` prices are rejected on create: a usage-based charge always carries a * concrete price. */ price: PriceUsageBased; /** Spend commitments for the charge. */ commitments?: SpendCommitments; /** * Unit conversion configuration for the charge. * * Synthesized on read for charges created from v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfig; /** A reference to the feature associated with the charge. */ feature: FeatureReference; /** The full, unprorated service period of the charge. */ fullServicePeriod?: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod?: ClosedPeriod; } /** Page paginated response. */ export interface FeaturePagePaginatedResponse { data: Feature[]; meta: PaginatedMeta; } /** Rate card configuration snapshot for a usage-based invoice line. */ export interface UpdateInvoiceLineRateCard { /** The price definition used to calculate charges for this line. */ price: UpdatePrice; /** Tax configuration snapshot for this line. */ taxConfig?: UpdateTaxCodeConfig; /** The feature key associated with this line's rate card. */ featureKey?: string; /** Discount configuration from the rate card. */ discounts?: UpdateDiscounts; } /** Page paginated response. */ export interface CreditGrantPagePaginatedResponse { data: CreditGrant[]; meta: PaginatedMeta; } /** Billing workflow settings. */ export interface Workflow { /** The collection settings for this workflow */ collection?: WorkflowCollectionSettings; /** The invoicing settings for this workflow */ invoicing?: WorkflowInvoicingSettings; /** The payment settings for this workflow */ payment?: WorkflowPaymentSettings; /** The tax settings for this workflow */ tax?: WorkflowTaxSettings; } /** Page paginated response. */ export interface AppPagePaginatedResponse { data: App[]; meta: PaginatedMeta; } /** Applications used by a billing profile. */ export interface ProfileApps { /** The tax app used for this workflow. */ tax: App; /** The invoicing app used for this workflow. */ invoicing: App; /** The payment app used for this workflow. */ payment: App; } /** * A notification event records that a notification rule fired and tracks the * delivery of its payload to each channel of the rule. Events are created by the * system and cannot be modified. */ export interface NotificationEvent { /** The unique identifier of the event. */ id: string; /** The type of the event. */ type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated'; /** When the event was generated. */ createdAt: Date; /** The rule that generated the event. */ rule: NotificationRuleReference; /** The delivery status of the event, one entry per channel of the rule. */ deliveryStatus: NotificationEventDeliveryStatus[]; /** The payload delivered to the channels. */ payload: NotificationEventPayload; } /** A subscription item pins a rate card to a cadence within a subscription phase. */ export interface SubscriptionItem { /** The unique identifier of the subscription item instance. */ id: string; /** An ISO-8601 timestamp representation of when this item version becomes active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when this item version stops being * active. */ activeTo?: Date; /** The rate card describing what the customer gets and pays for this item. */ rateCard: RateCard; } /** * The plan phase or pricing ramp allows changing a plan's rate cards over time as * a subscription progresses. */ export interface PlanPhase { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** * The duration of the phase. When not specified, the phase runs indefinitely. Only * the last phase may omit the duration. */ duration?: string; /** The rate cards of the plan. */ rateCards: RateCard[]; } /** * Add a new rate card to a phase. Adding an item to the current phase closes the * active version of the same item key and appends a new version. */ export interface SubscriptionEditAddItem { /** Discriminator for the add-item operation. */ type: 'add_item'; /** The key of the phase to add the item to. */ phaseKey: string; /** The rate card describing what the customer gets and pays for the new item. */ rateCard: RateCard; } /** A rate card for a subscription add-on. */ export interface SubscriptionAddonRateCard { /** The rate card. */ rateCard: RateCard; /** The IDs of the subscription items that this rate card belongs to. */ affectedSubscriptionItemIds: string[]; } /** * Add-on allows extending subscriptions with compatible plans with additional * ratecards. */ export interface Addon { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * A key is a semi-unique string that is used to identify the add-on. It is used to * reference the latest `active` version of the add-on and is unique with the * version number. */ key: string; /** Version of the add-on. Incremented when the add-on is updated. */ version: number; /** The InstanceType of the add-ons. Can be "single" or "multiple". */ instanceType: 'single' | 'multiple'; /** The currency code of the add-on. */ currency: BillingCurrencyCode; /** * The date and time when the add-on becomes effective. When not specified, the * add-on is a draft. */ effectiveFrom?: Date; /** * The date and time when the add-on is no longer effective. When not specified, * the add-on is effective indefinitely. */ effectiveTo?: Date; /** * The status of the add-on. Computed based on the effective start and end dates: * * - `draft`: `effective_from` is not set. * - `active`: `effective_from <= now` and (`effective_to` is not set or * `now < effective_to`). * - `archived`: `effective_to <= now`. */ status: 'draft' | 'active' | 'archived'; /** The rate cards of the add-on. */ rateCards: RateCard[]; /** List of validation errors. */ validationErrors?: ProductCatalogValidationError[]; } /** Addon create request. */ export interface CreateAddonRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * A key is a semi-unique string that is used to identify the add-on. It is used to * reference the latest `active` version of the add-on and is unique with the * version number. */ key: string; /** The InstanceType of the add-ons. Can be "single" or "multiple". */ instanceType: 'single' | 'multiple'; /** The currency code of the add-on. */ currency: BillingCurrencyCode; /** The rate cards of the add-on. */ rateCards: RateCard[]; } /** Addon upsert request. */ export interface UpsertAddonRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The InstanceType of the add-ons. Can be "single" or "multiple". */ instanceType: 'single' | 'multiple'; /** The rate cards of the add-on. */ rateCards: RateCard[]; } /** * A top-level line item on an invoice. * * Each line represents a single charge, typically associated with a rate card from * a subscription. Detailed (child) lines are nested under `detailed_lines` when * present. */ export interface InvoiceStandardLine { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * ID of the line. * * Optional on update: omit to create a new line, or supply the ID of an existing * line to edit it. Existing lines omitted from an update's `lines` array are * deleted. */ id?: string; /** The type of charge this line item represents. */ type: 'standard_line'; /** * Indicates whether this line item's lifecycle is controlled by OpenMeter or * manually overridden by the API user. */ lifecycleController: 'system' | 'manual'; /** * The service period covered by this invoice, spanning the earliest line start to * the latest line end across all of its lines. * * For an invoice with no lines the period is empty, which means `from` will be * equal to `to`. */ servicePeriod: ClosedPeriod; /** Aggregated financial totals for the line item. */ totals: Totals; /** Discounts applied to this line item. */ discounts?: InvoiceLineDiscounts; /** Credit applied to this line item. */ creditsApplied?: InvoiceLineCreditsApplied[]; /** External identifiers for this line item assigned by third-party systems. */ externalReferences?: InvoiceLineExternalReferences; /** Reference to the subscription item that generated this line. */ subscription?: SubscriptionReference; /** The rate card configuration snapshot used to price this line item. */ rateCard: InvoiceLineRateCard; /** * Detailed sub-lines that this line has been broken down into. * * Present when line has individual details. */ detailedLines: InvoiceDetailedLine[]; /** * Usage quantity details for this line when UnitConfig is in effect. * * Read-only; omitted for lines without unit conversion. */ usageQuantityDetail?: InvoiceUsageQuantityDetail; /** Reference to the charge associated with this line item. */ charge?: ChargeReference; } /** * A top-level line item on an invoice. * * Each line represents a single charge, typically associated with a rate card from * a subscription. Detailed (child) lines are nested under `detailed_lines` when * present. */ export interface UpdateInvoiceStandardLine { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: UpdateLabels; /** * ID of the line. * * Optional on update: omit to create a new line, or supply the ID of an existing * line to edit it. Existing lines omitted from an update's `lines` array are * deleted. */ id?: string; /** The type of charge this line item represents. */ type: 'standard_line'; /** * The service period covered by this invoice, spanning the earliest line start to * the latest line end across all of its lines. * * For an invoice with no lines the period is empty, which means `from` will be * equal to `to`. */ servicePeriod: UpdateClosedPeriod; /** The rate card configuration snapshot used to price this line item. */ rateCard: UpdateInvoiceLineRateCard; } /** * Billing profiles contain the settings for billing and controls invoice * generation. */ export interface Profile { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * The name and contact information for the supplier this billing profile * represents */ supplier: Party; /** The billing workflow settings for this profile */ workflow: Workflow; /** The applications used by this billing profile. */ apps: ProfileAppReferences; /** Whether this is the default profile. */ default: boolean; } /** BillingProfile create request. */ export interface CreateBillingProfileRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * The name and contact information for the supplier this billing profile * represents */ supplier: Party; /** The billing workflow settings for this profile */ workflow: Workflow; /** The applications used by this billing profile. */ apps: ProfileAppReferences; /** Whether this is the default profile. */ default: boolean; } /** BillingProfile upsert request. */ export interface UpsertBillingProfileRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * The name and contact information for the supplier this billing profile * represents */ supplier: Party; /** The billing workflow settings for this profile */ workflow: Workflow; /** Whether this is the default profile. */ default: boolean; } /** * A realization run of a charge. * * `totals` and `detailed_lines` are only populated with the `realization.totals` * and `realization.detailed_lines` expands, respectively, since computing them * requires re-deriving the run's rated breakdown. `invoice` is an ID reference * unless the `realization.invoice` expand is used, which resolves it to the * invoice header of the run's booked line: the invoice entity without its `lines` * and without the `customer` snapshot (the charge itself already identifies the * customer). */ export interface ChargeRealization { /** * The ID of the realization run. Not present on `outstanding` entries, which are * projections rather than persisted runs. */ id?: string; /** * The ID of the invoice line this realization was booked to, when the realization * has been invoiced. */ lineId?: string; /** The reference of the invoice related to the realization. */ invoice?: ChargeRealizationInvoiceOrReference; /** The type of the realization run. */ type: 'final_realization' | 'partial_invoice' | 'outstanding' | 'voided'; /** The service period covered by this realization run. */ servicePeriod: ClosedPeriod; /** * The metered usage quantity this realization run accounts for. Only present on * usage-based charges; flat fees are not metered, so their realizations carry no * usage. * * Booked entries report a signed delta: a negative value states a downward usage * correction (or a voided run that snapshotted behind its live neighbors) instead * of masking it as zero. * * On an `outstanding` entry this is `0` unless the `real_time_usage` expand is * applied, in which case it is the not-yet-booked remainder of the live metering * read (never negative). */ usage?: string; /** * The payment state of the realization, when the charge requires a fiat * transaction to settle. */ payment?: ChargeRealizationPayment; /** * Financial totals for the realization run, including credit allocations. * * Requires the `realization.totals` expand. */ totals?: Totals; /** * The detailed (rated) lines produced by the realization run. * * Requires the `realization.detailed_lines` expand. */ detailedLines?: ChargeRealizationDetailedLine[]; } /** Page paginated response. */ export interface NotificationEventPagePaginatedResponse { data: NotificationEvent[]; meta: PaginatedMeta; } /** * A subscription phase groups the rate cards in effect for a segment of the * subscription's lifetime. Analogous to plan phases. */ export interface SubscriptionPhase { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; /** An ISO-8601 timestamp representation of when the phase becomes active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when the phase stops being active. * Open-ended for the last phase. */ activeTo?: Date; /** * The rate cards in effect for this phase, resolved to the version active at the * queried time (the currently active version for the current phase, the first * version for future phases, and the last version for past phases). */ items: SubscriptionItem[]; } /** * An inline (custom) plan definition used to create or change a subscription * without referencing a published plan. Mirrors the plan create shape without a * key or version, since a custom plan is not persisted or versioned on its own. * * `settlement_mode` is also omitted: it is a subscription-level concern set via * the `settlement_mode` field on the create/change request, not on the inline * plan. */ export interface SubscriptionCustomPlan { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The currency code of the plan. */ currency: BillingCurrencyCode; /** The billing cadence for subscriptions using this plan. */ billingCadence: string; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled: boolean; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhase[]; } /** Plans provide a template for subscriptions. */ export interface Plan { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * A key is a semi-unique string that is used to identify the plan. It is used to * reference the latest `active` version of the plan and is unique with the version * number. */ key: string; /** * Plans are versioned to allow you to make changes without affecting running * subscriptions. */ version: number; /** The currency code of the plan. */ currency: BillingCurrencyCode; /** The billing cadence for subscriptions using this plan. */ billingCadence: string; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled: boolean; /** * The date and time when the plan becomes `active`. When not specified, the plan * is in `draft` status. */ effectiveFrom?: Date; /** * A scheduled date and time when the plan becomes `archived`. When not specified, * the plan is in `active` status indefinitely. */ effectiveTo?: Date; /** * The status of the plan. Computed based on the effective start and end dates: * * - `draft`: `effective_from` is not set. * - `scheduled`: `now < effective_from`. * - `active`: `effective_from <= now` and (`effective_to` is not set or * `now < effective_to`). * - `archived`: `effective_to <= now`. */ status: 'draft' | 'active' | 'archived' | 'scheduled'; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhase[]; /** * Settlement mode for plan. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** * List of validation errors in `draft` state that prevent the plan from being * published. */ validationErrors?: ProductCatalogValidationError[]; } /** * Plan create request. `settlement_mode` is re-declared as optional with a * `credit_then_invoice` default, applied only on create. */ export interface CreatePlanRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * A key is a semi-unique string that is used to identify the plan. It is used to * reference the latest `active` version of the plan and is unique with the version * number. */ key: string; /** The currency code of the plan. */ currency: BillingCurrencyCode; /** The billing cadence for subscriptions using this plan. */ billingCadence: string; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled: boolean; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhase[]; /** Settlement mode for the plan. Defaults to `credit_then_invoice` when omitted. */ settlementMode: 'credit_then_invoice' | 'credit_only'; } /** * Plan upsert (update) request. `settlement_mode` is re-declared as optional with * no default, so an omitted value leaves the plan's existing settlement mode * unchanged. */ export interface UpsertPlanRequest { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled: boolean; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhase[]; /** * Settlement mode for the plan. When omitted, the existing settlement mode is * preserved. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; } /** Addon purchased with a subscription. */ export interface SubscriptionAddon { id: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; /** The add-on associated with the subscription. */ addon: AddonReference; /** The quantity of the add-on. Always 1 for single instance add-ons. */ quantity: number; /** * An ISO-8601 timestamp representation of which point in time the quantity was * resolved to. */ quantityAt: Date; /** An ISO-8601 timestamp representation of the cadence start of the resource. */ activeFrom: Date; /** An ISO-8601 timestamp representation of the cadence end of the resource. */ activeTo?: Date; /** The timeline of the add-on. The returned periods are sorted and continuous. */ timeline: SubscriptionAddonTimelineSegment[]; /** The rate cards of the add-on. */ rateCards: SubscriptionAddonRateCard[]; } /** Page paginated response. */ export interface AddonPagePaginatedResponse { data: Addon[]; meta: PaginatedMeta; } /** Page paginated response. */ export interface ProfilePagePaginatedResponse { data: Profile[]; meta: PaginatedMeta; } /** Subscription. */ export interface Subscription { id: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * Display name of the subscription. Defaults to the plan name when the * subscription is created from a plan. */ name: string; /** Optional description of the subscription. */ description?: string; /** * An ISO-8601 timestamp representation of when the subscription became (or will * become) active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when the subscription stops being * active. Open-ended when not set. */ activeTo?: Date; /** The customer ID of the subscription. */ customerId: string; /** The plan ID of the subscription. Set if subscription is created from a plan. */ planId?: string; /** * The plan the subscription was created from, if any. Includes the plan key and * version so clients can resolve the exact plan revision. */ plan?: SubscriptionPlanReference; /** The fiat currency in which the subscription is invoiced. */ invoiceCurrency: string; /** * Controls whether custom-currency cost bases are resolved dynamically or pinned * when their currency pair is introduced to the subscription. */ costBasisMode: 'dynamic' | 'pinned'; /** Cost bases pinned to custom-currency pairs for this subscription. */ costBasisPins: SubscriptionCostBasisPin[]; /** * The billing cadence of the subscription in ISO-8601 duration format. Defines how * often the customer is billed. Examples: `P1M` (monthly), `P3M` (quarterly), * `P1Y` (annually). */ billingCadence: string; /** The pro-rating configuration of the subscription. */ proRatingConfig?: SubscriptionProRatingConfig; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) */ billingAnchor: Date; /** The status of the subscription. */ status: 'active' | 'inactive' | 'canceled' | 'scheduled'; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; /** * The current aligned billing period. Present only when the subscription is active * and aligned. */ currentPeriod?: ClosedPeriod; /** * The phases of the subscription in chronological order. A phase groups the rate * cards that are in effect for a segment of the subscription's lifetime. */ phases: SubscriptionPhase[]; } export interface SubscriptionCreate { labels?: Labels; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; /** The customer to create the subscription for. */ customer: { id?: string; key?: string; }; /** * A reference to a published plan the subscription is created from. * * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the * subscription on an existing published plan; use `custom_plan` to define the plan * inline. */ plan?: { id?: string; key?: string; version?: number; }; /** * An inline plan definition to create the subscription from, without referencing a * published plan. * * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not * linked to a persisted plan, so the response omits the `plan` reference. */ customPlan?: SubscriptionCustomPlan; /** * The key of the phase to start the subscription in. If not provided, the * subscription starts in the first phase of the plan. * * Only applies when creating from a published `plan`; custom plans define their * own phases inline. */ startingPhase?: string; /** * When the subscription should start. If not provided, the subscription starts * immediately. Provide a future timestamp to schedule the subscription to start * later — this creates a not-yet-active, scheduled subscription. A timestamp in * the past is rejected. */ timing?: SubscriptionCreateTiming; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) * * If not provided, the subscription will be created with the subscription's * creation time as the billing anchor. */ billingAnchor?: Date; /** Controls how custom-currency cost bases are selected for the subscription. */ costBasisMode: 'dynamic' | 'pinned'; } /** Request for changing a subscription. */ export interface SubscriptionChange { labels?: Labels; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; /** The customer to create the subscription for. */ customer: { id?: string; key?: string; }; /** * A reference to a published plan the subscription is created from. * * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the * subscription on an existing published plan; use `custom_plan` to define the plan * inline. */ plan?: { id?: string; key?: string; version?: number; }; /** * An inline plan definition to create the subscription from, without referencing a * published plan. * * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not * linked to a persisted plan, so the response omits the `plan` reference. */ customPlan?: SubscriptionCustomPlan; /** * The key of the phase to start the subscription in. If not provided, the * subscription starts in the first phase of the plan. * * Only applies when creating from a published `plan`; custom plans define their * own phases inline. */ startingPhase?: string; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) * * If not provided, the subscription will be created with the subscription's * creation time as the billing anchor. */ billingAnchor?: Date; /** Controls how custom-currency cost bases are selected for the subscription. */ costBasisMode: 'dynamic' | 'pinned'; /** * Timing configuration for the change, when the change should take effect. For * changing a subscription, the accepted values depend on the subscription * configuration. */ timing: SubscriptionEditTiming; } /** Page paginated response. */ export interface PlanPagePaginatedResponse { data: Plan[]; meta: PaginatedMeta; } /** * Request for editing a running subscription. Applies an ordered batch of * customizations to the subscription's phases and items. A later customization * observes the state produced by earlier ones. */ export interface SubscriptionEdit { /** The ordered batch of customizations to apply to the running subscription. */ customizations: SubscriptionEditOperation[]; /** When the requested changes should take effect. Defaults to immediate. */ timing: SubscriptionEditTiming; } /** Page paginated response. */ export interface SubscriptionAddonPagePaginatedResponse { data: SubscriptionAddon[]; meta: PaginatedMeta; } /** A standard invoice for charges owed by the customer. */ export interface InvoiceStandard { id: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Human-readable invoice number generated by the invoicing app. */ number: string; /** Three-letter ISO 4217 currency code for the invoice. */ currency: string; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: Supplier; /** Snapshot of the customer's information at the time the invoice was issued. */ customer: InvoiceCustomer; /** Aggregated financial totals for the invoice. */ totals: Totals; /** * The service period covered by this invoice. * * For flat fee the service period can be empty which means `from` will be equals * to `to`. In other cases those fields will be filled with the actual service * period. */ servicePeriod: ClosedPeriod; /** * Validation issues found during invoice processing. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** External identifiers assigned to this invoice by third-party systems. */ externalReferences?: InvoiceExternalReferences; /** Discriminator field identifying this as a standard invoice. */ type: 'standard'; /** Current lifecycle status of the invoice. */ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided'; /** Detailed status information including available actions and workflow state. */ statusDetails: InvoiceStatusDetails; /** Timestamp when the invoice was issued to the customer. */ issuedAt?: Date; /** * Timestamp until which the invoice remains in draft state. * * The invoice advances automatically once this time is reached. */ draftUntil?: Date; /** Timestamp when usage quantities were last snapshotted for this invoice. */ quantitySnapshottedAt?: Date; /** Timestamp when collection was initiated for this invoice. */ collectionAt?: Date; /** Timestamp when payment is due. */ dueAt?: Date; /** Timestamp when the invoice was sent to the customer. */ sentToCustomerAt?: Date; /** Workflow configuration snapshot captured at invoice creation time. */ workflow: InvoiceWorkflowSettings; /** * Line items on this invoice. * * Always returned on single-resource GET; omitted on list endpoints unless * explicitly expanded. Editable via update: existing lines are matched by `id`, * lines without an `id` are created, and lines present on the invoice but omitted * from the update request are deleted. Detailed (child) lines are always computed * and cannot be edited directly. */ lines?: InvoiceLine[]; } /** InvoiceStandard update request. */ export interface UpdateInvoiceStandardRequest { /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: UpdateLabels; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: UpdateSupplier; /** Snapshot of the customer's information at the time the invoice was issued. */ customer: UpdateInvoiceCustomer; /** Discriminator field identifying this as a standard invoice. */ type: 'standard'; /** Workflow configuration snapshot captured at invoice creation time. */ workflow: UpdateInvoiceWorkflowSettings; /** * Line items on this invoice. * * Always returned on single-resource GET; omitted on list endpoints unless * explicitly expanded. Editable via update: existing lines are matched by `id`, * lines without an `id` are created, and lines present on the invoice but omitted * from the update request are deleted. Detailed (child) lines are always computed * and cannot be edited directly. */ lines?: UpdateInvoiceLine[]; } /** Page paginated response. */ export interface SubscriptionPagePaginatedResponse { data: Subscription[]; meta: PaginatedMeta; } /** Response for changing a subscription. */ export interface SubscriptionChangeResponse { /** The current subscription before the change. */ current: Subscription; /** The new state of the subscription after the change. */ next: Subscription; } /** Response for migrating a subscription. */ export interface SubscriptionMigrateResponse { /** * The original subscription's own fields returned by the migration. For an * in-place migration this is the before snapshot; for replacement it includes the * cancellation. Does not include phases or the current billing period. */ current: SubscriptionBase; /** The resulting subscription, including its phases and items. */ next: Subscription; } /** A flat fee charge for a customer. */ export interface ChargeFlatFee { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the charge. */ type: 'flat_fee'; /** * The customer owning the charge. * * By default, only the `id` of the customer is returned. For more details use the * `customer` expand. */ customer: CustomerOrReference; /** * Indicates whether the charge lifecycle is controlled by the system or manually * overridden by the API user. */ lifecycleController: 'system' | 'manual'; /** * The subscription that originated the charge, when the charge was created from a * subscription item. * * By default, only the `id`, `phase.id`, `phase.item.id` of the subscription is * returned. For more details use the `subscription` expand. */ subscription?: SubscriptionOrReference; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * The resolved fiat conversion rate of a custom-currency charge. Resolution * depends on costbasis type: dynamic is resolved when charge becomes active, all * other types resolved on creation. */ resolvedCostBasis?: ChargeResolvedCostBasis; /** The lifecycle status of the charge. */ status: 'created' | 'active' | 'final' | 'deleted'; /** * Validation issues found while processing the charge. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** * The earliest time when the charge should be advanced again by background * processing. */ advanceAfter?: Date; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** The realization runs of the charge, sorted by `created_at`. */ realizations: ChargeRealization[]; /** Payment term of the flat fee charge. */ paymentTerm: PricePaymentTerm; /** The discounts applied to the charge. */ discounts?: ChargeFlatFeeDiscounts; /** The feature associated with the charge, when applicable. */ feature?: FeatureOrReference; /** The proration configuration of the charge. */ prorationConfiguration: RateCardProrationConfiguration; /** The amount after proration of the charge. */ amountAfterProration: CurrencyAmount; /** The price of the charge. */ price: PriceFlat; /** * Current intent from the system lifecycle controller for a charge that has an * active manual override. The top-level charge fields remain the effective * customer-facing intent. */ systemIntent?: ChargeFlatFeeSystemIntent; } /** A usage-based charge for a customer. */ export interface ChargeUsageBased { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the charge. */ type: 'usage_based'; /** * The customer owning the charge. * * By default, only the `id` of the customer is returned. For more details use the * `customer` expand. */ customer: CustomerOrReference; /** * Indicates whether the charge lifecycle is controlled by the system or manually * overridden by the API user. */ lifecycleController: 'system' | 'manual'; /** * The subscription that originated the charge, when the charge was created from a * subscription item. * * By default, only the `id`, `phase.id`, `phase.item.id` of the subscription is * returned. For more details use the `subscription` expand. */ subscription?: SubscriptionOrReference; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * The resolved fiat conversion rate of a custom-currency charge. Resolution * depends on costbasis type: dynamic is resolved when charge becomes active, all * other types resolved on creation. */ resolvedCostBasis?: ChargeResolvedCostBasis; /** The lifecycle status of the charge. */ status: 'created' | 'active' | 'final' | 'deleted'; /** * Validation issues found while processing the charge. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** * The earliest time when the charge should be advanced again by background * processing. */ advanceAfter?: Date; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** The realization runs of the charge, sorted by `created_at`. */ realizations: ChargeRealization[]; /** Discounts applied to the usage-based charge. */ discounts?: RateCardDiscounts; /** The feature associated with the charge. */ feature: FeatureOrReference; /** Aggregated booked and realtime totals for the charge. */ totals: ChargeTotals; /** * The metered usage quantity of the charge for its full service period. * * Requires the `real_time_usage` expand, since it is computed live from the * metering store rather than stored on the charge. */ usage?: string; /** * The price of the charge. * * `free` prices are rejected on create: a usage-based charge always carries a * concrete price. */ price: PriceUsageBased; /** Spend commitments for the charge. */ commitments?: SpendCommitments; /** * Unit conversion configuration for the charge. * * Synthesized on read for charges created from v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfig; /** * Current intent from the system lifecycle controller for a charge that has an * active manual override. The top-level charge fields remain the effective * customer-facing intent. */ systemIntent?: ChargeUsageBasedSystemIntent; } /** Page paginated response. */ export interface InvoicePagePaginatedResponse { data: Invoice[]; meta: PaginatedMeta; } /** Page paginated response. */ export interface ChargePagePaginatedResponse { data: Charge[]; meta: PaginatedMeta; } /** * Filters on the given string field value by either exact or fuzzy match. All * properties are optional; provide exactly one to specify the comparison. */ export type StringFieldFilter = string | { eq?: string; neq?: string; contains?: string; ocontains?: string[]; oeq?: string[]; gt?: string; gte?: string; lt?: string; lte?: string; exists?: boolean; }; /** The aggregation type to use for the meter. */ export type MeterAggregation = 'sum' | 'count' | 'unique_count' | 'avg' | 'min' | 'max' | 'latest'; /** * The granularity of the time grouping. Time durations are specified in ISO 8601 * format. */ export type MeterQueryGranularity = 'PT1M' | 'PT1H' | 'P1D' | 'P1M'; /** * The meter query granularities the usage history can be grouped into. Sub-hour * windows are too expensive to compute and monthly windows are not supported. */ export type EntitlementHistoryWindowSize = 'PT1H' | 'P1D'; /** * Filters on the given string field value by exact match. All properties are * optional; provide exactly one to specify the comparison. */ export type StringFieldFilterExact = string | { eq?: string; oeq?: string[]; neq?: string; }; /** The payment term of a flat price. */ export type PricePaymentTerm = 'in_advance' | 'in_arrears'; /** Filter by a boolean value (true/false). */ export type BooleanFieldFilter = boolean | { eq: boolean; }; /** Fiat or custom currency code. */ export type BillingCurrencyCode = string | string; /** Fiat or custom currency code. */ export type CreateCurrencyCode = string | string; /** * Filters on the given ULID field value by exact match. All properties are * optional; provide exactly one to specify the comparison. */ export type UlidFieldFilter = string | { eq?: string; oeq?: string[]; neq?: string; }; /** * Filters on the given datetime (RFC-3339) field value. All properties are * optional; provide exactly one to specify the comparison. */ export type DateTimeFieldFilter = Date | { eq?: Date; lt?: Date; lte?: Date; gt?: Date; gte?: Date; }; /** The time from which usage is measured, as a preset or an explicit timestamp. */ export type EntitlementMeasureUsageFrom = 'current_period_start' | 'now' | Date; /** Payment settings for a billing workflow. */ export type WorkflowPaymentSettings = WorkflowPaymentChargeAutomaticallySettings | WorkflowPaymentSendInvoiceSettings; /** * When a subscription should start: immediate (the default) or a custom timestamp * to schedule a future start. */ export type SubscriptionCreateTiming = 'immediate' | Date; /** * Subscription edit timing defined when the changes should take effect. If the * provided configuration is not supported by the subscription, an error will be * returned. */ export type SubscriptionEditTiming = 'immediate' | 'next_billing_cycle' | Date; /** Request to execute an operator action on an installed app. */ export type AppActionRequest = AppReconcileWebhookEventsActionRequest; /** Request to install an app from the catalog. */ export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing; /** Payment settings for a billing workflow. */ export type UpdateBillingWorkflowPaymentSettings = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettings; /** * Cost basis selection for a custom-currency charge. The variant chosen fixes when * and how the conversion rate is determined. */ export type CreateChargeCostBasis = CreateChargeCostBasisDynamic | CreateChargeCostBasisPinned | CreateChargeCostBasisManual; /** * Cost basis selection for a custom-currency charge. The variant chosen fixes when * and how the conversion rate is determined. */ export type ChargeCostBasis = ChargeCostBasisDynamic | ChargeCostBasisPinned | ChargeCostBasisManual; /** A parameter that failed validation. */ export type InvalidParameter = InvalidParameterStandard | InvalidParameterMinimumLength | InvalidParameterMaximumLength | InvalidParameterChoiceItem | InvalidParameterDependentItem; /** * Entitlement template configured on a rate card. The feature is taken from the * rate card itself, so it is omitted here. */ export type RateCardEntitlement = RateCardMeteredEntitlement | RateCardStaticEntitlement | RateCardBooleanEntitlement; /** Request to update an installed app. */ export type UpdateAppRequest = UpdateAppStripeRequest | UpdateAppSandboxRequest | UpdateAppExternalInvoicingRequest; /** * Per-unit cost configuration for a feature. Either a fixed manual amount or a * dynamic LLM cost lookup. */ export type FeatureUnitCost = FeatureManualUnitCost | FeatureLlmUnitCost; /** * A detailed (child) line type of a charge realization run. * * This is distinct from an invoice's own detailed lines: it represents the * rated/priced breakdown produced by the realization run itself, before that * breakdown is (or is not yet) reflected on an invoice line. Credit-then-invoice * runs include credit allocations in these lines, while credits-only runs keep the * gross rated detail. */ export type ChargeRealizationDetailedLine = ChargeRealizationDetailedLineFlatFee | ChargeRealizationDetailedLineUsageBased; /** Fiat or custom currency. */ export type Currency = CurrencyFiat | CurrencyCustom; /** Customer or reference. */ export type CustomerOrReference = Customer | CustomerReference; /** An entitlement grants a customer access to a feature. */ export type Entitlement = EntitlementMetered | EntitlementStatic | EntitlementBoolean; /** * The alignment for collecting the pending line items into an invoice. * * Defaults to subscription, which means that we are to create a new invoice every * time the a subscription period starts (for in advance items) or ends (for in * arrears items). */ export type WorkflowCollectionAlignment = WorkflowCollectionAlignmentSubscription | WorkflowCollectionAlignmentAnchored; /** * A notification rule selects the type of event to generate, the conditions * specific to that type, and the channels to deliver the events to. */ export type NotificationRule = NotificationRuleBalanceThreshold | NotificationRuleEntitlementReset | NotificationRuleInvoiceCreated | NotificationRuleInvoiceUpdated; /** * Request body for creating or updating a notification rule. Updates replace the * rule's mutable state: omitting `disabled`, `labels`, or `features` resets them * to their defaults. The `type` must match the existing rule on update. */ export type NotificationRuleRequest = NotificationRuleBalanceThresholdRequest | NotificationRuleEntitlementResetRequest | NotificationRuleInvoiceCreatedRequest | NotificationRuleInvoiceUpdatedRequest; /** Price. */ export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume; /** * Usage-based price types for a rate card or charge. * * When UnitConfig is present on the object, these price types operate on billing * units (i.e. post-conversion quantities), not raw metered units. */ export type PriceUsageBased = PriceUnit | PriceGraduated | PriceVolume; /** Price. */ export type UpdatePrice = UpdatePriceFree | UpdatePriceFlat | UpdatePriceUnit | UpdatePriceGraduated | UpdatePriceVolume; /** Entitlement create request. */ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest; /** Installed application. */ export type App = AppStripe | AppSandbox | AppExternalInvoicing; /** Response of the app install. */ export type BillingInstallAppResponse = InstalledAppStripe | InstalledAppSandbox | InstalledAppExternalInvoicing; /** The payload delivered to the channels, discriminated by the event type. */ export type NotificationEventPayload = NotificationEventBalanceThresholdPayload | NotificationEventResetPayload | NotificationEventInvoiceCreatedPayload | NotificationEventInvoiceUpdatedPayload; /** Feature or reference. */ export type FeatureOrReference = Feature | FeatureReference; /** ChargeRealizationInvoice or reference. */ export type ChargeRealizationInvoiceOrReference = ChargeRealizationInvoice | ChargeRealizationInvoiceReference; /** Customer charge. */ export type CreateChargeRequest = CreateChargeFlatFeeRequest | CreateChargeUsageBasedRequest; /** * A single customization to apply to a running subscription. The `type` field * discriminates which operation is performed. */ export type SubscriptionEditOperation = SubscriptionEditAddItem | SubscriptionEditRemoveItem | SubscriptionEditAddPhase | SubscriptionEditRemovePhase | SubscriptionEditStretchPhase | SubscriptionEditUnscheduleEdit; /** * A top-level line item on an invoice. * * Each line represents a single charge, typically associated with a rate card from * a subscription. Detailed (child) lines are nested under `detailed_lines` when * present. */ export type InvoiceLine = InvoiceStandardLine; /** * A top-level line item on an invoice. * * Each line represents a single charge, typically associated with a rate card from * a subscription. Detailed (child) lines are nested under `detailed_lines` when * present. */ export type UpdateInvoiceLine = UpdateInvoiceStandardLine; /** Subscription or reference. */ export type SubscriptionOrReference = Subscription | SubscriptionReference; /** * An invoice issued to a customer. * * The `type` field determines the concrete variant: * * - `standard`: a standard invoice for charges owed. */ export type Invoice = InvoiceStandard; /** UpdateInvoiceRequest update request. */ export type UpdateInvoiceRequest = UpdateInvoiceStandardRequest; /** Customer charge. */ export type Charge = ChargeFlatFee | ChargeUsageBased; /** * Sort query. * * The `asc` suffix is optional as the default sort order is ascending. The `desc` * suffix is used to specify a descending order. */ export interface SortQueryInput { /** The attribute to sort by. */ by: string; /** The sort order. `asc` for ascending, `desc` for descending. */ order?: 'asc' | 'desc'; } /** Standard error response. */ export interface BaseErrorInput { /** Type contains a URI that identifies the problem type. */ type?: string; /** * The HTTP status code generated by the origin server for this occurrence of the * problem. */ status: number; /** A a short, human-readable summary of the problem type. */ title: string; /** A human-readable explanation specific to this occurrence of the problem. */ detail: string; /** A URI reference that identifies the specific occurrence of the problem. */ instance: string; [key: string]: unknown; } /** * Invoice-level invoicing settings. * * A subset of BillingWorkflowInvoicingSettings limited to fields that are * meaningful per-invoice. progressive_billing is omitted as it is a gather-time / * profile-level decision. */ export interface InvoiceWorkflowInvoicingSettingsInput { /** Whether to automatically issue the invoice after the draft_period has passed. */ autoAdvance?: boolean; /** The period for the invoice to be kept in draft status for manual reviews. */ draftPeriod?: string; /** The period after which the invoice is considered overdue if not paid. */ dueAfter?: string; } /** * Payment settings for a billing workflow when the collection method is send * invoice. */ export interface WorkflowPaymentSendInvoiceSettingsInput { /** The collection method for the invoice. */ collectionMethod: 'send_invoice'; /** * The period after which the invoice is due. With some payment solutions it's only * applicable for manual collection method. */ dueAfter?: string; } /** * Invoice-level invoicing settings. * * A subset of BillingWorkflowInvoicingSettings limited to fields that are * meaningful per-invoice. progressive_billing is omitted as it is a gather-time / * profile-level decision. */ export interface UpdateBillingInvoiceWorkflowInvoicingSettingsInput { /** Whether to automatically issue the invoice after the draft_period has passed. */ autoAdvance?: boolean; /** The period for the invoice to be kept in draft status for manual reviews. */ draftPeriod?: string; } /** * Payment settings for a billing workflow when the collection method is send * invoice. */ export interface UpdateBillingWorkflowPaymentSendInvoiceSettingsInput { /** The collection method for the invoice. */ collectionMethod: 'send_invoice'; /** * The period after which the invoice is due. With some payment solutions it's only * applicable for manual collection method. */ dueAfter?: string; } /** * Usage granted automatically after each reset of a metered entitlement. The * balance returns to `amount` after every reset. */ export interface EntitlementIssueAfterResetInput { /** The amount granted after each reset, in the feature's unit. */ amount: string; /** * The priority of the grant created after each reset. Lower values have higher * priority. */ priority?: number; } /** Metering event following the CloudEvents specification. */ export interface EventInput { /** Identifies the event. */ id: string; /** Identifies the context in which an event happened. */ source: string; /** The version of the CloudEvents specification which the event uses. */ specversion?: string; /** * Contains a value describing the type of event related to the originating * occurrence. */ type: string; /** * Content type of the CloudEvents data value. Only the value "application/json" is * allowed over HTTP. */ datacontenttype?: 'application/json' | null; /** Identifies the schema that data adheres to. */ dataschema?: string | null; /** * Describes the subject of the event in the context of the event producer * (identified by source). */ subject: string; /** Timestamp of when the occurrence happened. Must adhere to RFC 3339. */ time?: Date | null; /** The event payload. Optional, if present it must be a JSON object. */ data?: Record | null; } /** Request body for resetting the usage of a metered entitlement. */ export interface ResetCustomerEntitlementUsageRequestInput { /** * The time the reset takes effect. Defaults to the current time and cannot be in * the future. Truncated to the minute. */ effectiveAt?: Date; /** * Whether the usage period anchor is kept. When false, the anchor moves to * `effective_at`. */ retainAnchor?: boolean; /** * Whether overage carries over into the new usage period. Defaults to the * entitlement's own setting. */ preserveOverage?: boolean; } /** Unauthorized. */ export interface UnauthorizedInput extends BaseErrorInput { } /** Forbidden. */ export interface ForbiddenInput extends BaseErrorInput { } /** Not Found. */ export interface NotFoundInput extends BaseErrorInput { } /** Gone. */ export interface GoneInput extends BaseErrorInput { } /** Conflict. */ export interface ConflictInput extends BaseErrorInput { } /** Payload Too Large. */ export interface PayloadTooLargeInput extends BaseErrorInput { } /** Unsupported Media Type. */ export interface UnsupportedMediaTypeInput extends BaseErrorInput { } /** Unprocessable Content. */ export interface UnprocessableContentInput extends BaseErrorInput { } /** Too Many Requests. */ export interface TooManyRequestsInput extends BaseErrorInput { } /** Internal Server Error. */ export interface InternalInput extends BaseErrorInput { } /** Not Implemented. */ export interface NotImplementedInput extends BaseErrorInput { } /** Not Available. */ export interface NotAvailableInput extends BaseErrorInput { } /** Controls which customer fields can be updated by the checkout session. */ export interface AppStripeCreateCheckoutSessionCustomerUpdateInput { /** * Whether to save the billing address to customer.address. * * Defaults to "never". */ address?: 'auto' | 'never'; /** * Whether to save the customer name to customer.name. * * Defaults to "never". */ name?: 'auto' | 'never'; /** * Whether to save shipping information to customer.shipping. * * Defaults to "never". */ shipping?: 'auto' | 'never'; } /** Tax ID collection configuration for checkout sessions. */ export interface AppStripeCreateCheckoutSessionTaxIdCollectionInput { /** * Enable tax ID collection during checkout. * * Defaults to false. */ enabled?: boolean; /** * Whether tax ID collection is required. * * Defaults to "never". */ required?: 'if_supported' | 'never'; } /** The entitlement template of a metered entitlement. */ export interface RateCardMeteredEntitlementInput { /** The type of the entitlement template. */ type: 'metered'; /** * If soft limit is true, the subject can use the feature even if the entitlement * is exhausted; access remains granted. */ isSoftLimit?: boolean; /** * The amount of usage granted each usage period, in the feature's unit. Usage is * counted against this allowance and the balance resets every usage period. When * `is_soft_limit` is true the subject keeps access after the limit is reached; * otherwise access is denied once the allowance is exhausted. */ limit?: number; /** * The reset interval of the metered entitlement in ISO8601 format. Defaults to the * billing cadence of the rate card. */ usagePeriod?: string; } /** Request body for voiding a credit grant. */ export interface VoidCreditGrantRequestInput { /** * How voiding adjusts payment state related to the grant. * * Currently only `none` is supported: voiding does not adjust invoices, payment * authorization, settlement, payment intents, or external collection state. If * payment later completes, the original invoiced amount may still be collected. */ paymentAdjustment?: 'none'; } /** * Unit conversion configuration. * * Transforms raw metered quantities into billing-ready units before pricing and * entitlement evaluation. Stored with a resource's rating configuration so the * same metered feature can be billed in different units across plans and charges. * * Examples: * * - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, * rounding=ceiling, displayUnit="GB" * - Meter seconds, bill hours: operation=divide, conversionFactor=3600, * rounding=ceiling, displayUnit="hours" * - Cost + 20% margin: operation=multiply, conversionFactor=1.2 * - Bill per million tokens: operation=divide, conversionFactor=1e6, * rounding=ceiling, displayUnit="M" * * v1 equivalents: * * - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + * UnitPrice(amount=1) * - PackagePrice(amount, quantityPerPkg): operation=divide, * conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount) */ export interface UnitConfigInput { /** The arithmetic operation to apply to the raw metered quantity. */ operation: 'divide' | 'multiply'; /** * The factor used in the conversion operation. * * - For `divide`: `converted = raw / conversionFactor`. * - For `multiply`: `converted = raw × conversionFactor`. * * Must be a positive non-zero value. */ conversionFactor: string; /** * The rounding mode applied to the converted quantity for invoicing. * * Defaults to none (no rounding). Entitlement checks always use the precise * (unrounded) value. */ rounding?: 'ceiling' | 'floor' | 'half_up' | 'none'; /** * The number of decimal places to retain after rounding. * * Only meaningful when rounding is not "none". Defaults to 0 (round to whole * numbers). */ precision?: number; /** * A human-readable label for the converted unit shown on invoices and in the * customer portal (e.g., "GB", "hours", "M tokens"). * * Optional. When omitted, no unit label is rendered. */ displayUnit?: string; } /** Invoice settings for a billing workflow. */ export interface WorkflowInvoicingSettingsInput { /** Whether to automatically issue the invoice after the draftPeriod has passed. */ autoAdvance?: boolean; /** The period for the invoice to be kept in draft status for manual reviews. */ draftPeriod?: string; /** Should progressive billing be allowed for this workflow? */ progressiveBilling?: boolean; /** Controls how subscription-ending shortened service periods are billed. */ subscriptionEndProrationMode?: 'bill_full_period' | 'bill_actual_period'; } /** Query to evaluate feature access for a list of customers. */ export interface EntitlementAccessQueryRequestInput { /** * Whether to include credit balance availability for each resolved customer. When * true, each feature evaluation includes credit balance checks. * * Defaults to `false`. */ includeCredits?: boolean; customer: EntitlementAccessQueryRequestCustomers; feature?: EntitlementAccessQueryRequestFeatures; } /** * A notification channel delivers notification events, such as entitlement balance * threshold crossings, to an external system. Today the only supported channel * type is a webhook delivered via Svix. */ export interface NotificationChannelInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the channel. Immutable after creation. */ type: 'webhook'; /** * Whether the channel is disabled. Disabled channels do not receive notification * events. */ disabled?: boolean; /** The URL that webhook notification events are delivered to. */ url: string; /** * Custom HTTP headers to include on every webhook delivery request, keyed by * header name. */ customHeaders?: Record; /** * Secret used to sign outgoing webhook payloads so recipients can verify their * authenticity. If omitted on create, a secret is generated automatically by the * delivery provider. This is a sensitive credential returned in responses (unlike * most secrets) specifically so clients can retrieve a server-generated value and * verify webhook signatures; handle it with the same care as any other credential. */ signingSecret?: string; } /** NotificationChannel create request. */ export interface CreateNotificationChannelRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of the channel. Immutable after creation. */ type: 'webhook'; /** * Whether the channel is disabled. Disabled channels do not receive notification * events. */ disabled?: boolean; /** The URL that webhook notification events are delivered to. */ url: string; /** * Custom HTTP headers to include on every webhook delivery request, keyed by * header name. */ customHeaders?: Record; /** * Secret used to sign outgoing webhook payloads so recipients can verify their * authenticity. If omitted on create, a secret is generated automatically by the * delivery provider. This is a sensitive credential returned in responses (unlike * most secrets) specifically so clients can retrieve a server-generated value and * verify webhook signatures; handle it with the same care as any other credential. */ signingSecret?: string; } /** * Request body for updating a notification channel. Updates replace the channel's * mutable state rather than merging it: `type`, `name`, and `url` must always be * provided, and omitting `disabled`, `labels`, or `custom_headers` resets them to * their defaults (enabled, no labels, no custom headers). `signing_secret` is the * one exception: omitting it keeps the channel's current signing secret instead of * clearing the credential. */ export interface UpdateBillingNotificationChannelRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** The type of the channel. Immutable after creation. */ type: 'webhook'; /** The URL that webhook notification events are delivered to. */ url: string; labels?: Labels; /** * Whether the channel is disabled. Disabled channels do not receive notification * events. */ disabled?: boolean; /** * Custom HTTP headers to include on every webhook delivery request, keyed by * header name. */ customHeaders?: Record; /** * Secret used to sign outgoing webhook payloads so recipients can verify their * authenticity. If omitted on create, a secret is generated automatically by the * delivery provider. This is a sensitive credential returned in responses (unlike * most secrets) specifically so clients can retrieve a server-generated value and * verify webhook signatures; handle it with the same care as any other credential. */ signingSecret?: string; } /** A rule that generates an event when an entitlement usage period is reset. */ export interface NotificationRuleEntitlementResetInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.reset'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** A rule that generates an event when an invoice is created. */ export interface NotificationRuleInvoiceCreatedInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.created'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** A rule that generates an event when an invoice is updated. */ export interface NotificationRuleInvoiceUpdatedInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.updated'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** Request body for an entitlement reset rule. */ export interface NotificationRuleEntitlementResetRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.reset'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** Request body for an invoice created rule. */ export interface NotificationRuleInvoiceCreatedRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.created'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** Request body for an invoice updated rule. */ export interface NotificationRuleInvoiceUpdatedRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'invoice.updated'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; } /** An ingested metering event with ingestion metadata. */ export interface IngestedEventInput { /** The original event ingested. */ event: EventInput; /** The customer if the event is associated with a customer. */ customer?: CustomerReference; /** The date and time the event was ingested and its processing started. */ ingestedAt: Date; /** The date and time the event was stored in the database. */ storedAt: Date; /** The validation errors of the ingested event. */ validationErrors?: IngestedEventValidationError[]; } /** * A metered entitlement grants a usage allowance for a feature. Access is * determined by the balance: the allowance provided by grants is burnt down by * usage. */ export interface EntitlementMeteredInput { id: string; /** The type of the entitlement. */ type: 'metered'; /** The feature the customer is entitled to use. */ feature: FeatureReference; /** The customer the entitlement belongs to. */ customer: CustomerReference; labels?: Labels; /** The time from which the entitlement is active. */ activeFrom: Date; /** * The time until which the entitlement is active. If not set, the entitlement is * active until deleted. */ activeTo?: Date; /** The time the entitlement was created. */ createdAt: Date; /** The time the entitlement was last updated. */ updatedAt: Date; /** The time the entitlement was deleted. */ deletedAt?: Date; /** * The usage period of the entitlement. The balance resets at the start of every * period. */ usagePeriod: RecurringPeriod; /** The current usage period of the entitlement. */ currentUsagePeriod: ClosedPeriod; /** * If true, the customer keeps access to the feature after the balance is * exhausted. */ isSoftLimit?: boolean; /** Usage granted automatically after each reset. Cannot be combined with `grants`. */ issue?: EntitlementIssueAfterResetInput; /** The amount granted automatically after each reset. */ issueAfterReset?: string; /** The priority of the grant created after each reset. */ issueAfterResetPriority?: number; /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */ preserveOverageAtReset?: boolean; /** The time from which usage is measured. */ measureUsageFrom: Date; /** The time of the last reset. */ lastReset: Date; } /** Subscription fields without phases or the current billing period. */ export interface SubscriptionBaseInput { id: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * Display name of the subscription. Defaults to the plan name when the * subscription is created from a plan. */ name: string; /** Optional description of the subscription. */ description?: string; /** * An ISO-8601 timestamp representation of when the subscription became (or will * become) active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when the subscription stops being * active. Open-ended when not set. */ activeTo?: Date; /** The customer ID of the subscription. */ customerId: string; /** The plan ID of the subscription. Set if subscription is created from a plan. */ planId?: string; /** * The plan the subscription was created from, if any. Includes the plan key and * version so clients can resolve the exact plan revision. */ plan?: SubscriptionPlanReference; /** The fiat currency in which the subscription is invoiced. */ invoiceCurrency: string; /** * Controls whether custom-currency cost bases are resolved dynamically or pinned * when their currency pair is introduced to the subscription. */ costBasisMode?: 'dynamic' | 'pinned'; /** Cost bases pinned to custom-currency pairs for this subscription. */ costBasisPins: SubscriptionCostBasisPin[]; /** * The billing cadence of the subscription in ISO-8601 duration format. Defines how * often the customer is billed. Examples: `P1M` (monthly), `P3M` (quarterly), * `P1Y` (annually). */ billingCadence: string; /** The pro-rating configuration of the subscription. */ proRatingConfig?: SubscriptionProRatingConfig; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) */ billingAnchor: Date; /** The status of the subscription. */ status: 'active' | 'inactive' | 'canceled' | 'scheduled'; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; } /** * Invoice-level snapshot of the workflow configuration. * * Contains only the settings that are meaningful for an already-created invoice: * invoicing behaviour and payment settings. Collection alignment and tax policy * are gather-time / profile-wide concerns and are not included. */ export interface InvoiceWorkflowInput { /** Invoicing settings for this invoice. */ invoicing?: InvoiceWorkflowInvoicingSettingsInput; /** Payment settings for this invoice. */ payment?: WorkflowPaymentSettingsInput; } /** Request for canceling a subscription. */ export interface SubscriptionCancelInput { /** If not provided the subscription is canceled immediately. */ timing?: SubscriptionEditTiming; } /** Request for migrating to a later version of the subscription's current plan. */ export interface SubscriptionMigrateInput { /** * When the migration takes effect: immediately (default), at the next billing * cycle, or at an explicit billing-aligned timestamp. In-place migrations may * target a later phase when the phase timelines match. The target plan reference * is saved now; changed items take effect at the requested time. */ timing?: SubscriptionEditTiming; /** A strictly later version of the current plan. Omit to use its latest version. */ targetVersion?: number; /** * Explicitly replace the subscription, starting in this target plan phase. Always * selects replacement, even when the phase matches the current one. Replacement * may produce billing adjustments and does not transfer addons. */ startingPhase?: string; /** * Providing a different billing anchor explicitly replaces the subscription. The * supplied anchor is preserved and may be before or after the replacement's start * time. Omit to retain the existing anchor. */ billingAnchor?: Date; } /** * Invoice-level snapshot of the workflow configuration. * * Contains only the settings that are meaningful for an already-created invoice: * invoicing behaviour and payment settings. Collection alignment and tax policy * are gather-time / profile-wide concerns and are not included. */ export interface UpdateBillingInvoiceWorkflowInput { /** Invoicing settings for this invoice. */ invoicing?: UpdateBillingInvoiceWorkflowInvoicingSettingsInput; /** Payment settings for this invoice. */ payment?: UpdateBillingWorkflowPaymentSettingsInput; } /** Page paginated response. */ export interface NotificationChannelPagePaginatedResponseInput { data: NotificationChannelInput[]; meta: PaginatedMeta; } /** * A rule that generates an event when an entitlement balance crosses one of its * thresholds. */ export interface NotificationRuleBalanceThresholdInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.balance.threshold'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** The thresholds that generate an event when crossed. */ thresholds: NotificationBalanceThreshold[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** Request body for a balance threshold rule. */ export interface NotificationRuleBalanceThresholdRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; labels?: Labels; /** The type of event the rule generates. Immutable after creation. */ type: 'entitlements.balance.threshold'; /** Whether the rule is disabled. Disabled rules do not generate events. */ disabled?: boolean; /** * The channels the rule delivers its events to. At least one and at most five * channels are required. Responses omit channels that have since been disabled or * deleted. */ channels: NotificationChannelReference[]; /** The thresholds that generate an event when crossed. */ thresholds: NotificationBalanceThreshold[]; /** * The features the rule applies to. When omitted, the rule applies to every * feature. */ features?: FeatureReference[]; } /** Purchase and payment terms of the grant. */ export interface CreateCreditGrantPurchaseInput { /** * Fiat currency the purchase is settled in. * * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency` * for custom-currency grants. */ currency: string; /** * Fiat cost basis per credit unit of a fiat-currency grant. * * If `per_unit_cost_basis` is 0.50 and credit amount is * $100.00, the total * charge is $50.00. The value must be greater than 0. If the * cost basis is 0, use `funding_method=none` instead. * * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults * to 1.0 when neither is provided. */ perUnitCostBasis?: string; /** * Defines how custom-currency credits are priced in the purchase `currency`; the * resolved rate is exposed through `resolved_cost_basis`. * * Fiat grants accept only a `manual` cost basis without `fiat_currency`, where * `rate` is the fiat cost per credit unit. Custom-currency grants require a cost * basis of any type with `fiat_currency` set and equal to the purchase `currency`. * A `dynamic` cost basis is resolved at the grant's effective time, so the * currency cost basis must be effective by then. Cannot be combined with * `per_unit_cost_basis`. */ costBasis?: CreateChargeCostBasis; /** * Controls when credits become available for consumption. * * Defaults to `on_creation`. */ availabilityPolicy?: 'on_creation'; } /** Purchase and payment terms of the grant. */ export interface CreditGrantPurchaseInput { /** * Fiat currency the purchase is settled in. * * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency` * for custom-currency grants. */ currency: string; /** * Fiat cost basis per credit unit of a fiat-currency grant. * * If `per_unit_cost_basis` is 0.50 and credit amount is * $100.00, the total * charge is $50.00. The value must be greater than 0. If the * cost basis is 0, use `funding_method=none` instead. * * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults * to 1.0 when neither is provided. */ perUnitCostBasis?: string; /** * The rate the purchase is settled at in the purchase `currency`. Present once the * cost basis is resolved. */ resolvedCostBasis?: ChargeResolvedCostBasis; /** * The purchase amount, calculated from the resolved cost basis and credit * `amount`. Present once the cost basis is resolved. */ amount?: string; /** * Controls when credits become available for consumption. * * Defaults to `on_creation`. */ availabilityPolicy?: 'on_creation'; /** Current payment settlement status. */ settlementStatus?: 'pending' | 'authorized' | 'settled'; } /** Tax settings for a billing workflow. */ export interface WorkflowTaxSettingsInput { /** * Enable automatic tax calculation when tax is supported by the app. For example, * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax. */ enabled?: boolean; /** * Enforce tax calculation when tax is supported by the app. When enabled, the * billing system will not allow to create an invoice without tax calculation. * Enforcement is different per apps, for example, Stripe app requires customer to * have a tax location when starting a paid subscription. */ enforced?: boolean; /** * Default tax configuration to apply to the invoices for line items. * * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax * config is deprecated and can no longer be added or changed: the organization * default tax code is used instead. Existing tax-code values may still be removed, * and `behavior` remains fully supported. */ defaultTaxConfig?: TaxConfig; } /** Cursor paginated response. */ export interface IngestedEventPaginatedResponseInput { data: IngestedEventInput[]; meta: CursorMeta; } /** A meter query request. */ export interface MeterQueryRequestInput { /** The start of the period the usage is queried from. */ from?: Date; /** The end of the period the usage is queried to. */ to?: Date; /** * The size of the time buckets to group the usage into. If not specified, the * usage is aggregated over the entire period. */ granularity?: MeterQueryGranularity; /** * The value is the name of the time zone as defined in the IANA Time Zone Database * (http://www.iana.org/time-zones). The time zone is used to determine the start * and end of the time buckets. If not specified, the UTC timezone will be used. */ timeZone?: string; /** The dimensions to group the results by. */ groupByDimensions?: string[]; /** Filters to apply to the query. */ filters?: MeterQueryFilters; } /** * Configuration options for creating a Stripe Checkout Session. * * Based on Stripe's * [Checkout Session API parameters](https://docs.stripe.com/api/checkout/sessions/create). */ export interface AppStripeCreateCheckoutSessionRequestOptionsInput { /** * Whether to collect the customer's billing address. * * Defaults to auto, which only collects the address when necessary for tax * calculation. */ billingAddressCollection?: 'auto' | 'required'; /** * URL to redirect customers who cancel the checkout session. * * Not allowed when ui_mode is "embedded". */ cancelUrl?: string; /** * Unique reference string for reconciling sessions with internal systems. * * Can be a customer ID, cart ID, or any other identifier. */ clientReferenceId?: string; /** Controls which customer fields can be updated by the checkout session. */ customerUpdate?: AppStripeCreateCheckoutSessionCustomerUpdateInput; /** Configuration for collecting customer consent during checkout. */ consentCollection?: AppStripeCreateCheckoutSessionConsentCollection; /** * Three-letter ISO 4217 currency code in uppercase. * * Required for payment mode sessions. Optional for setup mode sessions. */ currency?: string; /** Custom text to display during checkout at various stages. */ customText?: AppStripeCheckoutSessionCustomTextParams; /** * Unix timestamp when the checkout session expires. * * Can be 30 minutes to 24 hours from creation. Defaults to 24 hours. */ expiresAt?: bigint; /** * IETF language tag for the checkout UI locale. * * If blank or "auto", uses the browser's locale. Example: "en", "fr", "de". */ locale?: string; /** * Set of key-value pairs to attach to the checkout session. * * Useful for storing additional structured information. */ metadata?: Record; /** * Return URL for embedded checkout sessions after payment authentication. * * Required if ui_mode is "embedded" and redirect-based payment methods are * enabled. */ returnUrl?: string; /** * Success URL to redirect customers after completing payment or setup. * * Not allowed when ui_mode is "embedded". See: * https://docs.stripe.com/payments/checkout/custom-success-page */ successUrl?: string; /** * The UI mode for the checkout session. * * "hosted" displays a Stripe-hosted page. "embedded" integrates directly into your * app. Defaults to "hosted". */ uiMode?: 'embedded' | 'hosted'; /** * List of payment method types to enable (e.g., "card", "us_bank_account"). * * If not specified, Stripe enables all relevant payment methods. */ paymentMethodTypes?: string[]; /** * Redirect behavior for embedded checkout sessions. * * Controls when to redirect users after completion. See: * https://docs.stripe.com/payments/checkout/custom-success-page?payment-ui=embedded-form */ redirectOnCompletion?: 'always' | 'if_required' | 'never'; /** Configuration for collecting tax IDs during checkout. */ taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollectionInput; } /** Metered entitlement create request. */ export interface CreateEntitlementMeteredRequestInput { /** The type of the entitlement. */ type: 'metered'; /** The feature the customer is entitled to use. */ feature: FeatureReference; labels?: Labels; /** * If true, the customer keeps access to the feature after the balance is * exhausted. */ isSoftLimit?: boolean; /** Usage granted automatically after each reset. Cannot be combined with `grants`. */ issue?: EntitlementIssueAfterResetInput; /** The amount granted automatically after each reset. */ issueAfterReset?: string; /** The priority of the grant created after each reset. */ issueAfterResetPriority?: number; /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */ preserveOverageAtReset?: boolean; /** * The usage period of the entitlement. The balance resets at the start of every * period. The anchor defaults to the entitlement creation time. */ usagePeriod: RecurringPeriodInput; /** * The time from which usage is measured. Defaults to the entitlement creation * time. */ measureUsageFrom?: EntitlementMeasureUsageFrom; /** Grants created together with the entitlement. Cannot be combined with `issue`. */ grants?: EntitlementGrantCreateRequest[]; } /** Snapshot of the billing workflow configuration captured at invoice creation. */ export interface InvoiceWorkflowSettingsInput { /** The apps that will be used to orchestrate the invoice's workflow. */ apps?: InvoiceWorkflowAppsReferences; /** The billing profile that was the source of this workflow snapshot. */ sourceBillingProfile: ProfileReference; /** * The workflow configuration that was active when the invoice was created. * * Only the fields that are meaningful at the per-invoice level are included: * invoicing behaviour (auto-advance, draft period) and payment settings * (collection method, due date). Profile-wide settings such as collection * alignment, progressive billing, and tax policy are omitted. */ workflow: InvoiceWorkflowInput; } /** * A detailed (child) sub-line belonging to a parent invoice line. * * Detailed lines represent the individual flat-fee components that make up a * usage-based parent line after quantity snapshotting. */ export interface InvoiceDetailedLineInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The service period covered by this detailed line. */ servicePeriod: ClosedPeriod; /** Aggregated financial totals for the detailed line. */ totals: Totals; /** The cost category of this detailed line. */ category?: 'regular' | 'commitment'; /** Discounts applied to this detailed line. */ discounts?: InvoiceLineDiscounts; /** Credit applied to this detailed line. */ creditsApplied?: InvoiceLineCreditsApplied[]; /** External identifiers for this detailed line. */ externalReferences?: InvoiceLineExternalReferences; /** The quantity of the detailed line. */ quantity: string; /** The unit price of the detailed line. */ unitPrice: string; } /** Snapshot of the billing workflow configuration captured at invoice creation. */ export interface UpdateInvoiceWorkflowSettingsInput { /** * The workflow configuration that was active when the invoice was created. * * Only the fields that are meaningful at the per-invoice level are included: * invoicing behaviour (auto-advance, draft period) and payment settings * (collection method, due date). Profile-wide settings such as collection * alignment, progressive billing, and tax policy are omitted. */ workflow: UpdateBillingInvoiceWorkflowInput; } /** CreditGrant create request. */ export interface CreateCreditGrantRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: CreateLabels; /** Funding method of the grant. */ fundingMethod: 'none' | 'invoice' | 'external'; /** * The fiat or custom currency of the granted credits. * * Funded custom-currency grants must define `purchase.cost_basis` to settle in a * fiat currency. */ currency: CreateCurrencyCode; /** Granted credit amount. */ amount: string; /** Present when a funding workflow applies (funding_method is not `none`). */ purchase?: CreateCreditGrantPurchaseInput; /** * Tax configuration for the grant. * * For `invoice` and `external` funding methods, tax configuration should be * provided to ensure correct revenue recognition. When not provided, the default * credit grant tax code is applied, if that's not set the global default taxcode * is used. */ taxConfig?: CreateTaxCodeConfig; filters?: CreateCreditGrantFilters; /** Draw-down priority of the grant. Lower values have higher priority. */ priority?: number; /** * The timestamp when the credit grant becomes effective. * * Defaults to the current date and time. */ effectiveAt?: Date; /** * The duration after which the credit grant expires. * * Defaults to never expiring. */ expiresAfter?: string; /** * Idempotency key for the credit grant creation request. * * Unique per customer: reusing the same key for the same customer returns an HTTP * 409 Conflict instead of creating a duplicate grant, which makes create requests * safe to retry. The same key may be reused across different customers. */ key?: string; } /** * A credit grant allocates credits to a customer. * * Credits are drawn down against charges according to the settlement mode * configured on the rate card. */ export interface CreditGrantInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Funding method of the grant. */ fundingMethod: 'none' | 'invoice' | 'external'; /** * The fiat or custom currency of the granted credits. * * Funded custom-currency grants must define `purchase.cost_basis` to settle in a * fiat currency. */ currency: BillingCurrencyCode; /** Granted credit amount. */ amount: string; /** Present when a funding workflow applies (funding_method is not `none`). */ purchase?: CreditGrantPurchaseInput; /** * Tax configuration for the grant. * * For `invoice` and `external` funding methods, tax configuration should be * provided to ensure correct revenue recognition. When not provided, the default * credit grant tax code is applied, if that's not set the global default taxcode * is used. */ taxConfig?: TaxCodeConfig; /** Available when `funding_method` is `invoice`. */ invoice?: CreditGrantInvoiceReference; filters?: CreditGrantFilters; /** Draw-down priority of the grant. Lower values have higher priority. */ priority?: number; /** * The timestamp when the credit grant becomes effective. * * Defaults to the current date and time. */ effectiveAt?: Date; /** * Idempotency key for the credit grant creation request. * * Unique per customer: reusing the same key for the same customer returns an HTTP * 409 Conflict instead of creating a duplicate grant, which makes create requests * safe to retry. The same key may be reused across different customers. */ key?: string; /** * The timestamp when the credit grant expires. * * Calculated from the grant effective time and `expires_after` if provided. */ expiresAt?: Date; /** Timestamp when the grant was voided. */ voidedAt?: Date; /** Current lifecycle status of the grant. */ status: 'pending' | 'active' | 'expired' | 'voided'; /** * Validation issues found while processing the credit grant. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; } /** Bad Request. */ export interface BadRequestInput extends BaseErrorInput { /** The list of parameters that failed validation. */ invalidParameters: InvalidParameter[]; } /** * Request to create a Stripe Checkout Session for the customer. * * Checkout Sessions are used to collect payment method information from customers * in a secure, Stripe-hosted interface. This integration uses setup mode to * collect payment methods that can be charged later for subscription billing. */ export interface CustomerStripeCreateCheckoutSessionRequestInput { /** * Options for configuring the Stripe Checkout Session. * * These options are passed directly to Stripe's * [checkout session creation API](https://docs.stripe.com/api/checkout/sessions/create). */ stripeOptions: AppStripeCreateCheckoutSessionRequestOptionsInput; } /** Page paginated response. */ export interface EntitlementPagePaginatedResponseInput { data: EntitlementInput[]; meta: PaginatedMeta; } /** * Workflow collection specifies how to collect the pending line items for an * invoice. */ export interface WorkflowCollectionSettingsInput { /** The alignment for collecting the pending line items into an invoice. */ alignment?: WorkflowCollectionAlignment; /** * This grace period can be used to delay the collection of the pending line items * specified in alignment. * * This is useful, in case of multiple subscriptions having slightly different * billing periods. */ interval?: string; } /** * The invoice a charge realization was booked to, embedded as a header. * * Matches the standard invoice entity, except that it carries no `customer` * snapshot (the charge context already identifies the customer) and `lines` are * never populated (the realization itself is the line-level breakdown). The shared * invoice contract stays untouched: this model exists so the charges API can slim * the embedding without loosening the invoices API. */ export interface ChargeRealizationInvoiceInput { id: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Human-readable invoice number generated by the invoicing app. */ number: string; /** Three-letter ISO 4217 currency code for the invoice. */ currency: string; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: Supplier; /** Aggregated financial totals for the invoice. */ totals: Totals; /** * The service period covered by this invoice. * * For flat fee the service period can be empty which means `from` will be equals * to `to`. In other cases those fields will be filled with the actual service * period. */ servicePeriod: ClosedPeriod; /** * Validation issues found during invoice processing. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** External identifiers assigned to this invoice by third-party systems. */ externalReferences?: InvoiceExternalReferences; /** Discriminator field identifying this as a standard invoice. */ type: 'standard'; /** Current lifecycle status of the invoice. */ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided'; /** Detailed status information including available actions and workflow state. */ statusDetails: InvoiceStatusDetails; /** Timestamp when the invoice was issued to the customer. */ issuedAt?: Date; /** * Timestamp until which the invoice remains in draft state. * * The invoice advances automatically once this time is reached. */ draftUntil?: Date; /** Timestamp when usage quantities were last snapshotted for this invoice. */ quantitySnapshottedAt?: Date; /** Timestamp when collection was initiated for this invoice. */ collectionAt?: Date; /** Timestamp when payment is due. */ dueAt?: Date; /** Timestamp when the invoice was sent to the customer. */ sentToCustomerAt?: Date; /** Workflow configuration snapshot captured at invoice creation time. */ workflow: InvoiceWorkflowSettingsInput; } /** Page paginated response. */ export interface NotificationRulePagePaginatedResponseInput { data: NotificationRuleInput[]; meta: PaginatedMeta; } /** A rate card defines the pricing and entitlement of a feature or service. */ export interface RateCardInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** The feature associated with the rate card. */ feature?: FeatureReference; /** * Overrides the containing plan or add-on currency for this rate card. When * omitted, the containing resource currency applies. */ currency?: BillingCurrencyCode; /** * The billing cadence of the rate card. When null, the charge is one-time * (non-recurring). Only valid for flat prices. */ billingCadence?: string; /** The price of the rate card. */ price: Price; /** * Unit conversion configuration for the rate card. * * Synthesized on read for plans authored with v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create and update only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfigInput; /** * The payment term of the rate card. In advance payment term can only be used for * flat prices. */ paymentTerm?: PricePaymentTerm; /** * Spend commitments for this rate card. Only applicable to usage-based prices * (unit, graduated, volume). */ commitments?: SpendCommitments; /** The discounts of the rate card. */ discounts?: RateCardDiscounts; /** The tax config of the rate card. */ taxConfig?: TaxCodeConfig; /** * The entitlement template granted to subscribers of a plan or addon containing * this rate card. Requires `feature` to be set. */ entitlement?: RateCardEntitlementInput; } /** Rate card configuration snapshot for a usage-based invoice line. */ export interface InvoiceLineRateCardInput { /** The price definition used to calculate charges for this line. */ price: Price; /** Tax configuration snapshot for this line. */ taxConfig?: TaxCodeConfig; /** The feature key associated with this line's rate card. */ featureKey?: string; /** Discount configuration from the rate card. */ discounts?: RateCardDiscounts; /** * Unit config snapshot applied when this line was billed, converting the raw * metered quantity into the billed quantity. Frozen at billing time; read-only. */ unitConfig?: UnitConfigInput; } /** * Usage-based intent fields from the system lifecycle controller shadowed by a * manual override. */ export interface ChargeUsageBasedSystemIntentInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** Discounts applied to the usage-based charge. */ discounts?: RateCardDiscounts; /** * The price of the charge. * * `free` prices are rejected on create: a usage-based charge always carries a * concrete price. */ price: PriceUsageBased; /** Spend commitments for the charge. */ commitments?: SpendCommitments; /** * Unit conversion configuration for the charge. * * Synthesized on read for charges created from v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfigInput; /** * The timestamp when the system lifecycle controller intent was deleted. The * effective charge can remain visible while a manual override is active. */ deletedAt?: Date; } /** Usage-based charge create request. */ export interface CreateChargeUsageBasedRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The type of the charge. */ type: 'usage_based'; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * Defines how a custom-currency charge is converted into its fiat invoice * currency; the resolved rate is exposed through `resolved_cost_basis`. Required * when `currency` is custom and the charge settles as `credit_then_invoice`; must * be omitted otherwise. */ costBasis?: ChargeCostBasis; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** Discounts applied to the usage-based charge. */ discounts?: RateCardDiscounts; /** * The price of the charge. * * `free` prices are rejected on create: a usage-based charge always carries a * concrete price. */ price: PriceUsageBased; /** Spend commitments for the charge. */ commitments?: SpendCommitments; /** * Unit conversion configuration for the charge. * * Synthesized on read for charges created from v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfigInput; /** A reference to the feature associated with the charge. */ feature: FeatureReference; /** The full, unprorated service period of the charge. */ fullServicePeriod?: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod?: ClosedPeriod; } /** Page paginated response. */ export interface CreditGrantPagePaginatedResponseInput { data: CreditGrantInput[]; meta: PaginatedMeta; } /** Billing workflow settings. */ export interface WorkflowInput { /** The collection settings for this workflow */ collection?: WorkflowCollectionSettingsInput; /** The invoicing settings for this workflow */ invoicing?: WorkflowInvoicingSettingsInput; /** The payment settings for this workflow */ payment?: WorkflowPaymentSettingsInput; /** The tax settings for this workflow */ tax?: WorkflowTaxSettingsInput; } /** A subscription item pins a rate card to a cadence within a subscription phase. */ export interface SubscriptionItemInput { /** The unique identifier of the subscription item instance. */ id: string; /** An ISO-8601 timestamp representation of when this item version becomes active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when this item version stops being * active. */ activeTo?: Date; /** The rate card describing what the customer gets and pays for this item. */ rateCard: RateCardInput; } /** * The plan phase or pricing ramp allows changing a plan's rate cards over time as * a subscription progresses. */ export interface PlanPhaseInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; key: string; /** * The duration of the phase. When not specified, the phase runs indefinitely. Only * the last phase may omit the duration. */ duration?: string; /** The rate cards of the plan. */ rateCards: RateCardInput[]; } /** * Add a new rate card to a phase. Adding an item to the current phase closes the * active version of the same item key and appends a new version. */ export interface SubscriptionEditAddItemInput { /** Discriminator for the add-item operation. */ type: 'add_item'; /** The key of the phase to add the item to. */ phaseKey: string; /** The rate card describing what the customer gets and pays for the new item. */ rateCard: RateCardInput; } /** A rate card for a subscription add-on. */ export interface SubscriptionAddonRateCardInput { /** The rate card. */ rateCard: RateCardInput; /** The IDs of the subscription items that this rate card belongs to. */ affectedSubscriptionItemIds: string[]; } /** * Add-on allows extending subscriptions with compatible plans with additional * ratecards. */ export interface AddonInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * A key is a semi-unique string that is used to identify the add-on. It is used to * reference the latest `active` version of the add-on and is unique with the * version number. */ key: string; /** Version of the add-on. Incremented when the add-on is updated. */ version?: number; /** The InstanceType of the add-ons. Can be "single" or "multiple". */ instanceType: 'single' | 'multiple'; /** The currency code of the add-on. */ currency: BillingCurrencyCode; /** * The date and time when the add-on becomes effective. When not specified, the * add-on is a draft. */ effectiveFrom?: Date; /** * The date and time when the add-on is no longer effective. When not specified, * the add-on is effective indefinitely. */ effectiveTo?: Date; /** * The status of the add-on. Computed based on the effective start and end dates: * * - `draft`: `effective_from` is not set. * - `active`: `effective_from <= now` and (`effective_to` is not set or * `now < effective_to`). * - `archived`: `effective_to <= now`. */ status: 'draft' | 'active' | 'archived'; /** The rate cards of the add-on. */ rateCards: RateCardInput[]; /** List of validation errors. */ validationErrors?: ProductCatalogValidationError[]; } /** Addon create request. */ export interface CreateAddonRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * A key is a semi-unique string that is used to identify the add-on. It is used to * reference the latest `active` version of the add-on and is unique with the * version number. */ key: string; /** The InstanceType of the add-ons. Can be "single" or "multiple". */ instanceType: 'single' | 'multiple'; /** The currency code of the add-on. */ currency: BillingCurrencyCode; /** The rate cards of the add-on. */ rateCards: RateCardInput[]; } /** Addon upsert request. */ export interface UpsertAddonRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The InstanceType of the add-ons. Can be "single" or "multiple". */ instanceType: 'single' | 'multiple'; /** The rate cards of the add-on. */ rateCards: RateCardInput[]; } /** * A top-level line item on an invoice. * * Each line represents a single charge, typically associated with a rate card from * a subscription. Detailed (child) lines are nested under `detailed_lines` when * present. */ export interface InvoiceStandardLineInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * ID of the line. * * Optional on update: omit to create a new line, or supply the ID of an existing * line to edit it. Existing lines omitted from an update's `lines` array are * deleted. */ id?: string; /** The type of charge this line item represents. */ type: 'standard_line'; /** * Indicates whether this line item's lifecycle is controlled by OpenMeter or * manually overridden by the API user. */ lifecycleController: 'system' | 'manual'; /** * The service period covered by this invoice, spanning the earliest line start to * the latest line end across all of its lines. * * For an invoice with no lines the period is empty, which means `from` will be * equal to `to`. */ servicePeriod: ClosedPeriod; /** Aggregated financial totals for the line item. */ totals: Totals; /** Discounts applied to this line item. */ discounts?: InvoiceLineDiscounts; /** Credit applied to this line item. */ creditsApplied?: InvoiceLineCreditsApplied[]; /** External identifiers for this line item assigned by third-party systems. */ externalReferences?: InvoiceLineExternalReferences; /** Reference to the subscription item that generated this line. */ subscription?: SubscriptionReference; /** The rate card configuration snapshot used to price this line item. */ rateCard: InvoiceLineRateCardInput; /** * Detailed sub-lines that this line has been broken down into. * * Present when line has individual details. */ detailedLines: InvoiceDetailedLineInput[]; /** * Usage quantity details for this line when UnitConfig is in effect. * * Read-only; omitted for lines without unit conversion. */ usageQuantityDetail?: InvoiceUsageQuantityDetail; /** Reference to the charge associated with this line item. */ charge?: ChargeReference; } /** * Billing profiles contain the settings for billing and controls invoice * generation. */ export interface ProfileInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * The name and contact information for the supplier this billing profile * represents */ supplier: Party; /** The billing workflow settings for this profile */ workflow: WorkflowInput; /** The applications used by this billing profile. */ apps: ProfileAppReferences; /** Whether this is the default profile. */ default: boolean; } /** BillingProfile create request. */ export interface CreateBillingProfileRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * The name and contact information for the supplier this billing profile * represents */ supplier: Party; /** The billing workflow settings for this profile */ workflow: WorkflowInput; /** The applications used by this billing profile. */ apps: ProfileAppReferences; /** Whether this is the default profile. */ default: boolean; } /** BillingProfile upsert request. */ export interface UpsertBillingProfileRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * The name and contact information for the supplier this billing profile * represents */ supplier: Party; /** The billing workflow settings for this profile */ workflow: WorkflowInput; /** Whether this is the default profile. */ default: boolean; } /** * A realization run of a charge. * * `totals` and `detailed_lines` are only populated with the `realization.totals` * and `realization.detailed_lines` expands, respectively, since computing them * requires re-deriving the run's rated breakdown. `invoice` is an ID reference * unless the `realization.invoice` expand is used, which resolves it to the * invoice header of the run's booked line: the invoice entity without its `lines` * and without the `customer` snapshot (the charge itself already identifies the * customer). */ export interface ChargeRealizationInput { /** * The ID of the realization run. Not present on `outstanding` entries, which are * projections rather than persisted runs. */ id?: string; /** * The ID of the invoice line this realization was booked to, when the realization * has been invoiced. */ lineId?: string; /** The reference of the invoice related to the realization. */ invoice?: ChargeRealizationInvoiceOrReferenceInput; /** The type of the realization run. */ type: 'final_realization' | 'partial_invoice' | 'outstanding' | 'voided'; /** The service period covered by this realization run. */ servicePeriod: ClosedPeriod; /** * The metered usage quantity this realization run accounts for. Only present on * usage-based charges; flat fees are not metered, so their realizations carry no * usage. * * Booked entries report a signed delta: a negative value states a downward usage * correction (or a voided run that snapshotted behind its live neighbors) instead * of masking it as zero. * * On an `outstanding` entry this is `0` unless the `real_time_usage` expand is * applied, in which case it is the not-yet-booked remainder of the live metering * read (never negative). */ usage?: string; /** * The payment state of the realization, when the charge requires a fiat * transaction to settle. */ payment?: ChargeRealizationPayment; /** * Financial totals for the realization run, including credit allocations. * * Requires the `realization.totals` expand. */ totals?: Totals; /** * The detailed (rated) lines produced by the realization run. * * Requires the `realization.detailed_lines` expand. */ detailedLines?: ChargeRealizationDetailedLine[]; } /** * A subscription phase groups the rate cards in effect for a segment of the * subscription's lifetime. Analogous to plan phases. */ export interface SubscriptionPhaseInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; key: string; /** An ISO-8601 timestamp representation of when the phase becomes active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when the phase stops being active. * Open-ended for the last phase. */ activeTo?: Date; /** * The rate cards in effect for this phase, resolved to the version active at the * queried time (the currently active version for the current phase, the first * version for future phases, and the last version for past phases). */ items: SubscriptionItemInput[]; } /** * An inline (custom) plan definition used to create or change a subscription * without referencing a published plan. Mirrors the plan create shape without a * key or version, since a custom plan is not persisted or versioned on its own. * * `settlement_mode` is also omitted: it is a subscription-level concern set via * the `settlement_mode` field on the create/change request, not on the inline * plan. */ export interface SubscriptionCustomPlanInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** The currency code of the plan. */ currency: BillingCurrencyCode; /** The billing cadence for subscriptions using this plan. */ billingCadence: string; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled?: boolean; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhaseInput[]; } /** Plans provide a template for subscriptions. */ export interface PlanInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * A key is a semi-unique string that is used to identify the plan. It is used to * reference the latest `active` version of the plan and is unique with the version * number. */ key: string; /** * Plans are versioned to allow you to make changes without affecting running * subscriptions. */ version?: number; /** The currency code of the plan. */ currency: BillingCurrencyCode; /** The billing cadence for subscriptions using this plan. */ billingCadence: string; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled?: boolean; /** * The date and time when the plan becomes `active`. When not specified, the plan * is in `draft` status. */ effectiveFrom?: Date; /** * A scheduled date and time when the plan becomes `archived`. When not specified, * the plan is in `active` status indefinitely. */ effectiveTo?: Date; /** * The status of the plan. Computed based on the effective start and end dates: * * - `draft`: `effective_from` is not set. * - `scheduled`: `now < effective_from`. * - `active`: `effective_from <= now` and (`effective_to` is not set or * `now < effective_to`). * - `archived`: `effective_to <= now`. */ status: 'draft' | 'active' | 'archived' | 'scheduled'; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhaseInput[]; /** * Settlement mode for plan. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** * List of validation errors in `draft` state that prevent the plan from being * published. */ validationErrors?: ProductCatalogValidationError[]; } /** * Plan create request. `settlement_mode` is re-declared as optional with a * `credit_then_invoice` default, applied only on create. */ export interface CreatePlanRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** * A key is a semi-unique string that is used to identify the plan. It is used to * reference the latest `active` version of the plan and is unique with the version * number. */ key: string; /** The currency code of the plan. */ currency: BillingCurrencyCode; /** The billing cadence for subscriptions using this plan. */ billingCadence: string; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled?: boolean; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhaseInput[]; /** Settlement mode for the plan. Defaults to `credit_then_invoice` when omitted. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; } /** * Plan upsert (update) request. `settlement_mode` is re-declared as optional with * no default, so an omitted value leaves the plan's existing settlement mode * unchanged. */ export interface UpsertPlanRequestInput { /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** Whether pro-rating is enabled for this plan. */ proRatingEnabled?: boolean; /** * The plan phases define the pricing ramp for a subscription. A phase switch * occurs only at the end of a billing period. At least one phase is required. */ phases: PlanPhaseInput[]; /** * Settlement mode for the plan. When omitted, the existing settlement mode is * preserved. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; } /** Addon purchased with a subscription. */ export interface SubscriptionAddonInput { id: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; /** The add-on associated with the subscription. */ addon: AddonReference; /** The quantity of the add-on. Always 1 for single instance add-ons. */ quantity: number; /** * An ISO-8601 timestamp representation of which point in time the quantity was * resolved to. */ quantityAt: Date; /** An ISO-8601 timestamp representation of the cadence start of the resource. */ activeFrom: Date; /** An ISO-8601 timestamp representation of the cadence end of the resource. */ activeTo?: Date; /** The timeline of the add-on. The returned periods are sorted and continuous. */ timeline: SubscriptionAddonTimelineSegment[]; /** The rate cards of the add-on. */ rateCards: SubscriptionAddonRateCardInput[]; } /** Page paginated response. */ export interface AddonPagePaginatedResponseInput { data: AddonInput[]; meta: PaginatedMeta; } /** Page paginated response. */ export interface ProfilePagePaginatedResponseInput { data: ProfileInput[]; meta: PaginatedMeta; } /** Subscription. */ export interface SubscriptionInput { id: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** * Display name of the subscription. Defaults to the plan name when the * subscription is created from a plan. */ name: string; /** Optional description of the subscription. */ description?: string; /** * An ISO-8601 timestamp representation of when the subscription became (or will * become) active. */ activeFrom: Date; /** * An ISO-8601 timestamp representation of when the subscription stops being * active. Open-ended when not set. */ activeTo?: Date; /** The customer ID of the subscription. */ customerId: string; /** The plan ID of the subscription. Set if subscription is created from a plan. */ planId?: string; /** * The plan the subscription was created from, if any. Includes the plan key and * version so clients can resolve the exact plan revision. */ plan?: SubscriptionPlanReference; /** The fiat currency in which the subscription is invoiced. */ invoiceCurrency: string; /** * Controls whether custom-currency cost bases are resolved dynamically or pinned * when their currency pair is introduced to the subscription. */ costBasisMode?: 'dynamic' | 'pinned'; /** Cost bases pinned to custom-currency pairs for this subscription. */ costBasisPins: SubscriptionCostBasisPin[]; /** * The billing cadence of the subscription in ISO-8601 duration format. Defines how * often the customer is billed. Examples: `P1M` (monthly), `P3M` (quarterly), * `P1Y` (annually). */ billingCadence: string; /** The pro-rating configuration of the subscription. */ proRatingConfig?: SubscriptionProRatingConfig; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) */ billingAnchor: Date; /** The status of the subscription. */ status: 'active' | 'inactive' | 'canceled' | 'scheduled'; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; /** * The current aligned billing period. Present only when the subscription is active * and aligned. */ currentPeriod?: ClosedPeriod; /** * The phases of the subscription in chronological order. A phase groups the rate * cards that are in effect for a segment of the subscription's lifetime. */ phases: SubscriptionPhaseInput[]; } export interface SubscriptionCreateInput { labels?: Labels; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; /** The customer to create the subscription for. */ customer: { id?: string; key?: string; }; /** * A reference to a published plan the subscription is created from. * * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the * subscription on an existing published plan; use `custom_plan` to define the plan * inline. */ plan?: { id?: string; key?: string; version?: number; }; /** * An inline plan definition to create the subscription from, without referencing a * published plan. * * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not * linked to a persisted plan, so the response omits the `plan` reference. */ customPlan?: SubscriptionCustomPlanInput; /** * The key of the phase to start the subscription in. If not provided, the * subscription starts in the first phase of the plan. * * Only applies when creating from a published `plan`; custom plans define their * own phases inline. */ startingPhase?: string; /** * When the subscription should start. If not provided, the subscription starts * immediately. Provide a future timestamp to schedule the subscription to start * later — this creates a not-yet-active, scheduled subscription. A timestamp in * the past is rejected. */ timing?: SubscriptionCreateTiming; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) * * If not provided, the subscription will be created with the subscription's * creation time as the billing anchor. */ billingAnchor?: Date; /** Controls how custom-currency cost bases are selected for the subscription. */ costBasisMode?: 'dynamic' | 'pinned'; } /** Request for changing a subscription. */ export interface SubscriptionChangeInput { labels?: Labels; /** * Settlement mode for billing. * * Values: * * - `credit_then_invoice`: Credits are applied first, then any remainder is * invoiced. * - `credit_only`: Usage is settled exclusively against credits. */ settlementMode?: 'credit_then_invoice' | 'credit_only'; /** The customer to create the subscription for. */ customer: { id?: string; key?: string; }; /** * A reference to a published plan the subscription is created from. * * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the * subscription on an existing published plan; use `custom_plan` to define the plan * inline. */ plan?: { id?: string; key?: string; version?: number; }; /** * An inline plan definition to create the subscription from, without referencing a * published plan. * * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not * linked to a persisted plan, so the response omits the `plan` reference. */ customPlan?: SubscriptionCustomPlanInput; /** * The key of the phase to start the subscription in. If not provided, the * subscription starts in the first phase of the plan. * * Only applies when creating from a published `plan`; custom plans define their * own phases inline. */ startingPhase?: string; /** * A billing anchor is the fixed point in time that determines the subscription's * recurring billing cycle. It affects when charges occur and how prorations are * calculated. Common anchors: * * - Calendar month (1st of each month): `2025-01-01T00:00:00Z` * - Subscription anniversary (day customer signed up) * - Custom date (customer-specified day) * * If not provided, the subscription will be created with the subscription's * creation time as the billing anchor. */ billingAnchor?: Date; /** Controls how custom-currency cost bases are selected for the subscription. */ costBasisMode?: 'dynamic' | 'pinned'; /** * Timing configuration for the change, when the change should take effect. For * changing a subscription, the accepted values depend on the subscription * configuration. */ timing: SubscriptionEditTiming; } /** Page paginated response. */ export interface PlanPagePaginatedResponseInput { data: PlanInput[]; meta: PaginatedMeta; } /** * Request for editing a running subscription. Applies an ordered batch of * customizations to the subscription's phases and items. A later customization * observes the state produced by earlier ones. */ export interface SubscriptionEditInput { /** The ordered batch of customizations to apply to the running subscription. */ customizations: SubscriptionEditOperationInput[]; /** When the requested changes should take effect. Defaults to immediate. */ timing?: SubscriptionEditTiming; } /** Page paginated response. */ export interface SubscriptionAddonPagePaginatedResponseInput { data: SubscriptionAddonInput[]; meta: PaginatedMeta; } /** A standard invoice for charges owed by the customer. */ export interface InvoiceStandardInput { id: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** Human-readable invoice number generated by the invoicing app. */ number: string; /** Three-letter ISO 4217 currency code for the invoice. */ currency: string; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: Supplier; /** Snapshot of the customer's information at the time the invoice was issued. */ customer: InvoiceCustomer; /** Aggregated financial totals for the invoice. */ totals: Totals; /** * The service period covered by this invoice. * * For flat fee the service period can be empty which means `from` will be equals * to `to`. In other cases those fields will be filled with the actual service * period. */ servicePeriod: ClosedPeriod; /** * Validation issues found during invoice processing. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** External identifiers assigned to this invoice by third-party systems. */ externalReferences?: InvoiceExternalReferences; /** Discriminator field identifying this as a standard invoice. */ type: 'standard'; /** Current lifecycle status of the invoice. */ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided'; /** Detailed status information including available actions and workflow state. */ statusDetails: InvoiceStatusDetails; /** Timestamp when the invoice was issued to the customer. */ issuedAt?: Date; /** * Timestamp until which the invoice remains in draft state. * * The invoice advances automatically once this time is reached. */ draftUntil?: Date; /** Timestamp when usage quantities were last snapshotted for this invoice. */ quantitySnapshottedAt?: Date; /** Timestamp when collection was initiated for this invoice. */ collectionAt?: Date; /** Timestamp when payment is due. */ dueAt?: Date; /** Timestamp when the invoice was sent to the customer. */ sentToCustomerAt?: Date; /** Workflow configuration snapshot captured at invoice creation time. */ workflow: InvoiceWorkflowSettingsInput; /** * Line items on this invoice. * * Always returned on single-resource GET; omitted on list endpoints unless * explicitly expanded. Editable via update: existing lines are matched by `id`, * lines without an `id` are created, and lines present on the invoice but omitted * from the update request are deleted. Detailed (child) lines are always computed * and cannot be edited directly. */ lines?: InvoiceLineInput[]; } /** InvoiceStandard update request. */ export interface UpdateInvoiceStandardRequestInput { /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: UpdateLabels; /** * Snapshot of the supplier's contact information at the time the invoice was * issued. */ supplier: UpdateSupplier; /** Snapshot of the customer's information at the time the invoice was issued. */ customer: UpdateInvoiceCustomer; /** Discriminator field identifying this as a standard invoice. */ type: 'standard'; /** Workflow configuration snapshot captured at invoice creation time. */ workflow: UpdateInvoiceWorkflowSettingsInput; /** * Line items on this invoice. * * Always returned on single-resource GET; omitted on list endpoints unless * explicitly expanded. Editable via update: existing lines are matched by `id`, * lines without an `id` are created, and lines present on the invoice but omitted * from the update request are deleted. Detailed (child) lines are always computed * and cannot be edited directly. */ lines?: UpdateInvoiceLine[]; } /** Page paginated response. */ export interface SubscriptionPagePaginatedResponseInput { data: SubscriptionInput[]; meta: PaginatedMeta; } /** Response for changing a subscription. */ export interface SubscriptionChangeResponseInput { /** The current subscription before the change. */ current: SubscriptionInput; /** The new state of the subscription after the change. */ next: SubscriptionInput; } /** Response for migrating a subscription. */ export interface SubscriptionMigrateResponseInput { /** * The original subscription's own fields returned by the migration. For an * in-place migration this is the before snapshot; for replacement it includes the * cancellation. Does not include phases or the current billing period. */ current: SubscriptionBaseInput; /** The resulting subscription, including its phases and items. */ next: SubscriptionInput; } /** A flat fee charge for a customer. */ export interface ChargeFlatFeeInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the charge. */ type: 'flat_fee'; /** * The customer owning the charge. * * By default, only the `id` of the customer is returned. For more details use the * `customer` expand. */ customer: CustomerOrReference; /** * Indicates whether the charge lifecycle is controlled by the system or manually * overridden by the API user. */ lifecycleController: 'system' | 'manual'; /** * The subscription that originated the charge, when the charge was created from a * subscription item. * * By default, only the `id`, `phase.id`, `phase.item.id` of the subscription is * returned. For more details use the `subscription` expand. */ subscription?: SubscriptionOrReferenceInput; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * The resolved fiat conversion rate of a custom-currency charge. Resolution * depends on costbasis type: dynamic is resolved when charge becomes active, all * other types resolved on creation. */ resolvedCostBasis?: ChargeResolvedCostBasis; /** The lifecycle status of the charge. */ status: 'created' | 'active' | 'final' | 'deleted'; /** * Validation issues found while processing the charge. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** * The earliest time when the charge should be advanced again by background * processing. */ advanceAfter?: Date; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** The realization runs of the charge, sorted by `created_at`. */ realizations: ChargeRealizationInput[]; /** Payment term of the flat fee charge. */ paymentTerm: PricePaymentTerm; /** The discounts applied to the charge. */ discounts?: ChargeFlatFeeDiscounts; /** The feature associated with the charge, when applicable. */ feature?: FeatureOrReference; /** The proration configuration of the charge. */ prorationConfiguration: RateCardProrationConfiguration; /** The amount after proration of the charge. */ amountAfterProration: CurrencyAmount; /** The price of the charge. */ price: PriceFlat; /** * Current intent from the system lifecycle controller for a charge that has an * active manual override. The top-level charge fields remain the effective * customer-facing intent. */ systemIntent?: ChargeFlatFeeSystemIntent; } /** A usage-based charge for a customer. */ export interface ChargeUsageBasedInput { id: string; /** * Display name of the resource. * * Between 1 and 256 characters. */ name: string; /** * Optional description of the resource. * * Maximum 1024 characters. */ description?: string; labels?: Labels; /** An ISO-8601 timestamp representation of entity creation date. */ createdAt: Date; /** An ISO-8601 timestamp representation of entity last update date. */ updatedAt: Date; /** An ISO-8601 timestamp representation of entity deletion date. */ deletedAt?: Date; /** The type of the charge. */ type: 'usage_based'; /** * The customer owning the charge. * * By default, only the `id` of the customer is returned. For more details use the * `customer` expand. */ customer: CustomerOrReference; /** * Indicates whether the charge lifecycle is controlled by the system or manually * overridden by the API user. */ lifecycleController: 'system' | 'manual'; /** * The subscription that originated the charge, when the charge was created from a * subscription item. * * By default, only the `id`, `phase.id`, `phase.item.id` of the subscription is * returned. For more details use the `subscription` expand. */ subscription?: SubscriptionOrReferenceInput; /** The currency of the charge. */ currency: BillingCurrencyCode; /** * The resolved fiat conversion rate of a custom-currency charge. Resolution * depends on costbasis type: dynamic is resolved when charge becomes active, all * other types resolved on creation. */ resolvedCostBasis?: ChargeResolvedCostBasis; /** The lifecycle status of the charge. */ status: 'created' | 'active' | 'final' | 'deleted'; /** * Validation issues found while processing the charge. * * Present only when there are one or more validation findings. An empty list is * omitted. */ validationIssues?: ValidationIssue[]; /** The timestamp when the charge is intended to be invoiced. */ invoiceAt: Date; /** The effective service period covered by the charge. */ servicePeriod: ClosedPeriod; /** The full, unprorated service period of the charge. */ fullServicePeriod: ClosedPeriod; /** The billing period the charge belongs to. */ billingPeriod: ClosedPeriod; /** * The earliest time when the charge should be advanced again by background * processing. */ advanceAfter?: Date; /** Unique reference ID of the charge. */ uniqueReferenceId?: string; /** Settlement mode of the charge. */ settlementMode: 'credit_then_invoice' | 'credit_only'; /** Tax configuration of the charge. */ taxConfig?: TaxConfig; /** The realization runs of the charge, sorted by `created_at`. */ realizations: ChargeRealizationInput[]; /** Discounts applied to the usage-based charge. */ discounts?: RateCardDiscounts; /** The feature associated with the charge. */ feature: FeatureOrReference; /** Aggregated booked and realtime totals for the charge. */ totals: ChargeTotals; /** * The metered usage quantity of the charge for its full service period. * * Requires the `real_time_usage` expand, since it is computed live from the * metering store rather than stored on the charge. */ usage?: string; /** * The price of the charge. * * `free` prices are rejected on create: a usage-based charge always carries a * concrete price. */ price: PriceUsageBased; /** Spend commitments for the charge. */ commitments?: SpendCommitments; /** * Unit conversion configuration for the charge. * * Synthesized on read for charges created from v1 dynamic or package prices: * dynamic prices map to a unit price with a multiply unit config, and package * prices map to a unit price with a divide unit config. * * Accepted on create only when the UnitConfig feature is enabled on the * deployment; otherwise rejected. */ unitConfig?: UnitConfigInput; /** * Current intent from the system lifecycle controller for a charge that has an * active manual override. The top-level charge fields remain the effective * customer-facing intent. */ systemIntent?: ChargeUsageBasedSystemIntentInput; } /** Page paginated response. */ export interface InvoicePagePaginatedResponseInput { data: InvoiceInput[]; meta: PaginatedMeta; } /** Page paginated response. */ export interface ChargePagePaginatedResponseInput { data: ChargeInput[]; meta: PaginatedMeta; } /** Payment settings for a billing workflow. */ export type WorkflowPaymentSettingsInput = WorkflowPaymentChargeAutomaticallySettings | WorkflowPaymentSendInvoiceSettingsInput; /** Payment settings for a billing workflow. */ export type UpdateBillingWorkflowPaymentSettingsInput = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettingsInput; /** * Entitlement template configured on a rate card. The feature is taken from the * rate card itself, so it is omitted here. */ export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCardStaticEntitlement | RateCardBooleanEntitlement; /** An entitlement grants a customer access to a feature. */ export type EntitlementInput = EntitlementMeteredInput | EntitlementStatic | EntitlementBoolean; /** * A notification rule selects the type of event to generate, the conditions * specific to that type, and the channels to deliver the events to. */ export type NotificationRuleInput = NotificationRuleBalanceThresholdInput | NotificationRuleEntitlementResetInput | NotificationRuleInvoiceCreatedInput | NotificationRuleInvoiceUpdatedInput; /** * Request body for creating or updating a notification rule. Updates replace the * rule's mutable state: omitting `disabled`, `labels`, or `features` resets them * to their defaults. The `type` must match the existing rule on update. */ export type NotificationRuleRequestInput = NotificationRuleBalanceThresholdRequestInput | NotificationRuleEntitlementResetRequestInput | NotificationRuleInvoiceCreatedRequestInput | NotificationRuleInvoiceUpdatedRequestInput; /** Entitlement create request. */ export type CreateEntitlementRequestInput = CreateEntitlementMeteredRequestInput | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest; /** ChargeRealizationInvoice or reference. */ export type ChargeRealizationInvoiceOrReferenceInput = ChargeRealizationInvoiceInput | ChargeRealizationInvoiceReference; /** Customer charge. */ export type CreateChargeRequestInput = CreateChargeFlatFeeRequest | CreateChargeUsageBasedRequestInput; /** * A single customization to apply to a running subscription. The `type` field * discriminates which operation is performed. */ export type SubscriptionEditOperationInput = SubscriptionEditAddItemInput | SubscriptionEditRemoveItem | SubscriptionEditAddPhase | SubscriptionEditRemovePhase | SubscriptionEditStretchPhase | SubscriptionEditUnscheduleEdit; /** * A top-level line item on an invoice. * * Each line represents a single charge, typically associated with a rate card from * a subscription. Detailed (child) lines are nested under `detailed_lines` when * present. */ export type InvoiceLineInput = InvoiceStandardLineInput; /** Subscription or reference. */ export type SubscriptionOrReferenceInput = SubscriptionInput | SubscriptionReference; /** * An invoice issued to a customer. * * The `type` field determines the concrete variant: * * - `standard`: a standard invoice for charges owed. */ export type InvoiceInput = InvoiceStandardInput; /** UpdateInvoiceRequest update request. */ export type UpdateInvoiceRequestInput = UpdateInvoiceStandardRequestInput; /** Customer charge. */ export type ChargeInput = ChargeFlatFeeInput | ChargeUsageBasedInput;