From 84d83492b6ac2b727e357bd61768eec5a01419fe Mon Sep 17 00:00:00 2001 From: Tom Ribuot Date: Thu, 8 Oct 2026 01:33:08 +0200 Subject: [PATCH] feat: customer sessions and self-serve checkout @kaitencloud/server gains CustomerSessions.createCustomerSession and revokeCustomerSession, generated like its other resource classes: a vendor's backend mints a kst_ session for one of its customers and hands it to the page. @kaitencloud/client gains a session module for that page -- checkout preview, checkout and the customer's invoices -- over the bearer scheme it already has; with a publishable key the session methods refuse before sending anything. The contract snapshot is kaiten billing-step-11's (kaitencloud/kaiten#33): most of this diff is the generated billing surface. The public catalogue now maps the generated types instead of hand-written ones; its output is unchanged. Co-authored-by: Claude Opus 5.5 Signed-off-by: Tom Ribuot --- .changeset/customer-sessions-checkout.md | 10 + contracts/openapi.yaml | 28170 ++++++++++++---- packages/client/src/client/client.ts | 69 + packages/client/src/client/public-catalog.ts | 98 +- packages/client/src/client/session.ts | 206 + packages/client/src/core/generated/index.ts | 801 + packages/client/src/core/generated/sdk.gen.ts | 3414 +- .../client/src/core/generated/types.gen.ts | 22188 +++++++++--- packages/client/src/index.ts | 12 + packages/client/tests/client.test.ts | 179 + packages/server/src/generated/index.ts | 719 + packages/server/src/generated/sdk.gen.ts | 3530 +- packages/server/src/generated/types.gen.ts | 22188 +++++++++--- packages/server/tests/index.test.ts | 31 + 14 files changed, 63682 insertions(+), 17933 deletions(-) create mode 100644 .changeset/customer-sessions-checkout.md create mode 100644 packages/client/src/client/session.ts diff --git a/.changeset/customer-sessions-checkout.md b/.changeset/customer-sessions-checkout.md new file mode 100644 index 0000000..eaaaece --- /dev/null +++ b/.changeset/customer-sessions-checkout.md @@ -0,0 +1,10 @@ +--- +"@kaitencloud/client": minor +"@kaitencloud/server": minor +--- + +Customer sessions and self-serve checkout. + +- `@kaitencloud/server`: `CustomerSessions.createCustomerSession` mints a `kst_` session for one of your customers -- optionally bound to one of its instances -- from your backend, with a `ksh_` token holding `write:customer_sessions`; `CustomerSessions.revokeCustomerSession` ends one. The contract also gains the rest of the billing surface (subscriptions with add-ons and a voucher, invoices, add-ons, vouchers, publishable keys). +- `@kaitencloud/client`: with `authScheme: "bearer"` and a `tokenProvider` returning that session, `session.previewCheckout` answers what a checkout would bill today, `session.checkout` subscribes the session's instance to a public price -- answering `requires_payment_method` with a hosted setup page first when a card has to be saved, then `subscribed` with how the first payment went -- and `session.invoices` lists the customer's invoices with how to pay each. Totals come from the server. With a publishable key, the session methods refuse before sending anything. +- The public catalogue now maps the generated contract types; its output is unchanged. diff --git a/contracts/openapi.yaml b/contracts/openapi.yaml index 0d21213..6cae35f 100644 --- a/contracts/openapi.yaml +++ b/contracts/openapi.yaml @@ -1,1520 +1,2232 @@ components: schemas: - AuditTrail: + Addon: additionalProperties: false properties: - eventName: - description: Event name (e.g. ENTITLEMENT_VALUE_GET) + createdAt: + format: date-time + readOnly: true type: string - eventType: - description: Event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get) + description: + type: string + familySlug: + description: The family the version belongs to + examples: + - extra-seats type: string id: - description: Unique audit trail entry ID + readOnly: true type: string - instanceId: - description: Instance UUID (present for instance-scoped events) + isDefault: + description: The version the family resolves to. Only a PUBLISHED version. + type: boolean + lifecycleState: + description: A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. + enum: + - DRAFT + - PUBLISHED + - ARCHIVED type: string - instanceSlug: - description: Instance slug + maxQuantity: + description: The largest quantity an instance can hold; unbounded when absent + examples: + - 10 + format: int32 + type: integer + name: + examples: + - Extra seats type: string - payload: - description: Event payload (JSON) - timestamp: - description: When the event occurred + pricingType: + enum: + - FREE + - PAID + - CUSTOM + type: string + slug: + description: The version's slug, unique in the organization + examples: + - extra-seats-v1 + type: string + updatedAt: format: date-time + readOnly: true + type: string + version: + description: The version number in its family, assigned on create + examples: + - 1 + format: int32 + readOnly: true + type: integer + versionName: + examples: + - Version - 1 type: string required: - id - - instanceSlug - - eventName - - eventType - - timestamp + - slug + - familySlug + - name + - description + - version + - versionName + - isDefault + - lifecycleState + - pricingType + - createdAt + - updatedAt type: object - Basic: + AddonChanges: additionalProperties: false properties: - type: - enum: - - basic + description: type: string - value: + isDefault: + type: boolean + maxQuantity: + format: int32 + type: integer + name: + examples: + - Extra seats + minLength: 1 + type: string + versionName: type: string required: - - type - - value + - name + - description + - isDefault type: object - BasicTargeting: + AddonEntitlement: additionalProperties: false properties: - name: - examples: - - Targeting Rule 1 - type: string - rule: - description: CEL expression for basicTargeting evaluation + entitlementSlug: examples: - - user.group == 'beta' - maxLength: 10000 + - seats type: string - type: + entitlementType: enum: - - basic + - BOOLEAN + - NUMBER + - CONFIG + - NUMBER_AI_CREDIT type: string - variant: + id: + readOnly: true type: string - required: - - type - - name - - variant - - rule - type: object - BooleanEntitlementValue: - additionalProperties: false - properties: - type: - description: Value type discriminator + limitCapExceededOveragePercent: + description: The overage the add-on allows; absent inherits the licence grant's + format: int32 + type: integer + overrideBehavior: + description: "How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides." enum: - - boolean - examples: - - boolean + - ADD + - OVERRIDE + - MAX type: string value: - description: Boolean value - examples: - - true - type: boolean + additionalProperties: {} + description: "{type, value}, shaped like a licence grant. A number counts once per unit of quantity." + type: object required: - - type + - id + - entitlementSlug + - entitlementType - value + - overrideBehavior type: object - BulkEvaluationFailure: + AddonFamily: additionalProperties: false properties: - errorCode: - description: Error code specific to the bulk evaluation error + currentVersion: + $ref: "#/components/schemas/Addon" + description: The default version, else the highest PUBLISHED one; absent when none is published + id: + readOnly: true type: string - errorDetails: - description: Optional error details description + isPublic: + description: Whether the family is listed in the public catalogue + type: boolean + lastVersion: + description: The highest version number the family has assigned + format: int32 + type: integer + slug: + examples: + - extra-seats type: string + versions: + description: Every version, newest first + items: + $ref: "#/components/schemas/Addon" + type: + - array + - "null" required: - - errorCode + - id + - slug + - isPublic + - lastVersion + - versions type: object - BulkEvaluationRequest: + AddonFamilyVisibility: additionalProperties: false properties: - context: + isPublic: + description: List the family's default PUBLISHED version, with its ACTIVE prices, in the public catalogue + type: boolean + required: + - isPublic + type: object + AddonGrant: + additionalProperties: false + properties: + limitCapExceededOveragePercent: + description: "The overage the add-on allows: -1 with an unlimited value, 0 or more otherwise. Absent inherits the licence grant's." + format: int32 + type: integer + overrideBehavior: + default: MAX + description: How a number grant combines with the licence's + enum: + - ADD + - OVERRIDE + - MAX + type: string + value: additionalProperties: {} + description: "{type, value}, shaped like a licence grant: a number counts once per unit of quantity" + examples: + - type: number + value: 5 type: object + required: + - value type: object - Command: + AddonGrantUpdate: additionalProperties: false properties: + addonSlug: + description: The add-on version the grant belongs to + type: string entitlementSlug: + examples: + - seats + type: string + entitlementType: + enum: + - BOOLEAN + - NUMBER + - CONFIG + - NUMBER_AI_CREDIT + type: string + id: + readOnly: true type: string + limitCapExceededOveragePercent: + description: The overage the add-on allows; absent inherits the licence grant's + format: int32 + type: integer + overrideBehavior: + description: "How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides." + enum: + - ADD + - OVERRIDE + - MAX + type: string + value: + additionalProperties: {} + description: "{type, value}, shaped like a licence grant. A number counts once per unit of quantity." + type: object required: + - addonSlug + - id - entitlementSlug + - entitlementType + - value + - overrideBehavior type: object - Component: + AddonPriceUpdate: additionalProperties: false properties: + addonSlug: + description: The add-on version the price belongs to + type: string + billingModel: + description: "FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit." + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingPeriod: + description: The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + description: ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. + enum: + - ADVANCE + - ARREARS + type: string createdAt: - description: Timestamp when the component was created - examples: - - "2023-10-01T12:00:00Z" format: date-time readOnly: true type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this component - readOnly: true - description: - description: Description of the component + currency: + description: ISO 4217 code, upper case. One currency per licence version. examples: - - Main API gateway component - maxLength: 500 + - EUR type: string - id: - description: Unique identifier for the component - examples: - - 123e4567-e89b-12d3-a456-426614174000 - readOnly: true + deprecatedAt: + description: When the price was deprecated + format: date-time type: string - name: - description: Name of the component + displayLabel: + description: The invoice line's label; a default is derived when absent. examples: - - api-gateway - maxLength: 100 - minLength: 1 + - Pro plan type: string - previousComponentId: - description: Reference to the previous version of this component + displayOrder: + description: Order among the version's prices examples: - - 123e4567-e89b-12d3-a456-426614174000 + - 0 + format: int32 + type: integer + id: + description: Unique identifier of the price + readOnly: true type: string - slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. - examples: - - api-gateway-v1-2-3 - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + isDefault: + description: The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. + type: boolean + metered: + $ref: "#/components/schemas/Meter" + description: What a metered price measures. Absent on FLAT_FEE prices. + status: + description: A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + enum: + - ACTIVE + - DEPRECATED type: string - version: - description: Version of the component + unitAmount: + description: unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. examples: - - v1.2.3 - maxLength: 100 - minLength: 1 + - 2900 + format: int64 + type: integer + unitAmountDecimal: + description: "Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places." + examples: + - "2900" type: string - required: + updatedAt: + format: date-time + readOnly: true + type: string + required: + - addonSlug - id - - name - - version - - createdBy + - billingModel + - billingTiming + - currency + - unitAmountDecimal + - displayOrder + - isDefault + - status - createdAt + - updatedAt type: object - ConfigEntitlementValue: + AddonQuantity: additionalProperties: false properties: - type: - description: Value type discriminator - enum: - - object + quantity: examples: - - object - type: string - value: - additionalProperties: {} - description: Object configuration value - type: object + - 3 + format: int32 + minimum: 1 + type: integer required: - - type - - value + - quantity type: object - Connector: + AddonUpdate: additionalProperties: false properties: - created_at: - description: Timestamp when connector was first registered + changedFields: + description: The members the change touched, as the API names them + items: + type: string + type: + - array + - "null" + compatibleLicenseFamilies: + description: The licence families the version fits after the change + items: + type: string + type: + - array + - "null" + createdAt: format: date-time + readOnly: true type: string - entitlement_slug: - description: Slug of the BOOLEAN entitlement a license must grant for an organization to activate this connector. Absent means the connector is ungated. + description: + type: string + familySlug: + description: The family the version belongs to examples: - - connector-attio + - extra-seats type: string + id: + readOnly: true + type: string + isDefault: + description: The version the family resolves to. Only a PUBLISHED version. + type: boolean + lifecycleState: + description: A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. + enum: + - DRAFT + - PUBLISHED + - ARCHIVED + type: string + maxQuantity: + description: The largest quantity an instance can hold; unbounded when absent + examples: + - 10 + format: int32 + type: integer name: - description: Stable connector identifier examples: - - kaiten.integration.crm.attio + - Extra seats type: string - settings_schema: - additionalProperties: {} - description: JSON schema used to validate connector settings payloads - type: object - updated_at: - description: Timestamp when connector registration was last updated + pricingType: + enum: + - FREE + - PAID + - CUSTOM + type: string + slug: + description: The version's slug, unique in the organization + examples: + - extra-seats-v1 + type: string + updatedAt: format: date-time + readOnly: true type: string version: - description: Registered connector version + description: The version number in its family, assigned on create examples: - - 1.0.0 + - 1 + format: int32 + readOnly: true + type: integer + versionName: + examples: + - Version - 1 type: string required: + - changedFields + - compatibleLicenseFamilies + - id + - slug + - familySlug - name + - description - version - - settings_schema - - created_at - - updated_at + - versionName + - isDefault + - lifecycleState + - pricingType + - createdAt + - updatedAt type: object - ConnectorActivation: + AuditTrail: additionalProperties: false properties: - activatedAt: - description: When this organization first activated the connector - format: date-time + eventName: + description: Event name (e.g. ENTITLEMENT_VALUE_GET) type: string - connectorName: - description: Stable connector identifier - examples: - - kaiten.integration.crm.attio + eventType: + description: Event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get) + type: string + id: + description: Unique audit trail entry ID + type: string + instanceId: + description: Instance UUID (present for instance-scoped events) + type: string + instanceSlug: + description: Instance slug + type: string + payload: + description: Event payload (JSON) + timestamp: + description: When the event occurred + format: date-time type: string required: - - connectorName - - activatedAt + - id + - instanceSlug + - eventName + - eventType + - timestamp type: object - ConnectorSettings: + Basic: additionalProperties: false properties: - connector_name: - description: Stable connector identifier - examples: - - kaiten.integration.crm.attio - readOnly: true + type: + enum: + - basic + type: string + value: type: string - settings: - additionalProperties: {} - description: Connector settings payload - type: object required: - - connector_name - - settings + - type + - value type: object - ConnectorSettingsSchema: + BasicTargeting: additionalProperties: false properties: - connector_name: - description: Stable connector identifier + name: examples: - - kaiten.integration.crm.attio + - Targeting Rule 1 type: string - schema: - additionalProperties: {} - description: JSON schema describing supported connector settings payload - type: object - version: - description: Registered connector version + rule: + description: CEL expression for basicTargeting evaluation examples: - - 1.0.0 + - user.group == 'beta' + maxLength: 10000 + type: string + type: + enum: + - basic + type: string + variant: type: string required: - - connector_name - - version - - schema + - type + - name + - variant + - rule type: object - ConnectorState: + BillingCapabilities: additionalProperties: false properties: - activated: - description: Whether this organization has turned the connector on - type: boolean - activatedAt: - description: When this organization activated the connector. Absent when it has not. - format: date-time + disabledReason: + description: "Why they do not: billing is off on this deployment, or the organization's plan does not include it" + enum: + - DEPLOYMENT_DISABLED + - NOT_ENTITLED type: string + enabled: + description: Whether the billing routes answer for this organization + type: boolean + features: + $ref: "#/components/schemas/BillingFeatures" + description: Which parts of billing this release ships + providers: + description: Who can collect invoices + items: + $ref: "#/components/schemas/BillingProvider" + type: array + publicSurface: + $ref: "#/components/schemas/PublicSurface" + usageHistoryRetentionMonths: + description: How long usage reports are kept, in months; absent when they are kept forever or it cannot be told + format: int64 + type: integer + usageIdempotencyWindowDays: + description: How long a usage report's transactionId is remembered, in days + format: int64 + type: integer + required: + - enabled + - providers + - publicSurface + - usageIdempotencyWindowDays + - features + type: object + BillingFeatures: + additionalProperties: false + properties: + addons: + type: boolean + chargeAutomatically: + type: boolean + lifecycle: + description: Cancellation, reactivation, plan changes and overdue tracking + type: boolean + publicSurface: + type: boolean + stripe: + type: boolean + trials: + type: boolean + vouchers: + type: boolean + required: + - stripe + - lifecycle + - trials + - addons + - vouchers + - chargeAutomatically + - publicSurface + type: object + BillingHealth: + additionalProperties: false + properties: + closeBacklog: + $ref: "#/components/schemas/CloseBacklog" + description: Subscriptions whose period ended and has not closed yet + handoff: + $ref: "#/components/schemas/HandoffBacklog" + heldInvoices: + $ref: "#/components/schemas/HeldInvoices" + overdueInvoices: + format: int64 + type: integer + pastDueSubscriptions: + format: int64 + type: integer + providerSync: + items: + $ref: "#/components/schemas/ProviderSync" + type: array + pushFailures: + $ref: "#/components/schemas/PushFailures" + description: Invoices whose push failed at least as many times as the alert threshold + reconciliationMismatches30d: + description: Invoices whose provider's amounts differed from Kaiten's, in the last 30 days + format: int64 + type: integer + required: + - closeBacklog + - heldInvoices + - pushFailures + - reconciliationMismatches30d + - providerSync + - pastDueSubscriptions + - overdueInvoices + - handoff + type: object + BillingProvider: + additionalProperties: false + properties: available: - description: Whether this deployment has the connector registered + description: Whether the organization may connect it on this deployment type: boolean - connectorName: - description: Stable connector identifier - examples: - - kaiten.integration.crm.attio + capabilities: + $ref: "#/components/schemas/ProviderCapabilities" + connected: + description: Whether it is set up for the organization; NOOP always is + type: boolean + kind: + enum: + - NOOP + - STRIPE type: string - entitled: - description: Whether this organization's licence includes the connector. True for an ungated connector. + livemode: + description: Whether the connection reaches the provider's live account rather than a test one; absent when not connected, and for NOOP type: boolean - version: - description: Registered connector version. Absent when the connector is not available. - examples: - - 1.0.0 + unavailableReason: + description: Why it is not available; absent when it is + enum: + - NOT_ENTITLED + - VAULT_NOT_CONFIGURED type: string required: - - connectorName + - kind - available - - entitled - - activated + - connected + - capabilities type: object - Customer: + BillingSettings: additionalProperties: false properties: - createdAt: - description: Timestamp when the customer was created + defaultCollectionMethod: + description: "How an invoice is collected when its subscription does not say: SEND_INVOICE sends it for payment. CHARGE_AUTOMATICALLY needs a payment provider and is refused until one is available." + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY examples: - - "2023-10-01T12:00:00Z" - format: date-time - readOnly: true + - SEND_INVOICE type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this customer - readOnly: true - domain: - description: Optional customer domain name + defaultDaysUntilDue: + description: Days an invoice is due after it is issued, when its subscription does not say; 0 to 365. examples: - - example.tld - pattern: ^[a-z0-9_-]+(\.[a-z0-9_-]+)+$ + - 30 + format: int32 + type: integer + handoffStripeInvoices: + description: Whether invoices a payment provider issues also enter the handoff queue, for an accounting system that wants every invoice. Invoices without a provider always do. + type: boolean + required: + - defaultCollectionMethod + - defaultDaysUntilDue + - handoffStripeInvoices + type: object + BillingStarted: + additionalProperties: false + properties: + anchorAt: + description: The instant its periods are counted from + format: date-time type: string - externalCustomerId: - description: Optional identifier for the customer in an external system + basePrice: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription is pinned to, deprecated or not + billingPeriod: + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + cancelAtPeriodEnd: + type: boolean + cancelRequestedAt: + format: date-time + type: string + canceledAt: + format: date-time + type: string + cancellationReason: + type: string + collectionMethod: + description: "Effective: the subscription's own, else the organization's default" + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + collectionMethodOverride: + description: The subscription's own collection method; absent when it takes the organization's + type: string + createdAt: + format: date-time + type: string + currency: examples: - - external-customer-id-12345 - type: - - string - - "null" + - EUR + type: string + currentPeriodEnd: + description: "The next boundary: the period closes, and its invoice is composed, after it" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + customerName: + type: string + customerSlug: + type: string + daysUntilDue: + description: "Effective: the subscription's own, else the organization's default" + format: int32 + type: integer + daysUntilDueOverride: + description: The subscription's own payment terms; absent when it takes the organization's + format: int32 + type: integer id: - description: Unique identifier for the customer - examples: - - 123e4567-e89b-12d3-a456-426614174000 - readOnly: true type: string - integrations: - additionalProperties: - $ref: "#/components/schemas/CustomerIntegration" - description: Integrations grouped by adapter name - type: object - name: - description: Name of the customer - examples: - - Awesome Customer - minLength: 1 + instanceName: type: string - slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. - examples: - - awesome-customer - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + instanceSlug: + description: As it was at the subscription's last write + type: string + pastDueSince: + format: date-time + type: string + providerKind: + description: "Who collects its invoices. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + resubscribed: + description: Set when a CANCELED subscription was subscribed again + type: boolean + scheduledChange: + $ref: "#/components/schemas/ScheduledChange" + description: A plan change waiting for the next boundary + startedAt: + description: "When billing started: usage before it is never billed" + format: date-time + type: string + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + trialEndsAt: + description: "When the trial ends, or ended: usage before it is never billed" + format: date-time type: string updatedAt: - description: Timestamp when the customer was last updated - examples: - - "2023-10-01T12:00:00Z" format: date-time - readOnly: true type: string - updatedBy: - $ref: "#/components/schemas/User" - description: User who last updated this customer - readOnly: true required: + - resubscribed - id - - name - - createdBy + - instanceSlug + - instanceName + - customerSlug + - customerName + - status + - providerKind + - collectionMethod + - daysUntilDue + - basePrice + - billingPeriod + - currency + - anchorAt + - startedAt + - currentPeriodStart + - currentPeriodEnd + - cancelAtPeriodEnd - createdAt - - updatedBy - updatedAt type: object - CustomerBody: + BooleanEntitlementValue: additionalProperties: false properties: - domain: - description: Optional customer domain name - examples: - - example.tld - pattern: ^[a-z0-9_-]+(\.[a-z0-9_-]+)+$ - type: string - error: - description: Optional integration error message - type: string - integrationMetadata: - additionalProperties: {} - description: Adapter-specific integration metadata - type: object - name: - description: Customer name - examples: - - Awesome Customer - minLength: 1 - type: string - slug: - description: Customer slug + type: + description: Value type discriminator + enum: + - boolean examples: - - awesome-customer - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + - boolean type: string - webUrl: - description: Absolute http(s) link to the record in the third-party system + value: + description: Boolean value examples: - - https://app.attio.com/w/acme/record/rec_12345 - type: string + - true + type: boolean + required: + - type + - value type: object - CustomerCreationRejected: + BulkEvaluationFailure: additionalProperties: false properties: - name: - type: string - reason: + errorCode: + description: Error code specific to the bulk evaluation error type: string - slug: + errorDetails: + description: Optional error details description type: string required: - - name - - slug - - reason + - errorCode type: object - CustomerIntegration: + BulkEvaluationRequest: additionalProperties: false properties: - external_id: - description: External identifier in the third-party adapter - examples: - - rec_12345 - type: string - last_error: - description: Last synchronization error message, if any - type: string - metadata: + context: additionalProperties: {} - description: Adapter-specific integration metadata type: object - synced_at: - description: Timestamp of the last synchronization with the adapter - format: date-time - readOnly: true - type: string - web_url: - description: Absolute http(s) link to the record in the third-party system - examples: - - https://app.attio.com/w/acme/company/rec_12345 - type: string - required: - - external_id - - synced_at type: object - CustomerIntegrationResource: + CanceledSubscription: additionalProperties: false properties: - domain: - description: Optional customer domain name - examples: - - example.tld + anchorAt: + description: The instant its periods are counted from + format: date-time type: string - error: - description: Last synchronization error for this integration, if any + basePrice: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription is pinned to, deprecated or not + billingPeriod: + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL type: string - integrationMetadata: - additionalProperties: {} - description: Adapter-specific customer integration metadata - type: object - name: - description: Customer name - examples: - - Awesome Customer + cancelAtPeriodEnd: + type: boolean + cancelRequestedAt: + format: date-time type: string - slug: - description: Customer slug - examples: - - awesome-customer + canceledAt: + format: date-time type: string - webUrl: - description: Absolute http(s) link to the record in the third-party system - examples: - - https://app.attio.com/w/acme/company/rec_12345 + cancellationReason: + type: string + collectionMethod: + description: "Effective: the subscription's own, else the organization's default" + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + collectionMethodOverride: + description: The subscription's own collection method; absent when it takes the organization's type: string - required: - - integrationMetadata - - name - - slug - type: object - DefaultVariant: - discriminator: - mapping: - basic: "#/components/schemas/Basic" - rollout_date: "#/components/schemas/RolloutDate" - rollout_percentage: "#/components/schemas/RolloutPercentage" - propertyName: type - oneOf: - - $ref: "#/components/schemas/Basic" - - $ref: "#/components/schemas/RolloutDate" - - $ref: "#/components/schemas/RolloutPercentage" - Deployment: - additionalProperties: false - properties: createdAt: - description: Timestamp when the deployment was recorded - examples: - - "2023-10-01T12:00:00Z" format: date-time type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who recorded this deployment - deploymentZoneId: - description: Deployment zone the release was deployed to + currency: examples: - - 123e4567-e89b-12d3-a456-426614174000 + - EUR + type: string + currentPeriodEnd: + description: "The next boundary: the period closes, and its invoice is composed, after it" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + customerName: + type: string + customerSlug: type: string + daysUntilDue: + description: "Effective: the subscription's own, else the organization's default" + format: int32 + type: integer + daysUntilDueOverride: + description: The subscription's own payment terms; absent when it takes the organization's + format: int32 + type: integer + finalInvoice: + $ref: "#/components/schemas/InvoiceSummary" + description: The FINAL invoice of an immediate cancellation id: - description: Unique identifier for this deployment event - examples: - - 123e4567-e89b-12d3-a456-426614174000 type: string - releaseId: - description: Release that was deployed - examples: - - 123e4567-e89b-12d3-a456-426614174000 + instanceName: + type: string + instanceSlug: + description: As it was at the subscription's last write + type: string + pastDueSince: + format: date-time + type: string + providerKind: + description: "Who collects its invoices. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + scheduledChange: + $ref: "#/components/schemas/ScheduledChange" + description: A plan change waiting for the next boundary + startedAt: + description: "When billing started: usage before it is never billed" + format: date-time + type: string + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + trialEndsAt: + description: "When the trial ends, or ended: usage before it is never billed" + format: date-time + type: string + updatedAt: + format: date-time type: string required: - id - - deploymentZoneId - - releaseId - - createdBy + - instanceSlug + - instanceName + - customerSlug + - customerName + - status + - providerKind + - collectionMethod + - daysUntilDue + - basePrice + - billingPeriod + - currency + - anchorAt + - startedAt + - currentPeriodStart + - currentPeriodEnd + - cancelAtPeriodEnd - createdAt + - updatedAt type: object - DeploymentZone: + Cancellation: additionalProperties: false properties: + anchorAt: + description: The instant its periods are counted from + format: date-time + type: string + basePrice: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription is pinned to, deprecated or not + billingPeriod: + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + cancelAtPeriodEnd: + type: boolean + cancelRequestedAt: + format: date-time + type: string + canceledAt: + format: date-time + type: string + cancellationReason: + type: string + collectionMethod: + description: "Effective: the subscription's own, else the organization's default" + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + collectionMethodOverride: + description: The subscription's own collection method; absent when it takes the organization's + type: string createdAt: - description: Timestamp when the deployment zone was created - examples: - - "2023-10-01T12:00:00Z" format: date-time - readOnly: true type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this deployment zone - readOnly: true - description: - description: Description of the deployment zone + currency: examples: - - "2023-10-01T12:00:00Z" + - EUR + type: string + currentPeriodEnd: + description: "The next boundary: the period closes, and its invoice is composed, after it" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + customerName: + type: string + customerSlug: + type: string + daysUntilDue: + description: "Effective: the subscription's own, else the organization's default" + format: int32 + type: integer + daysUntilDueOverride: + description: The subscription's own payment terms; absent when it takes the organization's + format: int32 + type: integer + finalInvoiceId: + description: The FINAL invoice, when the cancellation issued one type: string id: - description: Unique identifier for the deployment zone - examples: - - 123e4567-e89b-12d3-a456-426614174000 - readOnly: true type: string - metadata: - additionalProperties: {} - description: Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema - examples: - - region: eu-west-1 - type: object - name: - description: Name of the deployment zone - examples: - - AWS us-west-2 - minLength: 1 + instanceName: type: string - releaseId: - description: Currently deployed release ID - examples: - - 123e4567-e89b-12d3-a456-426614174000 + instanceSlug: + description: As it was at the subscription's last write type: string - slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. - examples: - - aws-us-west-2 - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + mode: + description: How it was canceled; a trial is canceled at once in either mode + enum: + - AT_PERIOD_END + - IMMEDIATE type: string - type: - description: "Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type." - examples: - - production + pastDueSince: + format: date-time + type: string + providerKind: + description: "Who collects its invoices. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + scheduledChange: + $ref: "#/components/schemas/ScheduledChange" + description: A plan change waiting for the next boundary + startedAt: + description: "When billing started: usage before it is never billed" + format: date-time + type: string + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + trialEndsAt: + description: "When the trial ends, or ended: usage before it is never billed" + format: date-time type: string updatedAt: - description: Timestamp when the deployment zone was last updated - examples: - - "2023-10-01T12:00:00Z" format: date-time - readOnly: true type: string - updatedBy: - $ref: "#/components/schemas/User" - description: User who last updated the deployment zone - readOnly: true required: + - mode - id - - name - - type - - description - - createdBy + - instanceSlug + - instanceName + - customerSlug + - customerName + - status + - providerKind + - collectionMethod + - daysUntilDue + - basePrice + - billingPeriod + - currency + - anchorAt + - startedAt + - currentPeriodStart + - currentPeriodEnd + - cancelAtPeriodEnd - createdAt - - updatedBy - updatedAt type: object - Entitlement: + CancellationChange: additionalProperties: false properties: - aggregationMethod: - description: Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. + anchorAt: + description: The instant its periods are counted from + format: date-time + type: string + basePrice: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription is pinned to, deprecated or not + billingPeriod: enum: - - COUNT - - SUM - - AVERAGE - - MIN - - MAX - - LATEST - examples: - - SUM + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + cancelAtPeriodEnd: + type: boolean + cancelRequestedAt: + format: date-time + type: string + canceledAt: + format: date-time + type: string + cancellationReason: + type: string + collectionMethod: + description: "Effective: the subscription's own, else the organization's default" + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + collectionMethodOverride: + description: The subscription's own collection method; absent when it takes the organization's type: string createdAt: - description: Timestamp when this entitlement was created - examples: - - "2023-10-01T12:00:00Z" format: date-time - readOnly: true type: string - description: - description: Description of the entitlement - examples: - - Basic subscription plan with limited features - type: - - string - - "null" - displayOrder: - description: Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. + currency: examples: - - 10 + - EUR + type: string + currentPeriodEnd: + description: "The next boundary: the period closes, and its invoice is composed, after it" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + customerName: + type: string + customerSlug: + type: string + daysUntilDue: + description: "Effective: the subscription's own, else the organization's default" format: int32 - minimum: 0 type: integer - entitlementGroups: - description: Groups associated with this entitlement - items: - $ref: "#/components/schemas/EntitlementGroupSummary" - readOnly: true - type: - - array - - "null" - groupSlugs: - description: Groups associated with this entitlement, identified by slug - items: - type: string - type: - - array - - "null" - writeOnly: true - icon: - description: Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. - examples: - - lucide:rocket - maxLength: 64 - pattern: ^[a-z0-9]+:[a-z0-9]+(-[a-z0-9]+)*$ + daysUntilDueOverride: + description: The subscription's own payment terms; absent when it takes the organization's + format: int32 + type: integer + effectiveAt: + description: The boundary the cancellation takes effect at + format: date-time type: string id: - description: Unique identifier for the entitlement - examples: - - 123e4567-e89b-12d3-a456-426614174000 - readOnly: true type: string - name: - description: Name of the entitlement - examples: - - Basic Plan - minLength: 1 + instanceName: type: string - resetAnchor: - description: "Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set." - enum: - - CALENDAR - - LICENSE_START - examples: - - CALENDAR + instanceSlug: + description: As it was at the subscription's last write type: string - resetPeriod: - description: Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. + pastDueSince: + format: date-time + type: string + providerKind: + description: "Who collects its invoices. NOOP: the organization itself, through the handoff queue" enum: - - HOUR - - DAY - - WEEK - - MONTH - - YEAR - examples: - - MONTH + - NOOP + - STRIPE + type: string + scheduledChange: + $ref: "#/components/schemas/ScheduledChange" + description: A plan change waiting for the next boundary + startedAt: + description: "When billing started: usage before it is never billed" + format: date-time type: string - saleUnitFactor: - description: Number of base units one sale unit represents (1 sale unit = N base units). - examples: - - 3 - exclusiveMinimum: 0 - format: double - type: number - saleUnitPlural: - description: Plural label of the unit this entitlement is sold in, when it differs from the base unit. - examples: - - packs - maxLength: 100 - minLength: 1 + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED type: string - saleUnitSingular: - description: Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). - examples: - - pack - maxLength: 100 - minLength: 1 + trialEndsAt: + description: "When the trial ends, or ended: usage before it is never billed" + format: date-time type: string - slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. - examples: - - basic-plan - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + updatedAt: + format: date-time type: string - type: - description: Type of the entitlement - enum: - - BOOLEAN - - NUMBER - - CONFIG - - NUMBER_AI_CREDIT - examples: - - NUMBER - type: string - unitPlural: - description: Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. - examples: - - seats - maxLength: 100 - minLength: 1 + required: + - effectiveAt + - id + - instanceSlug + - instanceName + - customerSlug + - customerName + - status + - providerKind + - collectionMethod + - daysUntilDue + - basePrice + - billingPeriod + - currency + - anchorAt + - startedAt + - currentPeriodStart + - currentPeriodEnd + - cancelAtPeriodEnd + - createdAt + - updatedAt + type: object + CloseBacklog: + additionalProperties: false + properties: + count: + format: int64 + type: integer + oldestDueAt: + format: date-time type: string - unitSingular: - description: Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. - examples: - - seat - maxLength: 100 - minLength: 1 + required: + - count + type: object + ClosePeriodsScope: + additionalProperties: false + properties: + instanceSlug: + description: Close only this instance's subscription type: string - updatedAt: - description: Timestamp when this entitlement was last updated - examples: - - "2023-10-02T12:00:00Z" + type: object + ClosedInvoice: + additionalProperties: false + properties: + boundaryAt: format: date-time - readOnly: true type: string - userFacing: - description: Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. - examples: - - true + held: + description: Set when the invoice is a held DRAFT type: boolean - warningThresholdPercent: - description: Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). - examples: - - 80 - format: int32 - maximum: 100 - minimum: 0 - type: integer + id: + type: string + instanceSlug: + type: string + kind: + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + status: + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string required: - id - - name - - description - - createdAt - - updatedAt + - instanceSlug + - kind + - boundaryAt + - status + - held type: object - EntitlementGroup: + Command: + additionalProperties: false + properties: + entitlementSlug: + type: string + required: + - entitlementSlug + type: object + CompatibleLicenseFamilies: + additionalProperties: false + properties: + familySlugs: + examples: + - - pro + items: + type: string + type: array + required: + - familySlugs + type: object + CompletedPaymentMethodSession: additionalProperties: false properties: + paymentMethod: + $ref: "#/components/schemas/PaymentMethodLabels" + required: + - paymentMethod + type: object + Component: + additionalProperties: false + properties: + createdAt: + description: Timestamp when the component was created + examples: + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + description: User who created this component + readOnly: true description: - description: Description of the entitlement group + description: Description of the component examples: - - All entitlements related to AI usage quotas - type: - - string - - "null" + - Main API gateway component + maxLength: 500 + type: string id: - description: Unique identifier for the entitlement group + description: Unique identifier for the component examples: - 123e4567-e89b-12d3-a456-426614174000 readOnly: true type: string name: - description: Name of the entitlement group + description: Name of the component examples: - - AI Quotas + - api-gateway + maxLength: 100 minLength: 1 type: string + previousComponentId: + description: Reference to the previous version of this component + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string slug: - description: URL-friendly identifier, unique per organization. Auto-generated if not provided. + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. examples: - - ai-quotas + - api-gateway-v1-2-3 maxLength: 100 minLength: 2 pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string + version: + description: Version of the component + examples: + - v1.2.3 + maxLength: 100 + minLength: 1 + type: string required: - id - name - - description + - version + - createdBy + - createdAt type: object - EntitlementGroupSummary: + ConfigEntitlementValue: additionalProperties: false properties: - id: - description: Unique identifier for the entitlement group + type: + description: Value type discriminator + enum: + - object examples: - - 123e4567-e89b-12d3-a456-426614174000 + - object type: string - name: - description: Name of the entitlement group + value: + additionalProperties: {} + description: Object configuration value + type: object + required: + - type + - value + type: object + Connection: + additionalProperties: false + properties: + connectorName: + description: The connector that configures it examples: - - AI Quotas + - kaiten.integration.billing.stripe type: string - slug: - description: URL-friendly identifier for the entitlement group - examples: - - ai-quotas + livemode: + description: Whether the connection reaches the provider's live account rather than a test one + type: boolean + providerKind: + description: The payment provider + enum: + - STRIPE type: string required: - - id - - name - - slug + - providerKind + - connectorName + - livemode type: object - EntitlementGroupUsage: + Connector: additionalProperties: false properties: - currentPeriodEnd: - description: End of the current usage window (exclusive). Null for a lifetime entitlement. - format: date-time - type: string - currentPeriodStart: - description: Start of the current usage window (inclusive). Null for a lifetime entitlement. + created_at: + description: Timestamp when connector was first registered format: date-time type: string - entitlementId: - description: Entitlement ID + entitlement_slug: + description: Slug of the BOOLEAN entitlement a license must grant for an organization to activate this connector. Absent means the connector is ungated. + examples: + - connector-attio type: string - entitlementName: - description: Entitlement name + name: + description: Stable connector identifier + examples: + - kaiten.integration.crm.attio type: string - entitlementSlug: - description: Entitlement slug + settings_schema: + additionalProperties: {} + description: JSON schema used to validate connector settings payloads + type: object + updated_at: + description: Timestamp when connector registration was last updated + format: date-time type: string - entitlementType: - description: Entitlement type + version: + description: Registered connector version + examples: + - 1.0.0 type: string - licenseValue: - description: License limit value, discriminated by the 'type' field. Null when the license grants no value. - discriminator: - mapping: - boolean: "#/components/schemas/BooleanEntitlementValue" - number: "#/components/schemas/NumberEntitlementValue" - object: "#/components/schemas/ConfigEntitlementValue" - propertyName: type - oneOf: - - $ref: "#/components/schemas/NumberEntitlementValue" - - $ref: "#/components/schemas/BooleanEntitlementValue" - - $ref: "#/components/schemas/ConfigEntitlementValue" - usageValue: - description: Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. - discriminator: - mapping: - boolean: "#/components/schemas/BooleanEntitlementValue" - number: "#/components/schemas/NumberEntitlementValue" - object: "#/components/schemas/ConfigEntitlementValue" - propertyName: type - oneOf: - - $ref: "#/components/schemas/NumberEntitlementValue" - - $ref: "#/components/schemas/BooleanEntitlementValue" - - $ref: "#/components/schemas/ConfigEntitlementValue" required: - - entitlementId - - entitlementSlug - - entitlementName - - entitlementType + - name + - version + - settings_schema + - created_at + - updated_at type: object - EntitlementUsage: + ConnectorActivation: additionalProperties: false properties: - currentPeriodEnd: - description: End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). - examples: - - "2026-04-01T00:00:00Z" - format: date-time - type: string - currentPeriodStart: - description: Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). - examples: - - "2026-03-01T00:00:00Z" + activatedAt: + description: When this organization first activated the connector format: date-time type: string - entitlementId: - description: Unique identifier for the entitlement + connectorName: + description: Stable connector identifier examples: - - 123e4567-e89b-12d3-a456-426614174000 + - kaiten.integration.crm.attio type: string - entitlementSlug: - description: URL-friendly identifier of the entitlement + required: + - connectorName + - activatedAt + type: object + ConnectorSettings: + additionalProperties: false + properties: + connector_name: + description: Stable connector identifier examples: - - premium-support + - kaiten.integration.crm.attio + readOnly: true type: string - licenseId: - description: Unique identifier for the license to which this entitlement usage belongs + settings: + additionalProperties: {} + description: Connector settings payload + type: object + required: + - connector_name + - settings + type: object + ConnectorSettingsSchema: + additionalProperties: false + properties: + connector_name: + description: Stable connector identifier examples: - - 123e4567-e89b-12d3-a456-426614174001 + - kaiten.integration.crm.attio type: string - licenseSlug: - description: URL-friendly identifier of the license + schema: + additionalProperties: {} + description: JSON schema describing supported connector settings payload + type: object + version: + description: Registered connector version examples: - - enterprise-license + - 1.0.0 type: string - limit: - description: License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. - discriminator: - mapping: - boolean: "#/components/schemas/BooleanEntitlementValue" - number: "#/components/schemas/NumberEntitlementValue" - object: "#/components/schemas/ConfigEntitlementValue" - propertyName: type - oneOf: - - $ref: "#/components/schemas/NumberEntitlementValue" - - $ref: "#/components/schemas/BooleanEntitlementValue" - - $ref: "#/components/schemas/ConfigEntitlementValue" - value: - description: Resolved entitlement value, discriminated by the 'type' field - discriminator: - mapping: - boolean: "#/components/schemas/BooleanEntitlementValue" - number: "#/components/schemas/NumberEntitlementValue" - object: "#/components/schemas/ConfigEntitlementValue" - propertyName: type - oneOf: - - $ref: "#/components/schemas/NumberEntitlementValue" - - $ref: "#/components/schemas/BooleanEntitlementValue" - - $ref: "#/components/schemas/ConfigEntitlementValue" required: - - entitlementId - - entitlementSlug - - licenseId - - licenseSlug - - value + - connector_name + - version + - schema type: object - ErrorDetail: + ConnectorState: additionalProperties: false properties: - location: - description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' + activated: + description: Whether this organization has turned the connector on + type: boolean + activatedAt: + description: When this organization activated the connector. Absent when it has not. + format: date-time type: string - message: - description: Error message text + available: + description: Whether this deployment has the connector registered + type: boolean + connectorName: + description: Stable connector identifier + examples: + - kaiten.integration.crm.attio type: string - value: - description: The value at the given location + entitled: + description: Whether this organization's licence includes the connector. True for an ungated connector. + type: boolean + version: + description: Registered connector version. Absent when the connector is not available. + examples: + - 1.0.0 + type: string + required: + - connectorName + - available + - entitled + - activated type: object - EvaluationFailure: + CreatedCustomerSession: additionalProperties: false properties: - errorCode: - description: OpenFeature compatible error code + customerSlug: type: string - errorDetails: - description: Error description + expiresAt: + format: date-time type: string - key: - description: Feature flag key + id: + description: Revoke it with POST /customer-sessions/{id}/revoke + type: string + instanceSlug: + type: string + token: + description: "The kst_ token: hand it to the customer's browser, which sends it as Authorization: Bearer on /api/public/session routes. Shown once; only its digest is stored." + examples: + - kst_3q2-7wEXAMPLEtokenBodyOfFortyThreeCharactersX type: string - metadata: - additionalProperties: {} - description: Arbitrary metadata for the flag - type: object required: - - key - - errorCode - type: object - EvaluationRequest: - additionalProperties: false - properties: - context: - additionalProperties: {} - type: object + - id + - token + - expiresAt + - customerSlug type: object - EvaluationSuccess: + Customer: additionalProperties: false properties: - key: - description: Feature flag key + billingEmail: + description: "Where invoices sent to this customer are delivered, at most 254 characters (CreateCustomer.InvalidBillingEmail). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. Personal data: never included in event payloads." + examples: + - billing@example.tld type: string - metadata: - additionalProperties: {} - description: Arbitrary metadata for the flag - type: object - reason: - description: OpenFeature reason for the evaluation + createdAt: + description: Timestamp when the customer was created examples: - - STATIC + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true type: string - value: - description: Flag evaluation result - variant: - description: string of the evaluated flag value + createdBy: + $ref: "#/components/schemas/User" + description: User who created this customer + readOnly: true + domain: + description: Optional customer domain name + examples: + - example.tld + pattern: ^[a-z0-9_-]+(\.[a-z0-9_-]+)+$ type: string - required: - - key - type: object - FeatureFlag: - additionalProperties: false - properties: - default_variant: - $ref: "#/components/schemas/DefaultVariant" - description: + externalCustomerId: + description: Optional identifier for the customer in an external system examples: - - This is a new feature flag + - external-customer-id-12345 type: - string - "null" - enabled: - examples: - - true - type: boolean - event_name: - examples: - - feature_flag_event - type: string id: + description: Unique identifier for the customer examples: - 123e4567-e89b-12d3-a456-426614174000 readOnly: true type: string - metadata: - additionalProperties: {} + integrations: + additionalProperties: + $ref: "#/components/schemas/CustomerIntegration" + description: Integrations grouped by adapter name type: object name: + description: Name of the customer examples: - - New Feature + - Awesome Customer minLength: 1 type: string slug: + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. examples: - - new-feature + - awesome-customer maxLength: 100 minLength: 2 pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - targetings: - $ref: "#/components/schemas/Targetings" - type: - enum: - - boolean - - string - - number - - object + updatedAt: + description: Timestamp when the customer was last updated examples: - - boolean + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true type: string - variants: - items: - $ref: "#/components/schemas/Variant" - type: - - array - - "null" + updatedBy: + $ref: "#/components/schemas/User" + description: User who last updated this customer + readOnly: true required: - id - - type - - variants - - targetings - name - - description - - default_variant - - metadata - - enabled - - event_name + - createdBy + - createdAt + - updatedBy + - updatedAt type: object - FeatureFlagEvaluated: + CustomerBilling: additionalProperties: false properties: - error_code: - description: Set when the evaluation failed and the default was returned - type: string - error_message: - description: Human-readable detail accompanying error_code + billingEmail: + description: Where the customer's invoices are sent. Personal data type: string - flag_id: - description: Unique identifier of the evaluated flag + providers: + description: The customer in each payment provider; none for NOOP + items: + $ref: "#/components/schemas/CustomerInProvider" + type: array + required: + - providers + type: object + CustomerBody: + additionalProperties: false + properties: + domain: + description: Optional customer domain name + examples: + - example.tld + pattern: ^[a-z0-9_-]+(\.[a-z0-9_-]+)+$ type: string - flag_slug: - description: URL-friendly identifier of the evaluated flag + error: + description: Optional integration error message type: string - matched_rule_name: - description: Name of the targeting rule that matched, when the reason is TARGETING_MATCH + integrationMetadata: + additionalProperties: {} + description: Adapter-specific integration metadata + type: object + name: + description: Customer name + examples: + - Awesome Customer + minLength: 1 type: string - reason: - description: Why the value resolved as it did + slug: + description: Customer slug + examples: + - awesome-customer + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - variant: - description: Name of the resolved variant, when the flag has one + webUrl: + description: Absolute http(s) link to the record in the third-party system + examples: + - https://app.attio.com/w/acme/record/rec_12345 type: string - required: - - flag_slug - - flag_id - - reason - type: object - Impact: - additionalProperties: false - properties: - count: - description: Number of resources whose stored value for this field would no longer satisfy the candidate schema - format: int64 - type: integer - samples: - description: Up to 5 impacted resources, for display - items: - $ref: "#/components/schemas/ImpactSample" - type: - - array - - "null" - required: - - count - - samples type: object - ImpactSample: + CustomerCreationRejected: additionalProperties: false properties: name: - description: Resource display name + type: string + reason: type: string slug: - description: Resource slug type: string required: - name - slug + - reason type: object - Instance: + CustomerInProvider: additionalProperties: false properties: - createdAt: - description: Timestamp when the instance was created - examples: - - "2023-10-01T12:00:00Z" - format: date-time - readOnly: true + externalCustomerId: + description: The customer's id in the provider type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this instance - readOnly: true - customerId: - description: ID of the customer associated with this instance - examples: - - 123e4567-e89b-12d3-a456-426614174003 + paymentMethod: + $ref: "#/components/schemas/PaymentMethodLabels" + description: Its default payment method; null when there is none + providerKind: + enum: + - STRIPE type: string - customerSlug: - description: Slug of the customer associated with this instance - examples: - - acme-corp - readOnly: true + syncedAt: + format: date-time type: string - deploymentZoneId: - description: ID of the deployment zone associated with this instance (optional) - examples: - - 123e4567-e89b-12d3-a456-426614174005 + webUrl: + description: The customer's page in the provider's dashboard type: string - deploymentZoneSlug: - description: Slug of the deployment zone associated with this instance (optional) + required: + - providerKind + - externalCustomerId + - paymentMethod + type: object + CustomerIntegration: + additionalProperties: false + properties: + external_id: + description: External identifier in the third-party adapter examples: - - aws-us-west-2 - readOnly: true + - rec_12345 type: string - description: - description: Brief description of the instance - examples: - - This is a sample instance description + last_error: + description: Last synchronization error message, if any type: string - endLicenseDate: - description: End date of the license for this instance - examples: - - "2024-10-01T12:00:00Z" + metadata: + additionalProperties: {} + description: Adapter-specific integration metadata + type: object + synced_at: + description: Timestamp of the last synchronization with the adapter format: date-time - type: string - id: - description: Unique identifier for the instance - examples: - - 123e4567-e89b-12d3-a2456-426614174000 readOnly: true type: string - integrations: - additionalProperties: - $ref: "#/components/schemas/InstanceIntegration" - description: Integrations grouped by adapter name - type: object - licenseId: - description: ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. + web_url: + description: Absolute http(s) link to the record in the third-party system examples: - - 123e4567-e89b-12d3-a456-426614174004 + - https://app.attio.com/w/acme/company/rec_12345 type: string - licenseSlug: - description: Slug of the license associated with this instance + required: + - external_id + - synced_at + type: object + CustomerIntegrationResource: + additionalProperties: false + properties: + domain: + description: Optional customer domain name examples: - - my-license - readOnly: true + - example.tld type: string - lifecycleStage: - description: "Commercial lifecycle stage of the instance (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED)" - examples: - - ACTIVE - readOnly: true + error: + description: Last synchronization error for this integration, if any type: string - metadata: + integrationMetadata: additionalProperties: {} - description: Metadata for the instance - examples: - - key: value + description: Adapter-specific customer integration metadata type: object name: - description: Name of the instance + description: Customer name examples: - - My Instance - minLength: 1 + - Awesome Customer type: string slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. - examples: - - my-instance - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ - type: string - startLicenseDate: - description: Start date of the license for this instance - examples: - - "2023-10-01T12:00:00Z" - format: date-time - type: string - status: - description: Operational status of the instance - enum: - - HEALTHY - - DEGRADED - - INCIDENT - - MAINTENANCE + description: Customer slug examples: - - HEALTHY - readOnly: true + - awesome-customer type: string - updatedAt: - description: Timestamp when the instance was last updated + webUrl: + description: Absolute http(s) link to the record in the third-party system examples: - - "2023-10-01T12:00:00Z" - format: date-time - readOnly: true + - https://app.attio.com/w/acme/company/rec_12345 type: string - updatedBy: - $ref: "#/components/schemas/User" - description: User who last updated this instance - readOnly: true required: - - id - - createdBy - - createdAt - - updatedBy - - updatedAt + - integrationMetadata - name - - description - - customerId - - customerSlug - - licenseId - - licenseSlug - - startLicenseDate - - endLicenseDate + - slug type: object - InstanceBody: + CustomerSessionDraft: additionalProperties: false properties: - customerExternalId: - description: External identifier of the related customer in the same adapter - examples: - - rec_customer_123 - type: string - deploymentZoneId: - description: Deployment zone ID + customerSlug: + description: The customer the session acts for examples: - - 123e4567-e89b-12d3-a456-426614174005 + - acme type: string - description: - description: Instance description + instanceSlug: + description: "Binds the session to one of the customer's instances; checkout, cancel and the other subscription routes need it. Omitted: the session reads the whole customer." examples: - - This is a sample instance description + - acme-prod type: string - endLicenseDate: - description: License end date + ttlSeconds: + description: "How long the session lives, in seconds: 300 to 3600 (CreateCustomerSession.InvalidTtl otherwise). Default 30 minutes; mint a new one before it ends." examples: - - "2024-10-01T12:00:00Z" - format: date-time - type: string - error: - description: Optional integration error message - type: string - integrationMetadata: - additionalProperties: {} - description: Adapter-specific integration metadata - type: object - licenseId: - description: License ID + - 1800 + format: int32 + type: integer + required: + - customerSlug + type: object + DefaultVariant: + discriminator: + mapping: + basic: "#/components/schemas/Basic" + rollout_date: "#/components/schemas/RolloutDate" + rollout_percentage: "#/components/schemas/RolloutPercentage" + propertyName: type + oneOf: + - $ref: "#/components/schemas/Basic" + - $ref: "#/components/schemas/RolloutDate" + - $ref: "#/components/schemas/RolloutPercentage" + DeletedAddon: + additionalProperties: false + properties: + familySlug: + type: string + id: + type: string + slug: + type: string + required: + - id + - slug + - familySlug + type: object + Deployment: + additionalProperties: false + properties: + createdAt: + description: Timestamp when the deployment was recorded examples: - - 123e4567-e89b-12d3-a456-426614174004 + - "2023-10-01T12:00:00Z" + format: date-time + type: string + createdBy: + $ref: "#/components/schemas/User" + description: User who recorded this deployment + deploymentZoneId: + description: Deployment zone the release was deployed to + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string + id: + description: Unique identifier for this deployment event + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string + releaseId: + description: Release that was deployed + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string + required: + - id + - deploymentZoneId + - releaseId + - createdBy + - createdAt + type: object + DeploymentZone: + additionalProperties: false + properties: + createdAt: + description: Timestamp when the deployment zone was created + examples: + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + description: User who created this deployment zone + readOnly: true + description: + description: Description of the deployment zone + examples: + - "2023-10-01T12:00:00Z" + type: string + id: + description: Unique identifier for the deployment zone + examples: + - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true type: string metadata: additionalProperties: {} - description: Instance metadata + description: Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema + examples: + - region: eu-west-1 type: object name: - description: Instance name + description: Name of the deployment zone examples: - - My Instance + - AWS us-west-2 minLength: 1 type: string + releaseId: + description: Currently deployed release ID + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string slug: - description: Instance slug + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. examples: - - my-instance + - aws-us-west-2 maxLength: 100 minLength: 2 pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - startLicenseDate: - description: License start date + type: + description: "Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type." examples: - - "2023-10-01T12:00:00Z" - format: date-time + - production type: string - webUrl: - description: Absolute http(s) link to the record in the third-party system + updatedAt: + description: Timestamp when the deployment zone was last updated examples: - - https://app.attio.com/w/acme/record/rec_12345 + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true type: string + updatedBy: + $ref: "#/components/schemas/User" + description: User who last updated the deployment zone + readOnly: true + required: + - id + - name + - type + - description + - createdBy + - createdAt + - updatedBy + - updatedAt type: object - InstanceEntitlementCapExceeded: + DueToday: additionalProperties: false properties: - entitlement_slug: - description: URL-friendly identifier of the entitlement + currency: + examples: + - EUR type: string - overage: - description: Amount by which usage exceeds the cap - format: double - type: number - threshold: - description: The entitlement cap - format: double - type: number - value: - description: Current usage value, including overage - format: double - type: number + discountTotal: + description: Minor units + format: int64 + type: integer + lines: + items: + $ref: "#/components/schemas/SessionLine" + type: array + subtotal: + description: Minor units + format: int64 + type: integer + total: + description: Minor units + format: int64 + type: integer required: - - entitlement_slug - - threshold - - value - - overage + - currency + - subtotal + - discountTotal + - total + - lines type: object - InstanceEntitlementUsagePeriodRolledOver: + Entitlement: additionalProperties: false properties: - closed_period_end: + aggregationMethod: + description: Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. + enum: + - COUNT + - SUM + - AVERAGE + - MIN + - MAX + - LATEST + examples: + - SUM + type: string + createdAt: + description: Timestamp when this entitlement was created + examples: + - "2023-10-01T12:00:00Z" format: date-time + readOnly: true + type: string + description: + description: Description of the entitlement + examples: + - Basic subscription plan with limited features type: - string - "null" - closed_period_start: - format: date-time + displayOrder: + description: Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. + examples: + - 10 + format: int32 + minimum: 0 + type: integer + entitlementGroups: + description: Groups associated with this entitlement + items: + $ref: "#/components/schemas/EntitlementGroupSummary" + readOnly: true type: - - string + - array - "null" - entitlement_id: + groupSlugs: + description: Groups associated with this entitlement, identified by slug + items: + type: string + type: + - array + - "null" + writeOnly: true + icon: + description: Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. + examples: + - lucide:rocket + maxLength: 64 + pattern: ^[a-z0-9]+:[a-z0-9]+(-[a-z0-9]+)*$ type: string - entitlement_slug: + id: + description: Unique identifier for the entitlement + examples: + - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true type: string - event_count: - format: int32 - type: integer - instance_id: + name: + description: Name of the entitlement + examples: + - Basic Plan + minLength: 1 type: string - is_synthetic: - type: boolean - new_period_start: - format: date-time + resetAnchor: + description: "Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set." + enum: + - CALENDAR + - LICENSE_START + examples: + - CALENDAR type: string - value: - format: double - type: number - required: - - entitlement_id - - entitlement_slug - - instance_id - - value - - event_count - - closed_period_start - - closed_period_end - - new_period_start - - is_synthetic - type: object - InstanceEntitlementUsageReportAccepted: - additionalProperties: false - properties: - behavior: - description: "Report behavior: append folds the value into the stored total, set overwrites it" + resetPeriod: + description: Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. enum: - - append - - set + - HOUR + - DAY + - WEEK + - MONTH + - YEAR + examples: + - MONTH type: string - entitlement_slug: - description: URL-friendly identifier of the entitlement the usage was reported against + saleUnitFactor: + description: Number of base units one sale unit represents (1 sale unit = N base units). + examples: + - 3 + exclusiveMinimum: 0 + format: double + type: number + saleUnitPlural: + description: Plural label of the unit this entitlement is sold in, when it differs from the base unit. + examples: + - packs + maxLength: 100 + minLength: 1 type: string - event_count: - description: Number of reports folded into the current usage window, including this one - format: int32 - type: integer - status: - description: Whether the report was persisted + saleUnitSingular: + description: Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). + examples: + - pack + maxLength: 100 + minLength: 1 + type: string + slug: + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + examples: + - basic-plan + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + type: + description: Type of the entitlement enum: - - ACCEPTED - - REJECTED + - BOOLEAN + - NUMBER + - CONFIG + - NUMBER_AI_CREDIT + examples: + - NUMBER type: string - value: - description: Value carried by the report - format: double - type: number + unitPlural: + description: Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. + examples: + - seats + maxLength: 100 + minLength: 1 + type: string + unitSingular: + description: Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. + examples: + - seat + maxLength: 100 + minLength: 1 + type: string + updatedAt: + description: Timestamp when this entitlement was last updated + examples: + - "2023-10-02T12:00:00Z" + format: date-time + readOnly: true + type: string + userFacing: + description: Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. + examples: + - true + type: boolean + warningThresholdPercent: + description: Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + examples: + - 80 + format: int32 + maximum: 100 + minimum: 0 + type: integer required: - - entitlement_slug - - value - - behavior - - event_count - - status + - id + - name + - description + - createdAt + - updatedAt type: object - InstanceEntitlementUsageWarningThresholdReached: + EntitlementGroup: additionalProperties: false properties: - boundary: - description: Usage value at which the warning fires (cap * warningThresholdPercent / 100) - format: double - type: number - entitlement_slug: - description: URL-friendly identifier of the entitlement + description: + description: Description of the entitlement group + examples: + - All entitlements related to AI usage quotas + type: + - string + - "null" + id: + description: Unique identifier for the entitlement group + examples: + - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true + type: string + name: + description: Name of the entitlement group + examples: + - AI Quotas + minLength: 1 + type: string + slug: + description: URL-friendly identifier, unique per organization. Auto-generated if not provided. + examples: + - ai-quotas + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - threshold: - description: The entitlement cap - format: double - type: number - value: - description: Current usage value - format: double - type: number required: - - entitlement_slug - - threshold - - boundary - - value + - id + - name + - description type: object - InstanceEntitlementValueGet: + EntitlementGroupSummary: additionalProperties: false properties: - entitlement_id: - description: Unique identifier for the entitlement - type: string - entitlement_slug: - description: URL-friendly identifier of the entitlement + id: + description: Unique identifier for the entitlement group + examples: + - 123e4567-e89b-12d3-a456-426614174000 type: string - instance_id: - description: Unique identifier for the instance the value was read for + name: + description: Name of the entitlement group + examples: + - AI Quotas type: string - license_id: - description: Unique identifier for the license carrying the entitlement + slug: + description: URL-friendly identifier for the entitlement group + examples: + - ai-quotas type: string - organization_id: - description: Unique identifier for the owning organization + required: + - id + - name + - slug + type: object + EntitlementGroupUsage: + additionalProperties: false + properties: + currentPeriodEnd: + description: End of the current usage window (exclusive). Null for a lifetime entitlement. + format: date-time type: string - timestamp: - description: When the value was read + currentPeriodStart: + description: Start of the current usage window (inclusive). Null for a lifetime entitlement. format: date-time type: string - type: - description: Discriminator of the resolved entitlement value - examples: - - number + entitlementId: + description: Entitlement ID type: string - value: - description: Resolved entitlement value at read time + entitlementName: + description: Entitlement name + type: string + entitlementSlug: + description: Entitlement slug + type: string + entitlementType: + description: Entitlement type + type: string + licenseValue: + description: License limit value, discriminated by the 'type' field. Null when the license grants no value. + discriminator: + mapping: + boolean: "#/components/schemas/BooleanEntitlementValue" + number: "#/components/schemas/NumberEntitlementValue" + object: "#/components/schemas/ConfigEntitlementValue" + propertyName: type + oneOf: + - $ref: "#/components/schemas/NumberEntitlementValue" + - $ref: "#/components/schemas/BooleanEntitlementValue" + - $ref: "#/components/schemas/ConfigEntitlementValue" + usageValue: + description: Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. discriminator: mapping: boolean: "#/components/schemas/BooleanEntitlementValue" @@ -1526,1209 +2238,1290 @@ components: - $ref: "#/components/schemas/BooleanEntitlementValue" - $ref: "#/components/schemas/ConfigEntitlementValue" required: - - entitlement_id - - instance_id - - license_id - - organization_id - - type - - value - - timestamp - - entitlement_slug + - entitlementId + - entitlementSlug + - entitlementName + - entitlementType type: object - InstanceIntegration: + EntitlementUsage: additionalProperties: false properties: - external_id: - description: External identifier in the third-party adapter + currentPeriodEnd: + description: End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). examples: - - rec_12345 - type: string - last_error: - description: Last synchronization error message, if any + - "2026-04-01T00:00:00Z" + format: date-time type: string - metadata: - additionalProperties: {} - description: Adapter-specific integration metadata - type: object - synced_at: - description: Timestamp of the last synchronization with the adapter - format: date-time - readOnly: true - type: string - web_url: - description: Absolute http(s) link to the record in the third-party system + currentPeriodStart: + description: Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). examples: - - https://app.attio.com/w/acme/workspace/rec_12345 + - "2026-03-01T00:00:00Z" + format: date-time type: string - required: - - external_id - - synced_at - type: object - InstanceIntegrationResource: - additionalProperties: false - properties: - customerExternalId: - description: External identifier of the related customer in the same adapter + entitlementId: + description: Unique identifier for the entitlement examples: - - rec_customer_123 + - 123e4567-e89b-12d3-a456-426614174000 type: string - deploymentZoneId: - description: Deployment zone ID + entitlementSlug: + description: URL-friendly identifier of the entitlement examples: - - 123e4567-e89b-12d3-a456-426614174005 + - premium-support type: string - description: - description: Instance description + licenseId: + description: Unique identifier for the license to which this entitlement usage belongs examples: - - This is a sample instance description + - 123e4567-e89b-12d3-a456-426614174001 type: string - endLicenseDate: - description: License end date + licenseSlug: + description: URL-friendly identifier of the license examples: - - "2024-10-01T12:00:00Z" - format: date-time - type: string - error: - description: Last synchronization error for this integration, if any + - enterprise-license type: string - integrationMetadata: - additionalProperties: {} - description: Adapter-specific instance integration metadata - type: object - licenseId: - description: License ID - examples: - - 123e4567-e89b-12d3-a456-426614174004 + limit: + description: License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + discriminator: + mapping: + boolean: "#/components/schemas/BooleanEntitlementValue" + number: "#/components/schemas/NumberEntitlementValue" + object: "#/components/schemas/ConfigEntitlementValue" + propertyName: type + oneOf: + - $ref: "#/components/schemas/NumberEntitlementValue" + - $ref: "#/components/schemas/BooleanEntitlementValue" + - $ref: "#/components/schemas/ConfigEntitlementValue" + value: + description: Resolved entitlement value, discriminated by the 'type' field + discriminator: + mapping: + boolean: "#/components/schemas/BooleanEntitlementValue" + number: "#/components/schemas/NumberEntitlementValue" + object: "#/components/schemas/ConfigEntitlementValue" + propertyName: type + oneOf: + - $ref: "#/components/schemas/NumberEntitlementValue" + - $ref: "#/components/schemas/BooleanEntitlementValue" + - $ref: "#/components/schemas/ConfigEntitlementValue" + required: + - entitlementId + - entitlementSlug + - licenseId + - licenseSlug + - value + type: object + ErrorDetail: + additionalProperties: false + properties: + location: + description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' type: string - name: - description: Instance name - examples: - - My Instance + message: + description: Error message text type: string - slug: - description: Instance slug - examples: - - my-instance + value: + description: The value at the given location + type: object + EvaluationFailure: + additionalProperties: false + properties: + errorCode: + description: OpenFeature compatible error code type: string - startLicenseDate: - description: License start date - examples: - - "2023-10-01T12:00:00Z" - format: date-time + errorDetails: + description: Error description type: string - webUrl: - description: Absolute http(s) link to the record in the third-party system - examples: - - https://app.attio.com/w/acme/workspace/rec_12345 + key: + description: Feature flag key type: string + metadata: + additionalProperties: {} + description: Arbitrary metadata for the flag + type: object required: - - description - - endLicenseDate - - licenseId - - integrationMetadata - - name - - slug - - startLicenseDate + - key + - errorCode type: object - InstanceLifecycleStageChanged: + EvaluationRequest: additionalProperties: false properties: - changed_by: - format: uuid + context: + additionalProperties: {} + type: object + type: object + EvaluationSuccess: + additionalProperties: false + properties: + key: + description: Feature flag key type: string - instance_id: - format: uuid + metadata: + additionalProperties: {} + description: Arbitrary metadata for the flag + type: object + reason: + description: OpenFeature reason for the evaluation + examples: + - STATIC + type: string + value: + description: Flag evaluation result + variant: + description: string of the evaluated flag value type: string - new_lifecycle_stage: - type: - - string - - "null" - previous_lifecycle_stage: - type: - - string - - "null" required: - - instance_id - - previous_lifecycle_stage - - new_lifecycle_stage - - changed_by + - key type: object - InstanceStatusChanged: + Event: additionalProperties: false properties: - changed_by: - format: uuid - type: string - instance_id: - format: uuid + billingModel: + description: "FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit." + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE type: string - new_status: + billingPeriod: + description: The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. enum: - - HEALTHY - - DEGRADED - - INCIDENT - - MAINTENANCE + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL type: string - previous_status: + billingTiming: + description: ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. enum: - - HEALTHY - - DEGRADED - - INCIDENT - - MAINTENANCE + - ADVANCE + - ARREARS type: string - required: - - instance_id - - previous_status - - new_status - - changed_by - type: object - License: - additionalProperties: false - properties: createdAt: - description: Timestamp when this license was created - examples: - - "2023-10-01T12:00:00Z" format: date-time readOnly: true type: string - description: - description: Detailed description of the license capabilities and restrictions + currency: + description: ISO 4217 code, upper case. One currency per licence version. examples: - - This license provides access to all enterprise features including advanced analytics, priority support, and unlimited users. - maxLength: 500 + - EUR type: string - familyId: - description: "Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable)." + deprecatedAt: + description: When the price was deprecated + format: date-time + type: string + displayLabel: + description: The invoice line's label; a default is derived when absent. examples: - - 123e4567-e89b-12d3-a456-426614174000 + - Pro plan type: string - familySlug: - description: "Write-only on create: slug of the family this license is a new version of. familyId names the same family by identifier; sent together they must agree. Omit both to create a new family, of which this license becomes version 1. Never returned -- see familyId. Refused on update: a version cannot move between families." + displayOrder: + description: Order among the version's prices examples: - - enterprise-license - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + - 0 + format: int32 + type: integer + familySlug: + description: The family of that version type: string - writeOnly: true id: - description: Unique identifier for the license - examples: - - 123e4567-e89b-12d3-a456-426614174000 + description: Unique identifier of the price readOnly: true type: string isDefault: - description: "Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished)." - examples: - - false + description: The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. type: boolean - lifecycleState: - description: Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. + licenseSlug: + description: The licence version the price belongs to + type: string + metered: + $ref: "#/components/schemas/Meter" + description: What a metered price measures. Absent on FLAT_FEE prices. + status: + description: A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. enum: - - DRAFT - - PUBLISHED - - ARCHIVED - examples: - - PUBLISHED + - ACTIVE + - DEPRECATED type: string - name: - description: Display name of the license + unitAmount: + description: unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. examples: - - Enterprise License - maxLength: 100 - minLength: 1 - type: string - slug: - description: Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. - examples: - - enterprise-license - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ - type: string - type: - description: Type of the license determining its capabilities and restrictions - enum: - - DEVELOPMENT - - TRIAL - - PAID - - COMMUNITY - examples: - - paid + - 2900 + format: int64 + type: integer + unitAmountDecimal: + description: "Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places." + examples: + - "2900" type: string updatedAt: - description: Timestamp when this license was last updated - examples: - - "2023-10-02T12:00:00Z" format: date-time readOnly: true type: string - version: - description: "Version of the license within its family, assigned by the server when the version is created and never changed afterwards: the version's derived slug ({familySlug}-v{version}, see slug) is built from it. A number is never reused within a family, even after its version is deleted. Create refuses any value (CreateLicense.VersionNotSettable); update accepts only the stored one, so a representation can be written back as it was read (UpdateLicense.VersionNotSettable)." - examples: - - "1" - readOnly: true - type: string - versionName: - description: Optional human-readable name for the license version. Defaults to "Version - ". - examples: - - Winter 2024 Release - maxLength: 50 - type: string required: + - licenseSlug + - familySlug - id - - name - - description - - type - - version + - billingModel + - billingTiming + - currency + - unitAmountDecimal + - displayOrder - isDefault + - status - createdAt - updatedAt type: object - LicenseEntitlement: + ExhaustedEvent: additionalProperties: false properties: - createdAt: - description: Timestamp when this entitlement was created - examples: - - "2023-10-01T12:00:00Z" - format: date-time - readOnly: true - type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this entitlement - readOnly: true - entitlementGroups: - description: Groups associated with this entitlement - items: - $ref: "#/components/schemas/EntitlementGroupSummary" - readOnly: true - type: - - array - - "null" - entitlementName: - description: Name of the entitlement feature or service - examples: - - Premium Support - readOnly: true - type: string - entitlementSlug: - description: URL-friendly identifier for the entitlement - examples: - - premium-support - format: string - type: string - entitlementType: - description: Type of entitlement (BOOLEAN, NUMBER, or CONFIG) - enum: - - BOOLEAN - - NUMBER - - CONFIG - examples: - - NUMBER - readOnly: true - type: string - licenseId: - description: Unique identifier for the license this entitlement belongs to - examples: - - a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6 - readOnly: true - type: string - licenseSlug: - description: URL-friendly identifier for the license this entitlement belongs to - examples: - - enterprise-license - readOnly: true + id: type: string - limitCapExceededOveragePercent: - description: "Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants." - examples: - - 10 + maxRedemptions: format: int32 type: integer - updatedAt: - description: Timestamp when this entitlement was last updated - examples: - - "2023-10-02T12:00:00Z" - format: date-time - readOnly: true + name: type: string - updatedBy: - $ref: "#/components/schemas/User" - description: User who last updated this entitlement - readOnly: true - value: - description: "Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}}" - discriminator: - mapping: - boolean: "#/components/schemas/BooleanEntitlementValue" - number: "#/components/schemas/NumberEntitlementValue" - object: "#/components/schemas/ConfigEntitlementValue" - propertyName: type - oneOf: - - $ref: "#/components/schemas/NumberEntitlementValue" - - $ref: "#/components/schemas/BooleanEntitlementValue" - - $ref: "#/components/schemas/ConfigEntitlementValue" required: - - entitlementName - - licenseId - - licenseSlug - - createdBy - - createdAt - - updatedBy - - updatedAt - - value + - id + - name type: object - LicenseFamilyView: + FeatureFlag: additionalProperties: false properties: - createdAt: - description: Timestamp when this family was created + default_variant: + $ref: "#/components/schemas/DefaultVariant" + description: examples: - - "2023-10-01T12:00:00Z" - format: date-time - readOnly: true + - This is a new feature flag + type: + - string + - "null" + enabled: + examples: + - true + type: boolean + event_name: + examples: + - feature_flag_event type: string - currentVersion: - $ref: "#/components/schemas/License" - description: "The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns." id: - description: Unique identifier for the license family examples: - 123e4567-e89b-12d3-a456-426614174000 readOnly: true type: string - slug: - description: URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. + metadata: + additionalProperties: {} + type: object + name: examples: - - enterprise-license + - New Feature + minLength: 1 type: string - updatedAt: - description: Timestamp when a version was last added to this family, or when the family was created. Renames, lifecycle moves and default changes update the versions' own updatedAt, not this one. + slug: examples: - - "2023-10-02T12:00:00Z" - format: date-time - readOnly: true + - new-feature + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - versionCount: - description: Number of versions in this family, whatever their lifecycle state - examples: - - 3 - format: int32 - type: integer - versions: - description: "Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version." - items: - $ref: "#/components/schemas/License" - type: array - required: - - id - - slug - - versionCount - - createdAt - - updatedAt - type: object - List: - additionalProperties: false - properties: - data: - description: The page, newest first - items: - $ref: "#/components/schemas/Notification" - type: array - nextCursor: - description: Opaque cursor for the next page; null on the last page - type: + targetings: + $ref: "#/components/schemas/Targetings" + type: + enum: + - boolean - string - - "null" - unreadCount: - description: Unread notifications, capped (see MaxUnreadCount) - format: int64 - type: integer - required: - - data - - nextCursor - - unreadCount - type: object - ManifestEnvelope: - additionalProperties: false - properties: - flags: + - number + - object + examples: + - boolean + type: string + variants: items: - $ref: "#/components/schemas/ManifestFlag" + $ref: "#/components/schemas/Variant" type: - array - "null" required: - - flags + - id + - type + - variants + - targetings + - name + - description + - default_variant + - metadata + - enabled + - event_name type: object - ManifestFlag: + FeatureFlagEvaluated: additionalProperties: false properties: - defaultValue: {} - description: + error_code: + description: Set when the evaluation failed and the default was returned type: string - key: + error_message: + description: Human-readable detail accompanying error_code type: string - name: + flag_id: + description: Unique identifier of the evaluated flag type: string - type: + flag_slug: + description: URL-friendly identifier of the evaluated flag type: string - required: - - key - - type - - defaultValue + matched_rule_name: + description: Name of the targeting rule that matched, when the reason is TARGETING_MATCH + type: string + reason: + description: Why the value resolved as it did + type: string + variant: + description: Name of the resolved variant, when the flag has one + type: string + required: + - flag_slug + - flag_id + - reason type: object - MarkReadResult: + Grant: additionalProperties: false properties: - unreadCount: - description: Unread notifications after the change - format: int64 - type: integer - updated: - description: Notifications newly marked read - format: int64 - type: integer + entitlementSlug: + examples: + - tokens + type: string + modifierType: + description: SET replaces the value, ADD adds to it, MULTIPLY multiplies it, UNLIMITED lifts the limit + enum: + - SET + - ADD + - MULTIPLY + - UNLIMITED + type: string + modifierValue: + description: "A decimal: >= 0 for SET, > 0 for ADD and MULTIPLY, absent for UNLIMITED" + examples: + - "2" + type: string required: - - updated - - unreadCount + - entitlementSlug + - modifierType type: object - MetadataField: + Handoff: additionalProperties: false properties: - archivedAt: - description: Timestamp when the field was archived (soft delete). Absent if active. - format: date-time - readOnly: true - type: string - createdAt: - description: Timestamp when the field was created - examples: - - "2026-05-26T12:00:00Z" + acknowledgedAt: format: date-time - readOnly: true type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this field - readOnly: true - displayOrder: - description: Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. - examples: - - 0 + claimCount: format: int32 type: integer - id: - description: Unique identifier - examples: - - 123e4567-e89b-12d3-a456-426614174000 - readOnly: true + externalReference: + description: The invoice's number in the organization's accounting system type: string - jsonSchema: - additionalProperties: {} - description: "JSON Schema 2020-12 document describing the value space. Example: {\"type\":\"string\",\"enum\":[\"a\",\"b\"]}" - type: object - key: - description: Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. - examples: - - region - maxLength: 100 - minLength: 1 + leaseId: + description: The claim currently holding it type: string - label: - description: Human-readable label shown in the admin UI - examples: - - Region - maxLength: 100 - minLength: 1 + leasedUntil: + format: date-time type: string - resourceType: - description: Resource type this field applies to. Immutable after creation; update must echo back the stored value. + status: enum: - - DEPLOYMENT_ZONE - - INSTANCE + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED type: string - updatedAt: - description: Timestamp when the field was last updated - examples: - - "2026-05-26T12:00:00Z" + required: + - status + - claimCount + type: object + HandoffAcknowledgement: + additionalProperties: false + properties: + acknowledgedBy: + type: string + externalReference: + description: The invoice's number in the organization's accounting system + type: string + invoiceId: + type: string + required: + - invoiceId + - acknowledgedBy + type: object + HandoffBacklog: + additionalProperties: false + properties: + oldestPendingIssuedAt: format: date-time - readOnly: true type: string - updatedBy: - $ref: "#/components/schemas/User" - description: User who last updated this field - readOnly: true + pending: + format: int64 + type: integer required: - - id - - resourceType - - key - - label - - jsonSchema - - createdBy - - createdAt - - updatedBy - - updatedAt + - pending type: object - MetadataFieldReordered: + HandoffBooking: additionalProperties: false properties: - ids: - description: Metadata field ids in their new display order + externalReference: + description: The invoice's number in the accounting system, 1 to 255 characters + type: string + leaseId: + description: The claim's lease. When given, an invoice another claim took since is refused (AckHandoff.LeaseMismatch) + type: string + type: object + HandoffClaim: + additionalProperties: false + properties: + invoices: + description: "The leased invoices, oldest issue first, with their billing e-mail: what the accounting system needs to book them" items: - type: string - type: - - array - - "null" + $ref: "#/components/schemas/Invoice" + type: array + leaseId: + description: Pass it back when acknowledging an invoice of this claim + type: string + leasedUntil: + description: When the lease expires and the invoices are claimable again + format: date-time + type: string required: - - ids + - leaseId + - leasedUntil + - invoices type: object - MetadataFieldSchemaProposal: + HandoffClaimSize: additionalProperties: false properties: - jsonSchema: - additionalProperties: {} - description: Candidate JSON Schema 2020-12 document to evaluate existing values against. - type: object - required: - - jsonSchema + leaseSeconds: + description: Lease length, 60 to 3600 seconds; 900 when omitted + format: int32 + type: integer + limit: + description: Invoices to lease, 1 to 100; 25 when omitted + format: int32 + type: integer type: object - Notification: + HeldInvoice: additionalProperties: false properties: - actionUrl: - description: Where clicking the notification goes + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time type: string - body: - description: Rendered detail line, when the event has one + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY type: string createdAt: - description: When the event occurred format: date-time type: string - eventName: - description: Event this notification reports + currency: examples: - - INSTANCE_DEPLOYED + - EUR type: string - eventType: - description: CloudEvents type of the same event -- the key it is published under in this document's webhooks section, so a client can line a notification up with the payload schema and the description already published there - examples: - - com.kaiten.instance.v1.deployed + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdDetail: + $ref: "#/components/schemas/HoldDetail" + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH type: string id: - description: Identifier of the underlying audit trail entry + description: "The invoice's identifier: the key an accounting system deduplicates on" type: string - objectType: - description: What the notification is about -- the kind of page actionUrl opens, and what the list's objectType filter matches - examples: - - instance + instanceName: type: string - readAt: - description: When this user read it; absent means unread + instanceSlug: + type: string + issuedAt: format: date-time type: string - title: - description: Rendered headline + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time type: string required: + - holdDetail - id - - eventName - - eventType - - objectType - - title + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus - createdAt + - updatedAt type: object - NumberEntitlementValue: + HeldInvoices: additionalProperties: false properties: - event_count: - description: Number of events accumulated (server-computed) - examples: - - 2 - format: int32 - readOnly: true + byReason: + additionalProperties: + format: int64 + type: integer + type: object + count: + format: int64 type: integer - type: - description: Value type discriminator - enum: - - number - examples: - - number - type: string - value: - description: Numeric value - examples: - - 42.5 - format: double - type: number required: - - type - - value + - count + - byReason type: object - PageAuditTrail: + HeldPair: additionalProperties: false properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/AuditTrail" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + counterReportSeq: + format: int64 + type: + - integer + - "null" + entitlementId: type: string - required: - - items - - hasMore - type: object - PageComponent: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/Component" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. - type: string - required: - - items - - hasMore - type: object - PageCustomer: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/Customer" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + expected: type: string - required: - - items - - hasMore - type: object - PageDeploymentZone: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/DeploymentZone" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + firstSeq: + format: int64 + type: + - integer + - "null" + found: type: string - required: - - items - - hasMore - type: object - PageEntitlement: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/Entitlement" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + instanceId: type: string - required: - - items - - hasMore - type: object - PageEntitlementGroup: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/EntitlementGroup" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + invariant: type: string + lastSeq: + format: int64 + type: + - integer + - "null" required: - - items - - hasMore + - instanceId + - entitlementId + - invariant + - expected + - found + - firstSeq + - lastSeq + - counterReportSeq type: object - PageFeatureFlag: + HoldDetail: additionalProperties: false properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: + pairs: items: - $ref: "#/components/schemas/FeatureFlag" + $ref: "#/components/schemas/HeldPair" type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. - type: string required: - - items - - hasMore + - pairs type: object - PageInstance: + HoldRecord: additionalProperties: false properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/Instance" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + heldAt: + format: date-time type: string - required: - - items - - hasMore - type: object - PageLicense: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/License" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + releaseReason: type: string - required: - - items - - hasMore - type: object - PageLicenseEntitlement: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/LicenseEntitlement" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + releasedAt: + format: date-time type: string - required: - - items - - hasMore - type: object - PageLicenseFamilyView: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/LicenseFamilyView" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + releasedBy: + description: The user who released it; absent when it was released by a later check type: string - required: - - items - - hasMore type: object - PageMetadataField: + HoldRelease: additionalProperties: false properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/MetadataField" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + reason: + description: 1 to 500 characters type: string required: - - items - - hasMore + - reason type: object - PageRelease: + Impact: additionalProperties: false properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: + count: + description: Number of resources whose stored value for this field would no longer satisfy the candidate schema + format: int64 + type: integer + samples: + description: Up to 5 impacted resources, for display items: - $ref: "#/components/schemas/Release" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. - type: string + $ref: "#/components/schemas/ImpactSample" + type: + - array + - "null" required: - - items - - hasMore + - count + - samples type: object - PageServiceAccount: + ImpactSample: additionalProperties: false properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/ServiceAccount" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + name: + description: Resource display name type: string - required: - - items - - hasMore - type: object - PageToken: - additionalProperties: false - properties: - hasMore: - description: Whether more rows exist beyond this page. - type: boolean - items: - items: - $ref: "#/components/schemas/Token" - type: array - nextCursor: - description: Opaque cursor for the next page. Absent when hasMore is false. + slug: + description: Resource slug type: string required: - - items - - hasMore + - name + - slug type: object - PatchInstanceBody: + Instance: additionalProperties: false properties: - lifecycleStage: - description: "Commercial lifecycle stage (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED). When omitted, the current stage is preserved; clearing it back to unset is not supported." + createdAt: + description: Timestamp when the instance was created examples: - - AT_RISK - minLength: 1 + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true type: string - status: - description: Operational status of the instance - enum: - - HEALTHY - - DEGRADED - - INCIDENT - - MAINTENANCE + createdBy: + $ref: "#/components/schemas/User" + description: User who created this instance + readOnly: true + customerId: + description: ID of the customer associated with this instance examples: - - INCIDENT + - 123e4567-e89b-12d3-a456-426614174003 type: string - type: object - PlainToken: - additionalProperties: false - properties: - createdAt: - format: date-time + customerSlug: + description: Slug of the customer associated with this instance + examples: + - acme-corp readOnly: true type: string - createdBy: - $ref: "#/components/schemas/User" + deploymentZoneId: + description: ID of the deployment zone associated with this instance (optional) + examples: + - 123e4567-e89b-12d3-a456-426614174005 + type: string + deploymentZoneSlug: + description: Slug of the deployment zone associated with this instance (optional) + examples: + - aws-us-west-2 readOnly: true - expiresAt: + type: string + description: + description: Brief description of the instance + examples: + - This is a sample instance description + type: string + endLicenseDate: + description: End date of the license for this instance + examples: + - "2024-10-01T12:00:00Z" format: date-time type: string id: + description: Unique identifier for the instance + examples: + - 123e4567-e89b-12d3-a2456-426614174000 readOnly: true type: string - name: + integrations: + additionalProperties: + $ref: "#/components/schemas/InstanceIntegration" + description: Integrations grouped by adapter name + type: object + licenseId: + description: ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. + examples: + - 123e4567-e89b-12d3-a456-426614174004 type: string - revokedAt: - format: date-time + licenseSlug: + description: Slug of the license associated with this instance + examples: + - my-license readOnly: true type: string - revokedBy: - $ref: "#/components/schemas/User" - readOnly: true - scopes: - items: - type: string - type: - - array - - "null" - serviceAccountId: + lifecycleStage: + description: "Commercial lifecycle stage of the instance (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED)" + examples: + - ACTIVE readOnly: true type: string + metadata: + additionalProperties: {} + description: Metadata for the instance + examples: + - key: value + type: object + name: + description: Name of the instance + examples: + - My Instance + minLength: 1 + type: string slug: - description: Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + examples: + - my-instance maxLength: 100 minLength: 2 pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - token: + startLicenseDate: + description: Start date of the license for this instance + examples: + - "2023-10-01T12:00:00Z" + format: date-time + type: string + status: + description: Operational status of the instance + enum: + - HEALTHY + - DEGRADED + - INCIDENT + - MAINTENANCE + examples: + - HEALTHY + readOnly: true + type: string + updatedAt: + description: Timestamp when the instance was last updated + examples: + - "2023-10-01T12:00:00Z" + format: date-time readOnly: true type: string + updatedBy: + $ref: "#/components/schemas/User" + description: User who last updated this instance + readOnly: true required: - - name - - scopes - - createdAt + - id - createdBy + - createdAt + - updatedBy + - updatedAt + - name + - description + - customerId + - customerSlug + - licenseId + - licenseSlug + - startLicenseDate + - endLicenseDate type: object - PreferenceChoices: - additionalProperties: false - properties: - events: - description: Events to set; events left out keep their current value - items: - $ref: "#/components/schemas/PreferenceUpdate" - type: - - array - - "null" - required: - - events - type: object - PreferenceEvent: + InstanceAddon: additionalProperties: false properties: - channels: - additionalProperties: - type: boolean - description: Effective value per channel - type: object - eventName: - examples: - - INSTANCE_DEPLOYED + addonId: type: string - eventType: - description: CloudEvents type of the same event; see Notification.eventType + addonSlug: examples: - - com.kaiten.instance.v1.deployed + - extra-seats-v1 type: string - group: - description: Catalogue group the client renders this under + attachedAt: + format: date-time + type: string + familySlug: examples: - - deployments + - extra-seats type: string - label: - description: Human-readable event name + id: + readOnly: true type: string - required: - - eventName - - eventType - - label - - group - - channels - type: object - PreferenceMatrix: - additionalProperties: false - properties: - channels: - description: Channels this deployment serves, in display order - items: - type: string - type: array - events: - description: Every notifiable event + maxQuantity: + format: int32 + type: integer + prices: + description: "What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed." items: - $ref: "#/components/schemas/PreferenceEvent" + $ref: "#/components/schemas/Price" type: array - required: - - channels - - events - type: object - PreferenceUpdate: - additionalProperties: false - properties: - channels: - additionalProperties: - type: boolean - type: object - eventName: + quantity: + examples: + - 3 + format: int32 + type: integer + removedAt: + format: date-time type: string required: - - eventName - - channels + - id + - addonId + - addonSlug + - familySlug + - quantity + - attachedAt + - prices type: object - Problem: + InstanceAddonUpdate: additionalProperties: false properties: - code: - description: Stable, machine-readable error code. - examples: - - License.NotFound + addonId: type: string - detail: - description: A human-readable explanation specific to this occurrence of the problem. + addonSlug: examples: - - license not found + - extra-seats-v1 type: string - errorId: - description: Correlation id for the server-side log entry describing the withheld cause. - examples: - - 3f6b1a2c-7c1e-4d0b-9d5f-2b0a1c4e8d31 + attachedAt: + format: date-time type: string - errors: - description: Optional list of individual error details - items: - $ref: "#/components/schemas/ErrorDetail" - type: - - array - - "null" - instance: - description: A URI reference that identifies the specific occurrence of the problem. + familySlug: examples: - - /api/licenses/enterprise + - extra-seats type: string - status: - description: HTTP status code - examples: - - 404 - format: int64 + id: + readOnly: true + type: string + instanceSlug: + type: string + maxQuantity: + format: int32 type: integer - title: - description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + previousQuantity: + description: The quantity before a quantity change + format: int32 + type: integer + prices: + description: "What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed." + items: + $ref: "#/components/schemas/Price" + type: array + quantity: examples: - - Not Found - type: string - type: - default: about:blank - description: A URI reference to human-readable documentation for the error. - examples: - - https://tools.ietf.org/html/rfc7231#section-6.5.4 - format: uri + - 3 + format: int32 + type: integer + removedAt: + format: date-time type: string + required: + - instanceSlug + - id + - addonId + - addonSlug + - familySlug + - quantity + - attachedAt + - prices type: object - ReadSelection: + InstanceBilling: additionalProperties: false properties: - all: - description: Mark every notification read, up to now + anchorAt: + description: The instant its periods are counted from + format: date-time + type: string + basePrice: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription is pinned to, deprecated or not + billingPeriod: + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + cancelAtPeriodEnd: type: boolean - ids: - description: Notifications to mark read - items: - type: string - maxItems: 200 - type: - - array - - "null" + cancelRequestedAt: + format: date-time + type: string + canceledAt: + format: date-time + type: string + cancellationReason: + type: string + collectionMethod: + description: "Effective: the subscription's own, else the organization's default" + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + collectionMethodOverride: + description: The subscription's own collection method; absent when it takes the organization's + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + currentPeriodEnd: + description: "The next boundary: the period closes, and its invoice is composed, after it" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + customerName: + type: string + customerSlug: + type: string + daysUntilDue: + description: "Effective: the subscription's own, else the organization's default" + format: int32 + type: integer + daysUntilDueOverride: + description: The subscription's own payment terms; absent when it takes the organization's + format: int32 + type: integer + id: + type: string + instanceName: + type: string + instanceSlug: + description: As it was at the subscription's last write + type: string + pastDueSince: + format: date-time + type: string + providerKind: + description: "Who collects its invoices. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + scheduledChange: + $ref: "#/components/schemas/ScheduledChange" + description: A plan change waiting for the next boundary + startedAt: + description: "When billing started: usage before it is never billed" + format: date-time + type: string + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + trialEndsAt: + description: "When the trial ends, or ended: usage before it is never billed" + format: date-time + type: string + updatedAt: + format: date-time + type: string + required: + - id + - instanceSlug + - instanceName + - customerSlug + - customerName + - status + - providerKind + - collectionMethod + - daysUntilDue + - basePrice + - billingPeriod + - currency + - anchorAt + - startedAt + - currentPeriodStart + - currentPeriodEnd + - cancelAtPeriodEnd + - createdAt + - updatedAt type: object - Release: + InstanceBody: additionalProperties: false properties: - componentIds: - description: List of component IDs to link to this release + customerExternalId: + description: External identifier of the related customer in the same adapter examples: - - - 123e4567-e89b-12d3-a456-426614174000 - items: - type: string - type: - - array - - "null" - writeOnly: true - components: - description: List of components included in this release, fixed at creation - items: - $ref: "#/components/schemas/Component" - readOnly: true - type: - - array - - "null" - createdAt: - description: Timestamp when the release was created + - rec_customer_123 + type: string + deploymentZoneId: + description: Deployment zone ID examples: - - "2023-10-01T12:00:00Z" - format: date-time - readOnly: true + - 123e4567-e89b-12d3-a456-426614174005 type: string - createdBy: - $ref: "#/components/schemas/User" - description: User who created this release - readOnly: true description: - description: Description of the release + description: Instance description examples: - - "This release fixes everything. CHANGELOG: stuff was done" - maxLength: 500 + - This is a sample instance description type: string - id: - description: Unique identifier for the release + endLicenseDate: + description: License end date examples: - - 123e4567-e89b-12d3-a456-426614174000 - readOnly: true + - "2024-10-01T12:00:00Z" + format: date-time + type: string + error: + description: Optional integration error message + type: string + integrationMetadata: + additionalProperties: {} + description: Adapter-specific integration metadata + type: object + licenseId: + description: License ID + examples: + - 123e4567-e89b-12d3-a456-426614174004 + type: string + metadata: + additionalProperties: {} + description: Instance metadata + type: object + name: + description: Instance name + examples: + - My Instance + minLength: 1 type: string slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + description: Instance slug examples: - - v1-0-0 + - my-instance maxLength: 100 minLength: 2 pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ type: string - version: - description: Version of the release + startLicenseDate: + description: License start date examples: - - v1.0.0 - maxLength: 100 - minLength: 1 + - "2023-10-01T12:00:00Z" + format: date-time + type: string + webUrl: + description: Absolute http(s) link to the record in the third-party system + examples: + - https://app.attio.com/w/acme/record/rec_12345 + type: string + type: object + InstanceEntitlementCapExceeded: + additionalProperties: false + properties: + entitlement_slug: + description: URL-friendly identifier of the entitlement type: string + overage: + description: Amount by which usage exceeds the cap + format: double + type: number + threshold: + description: The entitlement cap + format: double + type: number + value: + description: Current usage value, including overage + format: double + type: number required: - - id - - version - - createdBy - - createdAt + - entitlement_slug + - threshold + - value + - overage type: object - ReorderMetadataFieldsInput: + InstanceEntitlementUsagePeriodRolledOver: additionalProperties: false properties: - ids: - items: - type: string + closed_period_end: + format: date-time type: - - array + - string + - "null" + closed_period_start: + format: date-time + type: + - string - "null" + entitlement_id: + type: string + entitlement_slug: + type: string + event_count: + format: int32 + type: integer + instance_id: + type: string + is_synthetic: + type: boolean + new_period_start: + format: date-time + type: string + value: + format: double + type: number required: - - ids + - entitlement_id + - entitlement_slug + - instance_id + - value + - event_count + - closed_period_start + - closed_period_end + - new_period_start + - is_synthetic type: object - ReportEntitlementUsageBody: + InstanceEntitlementUsageReportAccepted: additionalProperties: false properties: behavior: - description: "Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it" + description: "Report behavior: append folds the value into the stored total, set overwrites it" enum: - append - set type: string - metadata: - additionalProperties: {} - description: "Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings." - type: object - transactionId: - description: "Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key." - examples: - - llm-call-9f2c:tokens + entitlement_slug: + description: URL-friendly identifier of the entitlement the usage was reported against + type: string + event_count: + description: Number of reports folded into the current usage window, including this one + format: int32 + type: integer + status: + description: Whether the report was persisted + enum: + - ACCEPTED + - REJECTED type: string value: - description: Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + description: Value carried by the report + format: double + type: number + required: + - entitlement_slug + - value + - behavior + - event_count + - status + type: object + InstanceEntitlementUsageWarningThresholdReached: + additionalProperties: false + properties: + boundary: + description: Usage value at which the warning fires (cap * warningThresholdPercent / 100) + format: double + type: number + entitlement_slug: + description: URL-friendly identifier of the entitlement + type: string + threshold: + description: The entitlement cap + format: double + type: number + value: + description: Current usage value + format: double + type: number + required: + - entitlement_slug + - threshold + - boundary + - value + type: object + InstanceEntitlementValueGet: + additionalProperties: false + properties: + entitlement_id: + description: Unique identifier for the entitlement + type: string + entitlement_slug: + description: URL-friendly identifier of the entitlement + type: string + instance_id: + description: Unique identifier for the instance the value was read for + type: string + license_id: + description: Unique identifier for the license carrying the entitlement + type: string + organization_id: + description: Unique identifier for the owning organization + type: string + timestamp: + description: When the value was read + format: date-time + type: string + type: + description: Discriminator of the resolved entitlement value + examples: + - number + type: string + value: + description: Resolved entitlement value at read time discriminator: mapping: boolean: "#/components/schemas/BooleanEntitlementValue" @@ -2740,600 +3533,6498 @@ components: - $ref: "#/components/schemas/BooleanEntitlementValue" - $ref: "#/components/schemas/ConfigEntitlementValue" required: + - entitlement_id + - instance_id + - license_id + - organization_id + - type - value + - timestamp + - entitlement_slug type: object - RolloutDate: + InstanceIntegration: additionalProperties: false properties: - end: - $ref: "#/components/schemas/RolloutStep" - start: - $ref: "#/components/schemas/RolloutStep" - type: - enum: - - rollout_date + external_id: + description: External identifier in the third-party adapter + examples: + - rec_12345 + type: string + last_error: + description: Last synchronization error message, if any + type: string + metadata: + additionalProperties: {} + description: Adapter-specific integration metadata + type: object + synced_at: + description: Timestamp of the last synchronization with the adapter + format: date-time + readOnly: true + type: string + web_url: + description: Absolute http(s) link to the record in the third-party system + examples: + - https://app.attio.com/w/acme/workspace/rec_12345 type: string required: - - type - - start - - end + - external_id + - synced_at type: object - RolloutDateTargeting: + InstanceIntegrationResource: additionalProperties: false properties: - end: - $ref: "#/components/schemas/RolloutStep" + customerExternalId: + description: External identifier of the related customer in the same adapter examples: - - date: "2024-01-31T23:59:59Z" - percentage: 100 - variant: variant_a - name: + - rec_customer_123 + type: string + deploymentZoneId: + description: Deployment zone ID examples: - - Targeting Rule 1 + - 123e4567-e89b-12d3-a456-426614174005 type: string - rule: - description: CEL expression for basicTargeting evaluation + description: + description: Instance description examples: - - user.group == 'beta' - maxLength: 10000 + - This is a sample instance description type: string - start: - $ref: "#/components/schemas/RolloutStep" + endLicenseDate: + description: License end date examples: - - date: "2024-01-01T00:00:00Z" - percentage: 0 - variant: variant_a - type: - enum: - - rollout_date + - "2024-10-01T12:00:00Z" + format: date-time type: string - required: - - type - - name - - rule - - start - - end - type: object - RolloutPercentage: - additionalProperties: false - properties: - distribution: - additionalProperties: - format: int64 - type: integer - type: object - type: - enum: - - rollout_percentage + error: + description: Last synchronization error for this integration, if any type: string - required: - - type - - distribution - type: object - RolloutPercentageTargeting: - additionalProperties: false - properties: - distribution: - additionalProperties: - format: int64 - type: integer - examples: - - variant_a: 70 - variant_b: 30 + integrationMetadata: + additionalProperties: {} + description: Adapter-specific instance integration metadata type: object + licenseId: + description: License ID + examples: + - 123e4567-e89b-12d3-a456-426614174004 + type: string name: + description: Instance name examples: - - Targeting Rule 1234 + - My Instance type: string - rule: - description: CEL expression for basicTargeting evaluation + slug: + description: Instance slug examples: - - user.group == 'beta' - maxLength: 10000 + - my-instance type: string - type: - enum: - - rollout_percentage + startLicenseDate: + description: License start date + examples: + - "2023-10-01T12:00:00Z" + format: date-time + type: string + webUrl: + description: Absolute http(s) link to the record in the third-party system + examples: + - https://app.attio.com/w/acme/workspace/rec_12345 type: string required: - - type + - description + - endLicenseDate + - licenseId + - integrationMetadata - name - - rule - - distribution + - slug + - startLicenseDate type: object - RolloutStep: + InstanceLifecycleStageChanged: additionalProperties: false properties: - date: - examples: - - "2024-01-15T10:00:00Z" - format: date-time + changed_by: + format: uuid type: string - percentage: - examples: - - 50 - format: int64 - type: integer - variant: - examples: - - variant_b + instance_id: + format: uuid type: string + new_lifecycle_stage: + type: + - string + - "null" + previous_lifecycle_stage: + type: + - string + - "null" required: - - variant - - percentage - - date + - instance_id + - previous_lifecycle_stage + - new_lifecycle_stage + - changed_by type: object - ServiceAccount: + InstanceStatusChanged: additionalProperties: false properties: - createdAt: - format: date-time - readOnly: true + changed_by: + format: uuid type: string - createdBy: - $ref: "#/components/schemas/User" - readOnly: true - externalId: - readOnly: true - type: string - id: - readOnly: true + instance_id: + format: uuid type: string - name: - minLength: 1 + new_status: + enum: + - HEALTHY + - DEGRADED + - INCIDENT + - MAINTENANCE type: string - slug: - description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + previous_status: + enum: + - HEALTHY + - DEGRADED + - INCIDENT + - MAINTENANCE type: string - tokens: - items: - $ref: "#/components/schemas/Token" - readOnly: true - type: - - array - - "null" required: - - name - - tokens + - instance_id + - previous_status + - new_status + - changed_by type: object - SystemTokenIssuance: + Invoice: additionalProperties: false properties: - credentialKind: - description: Credential class that performed the mint; "platform" is the system:kaiten identity + billingEmail: + description: "The address the invoice is for, as it was when composed. Personal data: it appears in no event" + type: string + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: examples: - - platform + - EUR type: string - expiresAt: - description: Absent when the minted credential does not expire + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue format: date-time type: string + handoff: + $ref: "#/components/schemas/Handoff" + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + hold: + $ref: "#/components/schemas/HoldRecord" + description: When the invoice was held and released + holdDetail: + $ref: "#/components/schemas/HoldDetail" + description: Every meter whose journal failed a check + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string issuedAt: - description: When the credential was minted format: date-time type: string - issuedTokenId: - description: The credential that was minted + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL type: string - name: - description: Human-readable label the caller gave the minted credential - examples: - - ci-deploy + licenseId: type: string - platformTokenId: - description: Platform credential that performed the mint; revoking it revokes everything it issued + licenseSlug: type: string - scopes: - description: Scopes granted to the minted credential - examples: - - - read:customers + lines: items: - type: string - type: - - array - - "null" - slug: - description: Server-assigned identifier of the minted credential - examples: - - system-kaiten-9f2c1a + $ref: "#/components/schemas/InvoiceLine" + type: array + paidAt: + format: date-time + type: string + provider: + $ref: "#/components/schemas/ProviderRecord" + description: The invoice in its payment provider; absent for NOOP + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + replacedByInvoiceId: + description: The invoice recomposed from this VOID one + type: string + replacesInvoiceId: + description: The VOID invoice this one was recomposed from + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + uncollectibleAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + voidReason: + type: string + voidedAt: + format: date-time type: string required: - - credentialKind - - platformTokenId - - issuedTokenId - - name - - slug - - scopes - - issuedAt + - licenseId + - lines + - handoff + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt type: object - TargetingContext: + InvoiceHold: additionalProperties: false properties: - roots: - description: "Identifiers the server guarantees, and what is reachable below each. Not a closed set: a host may target on its own attributes too" - items: - $ref: "#/components/schemas/TargetingContextNode" - type: array + entitlementId: + type: string + invariant: + description: The check that failed + type: string required: - - roots + - entitlementId + - invariant type: object - TargetingContextNode: + InvoiceLine: additionalProperties: false properties: - description: - description: What this value means, shown by the editor + addonId: + description: The add-on version an ADDON line bills type: string - fields: - description: Named children, for an object - items: - $ref: "#/components/schemas/TargetingContextNode" - type: array - knownKeys: - description: Keys this map currently has, for completion. Not a closed set - items: - type: string - type: array - name: - description: Name as it is written in a rule + addonPriceId: + description: The add-on price an ADDON line bills type: string - optional: - description: Whether this value may be absent, in which case has() is worth using + amount: + description: round_half_up(quantity × unitAmountDecimal), in minor units; negative on a DISCOUNT line + examples: + - 2440 + format: int64 + type: integer + billingModel: + description: The price's billing model; absent on a DISCOUNT line + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingTiming: + description: ADVANCE lines bill the period that starts at the boundary, ARREARS lines the one that ends there; absent on a DISCOUNT line + enum: + - ADVANCE + - ARREARS + type: string + capped: + description: "Set on a preview line whose sample exceeded what the licence accepts: reports above that are rejected, so the excess is not billed" type: boolean + description: + description: The arithmetic of the line + examples: + - 3.05 × 8.00 EUR (per 10k tokens); 130,500 used; 30,500 above the applied limit (100,000) + type: string + discount: + $ref: "#/components/schemas/InvoiceLineDiscount" + description: How a DISCOUNT line was computed + entitlementId: + description: The metered entitlement, on USAGE and OVERAGE lines + type: string + entitlementSlug: + description: Its slug, as it was when the line was composed + type: string + id: + description: The line's identifier, stable for the invoice's life; absent on a preview + type: string + instanceAddonId: + description: The instance's attachment an ADDON line bills + type: string + instanceVoucherId: + description: The redemption a DISCOUNT line applies + type: string + label: + description: The price's display label, else a derived one + examples: + - Tokens — overage + type: string + licensePriceId: + description: The licence price the line bills; absent on an ADDON line + type: string + metering: + $ref: "#/components/schemas/InvoiceLineMetering" + description: How a USAGE or OVERAGE line's quantity was measured + overage: + $ref: "#/components/schemas/InvoiceLineOverage" + description: The arithmetic of an OVERAGE line + provider: + $ref: "#/components/schemas/InvoiceLineProvider" + description: The line in the payment provider, once pushed + quantity: + description: "In sale units, a decimal string: 1 on a BASE line, the quantity held on an ADDON line" + examples: + - "3.05" + type: string + seq: + description: Position on the invoice, from 1 + format: int64 + type: integer + serviceFrom: + description: Start of the period the line bills (inclusive) + format: date-time + type: string + serviceTo: + description: End of the period the line bills (exclusive) + format: date-time + type: string type: - description: Shape of this node's value + description: "BASE: the subscription's FLAT_FEE price. ADDON: an add-on's FLAT_FEE price times the quantity held at the boundary. USAGE: a USAGE_BASED price's metered usage. OVERAGE: an OVERAGE price's usage above the licence's limit. DISCOUNT: a PRICE voucher's discount, negative." enum: - - string - - number - - boolean - - object - - map - - dyn + - BASE + - ADDON + - USAGE + - OVERAGE + - DISCOUNT + type: string + unitAmountDecimal: + description: The price's unit amount in minor units; absent on a DISCOUNT line + examples: + - "800" + type: string + voucherId: + description: The voucher a DISCOUNT line applies type: string - values: - $ref: "#/components/schemas/TargetingContextNode" - description: Shape shared by every entry, for a map required: - - name + - seq - type + - label + - description + - serviceFrom + - serviceTo + - quantity + - amount type: object - TargetingRuleDraft: + InvoiceLineDiscount: additionalProperties: false properties: - rule: - description: The CEL targeting rule to check. May be blank, which is itself a mistake this reports - examples: - - __kaiten.license.familySlug == 'scale' - maxLength: 10000 + application: + description: Which invoice of the redemption this is, from 1 + format: int32 + type: integer + applicationsMax: + description: How many invoices the redemption discounts; absent for FOREVER + format: int32 + type: integer + appliesTo: + enum: + - LICENSE_BASE + - ADDONS + - BOTH + - SELECTED_PRICES + type: string + base: + description: What its targets still amounted to before it, exact, in minor units + type: string + currency: + type: string + discountType: + enum: + - PERCENTAGE + - FIXED_AMOUNT type: string + discountValue: + description: The percentage, or the amount in minor units + type: string + targetSeqs: + description: The lines it discounts + items: + format: int64 + type: integer + type: + - array + - "null" required: - - rule + - discountType + - discountValue + - appliesTo + - targetSeqs + - base + - application type: object - TargetingRuleIssue: + InvoiceLineLedger: additionalProperties: false properties: - column: - description: 1-based column the problem starts on, or 0 when it has no position - format: int64 - type: integer - endColumn: - description: 1-based column just past the problem, or 0 when only a point is known + firstSeq: + description: First report of the period, null when it has none format: int64 - type: integer - endLine: - description: 1-based line the problem ends on, or 0 when only a point is known + type: + - integer + - "null" + instanceId: + description: "The instance whose reports these are: with the line's entitlement, the pair the journal is kept by. It outlives the instance" + type: string + lastSeq: + description: Last report of the period, null when it has none format: int64 - type: integer - line: - description: 1-based line the problem starts on, or 0 when it has no position + type: + - integer + - "null" + rows: + description: Reports in the period format: int64 type: integer - message: - description: What is wrong, in the same words the write path refuses it with + sumDelta: + description: Sum of the reports' movements, before any floor type: string + sumOverage: + description: Sum of their movements above the limit, before any floor + type: + - string + - "null" required: - - message - - line - - column + - firstSeq + - lastSeq + - rows + - sumDelta + - sumOverage type: object - TargetingRuleRehearsal: + InvoiceLineMetering: additionalProperties: false properties: - evaluationError: - description: Why the engine could not answer, when it could not — e.g. the rule reads a host attribute this context does not carry. At a real evaluation the rule would simply not match + ledger: + $ref: "#/components/schemas/InvoiceLineLedger" + description: The usage journal rows the line was measured from + measuredQuantity: + description: "In measured units: the usage for a USAGE line, the overage for an OVERAGE line" + examples: + - "30500" type: string - facts: - additionalProperties: {} - description: The __kaiten namespace as enriched for this context — what a rule actually reads. Empty sub-roots mean the context resolved nothing for them - type: object - issues: - description: Problems the lint found. The rule is only run when there are none - items: - $ref: "#/components/schemas/TargetingRuleIssue" - type: array - matched: - description: Whether the rule matched this context. Meaningful only when valid and evaluationError is empty - type: boolean - valid: - description: Whether the rule lints clean - type: boolean + negativeSegmentsFloored: + description: Windows whose net movement was negative and counted as 0 + examples: + - 0 + format: int64 + type: integer + saleUnitFactor: + description: Measured units in one sale unit + examples: + - "10000" + type: string + windows: + description: Reset windows the period spans + examples: + - 1 + format: int64 + type: integer required: - - facts - - issues - - valid - - matched + - saleUnitFactor + - measuredQuantity + - windows + - negativeSegmentsFloored type: object - TargetingRuleTrial: + InvoiceLineOverage: additionalProperties: false properties: - context: - additionalProperties: {} - description: The evaluation context to rehearse against, as a client would send it. Anything under __kaiten is discarded, exactly as at a real evaluation - type: object - rule: - description: The CEL targeting rule to rehearse + limits: + description: The limits applied, in the order they first applied + items: + $ref: "#/components/schemas/OverageLimit" + type: array + overageMeasured: + description: Usage above the applied limit examples: - - __kaiten.license.familySlug == 'scale' - maxLength: 10000 + - "30500" type: string - targetingKey: - description: The key the evaluation would be bucketed on. Resolves license and entitlement facts when it names a customer slug + usageMeasured: + description: Usage in measured units + examples: + - "130500" type: string required: - - rule + - usageMeasured + - overageMeasured + - limits type: object - TargetingRuleVerdict: + InvoiceLineProvider: additionalProperties: false properties: - issues: - description: Every problem found, positioned where it is written. Empty when the rule is accepted - items: - $ref: "#/components/schemas/TargetingRuleIssue" - type: array - valid: - description: Whether the write path would accept this rule - type: boolean + amount: + description: The provider's amount, read back for reconciliation + format: int64 + type: integer + externalLineId: + description: The provider's id of the line + type: string required: - - issues - - valid + - externalLineId type: object - Targetings: - description: Polymorphic list of targeting rules (Basic, RolloutDate, RolloutPercentage) - items: - anyOf: - - $ref: "#/components/schemas/BasicTargeting" - - $ref: "#/components/schemas/RolloutDateTargeting" - - $ref: "#/components/schemas/RolloutPercentageTargeting" - type: - - array - - "null" - Token: + InvoicePayment: additionalProperties: false properties: - createdAt: + externalReference: + description: The invoice's number in the organization's accounting system, 1 to 255 characters. It also acknowledges an invoice still waiting in the handoff queue + type: string + note: + description: A note, such as the transfer's reference, kept only in the paid event + maxLength: 1000 + type: string + paidAt: + description: When it was paid, now or earlier; now when omitted format: date-time - readOnly: true type: string - createdBy: - $ref: "#/components/schemas/User" - readOnly: true - expiresAt: + type: object + InvoicePreview: + additionalProperties: false + properties: + asOf: + description: When the preview was composed format: date-time type: string - id: - readOnly: true + boundaryAt: + description: The boundary the invoice bills + format: date-time type: string - name: + currency: + description: ISO 4217 code + examples: + - EUR type: string - revokedAt: + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + kind: + description: The boundary previewed + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + description: The licence version previewed + type: string + lines: + items: + $ref: "#/components/schemas/InvoiceLine" + type: array + serviceFrom: + description: Earliest start of the lines' service periods; absent without lines format: date-time - readOnly: true type: string - revokedBy: - $ref: "#/components/schemas/User" - readOnly: true - scopes: + serviceTo: + description: Latest end of the lines' service periods; absent without lines + format: date-time + type: string + status: + description: Always PREVIEW + enum: + - PREVIEW + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + wouldHold: + description: Meters whose usage journal fails a consistency check, which would hold the invoice. Always empty for a sample. items: - type: string + $ref: "#/components/schemas/InvoiceHold" + type: array + required: + - status + - kind + - asOf + - boundaryAt + - licenseSlug + - currency + - subtotal + - discountTotal + - total + - lines + - wouldHold + type: object + InvoicePreviewScenario: + additionalProperties: false + properties: + basePriceId: + description: The FLAT_FEE price billed as the base (PreviewLicenseInvoice.PriceNotFound). Defaults to the version's default FLAT_FEE price (PreviewLicenseInvoice.NoBasePrice when it has none). + type: string + sampleUsage: + description: Usage of the metered entitlements over the period that ends, one entry per entitlement. An entitlement left out used nothing. + items: + $ref: "#/components/schemas/SampleUsageAmount" type: - array - "null" - serviceAccountId: - readOnly: true - type: string - slug: - description: Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. - maxLength: 100 - minLength: 2 - pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ - type: string - required: - - name - - scopes - - createdAt - - createdBy type: object - UsageReport: + InvoiceSummary: additionalProperties: false properties: - aggregationMethod: - description: The entitlement's aggregation method when the report was accepted - examples: - - SUM + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time type: string - behavior: - description: append adds the value through the aggregation method; set overwrites the counter + collectionMethod: enum: - - append - - set - type: string - delta: - description: valueAfter minus valueBefore; negative for a set that lowered the counter - examples: - - "600" + - SEND_INVOICE + - CHARGE_AUTOMATICALLY type: string - entitlementId: - description: The entitlement the report was made for. It may since have been deleted. - format: uuid + createdAt: + format: date-time type: string - eventCountAfter: - description: Reports counted in the window after this one + currency: examples: - - 1 - format: int32 - type: integer - instanceId: - description: The instance the report was made for. It may since have been deleted. - format: uuid + - EUR type: string - licenseId: - description: The instance's licence when the report was accepted - format: uuid - type: string - limitValue: - description: The limit in force when the report was accepted. Null when unlimited. - examples: - - "1000" + customerName: type: string - overageDelta: - description: "How much the usage above limitValue moved: max(0, valueAfter - limitValue) - max(0, valueBefore - limitValue). 0 when unlimited." - examples: - - "0" + customerSlug: + description: As it was when the invoice was composed type: string - overagePercent: - description: The overage allowed above limitValue, in percent, when the report was accepted. Null when unlimited. - examples: - - 50 + daysUntilDue: format: int32 type: integer - properties: - additionalProperties: {} - description: The report's metadata, when it was stored - type: object - reportSeq: - description: Position of the report among the pair's accepted reports, from 1, without gaps - examples: - - 42 + discountTotal: + description: Sum of the discounts, in minor units format: int64 type: integer - reportedAt: - description: When the server accepted the report (UTC, millisecond precision) - examples: - - "2026-10-05T08:00:00.000Z" + dueAt: + description: issuedAt + daysUntilDue format: date-time type: string - reportedValue: - description: "The value as sent: a delta for append, an absolute value for set" - examples: - - "600" + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED type: string - transactionId: - description: The report's idempotency key, when it was sent with one - examples: - - llm-call-9f2c:tokens + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH type: string - valueAfter: - description: The counter after the report - examples: - - "600" + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" type: string - valueBefore: - description: The counter before the report, after any window reset - examples: - - "0" + instanceName: type: string - windowEnd: - description: End of the usage window the report counted in (exclusive). Null for a lifetime entitlement. + instanceSlug: + type: string + issuedAt: format: date-time type: string - windowStart: - description: Start of the usage window the report counted in (inclusive). Null for a lifetime entitlement. + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: format: date-time type: string required: - - instanceId - - entitlementId - - reportSeq - - reportedAt - - behavior - - aggregationMethod - - reportedValue - - valueBefore - - valueAfter - - delta - - overageDelta - - eventCountAfter - - licenseId + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt type: object - UsageReportPage: + InvoiceVoid: additionalProperties: false properties: - items: - description: The reports, in reportSeq order + reason: + description: 1 to 500 characters + type: string + required: + - reason + type: object + InvoiceWriteOff: + additionalProperties: false + properties: + reason: + description: 1 to 500 characters + type: string + required: + - reason + type: object + IssuedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseId: + type: string + licenseSlug: + type: string + lines: items: - $ref: "#/components/schemas/UsageReport" + $ref: "#/components/schemas/InvoiceLine" type: array - nextAfterSeq: - description: Pass as afterSeq to read the next page. Absent on the last page. - examples: - - 100 + linesTruncated: + description: "Set when the lines did not fit the event: read the invoice for all of them" + type: boolean + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units format: int64 type: integer + updatedAt: + format: date-time + type: string required: - - items + - licenseId + - lines + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt type: object - User: + License: additionalProperties: false properties: + createdAt: + description: Timestamp when this license was created + examples: + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true + type: string + description: + description: Detailed description of the license capabilities and restrictions + examples: + - This license provides access to all enterprise features including advanced analytics, priority support, and unlimited users. + maxLength: 500 + type: string + familyId: + description: "Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable)." + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string + familySlug: + description: "Write-only on create: slug of the family this license is a new version of. familyId names the same family by identifier; sent together they must agree. Omit both to create a new family, of which this license becomes version 1. Never returned -- see familyId. Refused on update: a version cannot move between families." + examples: + - enterprise-license + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + writeOnly: true id: - description: ID of the user + description: Unique identifier for the license examples: - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true + type: string + isDefault: + description: "Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished)." + examples: + - false + type: boolean + lifecycleState: + description: Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. + enum: + - DRAFT + - PUBLISHED + - ARCHIVED + examples: + - PUBLISHED type: string name: - description: Name of the user + description: Display name of the license examples: - - John Doe + - Enterprise License + maxLength: 100 + minLength: 1 + type: string + pricingType: + description: How this version is sold. FREE and PAID can be bought self-serve; CUSTOM sends a buyer to selfServeCtaUrl or a conversation. Always present in responses. On create it defaults to CUSTOM; on update, omit it to keep the stored value. + enum: + - FREE + - PAID + - CUSTOM + examples: + - PAID + type: string + requiresPaymentMethod: + description: Whether self-serve signup captures a payment method before activation. Always present in responses; false when omitted on create. On update, omit it to keep the stored value. + examples: + - false + type: boolean + selfServeCtaUrl: + description: "Where a buyer is sent when this version cannot be bought self-serve: an http(s) URL of at most 2048 characters (CreateLicense.InvalidSelfServeCtaUrl). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it." + examples: + - https://example.com/contact-sales + maxLength: 2048 + type: string + slug: + description: Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. + examples: + - enterprise-license + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + trialPeriodDays: + description: Trial length, in days, a subscription to this version starts with by default. Absent when there is none. Must be at least 1 on create (CreateLicense.InvalidTrialPeriodDays). On update, omit it to keep the stored value, or send 0 to remove the trial. + examples: + - 14 + format: int32 + minimum: 0 + type: integer + type: + description: Type of the license determining its capabilities and restrictions + enum: + - DEVELOPMENT + - TRIAL + - PAID + - COMMUNITY + examples: + - paid + type: string + updatedAt: + description: Timestamp when this license was last updated + examples: + - "2023-10-02T12:00:00Z" + format: date-time + readOnly: true + type: string + version: + description: "Version of the license within its family, assigned by the server when the version is created and never changed afterwards: the version's derived slug ({familySlug}-v{version}, see slug) is built from it. A number is never reused within a family, even after its version is deleted. Create refuses any value (CreateLicense.VersionNotSettable); update accepts only the stored one, so a representation can be written back as it was read (UpdateLicense.VersionNotSettable)." + examples: + - "1" + readOnly: true + type: string + versionName: + description: Optional human-readable name for the license version. Defaults to "Version - ". + examples: + - Winter 2024 Release + maxLength: 50 type: string required: - id + - name + - description + - type + - version + - isDefault + - createdAt + - updatedAt type: object - Variant: + LicenseEntitlement: additionalProperties: false properties: - description: + createdAt: + description: Timestamp when this entitlement was created + examples: + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true type: string - name: + createdBy: + $ref: "#/components/schemas/User" + description: User who created this entitlement + readOnly: true + entitlementGroups: + description: Groups associated with this entitlement + items: + $ref: "#/components/schemas/EntitlementGroupSummary" + readOnly: true + type: + - array + - "null" + entitlementName: + description: Name of the entitlement feature or service + examples: + - Premium Support + readOnly: true type: string - value: {} - required: - - name - - description - - value - type: object - securitySchemes: - bearerAuth: - bearerFormat: JWT - description: "A JWT verified by the proxy in front of this API, or a Kaiten access token (`ksh_...`) — send either as `Authorization: Bearer `. The scopes listed on each operation are the ones the token must carry; `write:` implies `read:`, and `read:*` / `write:*` are wildcards over every module. `x-kaiten-scopes` lists every scope such a token can carry, including those enforced by a service in front of this API rather than by one of its operations." - scheme: bearer - type: http - x-kaiten-scopes: - - read:components - - read:customers - - read:deployment_zones - - read:entitlements - - read:feature_flags - - read:instances - - read:licenses - - read:metadata_fields - - read:notifications - - read:organizations - - read:releases + entitlementSlug: + description: URL-friendly identifier for the entitlement + examples: + - premium-support + format: string + type: string + entitlementType: + description: Type of entitlement (BOOLEAN, NUMBER, or CONFIG) + enum: + - BOOLEAN + - NUMBER + - CONFIG + examples: + - NUMBER + readOnly: true + type: string + licenseId: + description: Unique identifier for the license this entitlement belongs to + examples: + - a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6 + readOnly: true + type: string + licenseSlug: + description: URL-friendly identifier for the license this entitlement belongs to + examples: + - enterprise-license + readOnly: true + type: string + limitCapExceededOveragePercent: + description: "Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants." + examples: + - 10 + format: int32 + type: integer + updatedAt: + description: Timestamp when this entitlement was last updated + examples: + - "2023-10-02T12:00:00Z" + format: date-time + readOnly: true + type: string + updatedBy: + $ref: "#/components/schemas/User" + description: User who last updated this entitlement + readOnly: true + value: + description: "Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}}" + discriminator: + mapping: + boolean: "#/components/schemas/BooleanEntitlementValue" + number: "#/components/schemas/NumberEntitlementValue" + object: "#/components/schemas/ConfigEntitlementValue" + propertyName: type + oneOf: + - $ref: "#/components/schemas/NumberEntitlementValue" + - $ref: "#/components/schemas/BooleanEntitlementValue" + - $ref: "#/components/schemas/ConfigEntitlementValue" + required: + - entitlementName + - licenseId + - licenseSlug + - createdBy + - createdAt + - updatedBy + - updatedAt + - value + type: object + LicenseFamilyView: + additionalProperties: false + properties: + createdAt: + description: Timestamp when this family was created + examples: + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true + type: string + currentVersion: + $ref: "#/components/schemas/License" + description: "The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns." + id: + description: Unique identifier for the license family + examples: + - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true + type: string + isPublic: + description: Whether the family's default PUBLISHED version is listed in the public catalogue. Private by default. + type: boolean + slug: + description: URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. + examples: + - enterprise-license + type: string + updatedAt: + description: Timestamp when a version was last added to this family, or when the family was created. Renames, lifecycle moves and default changes update the versions' own updatedAt, not this one. + examples: + - "2023-10-02T12:00:00Z" + format: date-time + readOnly: true + type: string + versionCount: + description: Number of versions in this family, whatever their lifecycle state + examples: + - 3 + format: int32 + type: integer + versions: + description: "Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version." + items: + $ref: "#/components/schemas/License" + type: array + required: + - id + - slug + - versionCount + - isPublic + - createdAt + - updatedAt + type: object + LicenseFamilyVisibility: + additionalProperties: false + properties: + isPublic: + description: List the family's default PUBLISHED version, with its ACTIVE prices, in the public catalogue + type: boolean + required: + - isPublic + type: object + LicensePriceChanges: + additionalProperties: false + properties: + billingPeriod: + description: See createLicensePrice. + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + description: See createLicensePrice. + enum: + - ADVANCE + - ARREARS + type: string + displayLabel: + maxLength: 200 + type: string + displayOrder: + format: int32 + minimum: 0 + type: integer + isDefault: + type: boolean + meteredEntitlementSlug: + description: See createLicensePrice. + type: string + unitAmountDecimal: + description: See createLicensePrice. + type: string + type: object + LineDifference: + additionalProperties: false + properties: + externalLineId: + type: string + kaitenAmount: + format: int64 + type: integer + lineId: + type: string + providerAmount: + format: int64 + type: integer + seq: + format: int64 + type: integer + required: + - lineId + - seq + - kaitenAmount + - providerAmount + - externalLineId + type: object + LineReportPage: + additionalProperties: false + properties: + items: + description: The reports, in reportSeq order + items: + $ref: "#/components/schemas/UsageReport" + type: array + nextAfterSeq: + description: Pass as afterSeq to read the next page. Absent on the last page. + format: int64 + type: integer + required: + - items + type: object + List: + additionalProperties: false + properties: + data: + description: The page, newest first + items: + $ref: "#/components/schemas/Notification" + type: array + nextCursor: + description: Opaque cursor for the next page; null on the last page + type: + - string + - "null" + unreadCount: + description: Unread notifications, capped (see MaxUnreadCount) + format: int64 + type: integer + required: + - data + - nextCursor + - unreadCount + type: object + ManifestEnvelope: + additionalProperties: false + properties: + flags: + items: + $ref: "#/components/schemas/ManifestFlag" + type: + - array + - "null" + required: + - flags + type: object + ManifestFlag: + additionalProperties: false + properties: + defaultValue: {} + description: + type: string + key: + type: string + name: + type: string + type: + type: string + required: + - key + - type + - defaultValue + type: object + MarkReadResult: + additionalProperties: false + properties: + unreadCount: + description: Unread notifications after the change + format: int64 + type: integer + updated: + description: Notifications newly marked read + format: int64 + type: integer + required: + - updated + - unreadCount + type: object + MetadataField: + additionalProperties: false + properties: + archivedAt: + description: Timestamp when the field was archived (soft delete). Absent if active. + format: date-time + readOnly: true + type: string + createdAt: + description: Timestamp when the field was created + examples: + - "2026-05-26T12:00:00Z" + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + description: User who created this field + readOnly: true + displayOrder: + description: Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. + examples: + - 0 + format: int32 + type: integer + id: + description: Unique identifier + examples: + - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true + type: string + jsonSchema: + additionalProperties: {} + description: "JSON Schema 2020-12 document describing the value space. Example: {\"type\":\"string\",\"enum\":[\"a\",\"b\"]}" + type: object + key: + description: Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. + examples: + - region + maxLength: 100 + minLength: 1 + type: string + label: + description: Human-readable label shown in the admin UI + examples: + - Region + maxLength: 100 + minLength: 1 + type: string + resourceType: + description: Resource type this field applies to. Immutable after creation; update must echo back the stored value. + enum: + - DEPLOYMENT_ZONE + - INSTANCE + type: string + updatedAt: + description: Timestamp when the field was last updated + examples: + - "2026-05-26T12:00:00Z" + format: date-time + readOnly: true + type: string + updatedBy: + $ref: "#/components/schemas/User" + description: User who last updated this field + readOnly: true + required: + - id + - resourceType + - key + - label + - jsonSchema + - createdBy + - createdAt + - updatedBy + - updatedAt + type: object + MetadataFieldReordered: + additionalProperties: false + properties: + ids: + description: Metadata field ids in their new display order + items: + type: string + type: + - array + - "null" + required: + - ids + type: object + MetadataFieldSchemaProposal: + additionalProperties: false + properties: + jsonSchema: + additionalProperties: {} + description: Candidate JSON Schema 2020-12 document to evaluate existing values against. + type: object + required: + - jsonSchema + type: object + Meter: + additionalProperties: false + properties: + entitlementSlug: + description: The metered entitlement + examples: + - tokens + type: string + saleUnitFactor: + description: "Measured units in one sale unit, captured when the price was created (1 when the entitlement has no sale unit): 10000 bills per 10,000 tokens." + examples: + - "10000" + type: string + saleUnitPlural: + examples: + - 10k tokens + type: string + saleUnitSingular: + examples: + - 10k tokens + type: string + required: + - entitlementSlug + - saleUnitFactor + type: object + MinimumAmount: + additionalProperties: false + properties: + currency: + examples: + - EUR + type: string + unitAmountDecimal: + description: In minor units + examples: + - "2900" + type: string + required: + - currency + - unitAmountDecimal + type: object + MismatchedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + reconciliationDetail: + $ref: "#/components/schemas/Reconciliation" + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - reconciliationDetail + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + NewAddon: + additionalProperties: false + properties: + description: + examples: + - Five more seats per unit + type: string + familyId: + description: Make this a new version of this family + type: string + familySlug: + description: Make this a new version of this family + examples: + - extra-seats + type: string + isDefault: + description: Make this version its family's default; the previous default loses it + type: boolean + lifecycleState: + default: PUBLISHED + enum: + - DRAFT + - PUBLISHED + type: string + maxQuantity: + description: The largest quantity an instance can hold + examples: + - 10 + format: int32 + type: integer + name: + examples: + - Extra seats + minLength: 1 + type: string + pricingType: + enum: + - FREE + - PAID + - CUSTOM + type: string + slug: + description: "The version's slug. Default: {familySlug}-v{n} for a new version of a family, a slug generated from the name for a new family." + examples: + - extra-seats-v1 + type: string + versionName: + description: "Default: Version - {n}" + type: string + required: + - name + - description + - pricingType + type: object + NewAddonGrant: + additionalProperties: false + properties: + entitlementSlug: + examples: + - seats + type: string + limitCapExceededOveragePercent: + description: "The overage the add-on allows: -1 with an unlimited value, 0 or more otherwise. Absent inherits the licence grant's." + format: int32 + type: integer + overrideBehavior: + default: MAX + description: How a number grant combines with the licence's + enum: + - ADD + - OVERRIDE + - MAX + type: string + value: + additionalProperties: {} + description: "{type, value}, shaped like a licence grant: a number counts once per unit of quantity" + examples: + - type: number + value: 5 + type: object + required: + - entitlementSlug + - value + type: object + NewAddonPrice: + additionalProperties: false + properties: + billingModel: + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingPeriod: + description: "Required on a FLAT_FEE price: it bills subscriptions of that period. Refused on a metered one." + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + description: Defaults to ADVANCE for a FLAT_FEE price and ARREARS for a metered one, which must be ARREARS. + enum: + - ADVANCE + - ARREARS + type: string + currency: + description: ISO 4217 code, upper case. One currency per add-on version. + examples: + - EUR + type: string + displayLabel: + maxLength: 200 + type: string + displayOrder: + format: int32 + minimum: 0 + type: integer + isDefault: + description: Makes this FLAT_FEE price the one that bills its period; the previous default of the period loses it. + type: boolean + meteredEntitlementSlug: + description: "The entitlement a metered price measures: granted by the add-on version, with a reset period, SUM or COUNT, NUMBER or NUMBER_AI_CREDIT." + examples: + - tokens + type: string + unitAmountDecimal: + description: "Amount in minor units: per unit and period for FLAT_FEE, per sale unit for metered prices." + examples: + - "900" + type: string + required: + - billingModel + - currency + - unitAmountDecimal + type: object + NewInstanceAddon: + additionalProperties: false + properties: + addonSlug: + description: The add-on version to attach + examples: + - extra-seats-v1 + type: string + quantity: + default: 1 + examples: + - 3 + format: int32 + minimum: 1 + type: integer + required: + - addonSlug + type: object + NewLicensePrice: + additionalProperties: false + properties: + billingModel: + description: "FLAT_FEE: an amount per billing period. USAGE_BASED: per sale unit of usage. OVERAGE: per sale unit of usage above the licence's limit." + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingPeriod: + description: Required on a FLAT_FEE price, refused on a metered one (CreateLicensePrice.InvalidPeriod). + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + description: Defaults to ADVANCE for a FLAT_FEE price and ARREARS for a metered one, which must be ARREARS (CreateLicensePrice.InvalidTiming). + enum: + - ADVANCE + - ARREARS + type: string + currency: + description: ISO 4217 code, upper case (CreateLicensePrice.InvalidCurrency). One currency per licence version (CreateLicensePrice.CurrencyMismatch). + examples: + - EUR + type: string + displayLabel: + description: The invoice line's label. + maxLength: 200 + type: string + displayOrder: + description: Order among the version's prices. + format: int32 + minimum: 0 + type: integer + isDefault: + description: Makes this FLAT_FEE price the default of its billing period (CreateLicensePrice.DefaultConflict when another is). + type: boolean + meteredEntitlementSlug: + description: "The entitlement a metered price measures: granted by the version, with a reset period, SUM or COUNT, NUMBER or NUMBER_AI_CREDIT, and metered by no other active price of the version." + examples: + - tokens + type: string + unitAmountDecimal: + description: "Amount in minor units: per period for FLAT_FEE, per sale unit for metered prices. A non-negative decimal of at most 12 integer digits and 12 decimal places (CreateLicensePrice.InvalidAmount)." + examples: + - "2900" + type: string + required: + - billingModel + - currency + - unitAmountDecimal + type: object + NewPaymentMethodSession: + additionalProperties: false + properties: + currency: + description: The currency the payment method is set up in; required when the customer has no live subscription, whose currency is used otherwise + examples: + - EUR + type: string + returnUrl: + description: "Where the customer comes back to: https, or http on localhost. The session id is appended as kaiten_setup_session" + examples: + - https://app.example.test/billing + type: string + required: + - returnUrl + type: object + NewPortalSession: + additionalProperties: false + properties: + returnUrl: + description: https, or http on localhost + examples: + - https://app.example.test/billing + type: string + required: + - returnUrl + type: object + NewSubscription: + additionalProperties: false + properties: + addOns: + description: "Add-ons to attach with the subscription, under the rules of POST /instances/{instanceSlug}/addons; the ACTIVATION invoice bills them. One refused refuses the subscribe: 422 SubscribeInstance.AddonInvalid, the add-on's own code in errors[0].value.code." + items: + $ref: "#/components/schemas/SubscriptionAddon" + maxItems: 50 + type: + - array + - "null" + basePriceId: + description: An ACTIVE FLAT_FEE price of the instance's licence version, which must be PUBLISHED. The subscription stays pinned to it, even once deprecated. + type: string + collectionMethod: + description: "Omitted: the organization's default, read at each invoice. CHARGE_AUTOMATICALLY needs a provider that charges automatically (SubscribeInstance.CollectionMethodUnsupported)." + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + daysUntilDue: + description: "Payment terms in days, 0 to 365. Omitted: the organization's default, read at each invoice." + format: int32 + type: integer + providerKind: + description: "Who issues and collects the invoices. NOOP (the default): the organization itself, through the handoff queue. A provider must be connected (SubscribeInstance.ProviderNotConnected); one that pushes invoices needs the customer's billing e-mail for SEND_INVOICE (.BillingEmailMissing) and the price's currency (.UnsupportedCurrency), and registers the customer first." + enum: + - NOOP + - STRIPE + type: string + startAt: + description: "The anchor periods are counted from, truncated to the second: now when omitted, else at most one billing period ago. A period that has already ended closes on the next pass." + format: date-time + type: string + trialDays: + description: "Days of trial from the anchor: nothing is billed, and no usage counts, until it ends; the period close then issues the first invoice. 0 is no trial. Omitted: the licence's trialPeriodDays, else no trial." + format: int32 + type: integer + voucherCode: + description: "A voucher to redeem with the subscription, once its add-ons are attached; a PRICE voucher applies from the ACTIVATION invoice. Refused: 422 SubscribeInstance.VoucherInvalid, the redemption's own code in errors[0].value.code." + maxLength: 64 + minLength: 1 + type: string + required: + - basePriceId + type: object + Notification: + additionalProperties: false + properties: + actionUrl: + description: Where clicking the notification goes + type: string + body: + description: Rendered detail line, when the event has one + type: string + createdAt: + description: When the event occurred + format: date-time + type: string + eventName: + description: Event this notification reports + examples: + - INSTANCE_DEPLOYED + type: string + eventType: + description: CloudEvents type of the same event -- the key it is published under in this document's webhooks section, so a client can line a notification up with the payload schema and the description already published there + examples: + - com.kaiten.instance.v1.deployed + type: string + id: + description: Identifier of the underlying audit trail entry + type: string + objectType: + description: What the notification is about -- the kind of page actionUrl opens, and what the list's objectType filter matches + examples: + - instance + type: string + readAt: + description: When this user read it; absent means unread + format: date-time + type: string + title: + description: Rendered headline + type: string + required: + - id + - eventName + - eventType + - objectType + - title + - createdAt + type: object + NumberEntitlementValue: + additionalProperties: false + properties: + event_count: + description: Number of events accumulated (server-computed) + examples: + - 2 + format: int32 + readOnly: true + type: integer + type: + description: Value type discriminator + enum: + - number + examples: + - number + type: string + value: + description: Numeric value + examples: + - 42.5 + format: double + type: number + required: + - type + - value + type: object + Outcome: + additionalProperties: false + properties: + applied: + description: Invoices read and applied + format: int64 + type: integer + error: + type: string + failed: + description: Invoices that could not be read or applied + format: int64 + type: integer + providerKind: + enum: + - NOOP + - STRIPE + type: string + status: + enum: + - SUCCESS + - PARTIAL + - FAILED + type: string + syncedAt: + format: date-time + type: string + required: + - providerKind + - status + - applied + - failed + - syncedAt + type: object + OverageLimit: + additionalProperties: false + properties: + limitValue: + description: The limit, null when unlimited + examples: + - "100000" + type: + - string + - "null" + overagePercent: + description: Usage accepted above the limit, as a percent of it + examples: + - 50 + format: int32 + type: integer + rows: + description: Usage reports measured against it; 0 for a sample + format: int64 + type: integer + required: + - limitValue + - overagePercent + - rows + type: object + PageAuditTrail: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/AuditTrail" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageComponent: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/Component" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageCustomer: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/Customer" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageDeploymentZone: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/DeploymentZone" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageEntitlement: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/Entitlement" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageEntitlementGroup: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/EntitlementGroup" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageFeatureFlag: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/FeatureFlag" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageInstance: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/Instance" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageInvoiceSummary: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/InvoiceSummary" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageLicense: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/License" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageLicenseEntitlement: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/LicenseEntitlement" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageLicenseFamilyView: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/LicenseFamilyView" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageMetadataField: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/MetadataField" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageQueuedInvoice: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/QueuedInvoice" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageRelease: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/Release" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageServiceAccount: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/ServiceAccount" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageSessionInvoice: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/SessionInvoice" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PageToken: + additionalProperties: false + properties: + hasMore: + description: Whether more rows exist beyond this page. + type: boolean + items: + items: + $ref: "#/components/schemas/Token" + type: array + nextCursor: + description: Opaque cursor for the next page. Absent when hasMore is false. + type: string + required: + - items + - hasMore + type: object + PaidInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + externalReference: + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + note: + description: The note given when it was marked paid, kept only here + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + source: + description: "MARK_PAID: recorded by the organization. ZERO_TOTAL: nothing was owed" + enum: + - MARK_PAID + - PROVIDER + - ZERO_TOTAL + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - source + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + PatchInstanceBody: + additionalProperties: false + properties: + lifecycleStage: + description: "Commercial lifecycle stage (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED). When omitted, the current stage is preserved; clearing it back to unset is not supported." + examples: + - AT_RISK + minLength: 1 + type: string + status: + description: Operational status of the instance + enum: + - HEALTHY + - DEGRADED + - INCIDENT + - MAINTENANCE + examples: + - INCIDENT + type: string + type: object + Payment: + additionalProperties: false + properties: + hostedInvoiceUrl: + type: string + status: + description: "paid. requires_action: the customer must confirm the payment on hostedInvoiceUrl. failed: the charge was refused; save another payment method, or pay on hostedInvoiceUrl. processing: the outcome is not known yet; poll GET /public/session/invoices. not_required: nothing is due today." + enum: + - paid + - requires_action + - failed + - processing + - not_required + type: string + required: + - status + type: object + PaymentFailedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + failureCode: + description: The provider's decline or failure code, such as card_declined, expired_card, authentication_required or no_payment_method + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + requiresAction: + description: The customer must authenticate the payment on the invoice's hosted page + type: boolean + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - failureCode + - requiresAction + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + PaymentMethodAttached: + additionalProperties: false + properties: + attachedAt: + format: date-time + type: string + customerSlug: + type: string + providerKind: + enum: + - STRIPE + type: string + status: + enum: + - ACTIVE + type: string + required: + - customerSlug + - providerKind + - status + - attachedAt + type: object + PaymentMethodDetached: + additionalProperties: false + properties: + customerSlug: + type: string + providerKind: + enum: + - STRIPE + type: string + required: + - customerSlug + - providerKind + type: object + PaymentMethodExpiring: + additionalProperties: false + properties: + customerSlug: + type: string + expiresAt: + description: The last instant of the payment method's expiry month + format: date-time + type: string + providerKind: + enum: + - STRIPE + type: string + required: + - customerSlug + - providerKind + - expiresAt + type: object + PaymentMethodLabels: + additionalProperties: false + properties: + attachedAt: + format: date-time + type: string + brand: + examples: + - visa + type: string + expMonth: + examples: + - 12 + format: int64 + type: integer + expYear: + examples: + - 2030 + format: int64 + type: integer + last4: + examples: + - "4242" + type: string + status: + description: "ACTIVE: charged automatically. EXPIRED, FAILED: a charge said it is no longer usable; save another one" + enum: + - ACTIVE + - EXPIRED + - FAILED + type: string + required: + - status + type: object + PaymentMethodSession: + additionalProperties: false + properties: + expiresAt: + format: date-time + type: string + sessionId: + description: Complete it with POST …/payment-method-session/{sessionId}/complete once the customer is back + type: string + url: + description: The provider's page; send the customer there + type: string + required: + - url + - sessionId + - expiresAt + type: object + PlainToken: + additionalProperties: false + properties: + createdAt: + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + readOnly: true + expiresAt: + format: date-time + type: string + id: + readOnly: true + type: string + name: + type: string + revokedAt: + format: date-time + readOnly: true + type: string + revokedBy: + $ref: "#/components/schemas/User" + readOnly: true + scopes: + items: + type: string + type: + - array + - "null" + serviceAccountId: + readOnly: true + type: string + slug: + description: Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + token: + readOnly: true + type: string + required: + - name + - scopes + - createdAt + - createdBy + type: object + PlanChange: + additionalProperties: false + properties: + fromLicenseSlug: + type: string + fromPriceId: + type: string + instanceSlug: + type: string + invoiceId: + description: The RENEWAL that billed the old plan's arrears and the new plan's advance + type: string + toLicenseSlug: + type: string + toPriceId: + type: string + required: + - instanceSlug + - fromLicenseSlug + - toLicenseSlug + - fromPriceId + - toPriceId + - invoiceId + type: object + PlanChangeSchedule: + additionalProperties: false + properties: + effectiveAt: + format: date-time + type: string + fromPriceId: + type: string + instanceSlug: + type: string + toPriceId: + type: string + required: + - instanceSlug + - fromPriceId + - toPriceId + - effectiveAt + type: object + PlanChangeTarget: + additionalProperties: false + properties: + licensePriceId: + description: An ACTIVE FLAT_FEE price of a PUBLISHED licence version, in the subscription's currency + type: string + required: + - licensePriceId + type: object + PortalSession: + additionalProperties: false + properties: + url: + type: string + required: + - url + type: object + PreferenceChoices: + additionalProperties: false + properties: + events: + description: Events to set; events left out keep their current value + items: + $ref: "#/components/schemas/PreferenceUpdate" + type: + - array + - "null" + required: + - events + type: object + PreferenceEvent: + additionalProperties: false + properties: + channels: + additionalProperties: + type: boolean + description: Effective value per channel + type: object + eventName: + examples: + - INSTANCE_DEPLOYED + type: string + eventType: + description: CloudEvents type of the same event; see Notification.eventType + examples: + - com.kaiten.instance.v1.deployed + type: string + group: + description: Catalogue group the client renders this under + examples: + - deployments + type: string + label: + description: Human-readable event name + type: string + required: + - eventName + - eventType + - label + - group + - channels + type: object + PreferenceMatrix: + additionalProperties: false + properties: + channels: + description: Channels this deployment serves, in display order + items: + type: string + type: array + events: + description: Every notifiable event + items: + $ref: "#/components/schemas/PreferenceEvent" + type: array + required: + - channels + - events + type: object + PreferenceUpdate: + additionalProperties: false + properties: + channels: + additionalProperties: + type: boolean + type: object + eventName: + type: string + required: + - eventName + - channels + type: object + Price: + additionalProperties: false + properties: + billingModel: + description: "FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit." + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingPeriod: + description: The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + description: ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. + enum: + - ADVANCE + - ARREARS + type: string + createdAt: + format: date-time + readOnly: true + type: string + currency: + description: ISO 4217 code, upper case. One currency per licence version. + examples: + - EUR + type: string + deprecatedAt: + description: When the price was deprecated + format: date-time + type: string + displayLabel: + description: The invoice line's label; a default is derived when absent. + examples: + - Pro plan + type: string + displayOrder: + description: Order among the version's prices + examples: + - 0 + format: int32 + type: integer + id: + description: Unique identifier of the price + readOnly: true + type: string + isDefault: + description: The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. + type: boolean + metered: + $ref: "#/components/schemas/Meter" + description: What a metered price measures. Absent on FLAT_FEE prices. + status: + description: A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + enum: + - ACTIVE + - DEPRECATED + type: string + unitAmount: + description: unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. + examples: + - 2900 + format: int64 + type: integer + unitAmountDecimal: + description: "Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places." + examples: + - "2900" + type: string + updatedAt: + format: date-time + readOnly: true + type: string + required: + - id + - billingModel + - billingTiming + - currency + - unitAmountDecimal + - displayOrder + - isDefault + - status + - createdAt + - updatedAt + type: object + Problem: + additionalProperties: false + properties: + code: + description: Stable, machine-readable error code. + examples: + - License.NotFound + type: string + detail: + description: A human-readable explanation specific to this occurrence of the problem. + examples: + - license not found + type: string + errorId: + description: Correlation id for the server-side log entry describing the withheld cause. + examples: + - 3f6b1a2c-7c1e-4d0b-9d5f-2b0a1c4e8d31 + type: string + errors: + description: Optional list of individual error details + items: + $ref: "#/components/schemas/ErrorDetail" + type: + - array + - "null" + instance: + description: A URI reference that identifies the specific occurrence of the problem. + examples: + - /api/licenses/enterprise + type: string + status: + description: HTTP status code + examples: + - 404 + format: int64 + type: integer + title: + description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + examples: + - Not Found + type: string + type: + default: about:blank + description: A URI reference to human-readable documentation for the error. + examples: + - https://tools.ietf.org/html/rfc7231#section-6.5.4 + format: uri + type: string + type: object + ProviderCapabilities: + additionalProperties: false + properties: + automaticCollection: + type: boolean + billingPortal: + type: boolean + paymentMethodCapture: + type: boolean + required: + - paymentMethodCapture + - billingPortal + - automaticCollection + type: object + ProviderChange: + additionalProperties: false + properties: + effectiveFrom: + description: Invoices already composed keep their provider + enum: + - next_composition + type: string + from: + enum: + - NOOP + - STRIPE + type: string + instanceSlug: + type: string + to: + enum: + - NOOP + - STRIPE + type: string + required: + - instanceSlug + - from + - to + - effectiveFrom + type: object + ProviderRecord: + additionalProperties: false + properties: + externalCustomerId: + type: string + externalInvoiceId: + type: string + hostedInvoiceUrl: + type: string + invoiceNumber: + description: The provider's invoice number + type: string + invoicePdfUrl: + type: string + lastPaymentError: + description: "Why the last automatic charge failed, as the provider coded it: authentication_required (the customer must confirm the payment on the hosted invoice page), card_declined, expired_card, no_payment_method..." + type: string + lastPushError: + description: The provider's code and message of the last failed push step + type: string + nextPushAt: + description: When the push queue tries it next; absent when it waits for a human (finalization in the provider) or is pushed + format: date-time + type: string + pushAttempts: + format: int32 + type: integer + pushedAt: + format: date-time + type: string + reconciledAt: + format: date-time + type: string + reconciliationDetail: + $ref: "#/components/schemas/Reconciliation" + description: What differs, on a MISMATCH + reconciliationStatus: + enum: + - MATCHED + - MISMATCH + type: string + status: + description: The provider's status, mirrored verbatim + enum: + - draft + - open + - paid + - uncollectible + - void + type: string + syncedAt: + format: date-time + type: string + totalExcludingTax: + description: The provider's total excluding tax, read back + format: int64 + type: integer + required: + - pushAttempts + type: object + ProviderSync: + additionalProperties: false + properties: + consecutiveFailures: + format: int32 + type: integer + lagSeconds: + description: Seconds since the last pass + format: int64 + type: integer + lastFullSweepAt: + format: date-time + type: string + lastSyncError: + type: string + lastSyncStatus: + enum: + - SUCCESS + - PARTIAL + - FAILED + type: string + lastSyncedAt: + format: date-time + type: string + providerKind: + enum: + - NOOP + - STRIPE + type: string + required: + - providerKind + - consecutiveFailures + type: object + PublicAddOn: + additionalProperties: false + properties: + addonId: + format: uuid + type: string + addonSlug: + examples: + - extra-seats-v1 + type: string + compatibleLicenseFamilies: + description: Public licence families this add-on fits + items: + type: string + type: array + description: + type: string + entitlements: + description: User-facing entitlements one unit grants + items: + $ref: "#/components/schemas/PublicAddOnEntitlement" + type: array + familySlug: + examples: + - extra-seats + type: string + maxQuantity: + description: Most units one instance may attach; null when unbounded + format: int32 + type: + - integer + - "null" + name: + type: string + prices: + items: + $ref: "#/components/schemas/PublicPrice" + type: array + pricingType: + enum: + - FREE + - PAID + - CUSTOM + type: string + required: + - familySlug + - addonSlug + - addonId + - name + - description + - pricingType + - maxQuantity + - prices + - entitlements + - compatibleLicenseFamilies + type: object + PublicAddOnEntitlement: + additionalProperties: false + properties: + limitCapExceededOveragePercent: + format: int32 + type: integer + name: + type: string + overrideBehavior: + description: "How the grant combines with the plan's: added to it, replacing it, or the larger of the two" + enum: + - ADD + - OVERRIDE + - MAX + type: string + slug: + type: string + type: + enum: + - BOOLEAN + - NUMBER + - CONFIG + type: string + value: {} + required: + - slug + - name + - type + - value + - overrideBehavior + type: object + PublicCatalog: + additionalProperties: false + properties: + addOns: + description: The default version of each public add-on family; empty when include omits addons + items: + $ref: "#/components/schemas/PublicAddOn" + type: array + capabilities: + $ref: "#/components/schemas/PublicCatalogCapabilities" + plans: + description: The default version of each public licence family, by family slug + items: + $ref: "#/components/schemas/PublicPlan" + type: array + required: + - plans + - addOns + - capabilities + type: object + PublicCatalogCapabilities: + additionalProperties: false + properties: + checkout: + description: "Whether self-serve checkout is available through the public surface. False in this release: checkout ships with customer sessions." + type: boolean + paymentMethods: + description: Whether the organization's billing provider captures payment methods + type: boolean + required: + - checkout + - paymentMethods + type: object + PublicMeter: + additionalProperties: false + properties: + entitlementSlug: + examples: + - tokens + type: string + saleUnitFactor: + description: Measured units in one sale unit + examples: + - "10000" + type: string + saleUnitPlural: + examples: + - 10k tokens + type: string + saleUnitSingular: + examples: + - 10k tokens + type: string + required: + - entitlementSlug + - saleUnitFactor + type: object + PublicPlan: + additionalProperties: false + properties: + compatibleAddonFamilies: + description: Public add-on families whose listed version fits this plan + items: + type: string + type: array + currency: + description: ISO 4217 code of the plan's prices; null when it has none + examples: + - EUR + type: + - string + - "null" + description: + type: string + entitlements: + description: User-facing entitlements the plan grants, in display order + items: + $ref: "#/components/schemas/PublicPlanEntitlement" + type: array + familySlug: + examples: + - pro + type: string + licenseId: + format: uuid + type: string + licenseSlug: + description: The version's own slug + examples: + - pro-v3 + type: string + lifecycleState: + description: "Always PUBLISHED: only the default version is listed, and a default version is published" + enum: + - PUBLISHED + type: string + name: + examples: + - Pro + type: string + prices: + description: ACTIVE prices, in display order + items: + $ref: "#/components/schemas/PublicPrice" + type: array + pricingType: + description: "CUSTOM: priced on request; render selfServeCtaUrl" + enum: + - FREE + - PAID + - CUSTOM + type: string + requiresPaymentMethod: + description: A card is captured before subscribing, even when nothing is due + type: boolean + selfServe: + description: "Whether a customer can subscribe to this plan alone: not CUSTOM, with a default ACTIVE flat-fee price, and either FREE or sold through a provider that captures payment methods. Otherwise render selfServeCtaUrl." + type: boolean + selfServeCtaUrl: + description: Where to send a customer who cannot subscribe alone ("Contact us") + type: + - string + - "null" + trialPeriodDays: + description: Length of the free trial; null when the plan has none + format: int32 + type: + - integer + - "null" + required: + - familySlug + - licenseSlug + - licenseId + - name + - description + - lifecycleState + - pricingType + - trialPeriodDays + - requiresPaymentMethod + - selfServe + - selfServeCtaUrl + - currency + - prices + - compatibleAddonFamilies + - entitlements + type: object + PublicPlanEntitlement: + additionalProperties: false + properties: + description: + type: string + displayOrder: + format: int32 + type: integer + icon: + type: string + limitCapExceededOveragePercent: + description: "How far usage may exceed a NUMBER grant before it is refused: 0 is a hard limit, -1 is unlimited; absent for other types" + format: int32 + type: integer + name: + examples: + - Seats + type: string + saleUnitFactor: + type: string + saleUnitPlural: + type: string + saleUnitSingular: + type: string + slug: + examples: + - seats + type: string + type: + enum: + - BOOLEAN + - NUMBER + - CONFIG + type: string + unitPlural: + examples: + - seats + type: string + unitSingular: + examples: + - seat + type: string + unlimited: + description: A NUMBER grant with no limit + type: boolean + value: + description: "The granted value: a boolean, a number, or a configuration object" + required: + - slug + - name + - type + - value + - unlimited + - displayOrder + type: object + PublicPrice: + additionalProperties: false + properties: + billingModel: + description: "FLAT_FEE: per billing period. USAGE_BASED: per sale unit of usage. OVERAGE: per sale unit of usage above the limit. Never sum metered prices into a headline." + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingPeriod: + description: The period a FLAT_FEE price is charged for; absent on metered prices + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + enum: + - ADVANCE + - ARREARS + type: string + currency: + examples: + - EUR + type: string + displayLabel: + examples: + - Pro plan + type: string + displayOrder: + format: int32 + type: integer + id: + format: uuid + type: string + isDefault: + description: The FLAT_FEE price shown for its billing period + type: boolean + metered: + $ref: "#/components/schemas/PublicMeter" + description: What a metered price measures; absent on FLAT_FEE prices + unitAmount: + description: The amount in minor units, when it is a whole number of them; absent otherwise (render unitAmountDecimal) + examples: + - 2900 + format: int64 + type: integer + unitAmountDecimal: + description: The amount in minor units, up to 12 decimal places + examples: + - "2900" + type: string + required: + - id + - billingModel + - billingTiming + - currency + - unitAmountDecimal + - displayOrder + - isDefault + type: object + PublicSurface: + additionalProperties: false + properties: + enabled: + type: boolean + required: + - enabled + type: object + PublishableKey: + additionalProperties: false + properties: + allowedOrigins: + description: "Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may." + examples: + - - https://www.example.com + items: + type: string + type: array + createdAt: + format: date-time + readOnly: true + type: string + id: + description: Unique identifier of the key + readOnly: true + type: string + keyHint: + description: The last four characters of the key + examples: + - x9Qa + readOnly: true + type: string + label: + description: What the key is for, to tell keys apart + examples: + - Marketing site + type: string + lastUsedAt: + description: When the key last authenticated a request, to the minute + format: date-time + readOnly: true + type: string + revokedAt: + description: When the key was revoked; absent while it is live + format: date-time + readOnly: true + type: string + updatedAt: + format: date-time + readOnly: true + type: string + required: + - id + - label + - keyHint + - allowedOrigins + - createdAt + - updatedAt + type: object + PublishableKeyCreated: + additionalProperties: false + properties: + allowedOrigins: + description: "Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may." + examples: + - - https://www.example.com + items: + type: string + type: array + createdAt: + format: date-time + readOnly: true + type: string + id: + description: Unique identifier of the key + readOnly: true + type: string + key: + description: "The key itself. Shown once: only its digest is stored." + examples: + - pk_3q2-7wEXAMPLEkeyBodyOfFortyThreeCharactersXyz + readOnly: true + type: string + keyHint: + description: The last four characters of the key + examples: + - x9Qa + readOnly: true + type: string + label: + description: What the key is for, to tell keys apart + examples: + - Marketing site + type: string + lastUsedAt: + description: When the key last authenticated a request, to the minute + format: date-time + readOnly: true + type: string + revokedAt: + description: When the key was revoked; absent while it is live + format: date-time + readOnly: true + type: string + updatedAt: + format: date-time + readOnly: true + type: string + required: + - key + - id + - label + - keyHint + - allowedOrigins + - createdAt + - updatedAt + type: object + PublishableKeyDraft: + additionalProperties: false + properties: + allowedOrigins: + description: "Browser origins allowed to send the key, as scheme://host[:port]: https, or http for localhost. Empty: no browser origin may." + examples: + - - https://www.example.com + items: + type: string + maxItems: 50 + type: array + label: + description: What the key is for + examples: + - Marketing site + maxLength: 100 + minLength: 1 + type: string + required: + - label + - allowedOrigins + type: object + PublishableKeyPatch: + additionalProperties: false + properties: + allowedOrigins: + description: Replaces the allowed browser origins. Takes effect on the next request. + items: + type: string + maxItems: 50 + type: array + label: + description: What the key is for + maxLength: 100 + minLength: 1 + type: string + type: object + PushFailedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + lastPushError: + description: The provider's code and message, never a request body + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + pushAttempts: + format: int32 + type: integer + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - pushAttempts + - lastPushError + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + PushFailures: + additionalProperties: false + properties: + count: + format: int64 + type: integer + oldestFailedAt: + format: date-time + type: string + required: + - count + type: object + PushedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + externalInvoiceId: + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerInvoiceNumber: + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - externalInvoiceId + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + QueuedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoff: + $ref: "#/components/schemas/Handoff" + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - handoff + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + ReadSelection: + additionalProperties: false + properties: + all: + description: Mark every notification read, up to now + type: boolean + ids: + description: Notifications to mark read + items: + type: string + maxItems: 200 + type: + - array + - "null" + type: object + Reconciliation: + additionalProperties: false + properties: + extraInProvider: + description: Provider lines Kaiten does not have + items: + type: string + type: array + inclusiveTax: + description: Whether the provider's subtotal was compared, its tax being included in the amounts + type: boolean + lines: + items: + $ref: "#/components/schemas/LineDifference" + type: array + missingInProvider: + description: Kaiten lines the provider does not have + items: + type: string + type: array + totals: + $ref: "#/components/schemas/TotalsDifference" + required: + - lines + - missingInProvider + - extraInProvider + - totals + - inclusiveTax + type: object + RedeemableCode: + additionalProperties: false + properties: + code: + examples: + - SUMMER-2026-LAUNCH + maxLength: 64 + minLength: 1 + type: string + required: + - code + type: object + Redemption: + additionalProperties: false + properties: + applicationsCount: + description: Invoices a PRICE voucher discounted + format: int32 + type: integer + applicationsMax: + description: 1 for ONE_TIME, durationInPeriods for REPEATING; absent for FOREVER + format: int32 + type: integer + codeHint: + type: string + effectiveExpiresAt: + description: When a boost stops applying; absent for a PRICE voucher, counted in invoices, and for FOREVER + format: date-time + type: string + effectiveStartsAt: + format: date-time + type: string + expiredAt: + format: date-time + type: string + id: + readOnly: true + type: string + instanceSlug: + type: string + redeemedAt: + format: date-time + type: string + revokedAt: + format: date-time + type: string + revokedReason: + type: string + status: + enum: + - ACTIVE + - EXPIRED + - REVOKED + type: string + voucherId: + type: string + voucherName: + type: string + voucherType: + enum: + - PRICE + - ENTITLEMENT_BOOST + type: string + required: + - id + - voucherId + - voucherName + - voucherType + - codeHint + - instanceSlug + - redeemedAt + - effectiveStartsAt + - applicationsCount + - status + type: object + RedemptionRules: + additionalProperties: false + properties: + annualOnly: + description: Only for an instance with a live ANNUAL subscription + type: boolean + firstTimeOnly: + description: Only for a customer none of whose instances has paid an invoice + type: boolean + minimumSubscriptionAmount: + $ref: "#/components/schemas/MinimumAmount" + description: Only for a live subscription whose base price is at least this + type: object + Release: + additionalProperties: false + properties: + componentIds: + description: List of component IDs to link to this release + examples: + - - 123e4567-e89b-12d3-a456-426614174000 + items: + type: string + type: + - array + - "null" + writeOnly: true + components: + description: List of components included in this release, fixed at creation + items: + $ref: "#/components/schemas/Component" + readOnly: true + type: + - array + - "null" + createdAt: + description: Timestamp when the release was created + examples: + - "2023-10-01T12:00:00Z" + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + description: User who created this release + readOnly: true + description: + description: Description of the release + examples: + - "This release fixes everything. CHANGELOG: stuff was done" + maxLength: 500 + type: string + id: + description: Unique identifier for the release + examples: + - 123e4567-e89b-12d3-a456-426614174000 + readOnly: true + type: string + slug: + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + examples: + - v1-0-0 + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + version: + description: Version of the release + examples: + - v1.0.0 + maxLength: 100 + minLength: 1 + type: string + required: + - id + - version + - createdBy + - createdAt + type: object + ReleasedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdDetail: + $ref: "#/components/schemas/HoldDetail" + description: The hold it left, which the invoice no longer shows + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + releaseReason: + type: string + releasedBy: + description: The user who released it, or system when a later check found the journal sound + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - releaseReason + - releasedBy + - holdDetail + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + ReorderMetadataFieldsInput: + additionalProperties: false + properties: + ids: + items: + type: string + type: + - array + - "null" + required: + - ids + type: object + Report: + additionalProperties: false + properties: + closed: + description: Periods closed into an invoice + format: int64 + type: integer + examined: + description: Subscriptions the batch looked at + format: int64 + type: integer + hasMore: + description: Set when due subscriptions are left beyond the batch + type: boolean + held: + description: Of those, invoices held as DRAFTs for their usage journal + format: int64 + type: integer + invoices: + items: + $ref: "#/components/schemas/ClosedInvoice" + type: array + skipped: + description: "Subscriptions left for later: held by another transaction, their meters' clock not at the boundary, or failed (logged)" + format: int64 + type: integer + required: + - examined + - closed + - held + - skipped + - hasMore + - invoices + type: object + ReportEntitlementUsageBody: + additionalProperties: false + properties: + behavior: + description: "Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it" + enum: + - append + - set + type: string + metadata: + additionalProperties: {} + description: "Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings." + type: object + transactionId: + description: "Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key." + examples: + - llm-call-9f2c:tokens + type: string + value: + description: Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + discriminator: + mapping: + boolean: "#/components/schemas/BooleanEntitlementValue" + number: "#/components/schemas/NumberEntitlementValue" + object: "#/components/schemas/ConfigEntitlementValue" + propertyName: type + oneOf: + - $ref: "#/components/schemas/NumberEntitlementValue" + - $ref: "#/components/schemas/BooleanEntitlementValue" + - $ref: "#/components/schemas/ConfigEntitlementValue" + required: + - value + type: object + RevocationReason: + additionalProperties: false + properties: + reason: + examples: + - Granted by mistake + maxLength: 500 + type: string + required: + - reason + type: object + RolloutDate: + additionalProperties: false + properties: + end: + $ref: "#/components/schemas/RolloutStep" + start: + $ref: "#/components/schemas/RolloutStep" + type: + enum: + - rollout_date + type: string + required: + - type + - start + - end + type: object + RolloutDateTargeting: + additionalProperties: false + properties: + end: + $ref: "#/components/schemas/RolloutStep" + examples: + - date: "2024-01-31T23:59:59Z" + percentage: 100 + variant: variant_a + name: + examples: + - Targeting Rule 1 + type: string + rule: + description: CEL expression for basicTargeting evaluation + examples: + - user.group == 'beta' + maxLength: 10000 + type: string + start: + $ref: "#/components/schemas/RolloutStep" + examples: + - date: "2024-01-01T00:00:00Z" + percentage: 0 + variant: variant_a + type: + enum: + - rollout_date + type: string + required: + - type + - name + - rule + - start + - end + type: object + RolloutPercentage: + additionalProperties: false + properties: + distribution: + additionalProperties: + format: int64 + type: integer + type: object + type: + enum: + - rollout_percentage + type: string + required: + - type + - distribution + type: object + RolloutPercentageTargeting: + additionalProperties: false + properties: + distribution: + additionalProperties: + format: int64 + type: integer + examples: + - variant_a: 70 + variant_b: 30 + type: object + name: + examples: + - Targeting Rule 1234 + type: string + rule: + description: CEL expression for basicTargeting evaluation + examples: + - user.group == 'beta' + maxLength: 10000 + type: string + type: + enum: + - rollout_percentage + type: string + required: + - type + - name + - rule + - distribution + type: object + RolloutStep: + additionalProperties: false + properties: + date: + examples: + - "2024-01-15T10:00:00Z" + format: date-time + type: string + percentage: + examples: + - 50 + format: int64 + type: integer + variant: + examples: + - variant_b + type: string + required: + - variant + - percentage + - date + type: object + SampleUsageAmount: + additionalProperties: false + properties: + entitlementSlug: + description: An entitlement an ACTIVE price of the version meters + examples: + - tokens + type: string + quantity: + description: "Usage in the entitlement's measured units, a non-negative decimal string. Rated as one reset window against the version's grant: usage above limit × (1 + overage percent / 100) would be rejected, so it is capped, and the line says capped." + examples: + - "130500" + type: string + required: + - entitlementSlug + - quantity + type: object + ScheduledChange: + additionalProperties: false + properties: + effectiveAt: + description: "The boundary it applies at: the current period's end" + format: date-time + type: string + price: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription moves to + scheduledAt: + format: date-time + type: string + required: + - price + - scheduledAt + - effectiveAt + type: object + ServiceAccount: + additionalProperties: false + properties: + createdAt: + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + readOnly: true + externalId: + readOnly: true + type: string + id: + readOnly: true + type: string + name: + minLength: 1 + type: string + slug: + description: Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + tokens: + items: + $ref: "#/components/schemas/Token" + readOnly: true + type: + - array + - "null" + required: + - name + - tokens + type: object + SessionCheckout: + additionalProperties: false + properties: + activationInvoice: + $ref: "#/components/schemas/SessionInvoice" + description: "subscribed: the invoice of the first period; absent during a trial" + dueToday: + $ref: "#/components/schemas/DueToday" + description: "preview: what the checkout bills today; zero, with no lines, during a trial" + expiresAt: + description: "requires_payment_method: when the setup page expires" + format: date-time + type: string + payment: + $ref: "#/components/schemas/Payment" + description: "subscribed: how paying the activation invoice went" + setupSessionId: + description: "requires_payment_method: send it back as setupSessionId once the customer returns" + type: string + setupUrl: + description: "requires_payment_method: the provider's page where the customer saves a payment method" + type: string + status: + enum: + - preview + - requires_payment_method + - subscribed + type: string + subscription: + $ref: "#/components/schemas/SessionSubscription" + description: "subscribed: the subscription started" + trialEndsAt: + description: "preview: when the trial would end, if there is one" + format: date-time + type: string + required: + - status + type: object + SessionCheckoutOrder: + additionalProperties: false + properties: + addOns: + description: Public add-ons that fit the plan + items: + $ref: "#/components/schemas/SubscriptionAddon" + maxItems: 50 + type: + - array + - "null" + billingEmail: + description: Where invoices go. Required when the customer has none; stored on the customer when given. + maxLength: 254 + type: string + dryRun: + description: Answer what the checkout would bill today, and change nothing + type: boolean + licensePriceId: + description: An ACTIVE flat-fee price of a plan in the public catalogue. The instance is moved to that price's version when it is on another one. + type: string + returnUrl: + description: Where the setup page sends the customer back, with kaiten_setup_session appended. Required when a payment method has to be captured. Its origin must be one the organization's publishable keys allow. + format: uri + type: string + setupSessionId: + description: "The setupSessionId a requires_payment_method answer gave, once the customer is back from the setup page: the payment method saved there is checked with the provider and used." + type: string + trial: + description: "false skips the plan's trial. Omitted: the plan's trial, if it has one." + type: boolean + voucherCode: + description: Validated and redeemed in the checkout; any refusal answers .VoucherInvalid + maxLength: 64 + minLength: 1 + type: string + required: + - licensePriceId + type: object + SessionInvoice: + additionalProperties: false + properties: + currency: + examples: + - EUR + type: string + discountTotal: + description: Minor units + format: int64 + type: integer + dueAt: + format: date-time + type: + - string + - "null" + externalReference: + description: The vendor's own number for an invoice it collects itself + type: + - string + - "null" + hostedInvoiceUrl: + description: Where the customer pays the invoice, or confirms a payment that needs authenticating + type: + - string + - "null" + id: + format: uuid + type: string + invoicePdfUrl: + type: + - string + - "null" + issuedAt: + format: date-time + type: + - string + - "null" + kind: + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + lines: + items: + $ref: "#/components/schemas/SessionLine" + type: array + paidAt: + format: date-time + type: + - string + - "null" + providerInvoiceNumber: + type: + - string + - "null" + serviceFrom: + format: date-time + type: string + serviceTo: + format: date-time + type: string + status: + description: "PUSHED: issued and awaiting payment. PAYMENT_FAILED: a charge failed; pay on hostedInvoiceUrl. MANUAL: issued, the vendor collects it." + enum: + - MANUAL + - PUSHED + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Minor units + format: int64 + type: integer + total: + description: Minor units + format: int64 + type: integer + required: + - id + - kind + - status + - currency + - subtotal + - discountTotal + - total + - issuedAt + - dueAt + - paidAt + - serviceFrom + - serviceTo + - providerInvoiceNumber + - externalReference + - hostedInvoiceUrl + - invoicePdfUrl + - lines + type: object + SessionLine: + additionalProperties: false + properties: + amount: + description: Minor units; negative on a DISCOUNT line + format: int64 + type: integer + description: + type: string + label: + type: string + quantity: + description: In sale units, a decimal string + type: string + seq: + format: int64 + type: integer + serviceFrom: + format: date-time + type: string + serviceTo: + format: date-time + type: string + type: + enum: + - BASE + - ADDON + - USAGE + - OVERAGE + - DISCOUNT + type: string + unitAmountDecimal: + description: Minor units; empty on a DISCOUNT line + type: string + required: + - seq + - type + - label + - description + - quantity + - unitAmountDecimal + - amount + - serviceFrom + - serviceTo + type: object + SessionSubscription: + additionalProperties: false + properties: + basePrice: + $ref: "#/components/schemas/PublicPrice" + billingPeriod: + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + cancelAtPeriodEnd: + type: boolean + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + currency: + examples: + - EUR + type: string + currentPeriodEnd: + description: "When the current period ends: the renewal date, or the trial's end" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + providerKind: + enum: + - NOOP + - STRIPE + type: string + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + trialEndsAt: + format: date-time + type: + - string + - "null" + required: + - status + - providerKind + - collectionMethod + - currency + - billingPeriod + - basePrice + - currentPeriodStart + - currentPeriodEnd + - trialEndsAt + - cancelAtPeriodEnd + type: object + StartedSubscription: + additionalProperties: false + properties: + activationInvoice: + $ref: "#/components/schemas/InvoiceSummary" + description: "The invoice of the first period, when the base price bills in advance; absent otherwise. Charged automatically, it is pushed and charged before this answer when the provider answers within 20 seconds: its status says how it went." + anchorAt: + description: The instant its periods are counted from + format: date-time + type: string + basePrice: + $ref: "#/components/schemas/Price" + description: The FLAT_FEE price the subscription is pinned to, deprecated or not + billingPeriod: + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + cancelAtPeriodEnd: + type: boolean + cancelRequestedAt: + format: date-time + type: string + canceledAt: + format: date-time + type: string + cancellationReason: + type: string + collectionMethod: + description: "Effective: the subscription's own, else the organization's default" + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + collectionMethodOverride: + description: The subscription's own collection method; absent when it takes the organization's + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + currentPeriodEnd: + description: "The next boundary: the period closes, and its invoice is composed, after it" + format: date-time + type: string + currentPeriodStart: + format: date-time + type: string + customerName: + type: string + customerSlug: + type: string + daysUntilDue: + description: "Effective: the subscription's own, else the organization's default" + format: int32 + type: integer + daysUntilDueOverride: + description: The subscription's own payment terms; absent when it takes the organization's + format: int32 + type: integer + id: + type: string + instanceName: + type: string + instanceSlug: + description: As it was at the subscription's last write + type: string + pastDueSince: + format: date-time + type: string + providerKind: + description: "Who collects its invoices. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + scheduledChange: + $ref: "#/components/schemas/ScheduledChange" + description: A plan change waiting for the next boundary + startedAt: + description: "When billing started: usage before it is never billed" + format: date-time + type: string + status: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + trialEndsAt: + description: "When the trial ends, or ended: usage before it is never billed" + format: date-time + type: string + updatedAt: + format: date-time + type: string + required: + - id + - instanceSlug + - instanceName + - customerSlug + - customerName + - status + - providerKind + - collectionMethod + - daysUntilDue + - basePrice + - billingPeriod + - currency + - anchorAt + - startedAt + - currentPeriodStart + - currentPeriodEnd + - cancelAtPeriodEnd + - createdAt + - updatedAt + type: object + StatusChange: + additionalProperties: false + properties: + from: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + instanceBillingId: + type: string + instanceSlug: + type: string + reason: + enum: + - TRIAL_ENDED + - INVOICE_OVERDUE + - PAYMENT_FAILED + - SETTLED + type: string + to: + enum: + - TRIAL + - ACTIVE + - PAST_DUE + - CANCELED + type: string + required: + - instanceBillingId + - instanceSlug + - from + - to + - reason + type: object + SubscriptionAddon: + additionalProperties: false + properties: + addonSlug: + description: The add-on version to attach + examples: + - extra-seats-v1 + type: string + quantity: + default: 1 + examples: + - 3 + format: int32 + minimum: 1 + type: integer + required: + - addonSlug + type: object + SubscriptionCancellation: + additionalProperties: false + properties: + mode: + description: "AT_PERIOD_END (the default): the period paid for runs out, then the FINAL invoice is issued. IMMEDIATE: the FINAL invoice is issued now, flat fees billed in full and nothing refunded." + enum: + - AT_PERIOD_END + - IMMEDIATE + type: string + reason: + description: Up to 500 characters + type: string + type: object + SubscriptionTerms: + additionalProperties: false + properties: + collectionMethod: + description: "null: the organization's default. CHARGE_AUTOMATICALLY needs a provider that charges automatically (UpdateInstanceBilling.CollectionMethodUnsupported)." + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: + - string + - "null" + daysUntilDue: + description: "0 to 365; null: the organization's default" + format: int32 + type: + - integer + - "null" + providerKind: + description: "Who issues and collects the invoices, from the next one on. NOOP: the organization itself, through the handoff queue. A provider must be connected (UpdateInstanceBilling.ProviderNotConnected); one that pushes invoices needs the customer's billing e-mail for SEND_INVOICE (.BillingEmailMissing) and the subscription's currency (.UnsupportedCurrency)." + enum: + - NOOP + - STRIPE + type: string + type: object + SyncFailure: + additionalProperties: false + properties: + consecutiveFailures: + format: int32 + type: integer + lastSyncError: + type: string + lastSyncedAt: + format: date-time + type: string + providerKind: + type: string + required: + - providerKind + - consecutiveFailures + - lastSyncError + - lastSyncedAt + type: object + SyncReport: + additionalProperties: false + properties: + providers: + items: + $ref: "#/components/schemas/Outcome" + type: array + required: + - providers + type: object + SystemTokenIssuance: + additionalProperties: false + properties: + credentialKind: + description: Credential class that performed the mint; "platform" is the system:kaiten identity + examples: + - platform + type: string + expiresAt: + description: Absent when the minted credential does not expire + format: date-time + type: string + issuedAt: + description: When the credential was minted + format: date-time + type: string + issuedTokenId: + description: The credential that was minted + type: string + name: + description: Human-readable label the caller gave the minted credential + examples: + - ci-deploy + type: string + platformTokenId: + description: Platform credential that performed the mint; revoking it revokes everything it issued + type: string + scopes: + description: Scopes granted to the minted credential + examples: + - - read:customers + items: + type: string + type: + - array + - "null" + slug: + description: Server-assigned identifier of the minted credential + examples: + - system-kaiten-9f2c1a + type: string + required: + - credentialKind + - platformTokenId + - issuedTokenId + - name + - slug + - scopes + - issuedAt + type: object + TargetingContext: + additionalProperties: false + properties: + roots: + description: "Identifiers the server guarantees, and what is reachable below each. Not a closed set: a host may target on its own attributes too" + items: + $ref: "#/components/schemas/TargetingContextNode" + type: array + required: + - roots + type: object + TargetingContextNode: + additionalProperties: false + properties: + description: + description: What this value means, shown by the editor + type: string + fields: + description: Named children, for an object + items: + $ref: "#/components/schemas/TargetingContextNode" + type: array + knownKeys: + description: Keys this map currently has, for completion. Not a closed set + items: + type: string + type: array + name: + description: Name as it is written in a rule + type: string + optional: + description: Whether this value may be absent, in which case has() is worth using + type: boolean + type: + description: Shape of this node's value + enum: + - string + - number + - boolean + - object + - map + - dyn + type: string + values: + $ref: "#/components/schemas/TargetingContextNode" + description: Shape shared by every entry, for a map + required: + - name + - type + type: object + TargetingRuleDraft: + additionalProperties: false + properties: + rule: + description: The CEL targeting rule to check. May be blank, which is itself a mistake this reports + examples: + - __kaiten.license.familySlug == 'scale' + maxLength: 10000 + type: string + required: + - rule + type: object + TargetingRuleIssue: + additionalProperties: false + properties: + column: + description: 1-based column the problem starts on, or 0 when it has no position + format: int64 + type: integer + endColumn: + description: 1-based column just past the problem, or 0 when only a point is known + format: int64 + type: integer + endLine: + description: 1-based line the problem ends on, or 0 when only a point is known + format: int64 + type: integer + line: + description: 1-based line the problem starts on, or 0 when it has no position + format: int64 + type: integer + message: + description: What is wrong, in the same words the write path refuses it with + type: string + required: + - message + - line + - column + type: object + TargetingRuleRehearsal: + additionalProperties: false + properties: + evaluationError: + description: Why the engine could not answer, when it could not — e.g. the rule reads a host attribute this context does not carry. At a real evaluation the rule would simply not match + type: string + facts: + additionalProperties: {} + description: The __kaiten namespace as enriched for this context — what a rule actually reads. Empty sub-roots mean the context resolved nothing for them + type: object + issues: + description: Problems the lint found. The rule is only run when there are none + items: + $ref: "#/components/schemas/TargetingRuleIssue" + type: array + matched: + description: Whether the rule matched this context. Meaningful only when valid and evaluationError is empty + type: boolean + valid: + description: Whether the rule lints clean + type: boolean + required: + - facts + - issues + - valid + - matched + type: object + TargetingRuleTrial: + additionalProperties: false + properties: + context: + additionalProperties: {} + description: The evaluation context to rehearse against, as a client would send it. Anything under __kaiten is discarded, exactly as at a real evaluation + type: object + rule: + description: The CEL targeting rule to rehearse + examples: + - __kaiten.license.familySlug == 'scale' + maxLength: 10000 + type: string + targetingKey: + description: The key the evaluation would be bucketed on. Resolves license and entitlement facts when it names a customer slug + type: string + required: + - rule + type: object + TargetingRuleVerdict: + additionalProperties: false + properties: + issues: + description: Every problem found, positioned where it is written. Empty when the rule is accepted + items: + $ref: "#/components/schemas/TargetingRuleIssue" + type: array + valid: + description: Whether the write path would accept this rule + type: boolean + required: + - issues + - valid + type: object + Targetings: + description: Polymorphic list of targeting rules (Basic, RolloutDate, RolloutPercentage) + items: + anyOf: + - $ref: "#/components/schemas/BasicTargeting" + - $ref: "#/components/schemas/RolloutDateTargeting" + - $ref: "#/components/schemas/RolloutPercentageTargeting" + type: + - array + - "null" + Token: + additionalProperties: false + properties: + createdAt: + format: date-time + readOnly: true + type: string + createdBy: + $ref: "#/components/schemas/User" + readOnly: true + expiresAt: + format: date-time + type: string + id: + readOnly: true + type: string + name: + type: string + revokedAt: + format: date-time + readOnly: true + type: string + revokedBy: + $ref: "#/components/schemas/User" + readOnly: true + scopes: + items: + type: string + type: + - array + - "null" + serviceAccountId: + readOnly: true + type: string + slug: + description: Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + maxLength: 100 + minLength: 2 + pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$ + type: string + required: + - name + - scopes + - createdAt + - createdBy + type: object + TotalsDifference: + additionalProperties: false + properties: + kaitenTotal: + format: int64 + type: integer + providerSubtotal: + format: int64 + type: integer + providerTotalExcludingTax: + format: int64 + type: integer + required: + - kaitenTotal + - providerTotalExcludingTax + type: object + UncollectibleInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + reason: + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + required: + - reason + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + UpdatedEvent: + additionalProperties: false + properties: + billingModel: + description: "FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit." + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE + type: string + billingPeriod: + description: The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. + enum: + - MONTHLY + - QUARTERLY + - SEMI_ANNUAL + - ANNUAL + type: string + billingTiming: + description: ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. + enum: + - ADVANCE + - ARREARS + type: string + changedFields: + description: The members the update changed, as the API names them + items: + type: string + type: + - array + - "null" + createdAt: + format: date-time + readOnly: true + type: string + currency: + description: ISO 4217 code, upper case. One currency per licence version. + examples: + - EUR + type: string + deprecatedAt: + description: When the price was deprecated + format: date-time + type: string + displayLabel: + description: The invoice line's label; a default is derived when absent. + examples: + - Pro plan + type: string + displayOrder: + description: Order among the version's prices + examples: + - 0 + format: int32 + type: integer + familySlug: + description: The family of that version + type: string + id: + description: Unique identifier of the price + readOnly: true + type: string + isDefault: + description: The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. + type: boolean + licenseSlug: + description: The licence version the price belongs to + type: string + metered: + $ref: "#/components/schemas/Meter" + description: What a metered price measures. Absent on FLAT_FEE prices. + status: + description: A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + enum: + - ACTIVE + - DEPRECATED + type: string + unitAmount: + description: unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. + examples: + - 2900 + format: int64 + type: integer + unitAmountDecimal: + description: "Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places." + examples: + - "2900" + type: string + updatedAt: + format: date-time + readOnly: true + type: string + required: + - changedFields + - licenseSlug + - familySlug + - id + - billingModel + - billingTiming + - currency + - unitAmountDecimal + - displayOrder + - isDefault + - status + - createdAt + - updatedAt + type: object + UsageReport: + additionalProperties: false + properties: + aggregationMethod: + description: The entitlement's aggregation method when the report was accepted + examples: + - SUM + type: string + behavior: + description: append adds the value through the aggregation method; set overwrites the counter + enum: + - append + - set + type: string + delta: + description: valueAfter minus valueBefore; negative for a set that lowered the counter + examples: + - "600" + type: string + entitlementId: + description: The entitlement the report was made for. It may since have been deleted. + format: uuid + type: string + eventCountAfter: + description: Reports counted in the window after this one + examples: + - 1 + format: int32 + type: integer + instanceId: + description: The instance the report was made for. It may since have been deleted. + format: uuid + type: string + licenseId: + description: The instance's licence when the report was accepted + format: uuid + type: string + limitValue: + description: The limit in force when the report was accepted. Null when unlimited. + examples: + - "1000" + type: string + overageDelta: + description: "How much the usage above limitValue moved: max(0, valueAfter - limitValue) - max(0, valueBefore - limitValue). 0 when unlimited." + examples: + - "0" + type: string + overagePercent: + description: The overage allowed above limitValue, in percent, when the report was accepted. Null when unlimited. + examples: + - 50 + format: int32 + type: integer + properties: + additionalProperties: {} + description: The report's metadata, when it was stored + type: object + reportSeq: + description: Position of the report among the pair's accepted reports, from 1, without gaps + examples: + - 42 + format: int64 + type: integer + reportedAt: + description: When the server accepted the report (UTC, millisecond precision) + examples: + - "2026-10-05T08:00:00.000Z" + format: date-time + type: string + reportedValue: + description: "The value as sent: a delta for append, an absolute value for set" + examples: + - "600" + type: string + transactionId: + description: The report's idempotency key, when it was sent with one + examples: + - llm-call-9f2c:tokens + type: string + valueAfter: + description: The counter after the report + examples: + - "600" + type: string + valueBefore: + description: The counter before the report, after any window reset + examples: + - "0" + type: string + windowEnd: + description: End of the usage window the report counted in (exclusive). Null for a lifetime entitlement. + format: date-time + type: string + windowStart: + description: Start of the usage window the report counted in (inclusive). Null for a lifetime entitlement. + format: date-time + type: string + required: + - instanceId + - entitlementId + - reportSeq + - reportedAt + - behavior + - aggregationMethod + - reportedValue + - valueBefore + - valueAfter + - delta + - overageDelta + - eventCountAfter + - licenseId + type: object + UsageReportPage: + additionalProperties: false + properties: + items: + description: The reports, in reportSeq order + items: + $ref: "#/components/schemas/UsageReport" + type: array + nextAfterSeq: + description: Pass as afterSeq to read the next page. Absent on the last page. + examples: + - 100 + format: int64 + type: integer + required: + - items + type: object + User: + additionalProperties: false + properties: + id: + description: ID of the user + examples: + - 123e4567-e89b-12d3-a456-426614174000 + type: string + name: + description: Name of the user + examples: + - John Doe + type: string + required: + - id + type: object + Validity: + additionalProperties: false + properties: + reason: + description: The first failing check + enum: + - NOT_FOUND + - NOT_ACTIVE + - NOT_YET_VALID + - EXPIRED + - EXHAUSTED + - ALREADY_REDEEMED + - NOT_ELIGIBLE + - CURRENCY_MISMATCH + type: string + rule: + description: "With NOT_ELIGIBLE: the eligibility rule" + enum: + - RESTRICTED_CUSTOMER + - LICENSE_NOT_APPLICABLE + - ADDON_NOT_APPLICABLE + - FIRST_TIME_ONLY + - ANNUAL_ONLY + - MINIMUM_SUBSCRIPTION_AMOUNT + - NOTHING_TO_BOOST + type: string + valid: + type: boolean + voucher: + $ref: "#/components/schemas/Voucher" + description: The voucher, without its code, when the code names one + required: + - valid + type: object + Variant: + additionalProperties: false + properties: + description: + type: string + name: + type: string + value: {} + required: + - name + - description + - value + type: object + VoidedInvoice: + additionalProperties: false + properties: + boundaryAt: + description: The boundary the invoice bills. With the kind, it identifies the invoice within its subscription + format: date-time + type: string + collectionMethod: + enum: + - SEND_INVOICE + - CHARGE_AUTOMATICALLY + type: string + createdAt: + format: date-time + type: string + currency: + examples: + - EUR + type: string + customerName: + type: string + customerSlug: + description: As it was when the invoice was composed + type: string + daysUntilDue: + format: int32 + type: integer + discountTotal: + description: Sum of the discounts, in minor units + format: int64 + type: integer + dueAt: + description: issuedAt + daysUntilDue + format: date-time + type: string + handoffStatus: + description: "PENDING: waiting in the handoff queue for the organization's accounting system" + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + holdReason: + description: "Why a DRAFT is held: the usage journal it was measured from failed a consistency check" + enum: + - LEDGER_SEQUENCE_GAP + - LEDGER_CHAIN_BREAK + - LEDGER_COUNTER_MISMATCH + type: string + id: + description: "The invoice's identifier: the key an accounting system deduplicates on" + type: string + instanceName: + type: string + instanceSlug: + type: string + issuedAt: + format: date-time + type: string + kind: + description: ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + licenseSlug: + type: string + paidAt: + format: date-time + type: string + providerKind: + description: "Who collects it. NOOP: the organization itself, through the handoff queue" + enum: + - NOOP + - STRIPE + type: string + serviceFrom: + description: Earliest start of its lines' service periods + format: date-time + type: string + serviceTo: + description: Latest end of its lines' service periods + format: date-time + type: string + status: + description: "MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose" + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + subtotal: + description: Sum of the lines, in minor units + format: int64 + type: integer + total: + description: subtotal − discountTotal, in minor units + format: int64 + type: integer + updatedAt: + format: date-time + type: string + voidReason: + type: string + required: + - voidReason + - id + - kind + - boundaryAt + - serviceFrom + - serviceTo + - status + - providerKind + - collectionMethod + - currency + - subtotal + - discountTotal + - total + - customerSlug + - customerName + - instanceSlug + - instanceName + - licenseSlug + - handoffStatus + - createdAt + - updatedAt + type: object + Voucher: + additionalProperties: false + properties: + applicableAddonIds: + description: Only instances holding one of these add-on versions can redeem it; any when empty + items: + type: string + type: array + applicableAddonPriceIds: + items: + type: string + type: array + applicableLicenseIds: + description: Only instances on these licence versions can redeem it; any when empty + items: + type: string + type: array + applicableLicensePriceIds: + items: + type: string + type: array + code: + description: The code to redeem. Returned to read:vouchers callers only; never in an event. + examples: + - SUMMER-2026-LAUNCH + type: string + codeHint: + description: The last four characters of the normalized code + examples: + - UNCH + type: string + createdAt: + format: date-time + readOnly: true + type: string + currency: + description: The currency of a FIXED_AMOUNT discount + examples: + - EUR + type: string + description: + type: string + duration: + description: "PRICE: how many invoices it discounts (one, durationInPeriods, or every one). BOOST: how long a redemption lasts, in the subscription's billing periods." + enum: + - ONE_TIME + - REPEATING + - FOREVER + type: string + durationInPeriods: + format: int32 + type: integer + expiresAt: + format: date-time + type: string + grants: + description: What an ENTITLEMENT_BOOST changes + items: + $ref: "#/components/schemas/Grant" + type: array + id: + readOnly: true + type: string + maxRedemptions: + format: int32 + type: integer + name: + examples: + - Summer launch + type: string + priceAppliesTo: + enum: + - LICENSE_BASE + - ADDONS + - BOTH + - SELECTED_PRICES + type: string + priceDiscountType: + enum: + - PERCENTAGE + - FIXED_AMOUNT + type: string + priceDiscountValue: + description: A percentage in (0, 100], or an integer amount in minor units of currency + examples: + - "30" + type: string + redemptionRules: + $ref: "#/components/schemas/RedemptionRules" + redemptionsCount: + format: int32 + type: integer + restrictedCustomerSlug: + description: Only this customer's instances can redeem it + type: string + startsAt: + format: date-time + type: string + status: + enum: + - DRAFT + - ACTIVE + - EXPIRED + - EXHAUSTED + - ARCHIVED + type: string + updatedAt: + format: date-time + readOnly: true + type: string + voucherType: + enum: + - PRICE + - ENTITLEMENT_BOOST + type: string + required: + - id + - codeHint + - name + - voucherType + - status + - duration + - redemptionsCount + - applicableLicensePriceIds + - applicableAddonPriceIds + - grants + - applicableLicenseIds + - applicableAddonIds + - redemptionRules + - createdAt + - updatedAt + type: object + VoucherCheck: + additionalProperties: false + properties: + code: + examples: + - SUMMER-2026-LAUNCH + maxLength: 64 + minLength: 1 + type: string + instanceSlug: + description: Also run the checks that need the redeeming instance + type: string + required: + - code + type: object + VoucherCode: + additionalProperties: false + properties: + code: + examples: + - SUMMER-2026-LAUNCH + maxLength: 64 + minLength: 1 + type: string + required: + - code + type: object + VoucherDraft: + additionalProperties: false + properties: + applicableAddonIds: + items: + type: string + type: + - array + - "null" + applicableAddonPriceIds: + description: "With SELECTED_PRICES: the add-on prices it discounts" + items: + type: string + type: + - array + - "null" + applicableLicenseIds: + items: + type: string + type: + - array + - "null" + applicableLicensePriceIds: + description: "With SELECTED_PRICES: the licence prices it discounts" + items: + type: string + type: + - array + - "null" + code: + description: "8 to 64 of [A-Za-z0-9_-]. Generated when absent: 16 characters, 80 random bits. Matched without case or separators." + examples: + - SUMMER-2026-LAUNCH + type: string + currency: + description: Required with FIXED_AMOUNT, refused otherwise + examples: + - EUR + type: string + description: + maxLength: 2000 + type: string + duration: + enum: + - ONE_TIME + - REPEATING + - FOREVER + type: string + durationInPeriods: + description: Required with REPEATING, refused otherwise + format: int32 + type: integer + expiresAt: + format: date-time + type: string + grants: + description: Required on an ENTITLEMENT_BOOST, refused on a PRICE voucher + items: + $ref: "#/components/schemas/Grant" + type: + - array + - "null" + maxRedemptions: + format: int32 + minimum: 1 + type: integer + name: + examples: + - Summer launch + maxLength: 200 + minLength: 1 + type: string + priceAppliesTo: + enum: + - LICENSE_BASE + - ADDONS + - BOTH + - SELECTED_PRICES + type: string + priceDiscountType: + enum: + - PERCENTAGE + - FIXED_AMOUNT + type: string + priceDiscountValue: + description: A percentage in (0, 100], or an integer amount in minor units + examples: + - "30" + type: string + redemptionRules: + $ref: "#/components/schemas/RedemptionRules" + restrictedCustomerSlug: + type: string + startsAt: + format: date-time + type: string + voucherType: + enum: + - PRICE + - ENTITLEMENT_BOOST + type: string + required: + - name + - voucherType + - duration + type: object + securitySchemes: + bearerAuth: + bearerFormat: JWT + description: "A JWT verified by the proxy in front of this API, or a Kaiten access token (`ksh_...`) — send either as `Authorization: Bearer `. The scopes listed on each operation are the ones the token must carry; `write:` implies `read:`, and `read:*` / `write:*` are wildcards over every module. `x-kaiten-scopes` lists every scope such a token can carry, including those enforced by a service in front of this API rather than by one of its operations." + scheme: bearer + type: http + x-kaiten-scopes: + - read:addons + - read:billing + - read:components + - read:customer_sessions + - read:customers + - read:deployment_zones + - read:entitlements + - read:feature_flags + - read:instances + - read:licenses + - read:metadata_fields + - read:notifications + - read:organizations + - read:publishable_keys + - read:releases - read:tokens + - read:voucher_redemptions + - read:vouchers - read:webhooks + - write:addons + - write:billing - write:components + - write:customer_sessions - write:customers - write:deployment_zones - write:entitlements @@ -3343,9 +10034,22 @@ components: - write:metadata_fields - write:notifications - write:organizations + - write:publishable_keys - write:releases - write:tokens + - write:voucher_redemptions + - write:vouchers - write:webhooks + customerSession: + bearerFormat: kst_ + description: "A customer session (`kst_...`), minted by the vendor's backend with POST /customer-sessions and sent as `Authorization: Bearer kst_...`. It acts for one customer -- and one of its instances, when bound -- on the /public/session routes and nowhere else. A browser request must come from an origin one of the organization's publishable keys allows." + scheme: bearer + type: http + publishableKey: + description: "A Kaiten publishable key (`pk_...`). Not a secret: it ships in web pages, and authorizes reading the organization's public catalogue and nothing else. A browser request must come from one of the key's allowed origins. Never send it as `Authorization`; a request carrying `Authorization` is refused." + in: header + name: X-Kaiten-Publishable-Key + type: apiKey info: contact: email: support@kaiten.sh @@ -3355,34 +10059,8030 @@ info: version: 1.0.0 openapi: 3.1.0 paths: + /addon-families: + get: + description: Every add-on family of the organization with its versions, newest family first. Requires billing to be enabled for the organization. + operationId: listAddonFamilies + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/AddonFamily" + type: array + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: List add-on families + tags: + - addons + /addon-families/{familySlug}: + get: + description: One add-on family with its versions and its current version. Requires billing to be enabled for the organization. + operationId: getAddonFamily + parameters: + - description: Add-on family slug + in: path + name: familySlug + required: true + schema: + description: Add-on family slug + examples: + - extra-seats + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/AddonFamily" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: Get an add-on family + tags: + - addons + patch: + description: Lists the family in the public catalogue, or takes it out. Families are private until made public. Emits ADDON_UPDATED on each of its versions. Requires billing to be enabled for the organization. + operationId: updateAddonFamily + parameters: + - description: Add-on family slug + in: path + name: familySlug + required: true + schema: + description: Add-on family slug + examples: + - extra-seats + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AddonFamilyVisibility" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/AddonFamily" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Update an add-on family + tags: + - addons + /addons: + get: + description: The organization's add-on versions, newest first. Requires billing to be enabled for the organization. + operationId: listAddons + parameters: + - description: Only versions in this state + explode: false + in: query + name: lifecycleState + schema: + description: Only versions in this state + enum: + - DRAFT + - PUBLISHED + - ARCHIVED + type: string + - description: Only versions of this family + explode: false + in: query + name: familySlug + schema: + description: Only versions of this family + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Addon" + type: array + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: List add-on versions + tags: + - addons + post: + description: "Creates an add-on version: the first of a new family, or the next version of the family familySlug (or familyId) names. Emits ADDON_CREATED. Requires billing to be enabled for the organization." + operationId: createAddon + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewAddon" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Addon" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Create an add-on version + tags: + - addons + /addons/{addonSlug}: + delete: + description: Deletes a version that was never attached and grants nothing (409 DeleteAddon.InUseConflict otherwise); its family goes with its last version. Emits ADDON_DELETED. Requires billing to be enabled for the organization. + operationId: deleteAddon + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Delete an add-on version + tags: + - addons + get: + description: One add-on version. Requires billing to be enabled for the organization. + operationId: getAddon + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Addon" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: Get an add-on version + tags: + - addons + put: + description: Replaces a version's name, description, version name, default flag and maximum quantity. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + operationId: updateAddon + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AddonChanges" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Addon" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Update an add-on version + tags: + - addons + /addons/{addonSlug}/archive: + post: + description: "Withdraws a PUBLISHED version from sale: instances holding it keep it, none can attach it again (409 ArchiveAddon.NotPublished otherwise). Emits ADDON_ARCHIVED. Requires billing to be enabled for the organization." + operationId: archiveAddon + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Addon" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Archive an add-on version + tags: + - addons + /addons/{addonSlug}/compatible-license-families: + get: + description: "The licence families an instance must be on to attach this add-on version. None: it cannot be attached. Requires billing to be enabled for the organization." + operationId: listAddonCompatibility + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CompatibleLicenseFamilies" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: List the licence families an add-on fits + tags: + - addons + /addons/{addonSlug}/compatible-license-families/{familySlug}: + delete: + description: Instances already holding the add-on keep it; no new attachment from the family. Idempotent. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + operationId: removeAddonCompatibility + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: License family slug + in: path + name: familySlug + required: true + schema: + description: License family slug + examples: + - pro + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Stop an add-on fitting a licence family + tags: + - addons + put: + description: Lets instances on any version of the licence family attach this add-on version. Idempotent. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + operationId: setAddonCompatibility + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: License family slug + in: path + name: familySlug + required: true + schema: + description: License family slug + examples: + - pro + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Make an add-on fit a licence family + tags: + - addons + /addons/{addonSlug}/entitlements: + get: + description: What one add-on version grants per unit of quantity. Requires billing to be enabled for the organization. + operationId: listAddonEntitlements + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/AddonEntitlement" + type: array + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: List an add-on version's grants + tags: + - addons + post: + description: Grants an entitlement per unit of an add-on version. Refused while an instance with a live subscription holds the version (409 AssignAddonEntitlement.BillingActive). Emits ADDON_ENTITLEMENT_ASSIGNED. Requires billing to be enabled for the organization. + operationId: assignAddonEntitlement + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewAddonGrant" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/AddonEntitlement" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Grant an entitlement through an add-on + tags: + - addons + /addons/{addonSlug}/entitlements/{entitlementSlug}: + delete: + description: Removes a grant. Refused while an instance with a live subscription holds the version (409 UnassignAddonEntitlement.BillingActive) and while an ACTIVE price of the version meters it (409 UnassignAddonEntitlement.MeteredByPrice). Emits ADDON_ENTITLEMENT_UNASSIGNED. Requires billing to be enabled for the organization. + operationId: unassignAddonEntitlement + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - seats + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Remove an add-on grant + tags: + - addons + get: + description: One grant of an add-on version. Requires billing to be enabled for the organization. + operationId: getAddonEntitlement + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - seats + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/AddonEntitlement" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: Get an add-on grant + tags: + - addons + put: + description: Replaces a grant's value, override behaviour and overage. Refused while an instance with a live subscription holds the version (409 UpdateAddonEntitlement.BillingActive). Emits ADDON_ENTITLEMENT_UPDATED. Requires billing to be enabled for the organization. + operationId: updateAddonEntitlement + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - seats + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AddonGrant" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/AddonEntitlement" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Update an add-on grant + tags: + - addons + /addons/{addonSlug}/prices: + get: + description: The prices of one add-on version, in display order. Requires billing to be enabled for the organization. + operationId: listAddonPrices + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: Only prices in this status; both when omitted + explode: false + in: query + name: status + schema: + description: Only prices in this status; both when omitted + enum: + - ACTIVE + - DEPRECATED + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Price" + type: array + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:addons + summary: List an add-on version's prices + tags: + - addons + post: + description: "Adds a price to an add-on version, under the rules of a licence price. A price cannot change once created: create another and deprecate this one. Refused while an instance with a live subscription holds the version (409 CreateAddonPrice.BillingActive). Emits ADDON_PRICE_CREATED. Requires billing to be enabled for the organization." + operationId: createAddonPrice + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewAddonPrice" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Price" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Create an add-on price + tags: + - addons + /addons/{addonSlug}/prices/{priceId}/deprecate: + post: + description: "Stops offering a price. A default price cannot be deprecated (409 DeprecateAddonPrice.IsDefault): it is what bills every instance holding the version; retire it through a new version. Emits ADDON_PRICE_DEPRECATED. Requires billing to be enabled for the organization." + operationId: deprecateAddonPrice + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + - description: Price id + in: path + name: priceId + required: true + schema: + description: Price id + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Price" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Deprecate an add-on price + tags: + - addons + /addons/{addonSlug}/publish: + post: + description: Puts a DRAFT version on sale (409 PublishAddon.NotADraft otherwise). Emits ADDON_PUBLISHED. Requires billing to be enabled for the organization. + operationId: publishAddon + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Addon" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Publish an add-on version + tags: + - addons + /addons/{addonSlug}/unarchive: + post: + description: Puts an ARCHIVED version back on sale (409 UnarchiveAddon.NotArchived otherwise). Emits ADDON_UNARCHIVED. Requires billing to be enabled for the organization. + operationId: unarchiveAddon + parameters: + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Addon" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:addons + summary: Unarchive an add-on version + tags: + - addons + /billing/capabilities: + get: + description: Whether billing is enabled for the organization, and if not why; who can collect its invoices; and which parts of billing this release ships, so a client shows only what works. Answers even when billing is disabled. + operationId: getBillingCapabilities + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/BillingCapabilities" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: Get billing capabilities + tags: + - billing + /billing/close-periods: + post: + description: "Closes the subscriptions whose period has ended now, rather than at the period-close job's next pass: each one's RENEWAL invoice is composed and issued (or held, when its usage journal fails a check) and its period advances. A subscription several periods behind closes one period at a time until it is current. Only what is due closes, at most the configured batch size per call. Requires billing to be enabled for the organization." + operationId: closeBillingPeriods + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ClosePeriodsScope" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Report" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Close due billing periods + tags: + - billing + /billing/handoff: + get: + description: "The invoices waiting for the organization's accounting system (PENDING), or already acknowledged by it, oldest issue first. Reading never leases: claim to take invoices. Requires billing to be enabled for the organization." + operationId: listHandoff + parameters: + - description: PENDING (the default) or ACKNOWLEDGED + explode: false + in: query + name: status + schema: + description: PENDING (the default) or ACKNOWLEDGED + enum: + - PENDING + - ACKNOWLEDGED + type: string + - description: Opaque cursor from the previous page's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque cursor from the previous page's nextCursor + type: string + - description: Page size, 50 by default, 200 at most + explode: false + in: query + name: limit + schema: + description: Page size, 50 by default, 200 at most + format: int32 + maximum: 200 + minimum: 0 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageQueuedInvoice" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: List the handoff queue + tags: + - billing + /billing/handoff/claim: + post: + description: "Leases the oldest invoices waiting for the organization's accounting system, under one lease. Two consumers claiming at once get different invoices. An invoice not acknowledged before its lease expires is claimed again: the queue delivers at least once, so a consumer deduplicates on the invoice id. A claim is not idempotent: a lost response leaves its invoices leased until leasedUntil. Requires billing to be enabled for the organization." + operationId: claimHandoff + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/HandoffClaimSize" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HandoffClaim" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Claim invoices from the handoff queue + tags: + - billing + /billing/handoff/{invoiceId}/ack: + post: + description: "Records that the organization's accounting system booked an invoice from the handoff queue. Safe to repeat: the same acknowledgement again, or one that adds a reference the invoice did not have, answers 200. Another reference than the one it was acknowledged under is refused (AckHandoff.ReferenceMismatch), which a consumer can take as already handed off. Requires billing to be enabled for the organization." + operationId: ackHandoff + parameters: + - description: Invoice identifier + in: path + name: invoiceId + required: true + schema: + description: Invoice identifier + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/HandoffBooking" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Invoice" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Acknowledge a handed-off invoice + tags: + - billing + /billing/health: + get: + description: "What the organization's billing needs attention for, computed when read: periods waiting for their close, held invoices, invoices a payment provider keeps refusing, reconciliation mismatches, each provider's sync, overdue invoices and the handoff backlog. Requires billing to be enabled for the organization." + operationId: getBillingHealth + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/BillingHealth" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: Get the billing health + tags: + - billing + /billing/settings: + get: + description: "The organization's billing defaults: the collection method and payment terms a subscription gets when it names none of its own. An organization that never wrote them has the defaults (SEND_INVOICE, 30 days)." + operationId: getBillingSettings + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/BillingSettings" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: Get billing settings + tags: + - billing + put: + description: Replaces the organization's billing defaults. A subscription that names its own terms keeps them; the others take these at their next invoice. + operationId: updateBillingSettings + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/BillingSettings" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/BillingSettings" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Update billing settings + tags: + - billing + /billing/sync: + post: + description: "Runs one sync pass now for each payment provider the organization has connected: payments, voids and finalizations done in the provider are mirrored, as the periodic pass does. Refused when none is connected (409 SyncProvider.NotConnected). Requires billing to be enabled for the organization." + operationId: syncBillingProvider + responses: + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/SyncReport" + description: Accepted + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Sync with the payment providers now + tags: + - billing /components: get: - description: Returns a cursor-paginated page of components for the current organization. - operationId: list-components + description: Returns a cursor-paginated page of components for the current organization. + operationId: list-components + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageComponent" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:components + summary: List components + tags: + - components + post: + description: Create a new standalone component. Optionally derive it from a previous component version. + operationId: create-component + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Component" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Component" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:components + summary: Create a new component + tags: + - components + /components/{componentSlug}: + delete: + description: Delete a component by slug if it is not linked to any release. + operationId: delete-component + parameters: + - description: Component slug + in: path + name: componentSlug + required: true + schema: + description: Component slug + examples: + - api-gateway-v1-2-3 + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:components + summary: Delete a component + tags: + - components + get: + description: Returns a single component by its slug. + operationId: get-component + parameters: + - description: Component slug + in: path + name: componentSlug + required: true + schema: + description: Component slug + examples: + - api-gateway-v1-2-3 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Component" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:components + summary: Get a component by slug + tags: + - components + put: + description: Update a component in place when unlinked, or create a new version when it is already linked to releases. + operationId: update-component + parameters: + - description: Component slug + in: path + name: componentSlug + required: true + schema: + description: Component slug + examples: + - api-gateway-v1-2-3 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Component" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Component" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:components + summary: Update a component + tags: + - components + /connectors: + get: + description: Returns every registered connector with its version and settings schema, ordered by name. The registry is platform-wide rather than per-organization and holds one row per connector, so the response is not paginated. + operationId: list-connectors + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Connector" + type: + - array + - "null" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:organizations + summary: List registered connectors + tags: + - connectors + /connectors/{connectorName}: + get: + description: Retrieves a registered connector resource including version and settings schema + operationId: get-connector + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Connector" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:organizations + summary: Get connector registration + tags: + - connectors + /connectors/{connectorName}/activation: + delete: + description: "Deactivates a connector for the authenticated organization. Idempotent, and never refused for an unregistered or unlicensed connector: an organization must always be able to stop using something." + operationId: deactivate-connector + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:organizations + summary: Deactivate connector + tags: + - connectors + put: + description: "Activates a registered connector for the authenticated organization. Idempotent: activating an already-active connector succeeds without changing when it was first activated. Refused when the organization's licence does not include the connector." + operationId: activate-connector + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectorActivation" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:organizations + summary: Activate connector + tags: + - connectors + /connectors/{connectorName}/settings: + delete: + description: Delete connector settings for the authenticated organization + operationId: delete-connector-settings + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:organizations + summary: Delete connector settings + tags: + - connectors + get: + description: Get settings for a connector scoped to the authenticated organization. Write-only fields (flagged `writeOnly` in the connector settings schema) are returned redacted as `***`. + operationId: get-connector-settings + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectorSettings" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:organizations + summary: Get connector settings + tags: + - connectors + put: + description: Create or update connector settings for the authenticated organization. Write-only fields (flagged `writeOnly` in the connector settings schema) may be omitted or sent as `***` to keep the stored value; they are returned redacted. + operationId: update-connector-settings + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectorSettings" + description: Connector settings payload to upsert + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectorSettings" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:organizations + summary: Upsert connector settings + tags: + - connectors + /connectors/{connectorName}/settings/schema: + get: + description: Get the JSON schema used to validate connector settings payloads + operationId: get-connector-settings-schema + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectorSettingsSchema" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:organizations + summary: Get connector settings schema + tags: + - connectors + /connectors/{connectorName}/state: + get: + description: "Returns whether the connector is registered in this deployment, whether the authenticated organization's licence includes it, and whether the organization has activated it. Answers 200 with `available: false` for a connector this deployment does not have." + operationId: get-connector-state + parameters: + - description: Stable connector name + in: path + name: connectorName + required: true + schema: + description: Stable connector name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectorState" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:organizations + summary: Get connector state for this organization + tags: + - connectors + /customer-sessions: + post: + description: "Mints a kst_ session for one of the organization's customers, optionally bound to one of its instances, for that customer's browser to call the /api/public/session routes: checkout, invoices. Call it from your backend, where the customer is signed in, and hand the token to the page; mint a new one before it expires. What the session writes is attributed to the caller. Limited to 50 sessions a second per organization." + operationId: createCustomerSession + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerSessionDraft" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/CreatedCustomerSession" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "429": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Too Many Requests + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customer_sessions + summary: Create a customer session + tags: + - customer-sessions + /customer-sessions/{sessionId}/revoke: + post: + description: "The session stops authenticating on the next request: on sign-out, or when the customer's access changes. Idempotent." + operationId: revokeCustomerSession + parameters: + - description: Customer session id + in: path + name: sessionId + required: true + schema: + description: Customer session id + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customer_sessions + summary: Revoke a customer session + tags: + - customer-sessions + /customers: + get: + description: Returns a cursor-paginated page of customers for the current organization. + operationId: list-customers + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageCustomer" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:customers + summary: List customers + tags: + - customers + post: + description: Create a new customer with the provided details. + operationId: create-customer + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Customer" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Customer" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:customers + summary: Create a new customer + tags: + - customers + /customers/{customerSlug}: + delete: + description: Delete a customer by their slug. + operationId: delete-customer + parameters: + - in: path + name: customerSlug + required: true + schema: + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customers + summary: Delete a customer + tags: + - customers + get: + description: Returns a single customer by their slug. + operationId: get-customer + parameters: + - in: path + name: customerSlug + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Customer" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:customers + summary: Get a customer by slug + tags: + - customers + put: + description: Update a customer's details. Slug and integrations are not renameable/settable through this endpoint -- omit them, or send the values already on record. + operationId: update-customer + parameters: + - in: path + name: customerSlug + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Customer" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customers + summary: Update a customer + tags: + - customers + /customers/{customerSlug}/billing: + get: + description: "The customer's billing e-mail and its side in each payment provider: its id there and the labels of its default payment method (never card data). 404 GetCustomerBilling.CustomerNotFound. Requires billing to be enabled for the organization." + operationId: getCustomerBilling + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerBilling" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: Get a customer's billing + tags: + - billing + /customers/{customerSlug}/billing/payment-method: + delete: + description: Removes the customer's payment method from the payment provider. 409 .InUseByAutomaticCollection while a live subscription of the customer is charged automatically, .NoPaymentMethod; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + operationId: detachPaymentMethod + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Detach a customer's payment method + tags: + - billing + /customers/{customerSlug}/billing/payment-method-session: + post: + description: Ensures the customer in the payment provider, then opens the provider's hosted page where the customer saves a payment method; Kaiten never sees card data. When the customer comes back to returnUrl, complete the session server-side. 404 .CustomerNotFound; 422 .ProviderNotConnected, .InvalidReturnUrl, .CurrencyRequired; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + operationId: createPaymentMethodSession + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewPaymentMethodSession" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PaymentMethodSession" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Open a page saving a customer's payment method + tags: + - billing + /customers/{customerSlug}/billing/payment-method-session/{sessionId}/complete: + post: + description: Checks the setup session with the payment provider (the redirect is never trusted) and makes the payment method saved there the one the customer's invoices are charged to. Idempotent. 404 .SessionNotFound (unknown, or another customer's); 409 .SessionNotComplete; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + operationId: completePaymentMethodSession + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + type: string + - description: The setup session id the customer came back with + in: path + name: sessionId + required: true + schema: + description: The setup session id the customer came back with + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CompletedPaymentMethodSession" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Complete a payment-method session + tags: + - billing + /customers/{customerSlug}/billing/portal-session: + post: + description: Opens the payment provider's hosted portal for the customer, where it manages payment methods and invoices; changes reach Kaiten through sync. 422 .ProviderNotConnected, .CustomerNotOnProvider, .InvalidReturnUrl; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + operationId: createPortalSession + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewPortalSession" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PortalSession" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Open a customer's billing portal + tags: + - billing + /customers/{customerSlug}/integrations/{integrationName}: + delete: + description: Delete a single integration for a customer + operationId: delete-customer-integration + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + examples: + - acme-corp + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customers + summary: Delete a customer integration + tags: + - customers + get: + description: Retrieve a single integration for a customer + operationId: get-customer-integration + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + examples: + - acme-corp + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerIntegration" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:customers + summary: Get a customer integration + tags: + - customers + post: + description: Create a single integration for a customer + operationId: create-customer-integration + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + examples: + - acme-corp + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerIntegration" + description: Integration payload + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerIntegration" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customers + summary: Create a customer integration + tags: + - customers + put: + description: Update a single integration for a customer + operationId: update-customer-integration + parameters: + - description: Customer slug + in: path + name: customerSlug + required: true + schema: + description: Customer slug + examples: + - acme-corp + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerIntegration" + description: Integration payload + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerIntegration" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:customers + summary: Update a customer integration + tags: + - customers + /deployment-zones: + get: + description: Returns a cursor-paginated page of deployment zones for the current organization. A deployment zone is one place a customer runs a release -- a target they name and classify themselves, holding the release currently on it. It is not an installation of Kaiten; that sense of the term belongs to operations and is not reachable through this API. + operationId: list-deployment-zones + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageDeploymentZone" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:deployment_zones + summary: List deployment zones + tags: + - deploymentZones + post: + description: Create a new deployment zone with the provided details. Supplying releaseId records the zone's first deployment. A deployment zone is one place a customer runs a release -- a target they name and classify themselves, holding the release currently on it. It is not an installation of Kaiten; that sense of the term belongs to operations and is not reachable through this API. + operationId: create-deployment-zone + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/DeploymentZone" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/DeploymentZone" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:deployment_zones + summary: Create a new deployment zone + tags: + - deploymentZones + /deployment-zones/{deploymentZoneSlug}: + delete: + description: Delete a deployment zone by their slug. + operationId: delete-deployment-zone + parameters: + - in: path + name: deploymentZoneSlug + required: true + schema: + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:deployment_zones + summary: Delete a deployment zone + tags: + - deploymentZones + get: + description: Returns a single deployment zone by their slug. + operationId: get-deployment-zone-by-slug + parameters: + - in: path + name: deploymentZoneSlug + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/DeploymentZone" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:deployment_zones + summary: Get a deployment zone by slug + tags: + - deploymentZones + put: + description: "Update a deployment zone's details. Changing releaseId records a deployment: the zone's current release becomes the new one and the change is appended to its deployment history, including when the new release is one the zone already ran (a rollback). Omitting releaseId, or echoing back the current one, leaves the history untouched." + operationId: update-deploymentZone + parameters: + - in: path + name: deploymentZoneSlug + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/DeploymentZone" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:deployment_zones + summary: Update a deployment zone + tags: + - deploymentZones + /entitlement-groups: + get: + description: Returns a cursor-paginated page of entitlement groups for the current organization. + operationId: list-entitlement-groups + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageEntitlementGroup" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:entitlements + summary: List all entitlement groups + tags: + - entitlement-groups + post: + description: Create a new entitlement group to aggregate entitlements + operationId: create-entitlement-group + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/EntitlementGroup" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/EntitlementGroup" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:entitlements + summary: Create a new entitlement group + tags: + - entitlement-groups + /entitlement-groups/{entitlementGroupSlug}: + delete: + description: Delete an entitlement group by its slug. This does not delete the member entitlements. + operationId: delete-entitlement-group + parameters: + - in: path + name: entitlementGroupSlug + required: true + schema: + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:entitlements + summary: Delete an entitlement group + tags: + - entitlement-groups + get: + description: Retrieve details of a specific entitlement group by its slug + operationId: get-entitlement-group + parameters: + - in: path + name: entitlementGroupSlug + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/EntitlementGroup" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:entitlements + summary: Get entitlement group by slug + tags: + - entitlement-groups + put: + description: Update an existing entitlement group with the provided details + operationId: update-entitlement-group + parameters: + - in: path + name: entitlementGroupSlug + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/EntitlementGroup" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:entitlements + summary: Update an entitlement group + tags: + - entitlement-groups + /entitlement-groups/{entitlementGroupSlug}/entitlements: + post: + description: Add an existing entitlement as a member of an entitlement group + operationId: add-entitlement-to-group + parameters: + - in: path + name: entitlementGroupSlug + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Command" + required: true + responses: + "201": + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:entitlements + summary: Add an entitlement to a group + tags: + - entitlement-groups + /entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}: + delete: + description: Remove an entitlement from an entitlement group. The entitlement itself is not deleted. + operationId: remove-entitlement-from-group + parameters: + - in: path + name: entitlementGroupSlug + required: true + schema: + type: string + - in: path + name: entitlementSlug + required: true + schema: + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:entitlements + summary: Remove an entitlement from a group + tags: + - entitlement-groups + /entitlement-groups/{entitlementGroupSlug}/usage: + get: + description: Retrieve the aggregated usage metrics of all member entitlements for a given instance + operationId: get-entitlement-group-usage + parameters: + - in: path + name: entitlementGroupSlug + required: true + schema: + type: string + - description: Instance slug to get usage for + explode: false + in: query + name: instance + required: true + schema: + description: Instance slug to get usage for + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/EntitlementGroupUsage" + type: + - array + - "null" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:entitlements + summary: Get aggregated usage for an entitlement group + tags: + - entitlement-groups + /entitlements: + get: + description: Returns a cursor-paginated page of entitlements for the current organization. + operationId: list-entitlements + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageEntitlement" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:entitlements + summary: List all entitlements + tags: + - entitlements + post: + description: Create a new entitlement with the provided details + operationId: create-entitlement + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Entitlement" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Entitlement" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:entitlements + summary: Create a new entitlement + tags: + - entitlements + /entitlements/{entitlementSlug}: + delete: + description: Delete an entitlement by its slug + operationId: delete-entitlement + parameters: + - in: path + name: entitlementSlug + required: true + schema: + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:entitlements + summary: Delete an entitlement + tags: + - entitlements + get: + description: Retrieve details of a specific entitlement by its slug + operationId: get-entitlement + parameters: + - in: path + name: entitlementSlug + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Entitlement" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:entitlements + summary: Get entitlement by slug + tags: + - entitlements + put: + description: Update an existing entitlement with the provided details + operationId: update-entitlement + parameters: + - in: path + name: entitlementSlug + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Entitlement" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:entitlements + summary: Update an entitlement + tags: + - entitlements + /feature-flags: + get: + description: Returns a cursor-paginated page of feature flags for the given organization. + operationId: get-feature-flags + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageFeatureFlag" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:feature_flags + summary: Get a list of feature flags + tags: + - featureflags + post: + description: Create a new featureflag with the provided details + operationId: create-feature-flag + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FeatureFlag" + description: Feature flag details + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/FeatureFlag" + description: Created feature flag + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:feature_flags + summary: Create a new featureflag + tags: + - featureflags + /feature-flags/targeting/context: + get: + description: "Returns the identifiers a targeting rule may read, with their types and descriptions, including the organization's own entitlement slugs. Intended for an editor: it is what autocomplete and hover documentation are built from. The set is not closed — a rule may also target on attributes the caller supplies in its own evaluation context." + operationId: get-targeting-context + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/TargetingContext" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:feature_flags + summary: Get the targeting context schema + tags: + - featureflags + /feature-flags/targeting/lint: + post: + description: "Runs the same check create and update run before accepting a targeting rule, and reports what it found without writing anything. A rule that references a fact or an entitlement that does not exist does not fail loudly at evaluation — it simply never matches — so this is what lets an editor say so while the rule is being written. A rejected rule is a 200 carrying `valid: false`, not a client error." + operationId: lint-targeting-rule + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/TargetingRuleDraft" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/TargetingRuleVerdict" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:feature_flags + summary: Check a targeting rule + tags: + - featureflags + /feature-flags/targeting/test: + post: + description: "Runs a rule the way an evaluation would, without a flag and without writing anything: the context is enriched from the same sources (license, entitlements, instance, customer, deployment zone), anything the caller forged under __kaiten is discarded the same way, and the same engine answers. The response carries the enriched facts so an author can see exactly what the rule read — which is usually the answer to why it did or did not match. Nothing is metered or audited: this is authoring, not serving." + operationId: test-targeting-rule + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/TargetingRuleTrial" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/TargetingRuleRehearsal" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:feature_flags + summary: Rehearse a targeting rule against a context + tags: + - featureflags + /feature-flags/{featureFlagSlug}: + delete: + description: Delete a featureflag with the provided details + operationId: delete-feature-flag + parameters: + - in: path + name: featureFlagSlug + required: true + schema: + type: string + responses: + "204": + description: No Content + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:feature_flags + summary: Delete a featureflag + tags: + - featureflags + get: + description: Get a feature flag with the provided slug + operationId: get-feature-flag + parameters: + - in: path + name: featureFlagSlug + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FeatureFlag" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:feature_flags + summary: Get a feature flag by slug + tags: + - featureflags + put: + description: Update a featureflag with the provided details + operationId: update-feature-flag + parameters: + - in: path + name: featureFlagSlug + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FeatureFlag" + description: Feature flag details + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:feature_flags + summary: Update a featureflag + tags: + - featureflags + /instances: + get: + description: Returns a cursor-paginated page of instances for the current organization. + operationId: getInstances + parameters: + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageInstance" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: List all instances + tags: + - instances + post: + description: Create a new instance with the provided details + operationId: createInstance + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Instance" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Instance" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:instances + summary: Create a new instance + tags: + - instances + /instances/{instanceSlug}: + delete: + description: Delete an instance with the provided slug + operationId: deleteInstance + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:instances + summary: Delete an instance + tags: + - instances + get: + description: Retrieve an instance by their unique slug + operationId: getInstance + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Instance" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: Get an instance by slug + tags: + - instances + patch: + description: Partially update an instance. Currently supports the operational status and the commercial lifecycle stage. + operationId: patchInstance + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PatchInstanceBody" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:instances + summary: Patch an instance + tags: + - instances + put: + description: Update an instance with the provided details + operationId: updateInstance + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Instance" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:instances + summary: Update an instance + tags: + - instances + /instances/{instanceSlug}/addons: + get: + description: The add-ons an instance holds, in attachment order, each with the prices its subscription bills. Requires billing to be enabled for the organization. + operationId: listInstanceAddons + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + - description: Also list the add-ons removed from the instance + explode: false + in: query + name: includeRemoved + schema: + description: Also list the add-ons removed from the instance + type: boolean + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/InstanceAddon" + type: array + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:instances + summary: List an instance's add-ons + tags: + - instances + post: + description: "Gives an instance an add-on version and a quantity. The entitlements apply at once; a subscription bills the quantity held at each boundary, without proration. One version per family: moving to another version is detach then attach. Emits INSTANCE_ADDON_ADDED. Requires billing to be enabled for the organization." + operationId: attachInstanceAddon + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewInstanceAddon" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceAddon" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:instances + summary: Attach an add-on to an instance + tags: + - instances + /instances/{instanceSlug}/addons/{addonSlug}: + delete: + description: Removes an add-on from an instance. The entitlements drop at once; nothing is refunded. The attachment stays readable with includeRemoved. Emits INSTANCE_ADDON_REMOVED. Requires billing to be enabled for the organization. + operationId: detachInstanceAddon + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:instances + summary: Remove an add-on from an instance + tags: + - instances + patch: + description: Changes how many units of an add-on an instance holds. The entitlements follow at once; the next invoice bills the new quantity. Emits INSTANCE_ADDON_QUANTITY_CHANGED. Requires billing to be enabled for the organization. + operationId: setInstanceAddonQuantity + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + - description: Add-on version slug + in: path + name: addonSlug + required: true + schema: + description: Add-on version slug + examples: + - extra-seats-v1 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AddonQuantity" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceAddon" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:instances + summary: Change an instance add-on's quantity + tags: + - instances + /instances/{instanceSlug}/audit-trails: + get: + description: "Returns audit trail events for a given instance, optionally filtered by event name and time range. Results are cursor-paginated (default limit: 50, max: 200) — pass the previous response's nextCursor as the cursor parameter to fetch the next page." + operationId: getAuditTrails + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) + explode: false + in: query + name: event_name + schema: + description: Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) + type: string + - description: RFC3339 timestamp — include entries with timestamp ≥ this value + explode: false + in: query + name: after + schema: + description: RFC3339 timestamp — include entries with timestamp ≥ this value + type: string + - description: RFC3339 timestamp — include entries with timestamp ≤ this value + explode: false + in: query + name: before + schema: + description: RFC3339 timestamp — include entries with timestamp ≤ this value + type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque pagination cursor from a previous response's nextCursor + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageAuditTrail" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: List audit trail entries for an instance + tags: + - instances + /instances/{instanceSlug}/billing: + get: + description: The instance's subscription, live or CANCELED; 404 when it was never subscribed. Requires billing to be enabled for the organization. + operationId: getInstanceBilling + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceBilling" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: Get an instance's subscription + tags: + - billing + patch: + description: Changes the subscription's payment provider, collection method and payment terms from its next invoice on; null restores the organization's default. Invoices already composed keep their own, and keep routing to the provider that issued them. Moving to a provider that pushes invoices registers the customer with it first (503 UpdateInstanceBilling.ProviderUnavailable when it cannot be reached). A provider change emits INSTANCE_BILLING_PROVIDER_CHANGED. Requires billing to be enabled for the organization. + operationId: updateInstanceBilling + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SubscriptionTerms" + application/octet-stream: + schema: + contentMediaType: application/octet-stream + format: binary + type: string + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceBilling" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Change a subscription's terms or provider + tags: + - billing + post: + description: Starts billing an instance on a FLAT_FEE price of its licence version. A base price that bills in advance issues the first period's invoice (ACTIVATION) at once; charged automatically, it is pushed and charged before the answer when the provider answers within 20 seconds. Each period then closes into a RENEWAL. Add-ons and a voucher can be started with it, in the same transaction. A CANCELED subscription is subscribed again. While the subscription is live the instance's customer and licence cannot change. Requires billing to be enabled for the organization. + operationId: subscribeInstance + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewSubscription" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/StartedSubscription" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Subscribe an instance + tags: + - billing + /instances/{instanceSlug}/billing/cancel: + post: + description: "Cancels an instance's subscription: a trial at once with no invoice; otherwise at the period's end (repeating it changes nothing), or immediately with a FINAL invoice. Cancellation changes billing only: entitlements and licence dates stay the vendor's to change. Requires billing to be enabled for the organization." + operationId: cancelSubscription + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SubscriptionCancellation" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CanceledSubscription" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Cancel a subscription + tags: + - billing + /instances/{instanceSlug}/billing/reactivate: + post: + description: Reverts a cancellation scheduled for the period end, before it. A canceled subscription is subscribed again instead. Requires billing to be enabled for the organization. + operationId: reactivateSubscription + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceBilling" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Reactivate a subscription + tags: + - billing + /instances/{instanceSlug}/billing/scheduled-change: + delete: + description: Drops the plan change scheduled for the next boundary. Requires billing to be enabled for the organization. + operationId: cancelPlanChange + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceBilling" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Cancel a scheduled plan change + tags: + - billing + put: + description: Schedules a move to another FLAT_FEE price, of any PUBLISHED licence version in the subscription's currency, for the next boundary. That boundary's RENEWAL bills the old plan's arrears and the new plan's advance, and moves the instance to the new version; there is no proration. Scheduling another target replaces the change, the same one changes nothing. A scheduled target's price cannot be deprecated, nor its version archived. Requires billing to be enabled for the organization. + operationId: schedulePlanChange + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PlanChangeTarget" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceBilling" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:billing + summary: Schedule a plan change + tags: + - billing + /instances/{instanceSlug}/billing/upcoming-invoice: + get: + description: "The invoice the subscription's next boundary will issue, composed from its usage so far, without writing anything: lines carry the period they will bill, quantities what was measured until now. wouldHold lists the meters whose usage journal fails a check and would hold the invoice. Requires billing to be enabled for the organization." + operationId: getUpcomingInvoice + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InvoicePreview" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:billing + summary: Preview an instance's upcoming invoice + tags: + - billing + /instances/{instanceSlug}/entitlements/usage: + get: + description: Retrieve a list of all entitlements usage metrics for a specific instance + operationId: getEntitlementsUsageMetrics + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/EntitlementUsage" + type: + - array + - "null" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: List all entitlements usage metrics + tags: + - instances + /instances/{instanceSlug}/entitlements/{entitlementSlug}/usage: + get: + description: Retrieve the usage metrics for a specific entitlement in a given instance + operationId: getEntitlementUsageMetrics + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - entitlement-slug + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/EntitlementUsage" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: Get entitlement usage metrics for an instance + tags: + - instances + post: + description: "Report a usage metric for a specific entitlement in a given instance, with optional metadata. The server dates every report on receipt; the request carries no timestamp. Send a transactionId to make retries safe: without one, a report sent twice counts twice." + operationId: reportEntitlementUsageMetric + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - entitlement-slug + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ReportEntitlementUsageBody" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/EntitlementUsage" + description: OK + headers: + Idempotent-Replayed: + schema: + description: "true when the report replays an earlier one sent with the same transactionId: the body is that report's original response and nothing was counted again" + type: string + Kaiten-Metadata-Dropped: + schema: + description: too_large when the report's metadata was above 4 KiB and was not stored; the report itself was counted + type: string + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - write:instances + summary: Report entitlement usage metric for an instance + tags: + - instances + /instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports: + get: + description: "The usage history of one instance and entitlement: every accepted report in the range, with the counter before and after it and the limit in force, in reportSeq order, paged with afterSeq. Decimals are strings. Reports are kept for the organization's usage history retention." + operationId: listUsageReports + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - entitlement-slug + type: string + - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. + explode: false + in: query + name: from + schema: + description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. + format: date-time + type: string + - description: End of the range, exclusive (RFC 3339). Defaults to now. + explode: false + in: query + name: to + schema: + description: End of the range, exclusive (RFC 3339). Defaults to now. + format: date-time + type: string + - description: "Return the reports after this reportSeq: the nextAfterSeq of the previous page" + explode: false + in: query + name: afterSeq + schema: + description: "Return the reports after this reportSeq: the nextAfterSeq of the previous page" + format: int64 + minimum: 0 + type: integer + - description: Maximum number of reports to return (default 100, max 500) + explode: false + in: query + name: limit + schema: + description: Maximum number of reports to return (default 100, max 500) + format: int32 + maximum: 500 + minimum: 1 + type: integer + - description: Only the report sent with this idempotency key + explode: false + in: query + name: transactionId + schema: + description: Only the report sent with this idempotency key + maxLength: 128 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/UsageReportPage" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: List an entitlement's usage reports for an instance + tags: + - instances + /instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export: + get: + description: Streams every report of one instance and entitlement in the range as CSV or NDJSON, in reportSeq order. Decimals are written exactly as the journal stores them. + operationId: exportUsageReports + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Entitlement slug + in: path + name: entitlementSlug + required: true + schema: + description: Entitlement slug + examples: + - entitlement-slug + type: string + - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + explode: false + in: query + name: from + schema: + description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + format: date-time + type: string + - description: End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. + explode: false + in: query + name: to + schema: + description: End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. + format: date-time + type: string + - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat." + explode: false + in: query + name: format + schema: + description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat." + examples: + - csv + type: string + responses: + "200": + content: + application/x-ndjson: + schema: + type: string + text/csv: + schema: + type: string + description: "The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json" + headers: + Content-Disposition: + description: attachment, with a file name naming the range + schema: + type: string + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: Export an entitlement's usage reports for an instance + tags: + - instances + /instances/{instanceSlug}/integrations/{integrationName}: + delete: + description: Delete a single integration for an instance + operationId: delete-instance-integration + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:instances + summary: Delete an instance integration + tags: + - instances + get: + description: Retrieve a single integration for an instance + operationId: get-instance-integration parameters: - - description: Opaque pagination cursor from a previous response's nextCursor + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceIntegration" + description: OK + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: Get an instance integration + tags: + - instances + post: + description: Create a single integration for an instance + operationId: create-instance-integration + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceIntegration" + description: Integration payload + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceIntegration" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:instances + summary: Create an instance integration + tags: + - instances + put: + description: Update a single integration for an instance + operationId: update-instance-integration + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - instance-slug + type: string + - description: Integration adapter name + in: path + name: integrationName + required: true + schema: + description: Integration adapter name + examples: + - kaiten.integration.crm.attio + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceIntegration" + description: Integration payload + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceIntegration" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:instances + summary: Update an instance integration + tags: + - instances + /instances/{instanceSlug}/invoices: + get: + description: The invoices of one instance's subscription, across every time it was subscribed, with the filters of listInvoices. Requires billing to be enabled for the organization. + operationId: listInstanceInvoices + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + - description: Only invoices in these statuses; repeat the parameter for several + explode: true + in: query + name: status + schema: + description: Only invoices in these statuses; repeat the parameter for several + items: + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + type: + - array + - "null" + - explode: false + in: query + name: kind + schema: + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + - explode: false + in: query + name: providerKind + schema: + enum: + - NOOP + - STRIPE + type: string + - description: "Only this customer's invoices: composed under this slug, or of the customer that has it now" + explode: false + in: query + name: customerSlug + schema: + description: "Only this customer's invoices: composed under this slug, or of the customer that has it now" + type: string + - description: Only issued invoices still unpaid past their due date + explode: false + in: query + name: overdue + schema: + description: Only issued invoices still unpaid past their due date + type: boolean + - description: Only DRAFTs held for their usage journal + explode: false + in: query + name: held + schema: + description: Only DRAFTs held for their usage journal + type: boolean + - explode: false + in: query + name: handoffStatus + schema: + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + - description: Issued at or after this instant (RFC 3339) + explode: false + in: query + name: issuedFrom + schema: + description: Issued at or after this instant (RFC 3339) + format: date-time + type: string + - description: Issued before this instant (RFC 3339) + explode: false + in: query + name: issuedTo + schema: + description: Issued before this instant (RFC 3339) + format: date-time + type: string + - description: Billing a boundary at or after this instant + explode: false + in: query + name: boundaryFrom + schema: + description: Billing a boundary at or after this instant + format: date-time + type: string + - description: Billing a boundary before this instant + explode: false + in: query + name: boundaryTo + schema: + description: Billing a boundary before this instant + format: date-time + type: string + - description: "Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change" + explode: false + in: query + name: updatedSince + schema: + description: "Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change" + format: date-time + type: string + - description: Opaque cursor from the previous page's nextCursor explode: false in: query name: cursor schema: - description: Opaque pagination cursor from a previous response's nextCursor + description: Opaque cursor from the previous page's nextCursor type: string - - description: Maximum number of entries to return (default 50, max 200) + - description: Page size, 50 by default, 200 at most explode: false in: query name: limit schema: - description: Maximum number of entries to return (default 50, max 200) + description: Page size, 50 by default, 200 at most format: int32 maximum: 200 - minimum: 1 + minimum: 0 type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageComponent" + $ref: "#/components/schemas/PageInvoiceSummary" description: OK "400": content: @@ -3402,6 +18102,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -3414,28 +18120,50 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:components - summary: List components + - read:billing + summary: List an instance's invoices tags: - - components - post: - description: Create a new standalone component. Optionally derive it from a previous component version. - operationId: create-component - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Component" - required: true + - billing + /instances/{instanceSlug}/vouchers: + get: + description: The vouchers an instance redeemed, newest first. Requires billing to be enabled for the organization. + operationId: listInstanceVouchers + parameters: + - description: Instance slug + in: path + name: instanceSlug + required: true + schema: + description: Instance slug + examples: + - acme-prod + type: string + - explode: false + in: query + name: status + schema: + enum: + - ACTIVE + - EXPIRED + - REVOKED + type: string responses: - "201": + "200": content: application/json: schema: - $ref: "#/components/schemas/Component" - description: Created + items: + $ref: "#/components/schemas/Redemption" + type: array + description: OK "400": content: application/problem+json: @@ -3460,12 +18188,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -3486,27 +18208,37 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:components - summary: Create a new component + - read:voucher_redemptions + summary: List an instance's vouchers tags: - - components - /components/{componentSlug}: - delete: - description: Delete a component by slug if it is not linked to any release. - operationId: delete-component + - vouchers + /instances/{instanceSlug}/vouchers/redeem: + post: + description: Redeems a voucher for an instance. A boost applies from the next read or report, for its duration; a PRICE voucher discounts the subscription's next invoices. Emits INSTANCE_VOUCHER_REDEEMED, and VOUCHER_EXHAUSTED with the last redemption. Requires billing to be enabled for the organization. + operationId: redeemVoucher parameters: - - description: Component slug + - description: Instance slug in: path - name: componentSlug + name: instanceSlug required: true schema: - description: Component slug + description: Instance slug examples: - - api-gateway-v1-2-3 + - acme-prod type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RedeemableCode" + required: true responses: - "204": - description: No Content + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Redemption" + description: Created "400": content: application/problem+json: @@ -3549,93 +18281,51 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error - security: - - bearerAuth: - - write:components - summary: Delete a component - tags: - - components - get: - description: Returns a single component by its slug. - operationId: get-component - parameters: - - description: Component slug - in: path - name: componentSlug - required: true - schema: - description: Component slug - examples: - - api-gateway-v1-2-3 - type: string - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/Component" - description: OK - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": + "503": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Internal Server Error + description: Service Unavailable security: - bearerAuth: - - read:components - summary: Get a component by slug + - write:voucher_redemptions + summary: Redeem a voucher tags: - - components - put: - description: Update a component in place when unlinked, or create a new version when it is already linked to releases. - operationId: update-component + - vouchers + /instances/{instanceSlug}/vouchers/{instanceVoucherId}/revoke: + post: + description: "Stops a redemption from applying: a boost ends at once, a discount applies to no further invoice. Invoices already issued are untouched. Emits INSTANCE_VOUCHER_REVOKED. Requires billing to be enabled for the organization." + operationId: revokeInstanceVoucher parameters: - - description: Component slug + - description: Instance slug in: path - name: componentSlug + name: instanceSlug required: true schema: - description: Component slug + description: Instance slug examples: - - api-gateway-v1-2-3 + - acme-prod + type: string + - description: Redemption id + in: path + name: instanceVoucherId + required: true + schema: + description: Redemption id type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/Component" + $ref: "#/components/schemas/RevocationReason" required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/Component" + $ref: "#/components/schemas/Redemption" description: OK "400": content: @@ -3679,26 +18369,47 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:components - summary: Update a component + - write:vouchers + summary: Revoke a redemption tags: - - components - /connectors: + - vouchers + /integration/{adapter}/customer/{externalId}: get: - description: Returns every registered connector with its version and settings schema, ordered by name. The registry is platform-wide rather than per-organization and holds one row per connector, so the response is not paginated. - operationId: list-connectors + description: Resolve a customer through one of its integrations using adapter + external ID. + operationId: get-customer-integration-by-external-id + parameters: + - description: Integration adapter without the kaiten.integration. prefix + in: path + name: adapter + required: true + schema: + description: Integration adapter without the kaiten.integration. prefix + examples: + - crm.attio + type: string + - description: External identifier in the third-party system + in: path + name: externalId + required: true + schema: + description: External identifier in the third-party system + examples: + - rec_12345 + type: string responses: "200": content: application/json: schema: - items: - $ref: "#/components/schemas/Connector" - type: - - array - - "null" + $ref: "#/components/schemas/CustomerIntegrationResource" description: OK "401": content: @@ -3712,6 +18423,18 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity "500": content: application/problem+json: @@ -3720,30 +18443,45 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:organizations - summary: List registered connectors + - read:customers + summary: Get a customer by integration external ID tags: - - connectors - /connectors/{connectorName}: - get: - description: Retrieves a registered connector resource including version and settings schema - operationId: get-connector + - integrations + - customers + patch: + description: Create or partially update a customer resolved through adapter + external ID. Missing fields are left unchanged. + operationId: upsert-customer-integration-by-external-id parameters: - - description: Stable connector name + - description: Integration adapter without the kaiten.integration. prefix in: path - name: connectorName + name: adapter required: true schema: - description: Stable connector name + description: Integration adapter without the kaiten.integration. prefix examples: - - kaiten.integration.crm.attio + - crm.attio + type: string + - description: External identifier in the third-party system + in: path + name: externalId + required: true + schema: + description: External identifier in the third-party system + examples: + - rec_12345 type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CustomerBody" + required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/Connector" + $ref: "#/components/schemas/CustomerIntegrationResource" description: OK "400": content: @@ -3769,6 +18507,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -3781,35 +18525,49 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:organizations - summary: Get connector registration + - write:customers + summary: Upsert a customer by integration external ID tags: - - connectors - /connectors/{connectorName}/activation: - delete: - description: "Deactivates a connector for the authenticated organization. Idempotent, and never refused for an unregistered or unlicensed connector: an organization must always be able to stop using something." - operationId: deactivate-connector + - integrations + - customers + /integration/{adapter}/instance/{externalId}: + get: + description: Resolve an instance through one of its integrations using adapter + external ID. + operationId: get-instance-integration-by-external-id parameters: - - description: Stable connector name + - description: Integration adapter without the kaiten.integration. prefix in: path - name: connectorName + name: adapter required: true schema: - description: Stable connector name + description: Integration adapter without the kaiten.integration. prefix examples: - - kaiten.integration.crm.attio + - crm.attio + type: string + - description: External identifier in the third-party system + in: path + name: externalId + required: true + schema: + description: External identifier in the third-party system + examples: + - rec_12345 type: string responses: - "204": - description: No Content - "400": + "200": content: - application/problem+json: + application/json: schema: - $ref: "#/components/schemas/Problem" - description: Bad Request + $ref: "#/components/schemas/InstanceIntegrationResource" + description: OK "401": content: application/problem+json: @@ -3822,6 +18580,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -3836,29 +18600,45 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:organizations - summary: Deactivate connector + - read:instances + summary: Get an instance by integration external ID tags: - - connectors - put: - description: "Activates a registered connector for the authenticated organization. Idempotent: activating an already-active connector succeeds without changing when it was first activated. Refused when the organization's licence does not include the connector." - operationId: activate-connector + - integrations + - instances + patch: + description: Create or partially update an instance resolved through adapter + external ID. Missing fields are left unchanged. + operationId: upsert-instance-integration-by-external-id parameters: - - description: Stable connector name + - description: Integration adapter without the kaiten.integration. prefix in: path - name: connectorName + name: adapter required: true schema: - description: Stable connector name + description: Integration adapter without the kaiten.integration. prefix examples: - - kaiten.integration.crm.attio + - crm.attio + type: string + - description: External identifier in the third-party system + in: path + name: externalId + required: true + schema: + description: External identifier in the third-party system + examples: + - rec_12345 type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/InstanceBody" + required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/ConnectorActivation" + $ref: "#/components/schemas/InstanceIntegrationResource" description: OK "400": content: @@ -3884,6 +18664,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -3904,27 +18690,154 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:organizations - summary: Activate connector + - write:instances + summary: Upsert an instance by integration external ID tags: - - connectors - /connectors/{connectorName}/settings: - delete: - description: Delete connector settings for the authenticated organization - operationId: delete-connector-settings + - integrations + - instances + /invoices: + get: + description: The organization's invoices, newest first; with updatedSince, the ones changed since an instant, oldest change first, for incremental sync. Invoices outlive their instance and customer. Requires billing to be enabled for the organization. + operationId: listInvoices parameters: - - description: Stable connector name - in: path - name: connectorName - required: true + - description: Only invoices in these statuses; repeat the parameter for several + explode: true + in: query + name: status schema: - description: Stable connector name - examples: - - kaiten.integration.crm.attio + description: Only invoices in these statuses; repeat the parameter for several + items: + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + type: + - array + - "null" + - explode: false + in: query + name: kind + schema: + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + - explode: false + in: query + name: providerKind + schema: + enum: + - NOOP + - STRIPE + type: string + - description: "Only this customer's invoices: composed under this slug, or of the customer that has it now" + explode: false + in: query + name: customerSlug + schema: + description: "Only this customer's invoices: composed under this slug, or of the customer that has it now" + type: string + - description: Only issued invoices still unpaid past their due date + explode: false + in: query + name: overdue + schema: + description: Only issued invoices still unpaid past their due date + type: boolean + - description: Only DRAFTs held for their usage journal + explode: false + in: query + name: held + schema: + description: Only DRAFTs held for their usage journal + type: boolean + - explode: false + in: query + name: handoffStatus + schema: + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + - description: Issued at or after this instant (RFC 3339) + explode: false + in: query + name: issuedFrom + schema: + description: Issued at or after this instant (RFC 3339) + format: date-time + type: string + - description: Issued before this instant (RFC 3339) + explode: false + in: query + name: issuedTo + schema: + description: Issued before this instant (RFC 3339) + format: date-time + type: string + - description: Billing a boundary at or after this instant + explode: false + in: query + name: boundaryFrom + schema: + description: Billing a boundary at or after this instant + format: date-time + type: string + - description: Billing a boundary before this instant + explode: false + in: query + name: boundaryTo + schema: + description: Billing a boundary before this instant + format: date-time + type: string + - description: "Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change" + explode: false + in: query + name: updatedSince + schema: + description: "Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change" + format: date-time + type: string + - description: Opaque cursor from the previous page's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque cursor from the previous page's nextCursor + type: string + - description: Page size, 50 by default, 200 at most + explode: false + in: query + name: limit + schema: + description: Page size, 50 by default, 200 at most + format: int32 + maximum: 200 + minimum: 0 + type: integer + - description: "Only this instance's invoices: composed under this slug, or of the instance that has it now" + explode: false + in: query + name: instanceSlug + schema: + description: "Only this instance's invoices: composed under this slug, or of the instance that has it now" type: string responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageInvoiceSummary" + description: OK "400": content: application/problem+json: @@ -3955,32 +18868,187 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:organizations - summary: Delete connector settings + - read:billing + summary: List invoices tags: - - connectors + - billing + /invoices/export: get: - description: Get settings for a connector scoped to the authenticated organization. Write-only fields (flagged `writeOnly` in the connector settings schema) are returned redacted as `***`. - operationId: get-connector-settings + description: "Streams the invoices the filters of listInvoices select, as CSV or NDJSON. Amounts are integer minor units with the currency's exponent beside them, so a spreadsheet never sees a float. The export carries billing e-mails: it is an authenticated read for the organization's accounting. Requires billing to be enabled for the organization." + operationId: exportInvoices parameters: - - description: Stable connector name - in: path - name: connectorName - required: true + - description: Only invoices in these statuses; repeat the parameter for several + explode: true + in: query + name: status schema: - description: Stable connector name + description: Only invoices in these statuses; repeat the parameter for several + items: + enum: + - DRAFT + - PUSHED + - PUSH_FAILED + - MANUAL + - PAID + - PAYMENT_FAILED + - UNCOLLECTIBLE + - VOID + type: string + type: + - array + - "null" + - explode: false + in: query + name: kind + schema: + enum: + - ACTIVATION + - RENEWAL + - FINAL + type: string + - explode: false + in: query + name: providerKind + schema: + enum: + - NOOP + - STRIPE + type: string + - description: "Only this customer's invoices: composed under this slug, or of the customer that has it now" + explode: false + in: query + name: customerSlug + schema: + description: "Only this customer's invoices: composed under this slug, or of the customer that has it now" + type: string + - description: Only issued invoices still unpaid past their due date + explode: false + in: query + name: overdue + schema: + description: Only issued invoices still unpaid past their due date + type: boolean + - description: Only DRAFTs held for their usage journal + explode: false + in: query + name: held + schema: + description: Only DRAFTs held for their usage journal + type: boolean + - explode: false + in: query + name: handoffStatus + schema: + enum: + - NOT_REQUIRED + - PENDING + - ACKNOWLEDGED + type: string + - description: Issued at or after this instant (RFC 3339) + explode: false + in: query + name: issuedFrom + schema: + description: Issued at or after this instant (RFC 3339) + format: date-time + type: string + - description: Issued before this instant (RFC 3339) + explode: false + in: query + name: issuedTo + schema: + description: Issued before this instant (RFC 3339) + format: date-time + type: string + - description: Billing a boundary at or after this instant + explode: false + in: query + name: boundaryFrom + schema: + description: Billing a boundary at or after this instant + format: date-time + type: string + - description: Billing a boundary before this instant + explode: false + in: query + name: boundaryTo + schema: + description: Billing a boundary before this instant + format: date-time + type: string + - description: "Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change" + explode: false + in: query + name: updatedSince + schema: + description: "Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change" + format: date-time + type: string + - description: Opaque cursor from the previous page's nextCursor + explode: false + in: query + name: cursor + schema: + description: Opaque cursor from the previous page's nextCursor + type: string + - description: Page size, 50 by default, 200 at most + explode: false + in: query + name: limit + schema: + description: Page size, 50 by default, 200 at most + format: int32 + maximum: 200 + minimum: 0 + type: integer + - description: Only this instance's invoices + explode: false + in: query + name: instanceSlug + schema: + description: Only this instance's invoices + type: string + - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one invoice with its lines per line. Anything else answers 422 ExportInvoices.InvalidFormat." + explode: false + in: query + name: format + schema: + description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one invoice with its lines per line. Anything else answers 422 ExportInvoices.InvalidFormat." examples: - - kaiten.integration.crm.attio + - csv + type: string + - description: "For csv: line (the default), one row per invoice line with the invoice's columns repeated; invoice, one row per invoice. Anything else answers 422 ExportInvoices.InvalidGranularity." + explode: false + in: query + name: granularity + schema: + description: "For csv: line (the default), one row per invoice line with the invoice's columns repeated; invoice, one row per invoice. Anything else answers 422 ExportInvoices.InvalidGranularity." + examples: + - line type: string responses: "200": content: - application/json: + application/x-ndjson: schema: - $ref: "#/components/schemas/ConnectorSettings" - description: OK + type: string + text/csv: + schema: + type: string + description: The invoices, as an attachment + headers: + Content-Disposition: + description: attachment, with a file name + schema: + type: string "400": content: application/problem+json: @@ -3999,12 +19067,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found "422": content: application/problem+json: @@ -4017,45 +19079,37 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:organizations - summary: Get connector settings + - read:billing + summary: Export invoices tags: - - connectors - put: - description: Create or update connector settings for the authenticated organization. Write-only fields (flagged `writeOnly` in the connector settings schema) may be omitted or sent as `***` to keep the stored value; they are returned redacted. - operationId: update-connector-settings + - billing + /invoices/{invoiceId}: + get: + description: "One invoice with its lines, the customer and instance as they were when it was composed, its hold and its handoff. Addressed by id at organization level: an invoice outlives its instance and customer. Requires billing to be enabled for the organization." + operationId: getInvoice parameters: - - description: Stable connector name + - description: Invoice identifier in: path - name: connectorName + name: invoiceId required: true schema: - description: Stable connector name - examples: - - kaiten.integration.crm.attio + description: Invoice identifier type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/ConnectorSettings" - description: Connector settings payload to upsert - required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/ConnectorSettings" + $ref: "#/components/schemas/Invoice" description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request "401": content: application/problem+json: @@ -4086,33 +19140,75 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:organizations - summary: Upsert connector settings + - read:billing + summary: Get an invoice tags: - - connectors - /connectors/{connectorName}/settings/schema: + - billing + /invoices/{invoiceId}/lines/{lineId}/reports: get: - description: Get the JSON schema used to validate connector settings payloads - operationId: get-connector-settings-schema + description: "The usage reports a USAGE or OVERAGE line was measured from: its pair's reports dated in its service period, in reportSeq order. Summed by reset window and floored at 0, they give the line's measured quantity. Addressed by invoice, it answers after the instance was deleted. Requires billing to be enabled for the organization." + operationId: listInvoiceLineReports parameters: - - description: Stable connector name + - description: Invoice identifier in: path - name: connectorName + name: invoiceId required: true schema: - description: Stable connector name + description: Invoice identifier + type: string + - description: Line identifier, as the invoice's lines carry it + in: path + name: lineId + required: true + schema: + description: Line identifier, as the invoice's lines carry it + type: string + - description: Reports after this reportSeq; 0 starts at the first + explode: false + in: query + name: afterSeq + schema: + description: Reports after this reportSeq; 0 starts at the first + format: int64 + minimum: 0 + type: integer + - description: Page size, 100 by default, 500 at most + explode: false + in: query + name: limit + schema: + description: Page size, 100 by default, 500 at most + format: int32 + maximum: 500 + minimum: 0 + type: integer + - description: "json (the default): one page. csv: every report, streamed as RFC 4180 with a header row. Anything else answers 422 ListInvoiceLineReports.InvalidFormat." + explode: false + in: query + name: format + schema: + description: "json (the default): one page. csv: every report, streamed as RFC 4180 with a header row. Anything else answers 422 ListInvoiceLineReports.InvalidFormat." examples: - - kaiten.integration.crm.attio + - json type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/ConnectorSettingsSchema" - description: OK + $ref: "#/components/schemas/LineReportPage" + text/csv: + schema: + type: string + description: One page of reports (json), or every report as a CSV attachment (csv) "400": content: application/problem+json: @@ -4149,32 +19245,42 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:organizations - summary: Get connector settings schema + - read:billing + summary: List the usage reports behind an invoice line tags: - - connectors - /connectors/{connectorName}/state: - get: - description: "Returns whether the connector is registered in this deployment, whether the authenticated organization's licence includes it, and whether the organization has activated it. Answers 200 with `available: false` for a connector this deployment does not have." - operationId: get-connector-state + - billing + /invoices/{invoiceId}/mark-paid: + post: + description: Records that a MANUAL invoice was paid. An invoice still waiting in the handoff queue is acknowledged by the same write. Marking it paid again with the same external reference answers it unchanged. An invoice a payment provider collects is settled there. Requires billing to be enabled for the organization. + operationId: markInvoicePaid parameters: - - description: Stable connector name + - description: Invoice identifier in: path - name: connectorName + name: invoiceId required: true schema: - description: Stable connector name - examples: - - kaiten.integration.crm.attio + description: Invoice identifier type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/InvoicePayment" + required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/ConnectorState" + $ref: "#/components/schemas/Invoice" description: OK "400": content: @@ -4194,6 +19300,18 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -4214,45 +19332,29 @@ paths: description: Service Unavailable security: - bearerAuth: - - read:organizations - summary: Get connector state for this organization + - write:billing + summary: Mark an invoice paid tags: - - connectors - /customers: - get: - description: Returns a cursor-paginated page of customers for the current organization. - operationId: list-customers + - billing + /invoices/{invoiceId}/recompose: + post: + description: "Composes an invoice again from the usage journal as it is now, keeping its BASE lines as they were sold. A held DRAFT is rewritten in place (200): issued when its journal is now sound, held again otherwise. A VOID invoice gets a replacement for the same boundary (201), under the subscription's current terms and billing e-mail. Any other invoice must be voided first. Requires billing to be enabled for the organization." + operationId: recomposeInvoice parameters: - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor + - description: Invoice identifier + in: path + name: invoiceId + required: true schema: - description: Opaque pagination cursor from a previous response's nextCursor + description: Invoice identifier type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageCustomer" + $ref: "#/components/schemas/Invoice" description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request "401": content: application/problem+json: @@ -4265,6 +19367,18 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -4277,28 +19391,43 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:customers - summary: List customers + - write:billing + summary: Recompose an invoice tags: - - customers + - billing + /invoices/{invoiceId}/release-hold: post: - description: Create a new customer with the provided details. - operationId: create-customer + description: "Accepts a held invoice as composed and issues it: MANUAL and pending in the handoff queue, or PAID when nothing is owed. The release keeps who released it and why. Requires billing to be enabled for the organization." + operationId: releaseInvoiceHold + parameters: + - description: Invoice identifier + in: path + name: invoiceId + required: true + schema: + description: Invoice identifier + type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/Customer" + $ref: "#/components/schemas/HoldRelease" required: true responses: - "201": + "200": content: application/json: schema: - $ref: "#/components/schemas/Customer" - description: Created + $ref: "#/components/schemas/Invoice" + description: OK "400": content: application/problem+json: @@ -4349,23 +19478,29 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:customers - summary: Create a new customer + - write:billing + summary: Release a held invoice tags: - - customers - /customers/{customerSlug}: - delete: - description: Delete a customer by their slug. - operationId: delete-customer + - billing + /invoices/{invoiceId}/retry-push: + post: + description: Puts a DRAFT or PUSH_FAILED invoice of a payment provider back in the push queue now, which resumes the push where its last attempt stopped. A draft waiting for finalization in its provider is finalized at once. Refused for a held invoice (409 RetryInvoicePush.Held) and for any other (409 RetryInvoicePush.InvalidStatus). Requires billing to be enabled for the organization. + operationId: retryInvoicePush parameters: - - in: path - name: customerSlug + - description: Invoice identifier + in: path + name: invoiceId required: true schema: + description: Invoice identifier type: string responses: - "204": - description: No Content + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/Invoice" + description: Accepted "400": content: application/problem+json: @@ -4390,6 +19525,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -4402,28 +19543,43 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:customers - summary: Delete a customer + - write:billing + summary: Retry pushing an invoice to its provider tags: - - customers - get: - description: Returns a single customer by their slug. - operationId: get-customer + - billing + /invoices/{invoiceId}/sync: + post: + description: "Reads an invoice from its payment provider now and applies what the provider says: its finalization, payment, write-off or void. Refused for an invoice not in a provider (409 SyncInvoice.NotPushed). Requires billing to be enabled for the organization." + operationId: syncInvoice parameters: - - in: path - name: customerSlug + - description: Invoice identifier + in: path + name: invoiceId required: true schema: + description: Invoice identifier type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/Customer" + $ref: "#/components/schemas/Invoice" description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -4442,6 +19598,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -4454,30 +19616,43 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:customers - summary: Get a customer by slug + - write:billing + summary: Sync an invoice with its provider tags: - - customers - put: - description: Update a customer's details. Slug and integrations are not renameable/settable through this endpoint -- omit them, or send the values already on record. - operationId: update-customer + - billing + /invoices/{invoiceId}/void: + post: + description: Voids an invoice not yet settled -- a DRAFT, held or not, a MANUAL one, or one a payment provider issued -- which frees its boundary for a recompose. A provider's invoice is voided there first, and here only once the provider confirms (503 VoidInvoice.ProviderUnavailable leaves it unchanged); one the provider reports paid is refused. A paid or written-off invoice cannot be voided. A handoff still pending stays so, and its consumer sees the VOID. Voiding a VOID invoice again answers it unchanged. Requires billing to be enabled for the organization. + operationId: voidInvoice parameters: - - in: path - name: customerSlug + - description: Invoice identifier + in: path + name: invoiceId required: true schema: + description: Invoice identifier type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/Customer" + $ref: "#/components/schemas/InvoiceVoid" required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Invoice" + description: OK "400": content: application/problem+json: @@ -4502,6 +19677,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -4514,38 +19695,43 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:customers - summary: Update a customer + - write:billing + summary: Void an invoice tags: - - customers - /customers/{customerSlug}/integrations/{integrationName}: - delete: - description: Delete a single integration for a customer - operationId: delete-customer-integration + - billing + /invoices/{invoiceId}/write-off: + post: + description: "Records that the organization gave up collecting a MANUAL invoice: it becomes UNCOLLECTIBLE. A handoff still pending stays so, and its consumer sees the new status. Writing off an UNCOLLECTIBLE invoice again answers it unchanged. Requires billing to be enabled for the organization." + operationId: writeOffInvoice parameters: - - description: Customer slug - in: path - name: customerSlug - required: true - schema: - description: Customer slug - examples: - - acme-corp - type: string - - description: Integration adapter name + - description: Invoice identifier in: path - name: integrationName + name: invoiceId required: true schema: - description: Integration adapter name - examples: - - kaiten.integration.crm.attio + description: Invoice identifier type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/InvoiceWriteOff" + required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Invoice" + description: OK "400": content: application/problem+json: @@ -4570,6 +19756,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -4582,59 +19774,65 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:customers - summary: Delete a customer integration + - write:billing + summary: Write off an invoice tags: - - customers + - billing + /license-families: get: - description: Retrieve a single integration for a customer - operationId: get-customer-integration + description: "Returns a cursor-paginated page of license families for the current organization, each with the version it currently resolves to: the family's default version, or its highest-numbered published version. A family whose versions are all drafts or all archived is still listed, with no current version." + operationId: list-license-families parameters: - - description: Customer slug - in: path - name: customerSlug - required: true + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor schema: - description: Customer slug - examples: - - acme-corp + description: Opaque pagination cursor from a previous response's nextCursor type: string - - description: Integration adapter name - in: path - name: integrationName - required: true + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit schema: - description: Integration adapter name - examples: - - kaiten.integration.crm.attio - type: string + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/CustomerIntegration" + $ref: "#/components/schemas/PageLicenseFamilyView" description: OK - "401": + "400": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": + description: Bad Request + "401": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Forbidden - "404": + description: Unauthorized + "403": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Not Found + description: Forbidden "422": content: application/problem+json: @@ -4649,46 +19847,56 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:customers - summary: Get a customer integration + - read:licenses + summary: List license families tags: - - customers - post: - description: Create a single integration for a customer - operationId: create-customer-integration + - license-families + /license-families/{familySlug}: + get: + description: |- + Resolves a license family to the version it currently serves, returned as currentVersion: the family's default version if it has one, otherwise its highest-numbered PUBLISHED version. This is the stable address for "the current version of this product", so a caller never has to name a version slug. + + A family with a default keeps serving it when a newer version is published -- the default is what the vendor puts forward, and superseding it is an explicit act (make another version the default, or unset it). A family without a default follows publication: the newest PUBLISHED version wins. + + Returns 404 GetLicenseFamily.NoPublishedVersion when the family exists but has no PUBLISHED version, since there is nothing to resolve to. Use ?include=versions to read such a family anyway: with the history requested, the family is returned with its versions and no currentVersion. Use ?version=N for explicit access to one version, including draft and archived ones. + operationId: get-license-family parameters: - - description: Customer slug + - description: License family slug in: path - name: customerSlug + name: familySlug required: true schema: - description: Customer slug + description: License family slug examples: - - acme-corp + - enterprise-license type: string - - description: Integration adapter name - in: path - name: integrationName - required: true + - description: "Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply." + explode: false + in: query + name: version schema: - description: Integration adapter name - examples: - - kaiten.integration.crm.attio - type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/CustomerIntegration" - description: Integration payload - required: true + description: "Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply." + format: int32 + minimum: 1 + type: integer + - description: "Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type." + explode: false + in: query + name: include + schema: + description: "Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type." + items: + enum: + - versions + type: string + type: array responses: - "201": + "200": content: application/json: schema: - $ref: "#/components/schemas/CustomerIntegration" - description: Created + $ref: "#/components/schemas/LicenseFamilyView" + description: OK "400": content: application/problem+json: @@ -4713,12 +19921,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -4733,45 +19935,35 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:customers - summary: Create a customer integration + - read:licenses + summary: Get a license family by slug tags: - - customers - put: - description: Update a single integration for a customer - operationId: update-customer-integration + - license-families + patch: + description: Lists the family in the public catalogue, or takes it out. Families are private until made public. + operationId: updateLicenseFamily parameters: - - description: Customer slug - in: path - name: customerSlug - required: true - schema: - description: Customer slug - examples: - - acme-corp - type: string - - description: Integration adapter name + - description: License family slug in: path - name: integrationName + name: familySlug required: true schema: - description: Integration adapter name + description: License family slug examples: - - kaiten.integration.crm.attio + - pro type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/CustomerIntegration" - description: Integration payload + $ref: "#/components/schemas/LicenseFamilyVisibility" required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/CustomerIntegration" + $ref: "#/components/schemas/LicenseFamilyView" description: OK "400": content: @@ -4797,12 +19989,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -4817,14 +20003,14 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:customers - summary: Update a customer integration + - write:licenses + summary: Update a license family tags: - - customers - /deployment-zones: + - licenses + /licenses: get: - description: Returns a cursor-paginated page of deployment zones for the current organization. A deployment zone is one place a customer runs a release -- a target they name and classify themselves, holding the release currently on it. It is not an installation of Kaiten; that sense of the term belongs to operations and is not reachable through this API. - operationId: list-deployment-zones + description: Returns a cursor-paginated page of licenses for the current organization. + operationId: get-licenses parameters: - description: Opaque pagination cursor from a previous response's nextCursor explode: false @@ -4848,7 +20034,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PageDeploymentZone" + $ref: "#/components/schemas/PageLicense" description: OK "400": content: @@ -4882,25 +20068,28 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:deployment_zones - summary: List deployment zones + - read:licenses + summary: GetUser all licenses tags: - - deploymentZones + - licenses post: - description: Create a new deployment zone with the provided details. Supplying releaseId records the zone's first deployment. A deployment zone is one place a customer runs a release -- a target they name and classify themselves, holding the release currently on it. It is not an installation of Kaiten; that sense of the term belongs to operations and is not reachable through this API. - operationId: create-deployment-zone + description: |- + Create a new license with the provided details. Without familySlug or familyId this creates a new license family and the license becomes its version 1. With one of them it adds the next version to that family (familySlug names it by slug, familyId by identifier; sent together they must agree), and the version number is assigned by the server as the next one in the family's sequence. The version starts PUBLISHED, or DRAFT when lifecycleState says so; ARCHIVED is refused (422 CreateLicense.LifecycleStateNotSettable), because a version is archived with archive-license once it has been on sale. + + Where the deployment limits how many licenses an organization may have, only a new family counts against that limit (409 CreateLicense.EntitlementLimitReached once it is reached): a new version of an existing family never does. + operationId: create-license requestBody: content: application/json: schema: - $ref: "#/components/schemas/DeploymentZone" + $ref: "#/components/schemas/License" required: true responses: "201": content: application/json: schema: - $ref: "#/components/schemas/DeploymentZone" + $ref: "#/components/schemas/License" description: Created "400": content: @@ -4920,6 +20109,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "409": content: application/problem+json: @@ -4946,19 +20141,23 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:deployment_zones - summary: Create a new deployment zone + - write:licenses + summary: Create a new license tags: - - deploymentZones - /deployment-zones/{deploymentZoneSlug}: + - licenses + /licenses/{licenseSlug}: delete: - description: Delete a deployment zone by their slug. - operationId: delete-deployment-zone + description: Delete a license with the provided details. Deleting the last version of a license family also deletes the family, and frees its slug for a new product to take. A deleted version's number is not reused by the next version of its family. + operationId: delete-license parameters: - - in: path - name: deploymentZoneSlug + - description: License slug + in: path + name: licenseSlug required: true schema: + description: License slug + examples: + - license-slug type: string responses: "204": @@ -4987,6 +20186,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5001,25 +20206,29 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:deployment_zones - summary: Delete a deployment zone + - write:licenses + summary: Delete a license tags: - - deploymentZones + - licenses get: - description: Returns a single deployment zone by their slug. - operationId: get-deployment-zone-by-slug + description: Retrieve a license by their unique slug + operationId: get-license parameters: - - in: path - name: deploymentZoneSlug + - description: License slug + in: path + name: licenseSlug required: true schema: + description: License slug + examples: + - license-slug type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/DeploymentZone" + $ref: "#/components/schemas/License" description: OK "401": content: @@ -5053,28 +20262,101 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:deployment_zones - summary: Get a deployment zone by slug + - read:licenses + summary: Get a license by slug tags: - - deploymentZones + - licenses put: - description: "Update a deployment zone's details. Changing releaseId records a deployment: the zone's current release becomes the new one and the change is appended to its deployment history, including when the new release is one the zone already ran (a rollback). Omitting releaseId, or echoing back the current one, leaves the history untouched." - operationId: update-deploymentZone + description: Update a license with the provided details + operationId: update-license parameters: - - in: path - name: deploymentZoneSlug + - description: License slug + in: path + name: licenseSlug + required: true + schema: + description: License slug + examples: + - license-slug + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/License" + required: true + responses: + "204": + description: No Content + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - write:licenses + summary: Update a license + tags: + - licenses + /licenses/{licenseSlug}/archive: + post: + description: "Withdraws a PUBLISHED license version from sale: its family stops resolving to it and no instance can be assigned to it any more, while instances already on it keep it. Only a published version can be archived (409 ArchiveLicense.NotPublished) -- a draft that was never on sale is deleted instead -- and not while it is its family's default (409 ArchiveLicense.DefaultMustBePublished): make another version the default, or unset it, first. Emits LICENSE_ARCHIVED." + operationId: archive-license + parameters: + - description: License version slug + in: path + name: licenseSlug required: true schema: + description: License version slug + examples: + - enterprise-license-v2 type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/DeploymentZone" - required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/License" + description: OK "400": content: application/problem+json: @@ -5099,6 +20381,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5113,15 +20401,24 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:deployment_zones - summary: Update a deployment zone + - write:licenses + summary: Archive a license version tags: - - deploymentZones - /entitlement-groups: + - licenses + /licenses/{licenseSlug}/entitlements: get: - description: Returns a cursor-paginated page of entitlement groups for the current organization. - operationId: list-entitlement-groups + description: Returns a cursor-paginated page of entitlements granted by a license, identified by its unique slug. + operationId: get-license-entitlements parameters: + - description: License slug + in: path + name: licenseSlug + required: true + schema: + description: License slug + examples: + - license-slug + type: string - description: Opaque pagination cursor from a previous response's nextCursor explode: false in: query @@ -5144,7 +20441,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PageEntitlementGroup" + $ref: "#/components/schemas/PageLicenseEntitlement" description: OK "400": content: @@ -5164,6 +20461,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -5178,26 +20481,32 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:entitlements - summary: List all entitlement groups + - read:licenses + summary: Get all entitlements for a license tags: - - entitlement-groups + - licenses post: - description: Create a new entitlement group to aggregate entitlements - operationId: create-entitlement-group + description: Associate an entitlement with a license by providing the license slug and entitlement details + operationId: associate-entitlement-with-license + parameters: + - description: License slug + in: path + name: licenseSlug + required: true + schema: + description: License slug + examples: + - license-slug + type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/EntitlementGroup" + $ref: "#/components/schemas/LicenseEntitlement" required: true responses: - "201": - content: - application/json: - schema: - $ref: "#/components/schemas/EntitlementGroup" - description: Created + "204": + description: No Content "400": content: application/problem+json: @@ -5216,6 +20525,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "409": content: application/problem+json: @@ -5242,17 +20557,22 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:entitlements - summary: Create a new entitlement group + - write:licenses + summary: Associate an entitlement with a license tags: - - entitlement-groups - /entitlement-groups/{entitlementGroupSlug}: + - licenses + /licenses/{licenseSlug}/entitlements/{entitlementSlug}: delete: - description: Delete an entitlement group by its slug. This does not delete the member entitlements. - operationId: delete-entitlement-group + description: Delete a license entitlement with the provided details + operationId: delete-license-entitlement parameters: - in: path - name: entitlementGroupSlug + name: licenseSlug + required: true + schema: + type: string + - in: path + name: entitlementSlug required: true schema: type: string @@ -5283,6 +20603,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5297,16 +20623,21 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:entitlements - summary: Delete an entitlement group + - write:licenses + summary: Delete a license entitlement tags: - - entitlement-groups + - licenses get: - description: Retrieve details of a specific entitlement group by its slug - operationId: get-entitlement-group + description: Retrieve a entitlement for a license by their unique slugs + operationId: get-license-entitlement parameters: - in: path - name: entitlementGroupSlug + name: licenseSlug + required: true + schema: + type: string + - in: path + name: entitlementSlug required: true schema: type: string @@ -5315,7 +20646,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EntitlementGroup" + $ref: "#/components/schemas/LicenseEntitlement" description: OK "401": content: @@ -5349,16 +20680,21 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:entitlements - summary: Get entitlement group by slug + - read:licenses + summary: Get a license entitlement tags: - - entitlement-groups + - licenses put: - description: Update an existing entitlement group with the provided details - operationId: update-entitlement-group + description: Update an license entitlement with the provided details + operationId: update-license-entitlement parameters: - in: path - name: entitlementGroupSlug + name: licenseSlug + required: true + schema: + type: string + - in: path + name: entitlementSlug required: true schema: type: string @@ -5366,7 +20702,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EntitlementGroup" + $ref: "#/components/schemas/LicenseEntitlement" required: true responses: "204": @@ -5395,6 +20731,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5409,29 +20751,37 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:entitlements - summary: Update an entitlement group + - write:licenses + summary: Update an license entitlement tags: - - entitlement-groups - /entitlement-groups/{entitlementGroupSlug}/entitlements: + - licenses + /licenses/{licenseSlug}/invoice-preview: post: - description: Add an existing entitlement as a member of an entitlement group - operationId: add-entitlement-to-group + description: "Composes the RENEWAL invoice a subscription to this licence version would be billed at a boundary now, without writing anything: the sample usage rated in arrears over the billing period that ends, and the base price for the period that starts (or the one that ends, for an ARREARS base). Works on DRAFT versions, to check prices before publishing. Requires billing to be enabled for the organization." + operationId: previewLicenseInvoice parameters: - - in: path - name: entitlementGroupSlug + - description: License version slug + in: path + name: licenseSlug required: true schema: + description: License version slug + examples: + - pro-v2 type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/Command" + $ref: "#/components/schemas/InvoicePreviewScenario" required: true responses: - "201": - description: Created + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/InvoicePreview" + description: OK "400": content: application/problem+json: @@ -5456,12 +20806,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -5474,30 +20818,62 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:entitlements - summary: Add an entitlement to a group + - read:licenses + summary: Preview a license invoice tags: - - entitlement-groups - /entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}: - delete: - description: Remove an entitlement from an entitlement group. The entitlement itself is not deleted. - operationId: remove-entitlement-from-group + - licenses + /licenses/{licenseSlug}/prices: + get: + description: The prices of one licence version, in display order. Requires billing to be enabled for the organization. + operationId: listLicensePrices parameters: - - in: path - name: entitlementGroupSlug + - description: License version slug + in: path + name: licenseSlug required: true schema: + description: License version slug + examples: + - pro-v2 type: string - - in: path - name: entitlementSlug - required: true + - description: Only prices in this status; both when omitted + explode: false + in: query + name: status + schema: + description: Only prices in this status; both when omitted + enum: + - ACTIVE + - DEPRECATED + type: string + - description: Only prices of this billing model + explode: false + in: query + name: billingModel schema: + description: Only prices of this billing model + enum: + - FLAT_FEE + - USAGE_BASED + - OVERAGE type: string responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Price" + type: array + description: OK "400": content: application/problem+json: @@ -5534,41 +20910,44 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error - security: - - bearerAuth: - - write:entitlements - summary: Remove an entitlement from a group - tags: - - entitlement-groups - /entitlement-groups/{entitlementGroupSlug}/usage: - get: - description: Retrieve the aggregated usage metrics of all member entitlements for a given instance - operationId: get-entitlement-group-usage - parameters: - - in: path - name: entitlementGroupSlug - required: true - schema: - type: string - - description: Instance slug to get usage for - explode: false - in: query - name: instance + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable + security: + - bearerAuth: + - read:licenses + summary: List a license version's prices + tags: + - licenses + post: + description: Adds a price to a licence version. A metered price's sale-unit factor is captured from its entitlement now and never changes. Requires billing to be enabled for the organization. + operationId: createLicensePrice + parameters: + - description: License version slug + in: path + name: licenseSlug required: true schema: - description: Instance slug to get usage for + description: License version slug + examples: + - pro-v2 type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/NewLicensePrice" + required: true responses: - "200": + "201": content: application/json: schema: - items: - $ref: "#/components/schemas/EntitlementGroupUsage" - type: - - array - - "null" - description: OK + $ref: "#/components/schemas/Price" + description: Created "400": content: application/problem+json: @@ -5593,6 +20972,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5605,40 +20990,45 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:entitlements - summary: Get aggregated usage for an entitlement group + - write:licenses + summary: Create a license price tags: - - entitlement-groups - /entitlements: + - licenses + /licenses/{licenseSlug}/prices/{priceId}: get: - description: Returns a cursor-paginated page of entitlements for the current organization. - operationId: list-entitlements + description: One price of a licence version. Requires billing to be enabled for the organization. + operationId: getLicensePrice parameters: - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor + - description: License version slug + in: path + name: licenseSlug + required: true schema: - description: Opaque pagination cursor from a previous response's nextCursor + description: License version slug + examples: + - pro-v2 type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit + - description: Price identifier + in: path + name: priceId + required: true schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + description: Price identifier + type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageEntitlement" + $ref: "#/components/schemas/Price" description: OK "400": content: @@ -5658,6 +21048,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -5670,28 +21066,51 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:entitlements - summary: List all entitlements + - read:licenses + summary: Get a license price tags: - - entitlements - post: - description: Create a new entitlement with the provided details - operationId: create-entitlement + - licenses + patch: + description: Edits a price of a DRAFT licence version; the prices of a published version are immutable (UpdateLicensePrice.VersionNotDraft). Currency and billing model cannot change. Requires billing to be enabled for the organization. + operationId: updateLicensePrice + parameters: + - description: License version slug + in: path + name: licenseSlug + required: true + schema: + description: License version slug + examples: + - pro-v2 + type: string + - description: Price identifier + in: path + name: priceId + required: true + schema: + description: Price identifier + type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/Entitlement" + $ref: "#/components/schemas/LicensePriceChanges" required: true responses: - "201": + "200": content: application/json: schema: - $ref: "#/components/schemas/Entitlement" - description: Created + $ref: "#/components/schemas/Price" + description: OK "400": content: application/problem+json: @@ -5742,29 +21161,38 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:entitlements - summary: Create a new entitlement + - write:licenses + summary: Update a license price tags: - - entitlements - /entitlements/{entitlementSlug}: - delete: - description: Delete an entitlement by its slug - operationId: delete-entitlement + - licenses + /licenses/{licenseSlug}/prices/{priceId}/deprecate: + post: + description: "Retires a price from the catalogue: it keeps billing what is already pinned to it, is no longer offered, and stops being a default. Deprecation cannot be undone. Requires billing to be enabled for the organization." + operationId: deprecateLicensePrice parameters: - - in: path - name: entitlementSlug + - description: License version slug + in: path + name: licenseSlug + required: true + schema: + description: License version slug + examples: + - pro-v2 + type: string + - description: Price identifier + in: path + name: priceId required: true schema: + description: Price identifier type: string responses: - "204": - description: No Content - "400": + "200": content: - application/problem+json: + application/json: schema: - $ref: "#/components/schemas/Problem" - description: Bad Request + $ref: "#/components/schemas/Price" + description: OK "401": content: application/problem+json: @@ -5783,6 +21211,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5795,28 +21229,45 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:entitlements - summary: Delete an entitlement + - write:licenses + summary: Deprecate a license price tags: - - entitlements - get: - description: Retrieve details of a specific entitlement by its slug - operationId: get-entitlement + - licenses + /licenses/{licenseSlug}/publish: + post: + description: "Puts a DRAFT license version on sale: it becomes PUBLISHED, so it can be made its family's default, and its family resolves to it when the family has no default and this is its highest published version. Only a draft can be published (409 PublishLicense.NotADraft); an archived version goes back on sale with unarchive-license. Emits LICENSE_PUBLISHED." + operationId: publish-license parameters: - - in: path - name: entitlementSlug + - description: License version slug + in: path + name: licenseSlug required: true schema: + description: License version slug + examples: + - enterprise-license-v2 type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/Entitlement" + $ref: "#/components/schemas/License" description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -5835,6 +21286,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -5849,28 +21306,31 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:entitlements - summary: Get entitlement by slug + - write:licenses + summary: Publish a license version tags: - - entitlements - put: - description: Update an existing entitlement with the provided details - operationId: update-entitlement + - licenses + /licenses/{licenseSlug}/unarchive: + post: + description: "Puts an ARCHIVED license version back on sale: it is PUBLISHED again, can be assigned to instances, and can be what its family resolves to. Only an archived version can be unarchived (409 UnarchiveLicense.NotArchived). Emits LICENSE_UNARCHIVED." + operationId: unarchive-license parameters: - - in: path - name: entitlementSlug + - description: License version slug + in: path + name: licenseSlug required: true schema: + description: License version slug + examples: + - enterprise-license-v2 type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Entitlement" - required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/License" + description: OK "400": content: application/problem+json: @@ -5915,15 +21375,24 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:entitlements - summary: Update an entitlement + - write:licenses + summary: Unarchive a license version tags: - - entitlements - /feature-flags: + - licenses + /metadata-fields: get: - description: Returns a cursor-paginated page of feature flags for the given organization. - operationId: get-feature-flags + description: Returns a cursor-paginated page of the active (non-archived) metadata fields declared for the org and the given resource type, ordered by displayOrder then createdAt. + operationId: list-metadata-fields parameters: + - explode: false + in: query + name: resourceType + required: true + schema: + enum: + - DEPLOYMENT_ZONE + - INSTANCE + type: string - description: Opaque pagination cursor from a previous response's nextCursor explode: false in: query @@ -5946,7 +21415,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PageFeatureFlag" + $ref: "#/components/schemas/PageMetadataField" description: OK "400": content: @@ -5966,12 +21435,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found "422": content: application/problem+json: @@ -5986,27 +21449,25 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:feature_flags - summary: Get a list of feature flags + - read:metadata_fields + summary: List active metadata fields for a resource type tags: - - featureflags + - metadataFields post: - description: Create a new featureflag with the provided details - operationId: create-feature-flag + description: Declares a typed metadata field for a given resource type (DEPLOYMENT_ZONE, INSTANCE). The json_schema is validated against JSON Schema 2020-12 before insertion. Restricted to write:metadata_fields scope (admin-only policy). + operationId: create-metadata-field requestBody: content: application/json: schema: - $ref: "#/components/schemas/FeatureFlag" - description: Feature flag details + $ref: "#/components/schemas/MetadataField" required: true responses: "201": content: application/json: schema: - $ref: "#/components/schemas/FeatureFlag" - description: Created feature flag + $ref: "#/components/schemas/MetadataField" description: Created "400": content: @@ -6052,21 +21513,29 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:feature_flags - summary: Create a new featureflag + - write:metadata_fields + summary: Create a metadata field tags: - - featureflags - /feature-flags/targeting/context: - get: - description: "Returns the identifiers a targeting rule may read, with their types and descriptions, including the organization's own entitlement slugs. Intended for an editor: it is what autocomplete and hover documentation are built from. The set is not closed — a rule may also target on attributes the caller supplies in its own evaluation context." - operationId: get-targeting-context + - metadataFields + /metadata-fields/reorder: + post: + description: Sets the displayOrder of the listed fields to their position in the array (0-indexed). All ids must belong to the same organization, resource type, and be non-archived; the entire reorder is applied in a single transaction. + operationId: reorder-metadata-fields + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ReorderMetadataFieldsInput" + required: true responses: - "200": + "204": + description: No Content + "400": content: - application/json: + application/problem+json: schema: - $ref: "#/components/schemas/TargetingContext" - description: OK + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -6079,6 +21548,18 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity "500": content: application/problem+json: @@ -6087,26 +21568,32 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:feature_flags - summary: Get the targeting context schema + - write:metadata_fields + summary: Reorder metadata fields tags: - - featureflags - /feature-flags/targeting/lint: - post: - description: "Runs the same check create and update run before accepting a targeting rule, and reports what it found without writing anything. A rule that references a fact or an entitlement that does not exist does not fail loudly at evaluation — it simply never matches — so this is what lets an editor say so while the rule is being written. A rejected rule is a 200 carrying `valid: false`, not a client error." - operationId: lint-targeting-rule + - metadataFields + /metadata-fields/{id}: + patch: + description: "Updates label and json_schema. `key` and `resourceType` are immutable, and `displayOrder` belongs to POST /metadata-fields/reorder. The new json_schema is validated against JSON Schema 2020-12 and the transition rules: type changes, cardinality changes, and free-string ↔ enum toggles are rejected with 422." + operationId: update-metadata-field + parameters: + - in: path + name: id + required: true + schema: + type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/TargetingRuleDraft" + $ref: "#/components/schemas/MetadataField" required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/TargetingRuleVerdict" + $ref: "#/components/schemas/MetadataField" description: OK "400": content: @@ -6126,6 +21613,18 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -6140,26 +21639,26 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:feature_flags - summary: Check a targeting rule + - write:metadata_fields + summary: Update a metadata field tags: - - featureflags - /feature-flags/targeting/test: + - metadataFields + /metadata-fields/{id}/archive: post: - description: "Runs a rule the way an evaluation would, without a flag and without writing anything: the context is enriched from the same sources (license, entitlements, instance, customer, deployment zone), anything the caller forged under __kaiten is discarded the same way, and the same engine answers. The response carries the enriched facts so an author can see exactly what the rule read — which is usually the answer to why it did or did not match. Nothing is metered or audited: this is authoring, not serving." - operationId: test-targeting-rule - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/TargetingRuleTrial" - required: true + description: Soft-deletes a metadata field. The row stays in the DB (its archived_at is set) so historic metadata is still interpretable; the field stops appearing in the active schema composition. + operationId: archive-metadata-field + parameters: + - in: path + name: id + required: true + schema: + type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/TargetingRuleRehearsal" + $ref: "#/components/schemas/MetadataField" description: OK "400": content: @@ -6179,6 +21678,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -6193,23 +21698,39 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:feature_flags - summary: Rehearse a targeting rule against a context + - write:metadata_fields + summary: Archive a metadata field tags: - - featureflags - /feature-flags/{featureFlagSlug}: - delete: - description: Delete a featureflag with the provided details - operationId: delete-feature-flag + - metadataFields + /metadata-fields/{id}/dry-run: + post: + description: Computes, server-side, how many existing resources of this field's resource type carry a value under this field's key that would NOT satisfy the supplied candidate JSON Schema, plus a small sample. Read-only — does not mutate the field. Replaces the former client-side dry-run that pulled every resource's metadata. + operationId: dry-run-metadata-field parameters: - in: path - name: featureFlagSlug + name: id required: true schema: type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MetadataFieldSchemaProposal" + required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Impact" + description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -6242,16 +21763,17 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:feature_flags - summary: Delete a featureflag + - write:metadata_fields + summary: Preview the impact of a metadata field schema change tags: - - featureflags - get: - description: Get a feature flag with the provided slug - operationId: get-feature-flag + - metadataFields + /metadata-fields/{id}/unarchive: + post: + description: Restores a previously archived metadata field (clears its archived_at). The field re-enters the active schema composition. Returns 409 if an active field already uses the same key for this resource type, or 404 if the field does not exist or is not archived. + operationId: unarchive-metadata-field parameters: - in: path - name: featureFlagSlug + name: id required: true schema: type: string @@ -6260,8 +21782,14 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/FeatureFlag" + $ref: "#/components/schemas/MetadataField" description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -6280,6 +21808,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -6292,18 +21826,89 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + security: + - bearerAuth: + - write:metadata_fields + summary: Unarchive a metadata field + tags: + - metadataFields + /ofrep/v1/evaluate/flags: + post: + description: |- + OFREP bulk evaluation request. + The endpoint is called by the client providers to evaluate all flags at once. + operationId: evaluateFlagsBulk + parameters: + - description: The request will be processed only if ETag doesn't match any of the values listed. + in: header + name: If-None-Match + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/BulkEvaluationRequest" + description: EvaluateVariant multiple flags in one request + responses: + "200": + content: + application/json: + schema: + oneOf: + - properties: + flags: + description: Array of evaluation results + items: + oneOf: + - $ref: "#/components/schemas/EvaluationSuccess" + - $ref: "#/components/schemas/EvaluationFailure" + type: array + - $ref: "#/components/schemas/BulkEvaluationFailure" + description: OFREP successful evaluation response + headers: + ETag: + description: Entity tag used for cache validation + schema: + type: string + "304": + description: Bulk evaluation is not modified + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/BulkEvaluationFailure" + description: Bad evaluation request + "401": + description: Unauthorized - You need credentials to access the API + "403": + description: Forbidden - You are not authorized to access the API + "429": + description: Rate limit reached on the Flag Management System + headers: + Retry-After: + description: Indicates when to retry the request again + schema: + type: string + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/BulkEvaluationFailure" + description: Internal server error security: - bearerAuth: - read:feature_flags - summary: Get a feature flag by slug + summary: OFREP bulk flag evaluation contract tags: - - featureflags - put: - description: Update a featureflag with the provided details - operationId: update-feature-flag + - OFREP Core + /ofrep/v1/evaluate/flags/{key}: + post: + description: EvaluateVariant a single feature flag for a given key + operationId: evaluateFlag parameters: - in: path - name: featureFlagSlug + name: key required: true schema: type: string @@ -6311,42 +21916,61 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/FeatureFlag" - description: Feature flag details + $ref: "#/components/schemas/EvaluationRequest" + description: Evaluation context required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/EvaluationSuccess" + description: Flag evaluated successfully "400": content: - application/problem+json: + application/json: schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": + $ref: "#/components/schemas/EvaluationFailure" + description: Evaluation failed + "500": content: - application/problem+json: + application/json: schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": + $ref: "#/components/schemas/EvaluationFailure" + description: Internal error + security: + - bearerAuth: + - read:feature_flags + summary: OFREP single flag evaluation contract + tags: + - OFREP Core + /openfeature/v0/manifest: + get: + description: Returns a manifest of all feature flags that have a fallback_value set in their metadata + operationId: get-openfeature-manifest + responses: + "200": content: - application/problem+json: + application/json: schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": + $ref: "#/components/schemas/ManifestEnvelope" + description: OK + headers: + X-Manifest-Capabilities: + schema: + type: string + "401": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Not Found - "422": + description: Unauthorized + "403": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Unprocessable Entity + description: Forbidden "500": content: application/problem+json: @@ -6355,39 +21979,49 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:feature_flags - summary: Update a featureflag + - read:feature_flags + summary: Get OpenFeature manifest tags: - - featureflags - /instances: + - OpenFeature + /public/catalog: get: - description: Returns a cursor-paginated page of instances for the current organization. - operationId: getInstances + description: "What a pricing page shows: for each licence family the organization made public, its default version with its ACTIVE prices and user-facing entitlements, and the same for public add-on families. Read with a publishable key (X-Kaiten-Publishable-Key); the organization is the key's. Amounts are in minor units; never sum metered prices into a headline. Cacheable for 60 seconds." + operationId: getPublicCatalog parameters: - - description: Opaque pagination cursor from a previous response's nextCursor + - description: Only this licence family explode: false in: query - name: cursor + name: familySlug schema: - description: Opaque pagination cursor from a previous response's nextCursor + description: Only this licence family + examples: + - pro type: string - - description: Maximum number of entries to return (default 50, max 200) + - description: addons (the default) lists the public add-ons too; none leaves them out explode: false in: query - name: limit + name: include schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + description: addons (the default) lists the public add-ons too; none leaves them out + items: + enum: + - addons + - none + type: string + type: + - array + - "null" responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageInstance" + $ref: "#/components/schemas/PublicCatalog" description: OK + headers: + Cache-Control: + schema: + type: string "400": content: application/problem+json: @@ -6412,33 +22046,45 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Unprocessable Entity + "429": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Too Many Requests "500": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - - bearerAuth: - - read:instances - summary: List all instances + - publishableKey: [] + summary: Get the public catalogue tags: - - instances + - public + /public/session/checkout: post: - description: Create a new instance with the provided details - operationId: createInstance + description: "Subscribes the session's instance to a price of the public catalogue, with add-ons and a voucher, in one call. With dryRun, answers 200 status=preview and what would be billed today, changing nothing. When a payment method has to be saved first, answers 200 status=requires_payment_method with a setup page: send the customer there, then call again with its setupSessionId. Otherwise answers 201 status=subscribed: the invoice of the first period has been pushed and charged, and payment.status says how that went -- poll GET /public/session/invoices on processing or requires_action. Needs a session bound to an instance." + operationId: createSessionCheckout requestBody: content: application/json: schema: - $ref: "#/components/schemas/Instance" + $ref: "#/components/schemas/SessionCheckoutOrder" required: true responses: "201": content: application/json: schema: - $ref: "#/components/schemas/Instance" + $ref: "#/components/schemas/SessionCheckout" description: Created "400": content: @@ -6458,12 +22104,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found "409": content: application/problem+json: @@ -6476,6 +22116,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Unprocessable Entity + "429": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Too Many Requests "500": content: application/problem+json: @@ -6489,28 +22135,39 @@ paths: $ref: "#/components/schemas/Problem" description: Service Unavailable security: - - bearerAuth: - - write:instances - summary: Create a new instance + - customerSession: [] + summary: Check out tags: - - instances - /instances/{instanceSlug}: - delete: - description: Delete an instance with the provided slug - operationId: deleteInstance + - public + /public/session/invoices: + get: + description: "The session's customer's issued invoices -- its instance's, for a session bound to one -- newest first, with how to pay each. An invoice still awaiting the outcome of its payment is read from the payment provider first, at most every 30 seconds: poll this after a checkout answered processing or requires_action." + operationId: listSessionInvoices parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true + - description: Opaque cursor from the previous page's nextCursor + explode: false + in: query + name: cursor schema: - description: Instance slug - examples: - - instance-slug + description: Opaque cursor from the previous page's nextCursor type: string + - description: Page size, 50 by default, 200 at most + explode: false + in: query + name: limit + schema: + description: Page size, 50 by default, 200 at most + format: int32 + maximum: 200 + minimum: 0 + type: integer responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PageSessionInvoice" + description: OK "400": content: application/problem+json: @@ -6529,18 +22186,18 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": + "422": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Not Found - "422": + description: Unprocessable Entity + "429": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Unprocessable Entity + description: Too Many Requests "500": content: application/problem+json: @@ -6548,31 +22205,37 @@ paths: $ref: "#/components/schemas/Problem" description: Internal Server Error security: - - bearerAuth: - - write:instances - summary: Delete an instance + - customerSession: [] + summary: List the customer's invoices tags: - - instances + - public + /publishable-keys: get: - description: Retrieve an instance by their unique slug - operationId: getInstance + description: The organization's publishable keys, newest first. The keys themselves are never returned, only their last four characters. + operationId: listPublishableKeys parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true + - description: Also list revoked keys + explode: false + in: query + name: includeRevoked schema: - description: Instance slug - examples: - - instance-slug - type: string + description: Also list revoked keys + type: boolean responses: "200": content: application/json: schema: - $ref: "#/components/schemas/Instance" + items: + $ref: "#/components/schemas/PublishableKey" + type: array description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -6585,12 +22248,58 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": + "422": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Not Found + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:publishable_keys + summary: List publishable keys + tags: + - publishable-keys + post: + description: Issues a pk_ key for a web page to read the organization's public catalogue (GET /api/public/catalog) and nothing else. The key is returned once; only its digest is stored. + operationId: createPublishableKey + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PublishableKeyDraft" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/PublishableKeyCreated" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden "422": content: application/problem+json: @@ -6605,32 +22314,35 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:instances - summary: Get an instance by slug + - write:publishable_keys + summary: Create a publishable key tags: - - instances + - publishable-keys + /publishable-keys/{keyId}: patch: - description: Partially update an instance. Currently supports the operational status and the commercial lifecycle stage. - operationId: patchInstance + description: Changes a live key's label or allowed origins. A revoked key answers 409. + operationId: updatePublishableKey parameters: - - description: Instance slug + - description: Publishable key id in: path - name: instanceSlug + name: keyId required: true schema: - description: Instance slug - examples: - - instance-slug + description: Publishable key id type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/PatchInstanceBody" + $ref: "#/components/schemas/PublishableKeyPatch" required: true - responses: - "204": - description: No Content + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PublishableKey" + description: OK "400": content: application/problem+json: @@ -6655,6 +22367,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -6669,32 +22387,29 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:instances - summary: Patch an instance + - write:publishable_keys + summary: Update a publishable key tags: - - instances - put: - description: Update an instance with the provided details - operationId: updateInstance + - publishable-keys + /publishable-keys/{keyId}/revoke: + post: + description: The key stops authenticating on the next request. Idempotent; revocation is final. + operationId: revokePublishableKey parameters: - - description: Instance slug + - description: Publishable key id in: path - name: instanceSlug + name: keyId required: true schema: - description: Instance slug - examples: - - instance-slug + description: Publishable key id type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Instance" - required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PublishableKey" + description: OK "400": content: application/problem+json: @@ -6719,12 +22434,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -6739,44 +22448,21 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:instances - summary: Update an instance + - write:publishable_keys + summary: Revoke a publishable key tags: - - instances - /instances/{instanceSlug}/audit-trails: + - publishable-keys + /releases: get: - description: "Returns audit trail events for a given instance, optionally filtered by event name and time range. Results are cursor-paginated (default limit: 50, max: 200) — pass the previous response's nextCursor as the cursor parameter to fetch the next page." - operationId: getAuditTrails + description: Returns a cursor-paginated page of releases for the current organization. + operationId: list-releases parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) - explode: false - in: query - name: event_name - schema: - description: Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) - type: string - - description: RFC3339 timestamp — include entries with timestamp ≥ this value - explode: false - in: query - name: after - schema: - description: RFC3339 timestamp — include entries with timestamp ≥ this value - type: string - - description: RFC3339 timestamp — include entries with timestamp ≤ this value + - description: Opaque pagination cursor from a previous response's nextCursor explode: false in: query - name: before + name: cursor schema: - description: RFC3339 timestamp — include entries with timestamp ≤ this value + description: Opaque pagination cursor from a previous response's nextCursor type: string - description: Maximum number of entries to return (default 50, max 200) explode: false @@ -6788,19 +22474,12 @@ paths: maximum: 200 minimum: 1 type: integer - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor - type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageAuditTrail" + $ref: "#/components/schemas/PageRelease" description: OK "400": content: @@ -6820,12 +22499,70 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:releases + summary: List releases + tags: + - releases + post: + description: "Create a new release with the provided details and link the requested components. A release is immutable: there is no update endpoint, and the component list cannot change afterwards. Correcting one means deleting it and creating a new one, which starts a new deployment history." + operationId: create-release + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Release" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Release" + description: Created + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden "404": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -6838,37 +22575,35 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:instances - summary: List audit trail entries for an instance + - write:releases + summary: Create a new release tags: - - instances - /instances/{instanceSlug}/entitlements/usage: - get: - description: Retrieve a list of all entitlements usage metrics for a specific instance - operationId: getEntitlementsUsageMetrics + - releases + /releases/{releaseSlug}: + delete: + description: Delete a release by their slug. Since a release is immutable, this plus a fresh create is the only way to change one -- and it discards the deployment history recorded against the old release. A release still deployed to a zone cannot be deleted (409). + operationId: delete-release parameters: - - description: Instance slug + - description: Release slug in: path - name: instanceSlug + name: releaseSlug required: true schema: - description: Instance slug + description: Release slug examples: - - instance-slug + - release-slug type: string responses: - "200": - content: - application/json: - schema: - items: - $ref: "#/components/schemas/EntitlementUsage" - type: - - array - - "null" - description: OK + "204": + description: No Content "400": content: application/problem+json: @@ -6893,6 +22628,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -6907,46 +22648,30 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:instances - summary: List all entitlements usage metrics + - write:releases + summary: Delete a release tags: - - instances - /instances/{instanceSlug}/entitlements/{entitlementSlug}/usage: + - releases get: - description: Retrieve the usage metrics for a specific entitlement in a given instance - operationId: getEntitlementUsageMetrics + description: Returns a single release by their slug. + operationId: get-release-by-slug parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Entitlement slug + - description: Release slug in: path - name: entitlementSlug + name: releaseSlug required: true schema: - description: Entitlement slug + description: Release slug examples: - - entitlement-slug + - release-slug type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/EntitlementUsage" + $ref: "#/components/schemas/Release" description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request "401": content: application/problem+json: @@ -6979,54 +22704,39 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:instances - summary: Get entitlement usage metrics for an instance + - read:releases + summary: Get a release by slug tags: - - instances - post: - description: "Report a usage metric for a specific entitlement in a given instance, with optional metadata. The server dates every report on receipt; the request carries no timestamp. Send a transactionId to make retries safe: without one, a report sent twice counts twice." - operationId: reportEntitlementUsageMetric + - deploymentZones + /service-accounts: + get: + description: Returns a cursor-paginated page of service accounts (machine users) for the current organization. + operationId: get-service-accounts parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Entitlement slug - in: path - name: entitlementSlug - required: true + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor schema: - description: Entitlement slug - examples: - - entitlement-slug + description: Opaque pagination cursor from a previous response's nextCursor type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/ReportEntitlementUsageBody" - required: true + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/EntitlementUsage" + $ref: "#/components/schemas/PageServiceAccount" description: OK - headers: - Idempotent-Replayed: - schema: - description: "true when the report replays an earlier one sent with the same transactionId: the body is that report's original response and nothing was counted again" - type: string - Kaiten-Metadata-Dropped: - schema: - description: too_large when the report's metadata was above 4 KiB and was not stored; the report itself was counted - type: string "400": content: application/problem+json: @@ -7051,12 +22761,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -7069,91 +22773,30 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable security: - bearerAuth: - - write:instances - summary: Report entitlement usage metric for an instance + - read:tokens + summary: List all service accounts tags: - - instances - /instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports: - get: - description: "The usage history of one instance and entitlement: every accepted report in the range, with the counter before and after it and the limit in force, in reportSeq order, paged with afterSeq. Decimals are strings. Reports are kept for the organization's usage history retention." - operationId: listUsageReports - parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Entitlement slug - in: path - name: entitlementSlug - required: true - schema: - description: Entitlement slug - examples: - - entitlement-slug - type: string - - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. - explode: false - in: query - name: from - schema: - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. - format: date-time - type: string - - description: End of the range, exclusive (RFC 3339). Defaults to now. - explode: false - in: query - name: to - schema: - description: End of the range, exclusive (RFC 3339). Defaults to now. - format: date-time - type: string - - description: "Return the reports after this reportSeq: the nextAfterSeq of the previous page" - explode: false - in: query - name: afterSeq - schema: - description: "Return the reports after this reportSeq: the nextAfterSeq of the previous page" - format: int64 - minimum: 0 - type: integer - - description: Maximum number of reports to return (default 100, max 500) - explode: false - in: query - name: limit - schema: - description: Maximum number of reports to return (default 100, max 500) - format: int32 - maximum: 500 - minimum: 1 - type: integer - - description: Only the report sent with this idempotency key - explode: false - in: query - name: transactionId - schema: - description: Only the report sent with this idempotency key - maxLength: 128 - type: string + - service-accounts + post: + description: Create a new service account (machine user) with the provided name. Service accounts can be used to generate API tokens for programmatic access. + operationId: create-service-account + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ServiceAccount" + description: Service account details + required: true responses: - "200": + "201": content: application/json: schema: - $ref: "#/components/schemas/UsageReportPage" - description: OK + $ref: "#/components/schemas/ServiceAccount" + description: Created service account + description: Created "400": content: application/problem+json: @@ -7178,6 +22821,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -7190,75 +22839,40 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:instances - summary: List an entitlement's usage reports for an instance + - write:tokens + summary: Create a new service account tags: - - instances - /instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export: + - service-accounts + /service-accounts/{serviceAccountSlug}: get: - description: Streams every report of one instance and entitlement in the range as CSV or NDJSON, in reportSeq order. Decimals are written exactly as the journal stores them. - operationId: exportUsageReports + description: Retrieve details of a specific service account (machine user) by its slug. + operationId: get-service-account parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Entitlement slug + - description: Service account slug in: path - name: entitlementSlug + name: serviceAccountSlug required: true schema: - description: Entitlement slug - examples: - - entitlement-slug - type: string - - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - explode: false - in: query - name: from - schema: - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - format: date-time - type: string - - description: End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. - explode: false - in: query - name: to - schema: - description: End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. - format: date-time - type: string - - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat." - explode: false - in: query - name: format - schema: - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat." + description: Service account slug examples: - - csv + - service-account-slug type: string responses: "200": content: - application/x-ndjson: - schema: - type: string - text/csv: - schema: - type: string - description: "The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json" - headers: - Content-Disposition: - description: attachment, with a file name naming the range + application/json: schema: - type: string + $ref: "#/components/schemas/ServiceAccount" + description: Service account details + description: OK "400": content: application/problem+json: @@ -7297,33 +22911,30 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:instances - summary: Export an entitlement's usage reports for an instance + - read:tokens + summary: Get a service account by slug tags: - - instances - /instances/{instanceSlug}/integrations/{integrationName}: - delete: - description: Delete a single integration for an instance - operationId: delete-instance-integration + - service-accounts + put: + description: Update the name of a service account (machine user) by its slug. + operationId: update-service-account parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Integration adapter name + - description: Service account slug in: path - name: integrationName + name: serviceAccountSlug required: true schema: - description: Integration adapter name + description: Service account slug examples: - - kaiten.integration.crm.attio + - service-account-slug type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ServiceAccount" + description: Service account update details + required: true responses: "204": description: No Content @@ -7365,39 +22976,54 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:instances - summary: Delete an instance integration + - write:tokens + summary: Update a service account tags: - - instances + - service-accounts + /service-accounts/{serviceAccountSlug}/tokens: get: - description: Retrieve a single integration for an instance - operationId: get-instance-integration + description: Returns a cursor-paginated page of API tokens associated with a service account. The organization context is derived from the authenticated user's JWT token. Token secret values are never returned, only metadata. + operationId: get-service-account-tokens parameters: - - description: Instance slug + - description: Service account slug in: path - name: instanceSlug + name: serviceAccountSlug required: true schema: - description: Instance slug + description: Service account slug examples: - - instance-slug + - service-account-slug type: string - - description: Integration adapter name - in: path - name: integrationName - required: true + - description: Opaque pagination cursor from a previous response's nextCursor + explode: false + in: query + name: cursor schema: - description: Integration adapter name - examples: - - kaiten.integration.crm.attio + description: Opaque pagination cursor from a previous response's nextCursor type: string + - description: Maximum number of entries to return (default 50, max 200) + explode: false + in: query + name: limit + schema: + description: Maximum number of entries to return (default 50, max 200) + format: int32 + maximum: 200 + minimum: 1 + type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/InstanceIntegration" + $ref: "#/components/schemas/PageToken" description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -7430,45 +23056,38 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:instances - summary: Get an instance integration + - read:tokens + summary: List all tokens for a service account tags: - - instances + - service-accounts post: - description: Create a single integration for an instance - operationId: create-instance-integration + description: Create a new API token for a service account. The token value is only returned once upon creation and cannot be retrieved again. The organization context is derived from the authenticated user's JWT token. + operationId: create-service-account-token parameters: - - description: Instance slug - in: path - name: instanceSlug - required: true - schema: - description: Instance slug - examples: - - instance-slug - type: string - - description: Integration adapter name + - description: Service account slug in: path - name: integrationName + name: serviceAccountSlug required: true schema: - description: Integration adapter name + description: Service account slug examples: - - kaiten.integration.crm.attio + - service-account-slug + format: text type: string requestBody: content: application/json: schema: - $ref: "#/components/schemas/InstanceIntegration" - description: Integration payload + $ref: "#/components/schemas/PlainToken" + description: Token creation details required: true responses: "201": content: application/json: schema: - $ref: "#/components/schemas/InstanceIntegration" + $ref: "#/components/schemas/PlainToken" + description: Created token with secret value (only shown once) description: Created "400": content: @@ -7512,48 +23131,46 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:instances - summary: Create an instance integration + - write:tokens + summary: Create a new token for a service account tags: - - instances - put: - description: Update a single integration for an instance - operationId: update-instance-integration + - service-accounts + /service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}: + delete: + description: Revoke an API token for a service account. Once revoked, the token can no longer be used for authentication. The organization context is derived from the authenticated user's JWT token. + operationId: delete-service-account-token parameters: - - description: Instance slug + - description: Service account slug in: path - name: instanceSlug + name: serviceAccountSlug required: true schema: - description: Instance slug + description: Service account slug examples: - - instance-slug + - service-account-slug + format: text type: string - - description: Integration adapter name + - description: Token slug to revoke in: path - name: integrationName + name: tokenSlug required: true schema: - description: Integration adapter name + description: Token slug to revoke examples: - - kaiten.integration.crm.attio + - my-token-slug + format: text type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/InstanceIntegration" - description: Integration payload - required: true responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/InstanceIntegration" - description: OK + "204": + description: No Content "400": content: application/problem+json: @@ -7578,12 +23195,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -7598,39 +23209,137 @@ paths: description: Internal Server Error security: - bearerAuth: - - write:instances - summary: Update an instance integration + - write:tokens + summary: Revoke a token for a service account tags: - - instances - /integration/{adapter}/customer/{externalId}: + - service-accounts + /usage/reports/export: get: - description: Resolve a customer through one of its integrations using adapter + external ID. - operationId: get-customer-integration-by-external-id + description: Streams every usage report of the organization in the range, across instances and entitlements, as CSV or NDJSON, ordered by reportedAt. Filters narrow it to one instance or one entitlement, including deleted ones by ID. Use it to keep the usage history before deleting the organization. + operationId: exportOrganizationUsageReports parameters: - - description: Integration adapter without the kaiten.integration. prefix - in: path - name: adapter - required: true + - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + explode: false + in: query + name: from schema: - description: Integration adapter without the kaiten.integration. prefix - examples: - - crm.attio + description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + format: date-time type: string - - description: External identifier in the third-party system - in: path - name: externalId - required: true + - description: End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. + explode: false + in: query + name: to schema: - description: External identifier in the third-party system + description: End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. + format: date-time + type: string + - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat." + explode: false + in: query + name: format + schema: + description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat." examples: - - rec_12345 + - csv + type: string + - description: Only this instance's reports + explode: false + in: query + name: instanceSlug + schema: + description: Only this instance's reports type: string + - description: Only this instance's reports. Reaches a deleted instance, whose reports are kept. + explode: false + in: query + name: instanceId + schema: + description: Only this instance's reports. Reaches a deleted instance, whose reports are kept. + format: uuid + type: string + - description: Only this entitlement's reports + explode: false + in: query + name: entitlementSlug + schema: + description: Only this entitlement's reports + type: string + - description: Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. + explode: false + in: query + name: entitlementId + schema: + description: Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. + format: uuid + type: string + responses: + "200": + content: + application/x-ndjson: + schema: + type: string + text/csv: + schema: + type: string + description: "The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json" + headers: + Content-Disposition: + description: attachment, with a file name naming the range + schema: + type: string + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request + "401": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found + "422": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Unprocessable Entity + "500": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Internal Server Error + security: + - bearerAuth: + - read:instances + summary: Export the organization's usage reports + tags: + - instances + /v1/notification-preferences: + get: + description: "Every notifiable event, with this user's effective value per channel: their own choice where they made one, the catalogue default otherwise. Events absent from the catalogue of a deployment never appear, which is what keeps high-volume system events out of the feed." + operationId: getNotificationPreferences responses: "200": content: application/json: schema: - $ref: "#/components/schemas/CustomerIntegrationResource" + $ref: "#/components/schemas/PreferenceMatrix" description: OK "401": content: @@ -7644,18 +23353,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity "500": content: application/problem+json: @@ -7664,45 +23361,25 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:customers - summary: Get a customer by integration external ID + - read:notifications + summary: Read the caller's notification preferences tags: - - integrations - - customers - patch: - description: Create or partially update a customer resolved through adapter + external ID. Missing fields are left unchanged. - operationId: upsert-customer-integration-by-external-id - parameters: - - description: Integration adapter without the kaiten.integration. prefix - in: path - name: adapter - required: true - schema: - description: Integration adapter without the kaiten.integration. prefix - examples: - - crm.attio - type: string - - description: External identifier in the third-party system - in: path - name: externalId - required: true - schema: - description: External identifier in the third-party system - examples: - - rec_12345 - type: string + - notifications + put: + description: Stores the signed-in user's choices and answers with the whole matrix. A value that equals the catalogue default is stored as no row at all, so a later change to that default still reaches this user. + operationId: putNotificationPreferences requestBody: content: application/json: schema: - $ref: "#/components/schemas/CustomerBody" + $ref: "#/components/schemas/PreferenceChoices" required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/CustomerIntegrationResource" + $ref: "#/components/schemas/PreferenceMatrix" description: OK "400": content: @@ -7722,18 +23399,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -7746,67 +23411,88 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable security: - bearerAuth: - - write:customers - summary: Upsert a customer by integration external ID + - write:notifications + summary: Set the caller's notification preferences tags: - - integrations - - customers - /integration/{adapter}/instance/{externalId}: + - notifications + /v1/notifications: get: - description: Resolve an instance through one of its integrations using adapter + external ID. - operationId: get-instance-integration-by-external-id + description: Returns the signed-in user's notification feed, newest first, with the unread count. Notifications are a view over this organization's audit trail, narrowed to the events the user subscribes to; the id of a notification is the id of the audit trail entry it reports. + operationId: listNotifications parameters: - - description: Integration adapter without the kaiten.integration. prefix - in: path - name: adapter - required: true + - description: Which notifications to return (default all) + explode: false + in: query + name: status schema: - description: Integration adapter without the kaiten.integration. prefix - examples: - - crm.attio + description: Which notifications to return (default all) + enum: + - all + - unread type: string - - description: External identifier in the third-party system - in: path - name: externalId - required: true + - description: "Only notifications about these kinds of object; repeat the parameter for several (default: all)" + explode: true + in: query + name: objectType schema: - description: External identifier in the third-party system - examples: - - rec_12345 + description: "Only notifications about these kinds of object; repeat the parameter for several (default: all)" + items: + enum: + - instance + - customer + - release + - deployment_zone + - component + - license + - token + type: string + type: + - array + - "null" + - description: Opaque cursor from a previous response's next_cursor + explode: false + in: query + name: cursor + schema: + description: Opaque cursor from a previous response's next_cursor type: string + - description: Page size (default 20, max 50) + explode: false + in: query + name: limit + schema: + description: Page size (default 20, max 50) + format: int32 + maximum: 50 + minimum: 1 + type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/InstanceIntegrationResource" + $ref: "#/components/schemas/List" description: OK - "401": + "400": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": + description: Bad Request + "401": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Forbidden - "404": + description: Unauthorized + "403": content: application/problem+json: schema: $ref: "#/components/schemas/Problem" - description: Not Found + description: Forbidden "422": content: application/problem+json: @@ -7821,45 +23507,26 @@ paths: description: Internal Server Error security: - bearerAuth: - - read:instances - summary: Get an instance by integration external ID + - read:notifications + summary: List the caller's notifications tags: - - integrations - - instances - patch: - description: Create or partially update an instance resolved through adapter + external ID. Missing fields are left unchanged. - operationId: upsert-instance-integration-by-external-id - parameters: - - description: Integration adapter without the kaiten.integration. prefix - in: path - name: adapter - required: true - schema: - description: Integration adapter without the kaiten.integration. prefix - examples: - - crm.attio - type: string - - description: External identifier in the third-party system - in: path - name: externalId - required: true - schema: - description: External identifier in the third-party system - examples: - - rec_12345 - type: string + - notifications + /v1/notifications/mark-read: + post: + description: "Marks the given notifications read for the signed-in user, or all of them with all: true. Ids belonging to another organization are ignored rather than rejected, so a retry of a partially applied call is safe." + operationId: markNotificationsRead requestBody: content: application/json: schema: - $ref: "#/components/schemas/InstanceBody" + $ref: "#/components/schemas/ReadSelection" required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/InstanceIntegrationResource" + $ref: "#/components/schemas/MarkReadResult" description: OK "400": content: @@ -7879,18 +23546,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -7903,47 +23558,49 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable security: - bearerAuth: - - write:instances - summary: Upsert an instance by integration external ID + - write:notifications + summary: Mark notifications read tags: - - integrations - - instances - /license-families: + - notifications + /vouchers: get: - description: "Returns a cursor-paginated page of license families for the current organization, each with the version it currently resolves to: the family's default version, or its highest-numbered published version. A family whose versions are all drafts or all archived is still listed, with no current version." - operationId: list-license-families + description: The organization's vouchers, newest first, with their codes. Requires billing to be enabled for the organization. + operationId: listVouchers parameters: - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false + - explode: false in: query - name: cursor + name: status schema: - description: Opaque pagination cursor from a previous response's nextCursor + enum: + - DRAFT + - ACTIVE + - EXPIRED + - EXHAUSTED + - ARCHIVED type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false + - explode: false in: query - name: limit + name: voucherType schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + enum: + - PRICE + - ENTITLEMENT_BOOST + type: string + - explode: false + in: query + name: restrictedCustomerSlug + schema: + type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageLicenseFamilyView" + items: + $ref: "#/components/schemas/Voucher" + type: array description: OK "400": content: @@ -7963,6 +23620,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -7975,58 +23638,34 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:licenses - summary: List license families + - read:vouchers + summary: List vouchers tags: - - license-families - /license-families/{familySlug}: - get: - description: |- - Resolves a license family to the version it currently serves, returned as currentVersion: the family's default version if it has one, otherwise its highest-numbered PUBLISHED version. This is the stable address for "the current version of this product", so a caller never has to name a version slug. - - A family with a default keeps serving it when a newer version is published -- the default is what the vendor puts forward, and superseding it is an explicit act (make another version the default, or unset it). A family without a default follows publication: the newest PUBLISHED version wins. - - Returns 404 GetLicenseFamily.NoPublishedVersion when the family exists but has no PUBLISHED version, since there is nothing to resolve to. Use ?include=versions to read such a family anyway: with the history requested, the family is returned with its versions and no currentVersion. Use ?version=N for explicit access to one version, including draft and archived ones. - operationId: get-license-family - parameters: - - description: License family slug - in: path - name: familySlug - required: true - schema: - description: License family slug - examples: - - enterprise-license - type: string - - description: "Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply." - explode: false - in: query - name: version - schema: - description: "Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply." - format: int32 - minimum: 1 - type: integer - - description: "Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type." - explode: false - in: query - name: include - schema: - description: "Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type." - items: - enum: - - versions - type: string - type: array + - vouchers + post: + description: "Creates a DRAFT voucher: a PRICE discount or an ENTITLEMENT_BOOST. The code is generated when none is given, and returned. Emits VOUCHER_CREATED, without the code. Requires billing to be enabled for the organization." + operationId: createVoucher + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/VoucherDraft" + required: true responses: - "200": + "201": content: application/json: schema: - $ref: "#/components/schemas/LicenseFamilyView" - description: OK + $ref: "#/components/schemas/Voucher" + description: Created "400": content: application/problem+json: @@ -8051,6 +23690,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -8063,40 +23708,34 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:licenses - summary: Get a license family by slug + - write:vouchers + summary: Create a voucher tags: - - license-families - /licenses: - get: - description: Returns a cursor-paginated page of licenses for the current organization. - operationId: get-licenses - parameters: - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor - type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + - vouchers + /vouchers/lookup: + post: + description: Finds the voucher a code names, matched without case or separators. The code travels in the body, never in a URL. Requires billing to be enabled for the organization. + operationId: lookupVoucher + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/VoucherCode" + required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageLicense" + $ref: "#/components/schemas/Voucher" description: OK "400": content: @@ -8116,6 +23755,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Not Found "422": content: application/problem+json: @@ -8128,31 +23773,35 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:licenses - summary: GetUser all licenses + - read:vouchers + summary: Find a voucher by code tags: - - licenses + - vouchers + /vouchers/validate: post: - description: |- - Create a new license with the provided details. Without familySlug or familyId this creates a new license family and the license becomes its version 1. With one of them it adds the next version to that family (familySlug names it by slug, familyId by identifier; sent together they must agree), and the version number is assigned by the server as the next one in the family's sequence. The version starts PUBLISHED, or DRAFT when lifecycleState says so; ARCHIVED is refused (422 CreateLicense.LifecycleStateNotSettable), because a version is archived with archive-license once it has been on sale. - - Where the deployment limits how many licenses an organization may have, only a new family counts against that limit (409 CreateLicense.EntitlementLimitReached once it is reached): a new version of an existing family never does. - operationId: create-license + description: "Runs the redemption checks without redeeming: the voucher's own, and, with instanceSlug, the instance's. Answers 200 with valid, and the first failing reason (and eligibility rule) otherwise. Requires billing to be enabled for the organization." + operationId: validateVoucher requestBody: content: application/json: schema: - $ref: "#/components/schemas/License" + $ref: "#/components/schemas/VoucherCheck" required: true responses: - "201": + "200": content: application/json: schema: - $ref: "#/components/schemas/License" - description: Created + $ref: "#/components/schemas/Validity" + description: OK "400": content: application/problem+json: @@ -8177,12 +23826,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -8203,27 +23846,29 @@ paths: description: Service Unavailable security: - bearerAuth: - - write:licenses - summary: Create a new license + - read:voucher_redemptions + summary: Validate a voucher code tags: - - licenses - /licenses/{licenseSlug}: - delete: - description: Delete a license with the provided details. Deleting the last version of a license family also deletes the family, and frees its slug for a new product to take. A deleted version's number is not reused by the next version of its family. - operationId: delete-license + - vouchers + /vouchers/{voucherId}: + get: + description: One voucher, with its code. Requires billing to be enabled for the organization. + operationId: getVoucher parameters: - - description: License slug + - description: Voucher id in: path - name: licenseSlug + name: voucherId required: true schema: - description: License slug - examples: - - license-slug + description: Voucher id type: string responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Voucher" + description: OK "400": content: application/problem+json: @@ -8248,12 +23893,6 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict "422": content: application/problem+json: @@ -8266,32 +23905,48 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:licenses - summary: Delete a license + - read:vouchers + summary: Get a voucher tags: - - licenses - get: - description: Retrieve a license by their unique slug - operationId: get-license + - vouchers + put: + description: Replaces a DRAFT voucher, but its type. An ACTIVE voucher takes a new name, description, expiresAt and maxRedemptions (at least redemptionsCount); its other members must stay as they are (409 UpdateVoucher.NotEditable). Emits VOUCHER_UPDATED. Requires billing to be enabled for the organization. + operationId: updateVoucher parameters: - - description: License slug + - description: Voucher id in: path - name: licenseSlug + name: voucherId required: true schema: - description: License slug - examples: - - license-slug + description: Voucher id type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/VoucherDraft" + required: true responses: "200": content: application/json: schema: - $ref: "#/components/schemas/License" + $ref: "#/components/schemas/Voucher" description: OK + "400": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Bad Request "401": content: application/problem+json: @@ -8310,6 +23965,12 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Not Found + "409": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Conflict "422": content: application/problem+json: @@ -8322,34 +23983,37 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:licenses - summary: Get a license by slug + - write:vouchers + summary: Update a voucher tags: - - licenses - put: - description: Update a license with the provided details - operationId: update-license + - vouchers + /vouchers/{voucherId}/archive: + post: + description: Stops a voucher from being redeemed. Redemptions already made keep applying until revoked. Emits VOUCHER_ARCHIVED. Requires billing to be enabled for the organization. + operationId: archiveVoucher parameters: - - description: License slug + - description: Voucher id in: path - name: licenseSlug + name: voucherId required: true schema: - description: License slug - examples: - - license-slug + description: Voucher id type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/License" - required: true responses: - "204": - description: No Content + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Voucher" + description: OK "400": content: application/problem+json: @@ -8392,32 +24056,36 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:licenses - summary: Update a license + - write:vouchers + summary: Archive a voucher tags: - - licenses - /licenses/{licenseSlug}/archive: + - vouchers + /vouchers/{voucherId}/publish: post: - description: "Withdraws a PUBLISHED license version from sale: its family stops resolving to it and no instance can be assigned to it any more, while instances already on it keep it. Only a published version can be archived (409 ArchiveLicense.NotPublished) -- a draft that was never on sale is deleted instead -- and not while it is its family's default (409 ArchiveLicense.DefaultMustBePublished): make another version the default, or unset it, first. Emits LICENSE_ARCHIVED." - operationId: archive-license + description: Makes a DRAFT voucher redeemable (409 PublishVoucher.NotADraft otherwise). Emits VOUCHER_PUBLISHED. Requires billing to be enabled for the organization. + operationId: publishVoucher parameters: - - description: License version slug + - description: Voucher id in: path - name: licenseSlug + name: voucherId required: true schema: - description: License version slug - examples: - - enterprise-license-v2 + description: Voucher id type: string responses: "200": content: application/json: schema: - $ref: "#/components/schemas/License" + $ref: "#/components/schemas/Voucher" description: OK "400": content: @@ -8461,49 +24129,38 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - write:licenses - summary: Archive a license version + - write:vouchers + summary: Publish a voucher tags: - - licenses - /licenses/{licenseSlug}/entitlements: + - vouchers + /vouchers/{voucherId}/redemptions: get: - description: Returns a cursor-paginated page of entitlements granted by a license, identified by its unique slug. - operationId: get-license-entitlements + description: Every redemption of a voucher, newest first. Requires billing to be enabled for the organization. + operationId: listVoucherRedemptions parameters: - - description: License slug + - description: Voucher id in: path - name: licenseSlug + name: voucherId required: true schema: - description: License slug - examples: - - license-slug - type: string - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor + description: Voucher id type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer responses: "200": content: application/json: schema: - $ref: "#/components/schemas/PageLicenseEntitlement" + items: + $ref: "#/components/schemas/Redemption" + type: array description: OK "400": content: @@ -8541,2133 +24198,1821 @@ paths: schema: $ref: "#/components/schemas/Problem" description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + description: Service Unavailable security: - bearerAuth: - - read:licenses - summary: Get all entitlements for a license + - read:vouchers + summary: List a voucher's redemptions tags: - - licenses + - vouchers +security: + - bearerAuth: [] +servers: + - url: /api +webhooks: + com.kaiten.addon.entitlement.v1.assigned: post: - description: Associate an entitlement with a license by providing the license slug and entitlement details - operationId: associate-entitlement-with-license - parameters: - - description: License slug - in: path - name: licenseSlug - required: true - schema: - description: License slug - examples: - - license-slug - type: string + description: Triggered when an add-on version grants an entitlement. + operationId: onAddonEntitlementAssigned + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/AddonGrantUpdate" + name: + description: Event name + enum: + - ADDON_ENTITLEMENT_ASSIGNED + examples: + - ADDON_ENTITLEMENT_ASSIGNED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.entitlement.v1.assigned + examples: + - com.kaiten.addon.entitlement.v1.assigned + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Entitlement Assigned Webhook + tags: + - webhooks + - addons + com.kaiten.addon.entitlement.v1.unassigned: + post: + description: Triggered when an add-on grant is removed. + operationId: onAddonEntitlementUnassigned + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/AddonGrantUpdate" + name: + description: Event name + enum: + - ADDON_ENTITLEMENT_UNASSIGNED + examples: + - ADDON_ENTITLEMENT_UNASSIGNED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.entitlement.v1.unassigned + examples: + - com.kaiten.addon.entitlement.v1.unassigned + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Entitlement Unassigned Webhook + tags: + - webhooks + - addons + com.kaiten.addon.entitlement.v1.updated: + post: + description: Triggered when an add-on grant changes. + operationId: onAddonEntitlementUpdated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/AddonGrantUpdate" + name: + description: Event name + enum: + - ADDON_ENTITLEMENT_UPDATED + examples: + - ADDON_ENTITLEMENT_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.entitlement.v1.updated + examples: + - com.kaiten.addon.entitlement.v1.updated + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Entitlement Updated Webhook + tags: + - webhooks + - addons + com.kaiten.addon.price.v1.created: + post: + description: Triggered when a price is added to an add-on version. + operationId: onAddonPriceCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/AddonPriceUpdate" + name: + description: Event name + enum: + - ADDON_PRICE_CREATED + examples: + - ADDON_PRICE_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.price.v1.created + examples: + - com.kaiten.addon.price.v1.created + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Price Created Webhook + tags: + - webhooks + - addons + com.kaiten.addon.price.v1.deprecated: + post: + description: Triggered when an add-on price stops being offered. + operationId: onAddonPriceDeprecated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/AddonPriceUpdate" + name: + description: Event name + enum: + - ADDON_PRICE_DEPRECATED + examples: + - ADDON_PRICE_DEPRECATED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.price.v1.deprecated + examples: + - com.kaiten.addon.price.v1.deprecated + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Price Deprecated Webhook + tags: + - webhooks + - addons + com.kaiten.addon.v1.archived: + post: + description: Triggered when an add-on version is withdrawn from sale. + operationId: onAddonArchived + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Addon" + name: + description: Event name + enum: + - ADDON_ARCHIVED + examples: + - ADDON_ARCHIVED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.v1.archived + examples: + - com.kaiten.addon.v1.archived + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Archived Webhook + tags: + - webhooks + - addons + com.kaiten.addon.v1.created: + post: + description: Triggered when an add-on version is created. + operationId: onAddonCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Addon" + name: + description: Event name + enum: + - ADDON_CREATED + examples: + - ADDON_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.v1.created + examples: + - com.kaiten.addon.v1.created + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Created Webhook + tags: + - webhooks + - addons + com.kaiten.addon.v1.deleted: + post: + description: Triggered when an add-on version is deleted. + operationId: onAddonDeleted requestBody: content: application/json: schema: - $ref: "#/components/schemas/LicenseEntitlement" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/DeletedAddon" + name: + description: Event name + enum: + - ADDON_DELETED + examples: + - ADDON_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.v1.deleted + examples: + - com.kaiten.addon.v1.deleted + type: string + required: + - name + - type + - data + type: object required: true responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable - security: - - bearerAuth: - - write:licenses - summary: Associate an entitlement with a license - tags: - - licenses - /licenses/{licenseSlug}/entitlements/{entitlementSlug}: - delete: - description: Delete a license entitlement with the provided details - operationId: delete-license-entitlement - parameters: - - in: path - name: licenseSlug - required: true - schema: - type: string - - in: path - name: entitlementSlug - required: true - schema: - type: string - responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:licenses - summary: Delete a license entitlement + "200": + description: Webhook processed successfully + summary: Add-on Deleted Webhook tags: - - licenses - get: - description: Retrieve a entitlement for a license by their unique slugs - operationId: get-license-entitlement - parameters: - - in: path - name: licenseSlug - required: true - schema: - type: string - - in: path - name: entitlementSlug - required: true - schema: - type: string + - webhooks + - addons + com.kaiten.addon.v1.published: + post: + description: Triggered when a draft add-on version goes on sale. + operationId: onAddonPublished + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Addon" + name: + description: Event name + enum: + - ADDON_PUBLISHED + examples: + - ADDON_PUBLISHED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.v1.published + examples: + - com.kaiten.addon.v1.published + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/LicenseEntitlement" - description: OK - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:licenses - summary: Get a license entitlement + description: Webhook processed successfully + summary: Add-on Published Webhook tags: - - licenses - put: - description: Update an license entitlement with the provided details - operationId: update-license-entitlement - parameters: - - in: path - name: licenseSlug - required: true - schema: - type: string - - in: path - name: entitlementSlug - required: true - schema: - type: string + - webhooks + - addons + com.kaiten.addon.v1.unarchived: + post: + description: Triggered when an archived add-on version goes back on sale. + operationId: onAddonUnarchived + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Addon" + name: + description: Event name + enum: + - ADDON_UNARCHIVED + examples: + - ADDON_UNARCHIVED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.v1.unarchived + examples: + - com.kaiten.addon.v1.unarchived + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Add-on Unarchived Webhook + tags: + - webhooks + - addons + com.kaiten.addon.v1.updated: + post: + description: Triggered when an add-on version, its compatibility or its family's visibility changes. + operationId: onAddonUpdated requestBody: content: application/json: schema: - $ref: "#/components/schemas/LicenseEntitlement" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/AddonUpdate" + name: + description: Event name + enum: + - ADDON_UPDATED + examples: + - ADDON_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.addon.v1.updated + examples: + - com.kaiten.addon.v1.updated + type: string + required: + - name + - type + - data + type: object required: true responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:licenses - summary: Update an license entitlement + "200": + description: Webhook processed successfully + summary: Add-on Updated Webhook tags: - - licenses - /licenses/{licenseSlug}/publish: + - webhooks + - addons + com.kaiten.billing_provider.v1.connected: post: - description: "Puts a DRAFT license version on sale: it becomes PUBLISHED, so it can be made its family's default, and its family resolves to it when the family has no default and this is its highest published version. Only a draft can be published (409 PublishLicense.NotADraft); an archived version goes back on sale with unarchive-license. Emits LICENSE_PUBLISHED." - operationId: publish-license - parameters: - - description: License version slug - in: path - name: licenseSlug - required: true - schema: - description: License version slug - examples: - - enterprise-license-v2 - type: string + description: Triggered when an organization connects a payment provider (activates its connector). + operationId: onBillingProviderConnected + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Connection" + name: + description: Event name + enum: + - BILLING_PROVIDER_CONNECTED + examples: + - BILLING_PROVIDER_CONNECTED + type: string + type: + description: Event type + enum: + - com.kaiten.billing_provider.v1.connected + examples: + - com.kaiten.billing_provider.v1.connected + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/License" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:licenses - summary: Publish a license version + description: Webhook processed successfully + summary: Billing Provider Connected Webhook tags: - - licenses - /licenses/{licenseSlug}/unarchive: + - webhooks + - billing + com.kaiten.billing_provider.v1.disconnected: post: - description: "Puts an ARCHIVED license version back on sale: it is PUBLISHED again, can be assigned to instances, and can be what its family resolves to. Only an archived version can be unarchived (409 UnarchiveLicense.NotArchived). Emits LICENSE_UNARCHIVED." - operationId: unarchive-license - parameters: - - description: License version slug - in: path - name: licenseSlug - required: true - schema: - description: License version slug - examples: - - enterprise-license-v2 - type: string - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/License" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:licenses - summary: Unarchive a license version + description: Triggered when an organization disconnects a payment provider (deactivates its connector). + operationId: onBillingProviderDisconnected + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Connection" + name: + description: Event name + enum: + - BILLING_PROVIDER_DISCONNECTED + examples: + - BILLING_PROVIDER_DISCONNECTED + type: string + type: + description: Event type + enum: + - com.kaiten.billing_provider.v1.disconnected + examples: + - com.kaiten.billing_provider.v1.disconnected + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Billing Provider Disconnected Webhook tags: - - licenses - /metadata-fields: - get: - description: Returns a cursor-paginated page of the active (non-archived) metadata fields declared for the org and the given resource type, ordered by displayOrder then createdAt. - operationId: list-metadata-fields - parameters: - - explode: false - in: query - name: resourceType - required: true - schema: - enum: - - DEPLOYMENT_ZONE - - INSTANCE - type: string - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor - type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + - webhooks + - billing + com.kaiten.billing_provider.v1.sync_failed: + post: + description: Triggered when syncing with a payment provider has failed three passes in a row, once per streak. + operationId: onBillingProviderSyncFailed + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/SyncFailure" + name: + description: Event name + enum: + - BILLING_PROVIDER_SYNC_FAILED + examples: + - BILLING_PROVIDER_SYNC_FAILED + type: string + type: + description: Event type + enum: + - com.kaiten.billing_provider.v1.sync_failed + examples: + - com.kaiten.billing_provider.v1.sync_failed + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/PageMetadataField" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:metadata_fields - summary: List active metadata fields for a resource type + description: Webhook processed successfully + summary: Billing Provider Sync Failed Webhook tags: - - metadataFields + - webhooks + - billing + com.kaiten.component.v1.created: post: - description: Declares a typed metadata field for a given resource type (DEPLOYMENT_ZONE, INSTANCE). The json_schema is validated against JSON Schema 2020-12 before insertion. Restricted to write:metadata_fields scope (admin-only policy). - operationId: create-metadata-field + description: Triggered when a new component is created. + operationId: onComponentCreated requestBody: content: application/json: schema: - $ref: "#/components/schemas/MetadataField" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Component" + name: + description: Event name + enum: + - COMPONENT_CREATED + examples: + - COMPONENT_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.component.v1.created + examples: + - com.kaiten.component.v1.created + type: string + required: + - name + - type + - data + type: object required: true responses: - "201": - content: - application/json: - schema: - $ref: "#/components/schemas/MetadataField" - description: Created - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable - security: - - bearerAuth: - - write:metadata_fields - summary: Create a metadata field + "200": + description: Webhook processed successfully + summary: Component Created Webhook + tags: + - webhooks + - components + com.kaiten.component.v1.deleted: + post: + description: Triggered when a component is deleted. + operationId: onComponentDeleted + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Component" + name: + description: Event name + enum: + - COMPONENT_DELETED + examples: + - COMPONENT_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.component.v1.deleted + examples: + - com.kaiten.component.v1.deleted + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Component Deleted Webhook + tags: + - webhooks + - components + com.kaiten.component.v1.updated: + post: + description: Triggered when a component is updated or auto-versioned. + operationId: onComponentUpdated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Component" + name: + description: Event name + enum: + - COMPONENT_UPDATED + examples: + - COMPONENT_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.component.v1.updated + examples: + - com.kaiten.component.v1.updated + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Component Updated Webhook tags: - - metadataFields - /metadata-fields/reorder: + - webhooks + - components + com.kaiten.customer.payment_method.v1.attached: post: - description: Sets the displayOrder of the listed fields to their position in the array (0-indexed). All ids must belong to the same organization, resource type, and be non-archived; the entire reorder is applied in a single transaction. - operationId: reorder-metadata-fields + description: Triggered when a customer's default payment method in a provider is set or replaced (a completed setup session, or a change in the provider's portal). Carries no card data. + operationId: onCustomerPaymentMethodAttached requestBody: content: application/json: schema: - $ref: "#/components/schemas/ReorderMetadataFieldsInput" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/PaymentMethodAttached" + name: + description: Event name + enum: + - CUSTOMER_PAYMENT_METHOD_ATTACHED + examples: + - CUSTOMER_PAYMENT_METHOD_ATTACHED + type: string + type: + description: Event type + enum: + - com.kaiten.customer.payment_method.v1.attached + examples: + - com.kaiten.customer.payment_method.v1.attached + type: string + required: + - name + - type + - data + type: object required: true responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:metadata_fields - summary: Reorder metadata fields + "200": + description: Webhook processed successfully + summary: Customer Payment Method Attached Webhook tags: - - metadataFields - /metadata-fields/{id}: - patch: - description: "Updates label and json_schema. `key` and `resourceType` are immutable, and `displayOrder` belongs to POST /metadata-fields/reorder. The new json_schema is validated against JSON Schema 2020-12 and the transition rules: type changes, cardinality changes, and free-string ↔ enum toggles are rejected with 422." - operationId: update-metadata-field - parameters: - - in: path - name: id - required: true - schema: - type: string + - webhooks + - billing + com.kaiten.customer.payment_method.v1.detached: + post: + description: Triggered when a customer no longer has a payment method in a provider. + operationId: onCustomerPaymentMethodDetached requestBody: content: application/json: schema: - $ref: "#/components/schemas/MetadataField" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/PaymentMethodDetached" + name: + description: Event name + enum: + - CUSTOMER_PAYMENT_METHOD_DETACHED + examples: + - CUSTOMER_PAYMENT_METHOD_DETACHED + type: string + type: + description: Event type + enum: + - com.kaiten.customer.payment_method.v1.detached + examples: + - com.kaiten.customer.payment_method.v1.detached + type: string + required: + - name + - type + - data + type: object required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/MetadataField" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:metadata_fields - summary: Update a metadata field - tags: - - metadataFields - /metadata-fields/{id}/archive: - post: - description: Soft-deletes a metadata field. The row stays in the DB (its archived_at is set) so historic metadata is still interpretable; the field stops appearing in the active schema composition. - operationId: archive-metadata-field - parameters: - - in: path - name: id - required: true - schema: - type: string - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/MetadataField" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:metadata_fields - summary: Archive a metadata field + description: Webhook processed successfully + summary: Customer Payment Method Detached Webhook tags: - - metadataFields - /metadata-fields/{id}/dry-run: + - webhooks + - billing + com.kaiten.customer.payment_method.v1.expiring: post: - description: Computes, server-side, how many existing resources of this field's resource type carry a value under this field's key that would NOT satisfy the supplied candidate JSON Schema, plus a small sample. Read-only — does not mutate the field. Replaces the former client-side dry-run that pulled every resource's metadata. - operationId: dry-run-metadata-field - parameters: - - in: path - name: id - required: true - schema: - type: string + description: Triggered once, 30 days before the end of the expiry month of a customer's payment method. + operationId: onCustomerPaymentMethodExpiring + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/PaymentMethodExpiring" + name: + description: Event name + enum: + - CUSTOMER_PAYMENT_METHOD_EXPIRING + examples: + - CUSTOMER_PAYMENT_METHOD_EXPIRING + type: string + type: + description: Event type + enum: + - com.kaiten.customer.payment_method.v1.expiring + examples: + - com.kaiten.customer.payment_method.v1.expiring + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Customer Payment Method Expiring Webhook + tags: + - webhooks + - billing + com.kaiten.customer.v1.created: + post: + description: Triggered when a new customer is created. + operationId: onCustomerCreated requestBody: content: application/json: schema: - $ref: "#/components/schemas/MetadataFieldSchemaProposal" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Customer" + name: + description: Event name + enum: + - CUSTOMER_CREATED + examples: + - CUSTOMER_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.customer.v1.created + examples: + - com.kaiten.customer.v1.created + type: string + required: + - name + - type + - data + type: object required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/Impact" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:metadata_fields - summary: Preview the impact of a metadata field schema change + description: Webhook processed successfully + summary: Customer Created Webhook tags: - - metadataFields - /metadata-fields/{id}/unarchive: + - webhooks + - customers + com.kaiten.customer.v1.creation_rejected: post: - description: Restores a previously archived metadata field (clears its archived_at). The field re-enters the active schema composition. Returns 409 if an active field already uses the same key for this resource type, or 404 if the field does not exist or is not archived. - operationId: unarchive-metadata-field - parameters: - - in: path - name: id - required: true - schema: - type: string + description: Triggered when a customer creation is refused because the organization has reached its customer entitlement cap. No customer is created. + operationId: onCustomerCreationRejected + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/CustomerCreationRejected" + name: + description: Event name + enum: + - CUSTOMER_CREATION_REJECTED + examples: + - CUSTOMER_CREATION_REJECTED + type: string + type: + description: Event type + enum: + - com.kaiten.customer.v1.creation_rejected + examples: + - com.kaiten.customer.v1.creation_rejected + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/MetadataField" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:metadata_fields - summary: Unarchive a metadata field + description: Webhook processed successfully + summary: Customer Creation Rejected Webhook tags: - - metadataFields - /ofrep/v1/evaluate/flags: + - webhooks + - customers + com.kaiten.customer.v1.deleted: post: - description: |- - OFREP bulk evaluation request. - The endpoint is called by the client providers to evaluate all flags at once. - operationId: evaluateFlagsBulk - parameters: - - description: The request will be processed only if ETag doesn't match any of the values listed. - in: header - name: If-None-Match - schema: - type: string + description: Triggered when a customer is deleted. + operationId: onCustomerDeleted requestBody: content: application/json: schema: - $ref: "#/components/schemas/BulkEvaluationRequest" - description: EvaluateVariant multiple flags in one request - responses: - "200": - content: - application/json: - schema: - oneOf: - - properties: - flags: - description: Array of evaluation results - items: - oneOf: - - $ref: "#/components/schemas/EvaluationSuccess" - - $ref: "#/components/schemas/EvaluationFailure" - type: array - - $ref: "#/components/schemas/BulkEvaluationFailure" - description: OFREP successful evaluation response - headers: - ETag: - description: Entity tag used for cache validation - schema: - type: string - "304": - description: Bulk evaluation is not modified - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/BulkEvaluationFailure" - description: Bad evaluation request - "401": - description: Unauthorized - You need credentials to access the API - "403": - description: Forbidden - You are not authorized to access the API - "429": - description: Rate limit reached on the Flag Management System - headers: - Retry-After: - description: Indicates when to retry the request again - schema: - type: string - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/BulkEvaluationFailure" - description: Internal server error - security: - - bearerAuth: - - read:feature_flags - summary: OFREP bulk flag evaluation contract + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Customer" + name: + description: Event name + enum: + - CUSTOMER_DELETED + examples: + - CUSTOMER_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.customer.v1.deleted + examples: + - com.kaiten.customer.v1.deleted + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Customer Deleted Webhook tags: - - OFREP Core - /ofrep/v1/evaluate/flags/{key}: + - webhooks + - customers + com.kaiten.customer.v1.updated: post: - description: EvaluateVariant a single feature flag for a given key - operationId: evaluateFlag - parameters: - - in: path - name: key - required: true - schema: - type: string + description: Triggered when a customer is updated. + operationId: onCustomerUpdated requestBody: content: application/json: schema: - $ref: "#/components/schemas/EvaluationRequest" - description: Evaluation context + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Customer" + name: + description: Event name + enum: + - CUSTOMER_UPDATED + examples: + - CUSTOMER_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.customer.v1.updated + examples: + - com.kaiten.customer.v1.updated + type: string + required: + - name + - type + - data + type: object required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationSuccess" - description: Flag evaluated successfully - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationFailure" - description: Evaluation failed - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationFailure" - description: Internal error - security: - - bearerAuth: - - read:feature_flags - summary: OFREP single flag evaluation contract + description: Webhook processed successfully + summary: Customer Updated Webhook tags: - - OFREP Core - /openfeature/v0/manifest: - get: - description: Returns a manifest of all feature flags that have a fallback_value set in their metadata - operationId: get-openfeature-manifest + - webhooks + - customers + com.kaiten.deployment_zone.v1.created: + post: + description: Triggered when a new deployment zone is created. + operationId: onDeploymentZoneCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/DeploymentZone" + name: + description: Event name + enum: + - DEPLOYMENT_ZONE_CREATED + examples: + - DEPLOYMENT_ZONE_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.deployment_zone.v1.created + examples: + - com.kaiten.deployment_zone.v1.created + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/ManifestEnvelope" - description: OK - headers: - X-Manifest-Capabilities: - schema: - type: string - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:feature_flags - summary: Get OpenFeature manifest + description: Webhook processed successfully + summary: Deployment Zone Created Webhook tags: - - OpenFeature - /releases: - get: - description: Returns a cursor-paginated page of releases for the current organization. - operationId: list-releases - parameters: - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor - type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + - webhooks + - deploymentZones + com.kaiten.deployment_zone.v1.deleted: + post: + description: Triggered when a deployment zone is deleted. + operationId: onDeploymentZoneDeleted + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/DeploymentZone" + name: + description: Event name + enum: + - DEPLOYMENT_ZONE_DELETED + examples: + - DEPLOYMENT_ZONE_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.deployment_zone.v1.deleted + examples: + - com.kaiten.deployment_zone.v1.deleted + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/PageRelease" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:releases - summary: List releases + description: Webhook processed successfully + summary: Deployment Zone Deleted Webhook tags: - - releases + - webhooks + - deploymentZones + com.kaiten.deployment_zone.v1.release_deployed: post: - description: "Create a new release with the provided details and link the requested components. A release is immutable: there is no update endpoint, and the component list cannot change afterwards. Correcting one means deleting it and creating a new one, which starts a new deployment history." - operationId: create-release + description: Triggered when a release is deployed to a deployment zone, either at zone creation or when an existing zone's release changes. + operationId: onReleaseDeployed requestBody: content: application/json: schema: - $ref: "#/components/schemas/Release" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Deployment" + name: + description: Event name + enum: + - RELEASE_DEPLOYED + examples: + - RELEASE_DEPLOYED + type: string + type: + description: Event type + enum: + - com.kaiten.deployment_zone.v1.release_deployed + examples: + - com.kaiten.deployment_zone.v1.release_deployed + type: string + required: + - name + - type + - data + type: object required: true responses: - "201": - content: - application/json: - schema: - $ref: "#/components/schemas/Release" - description: Created - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable - security: - - bearerAuth: - - write:releases - summary: Create a new release - tags: - - releases - /releases/{releaseSlug}: - delete: - description: Delete a release by their slug. Since a release is immutable, this plus a fresh create is the only way to change one -- and it discards the deployment history recorded against the old release. A release still deployed to a zone cannot be deleted (409). - operationId: delete-release - parameters: - - description: Release slug - in: path - name: releaseSlug - required: true - schema: - description: Release slug - examples: - - release-slug - type: string - responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:releases - summary: Delete a release + "200": + description: Webhook processed successfully + summary: Release Deployed Webhook tags: - - releases - get: - description: Returns a single release by their slug. - operationId: get-release-by-slug - parameters: - - description: Release slug - in: path - name: releaseSlug - required: true - schema: - description: Release slug - examples: - - release-slug - type: string + - webhooks + - deploymentZones + com.kaiten.deployment_zone.v1.updated: + post: + description: Triggered when a deployment zone is updated. + operationId: onDeploymentZoneUpdated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/DeploymentZone" + name: + description: Event name + enum: + - DEPLOYMENT_ZONE_UPDATED + examples: + - DEPLOYMENT_ZONE_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.deployment_zone.v1.updated + examples: + - com.kaiten.deployment_zone.v1.updated + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/Release" - description: OK - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:releases - summary: Get a release by slug + description: Webhook processed successfully + summary: Deployment Zone Updated Webhook + tags: + - webhooks + - deploymentZones + com.kaiten.entitlement.v1.created: + post: + description: Triggered when a new entitlement is created. + operationId: onEntitlementCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Entitlement" + name: + description: Event name + enum: + - ENTITLEMENT_CREATED + examples: + - ENTITLEMENT_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.entitlement.v1.created + examples: + - com.kaiten.entitlement.v1.created + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Entitlement Created Webhook tags: - - deploymentZones - /service-accounts: - get: - description: Returns a cursor-paginated page of service accounts (machine users) for the current organization. - operationId: get-service-accounts - parameters: - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor - type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + - webhooks + - entitlements + com.kaiten.entitlement.v1.deleted: + post: + description: Triggered when an entitlement is deleted. + operationId: onEntitlementDeleted + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Entitlement" + name: + description: Event name + enum: + - ENTITLEMENT_DELETED + examples: + - ENTITLEMENT_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.entitlement.v1.deleted + examples: + - com.kaiten.entitlement.v1.deleted + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/PageServiceAccount" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:tokens - summary: List all service accounts + description: Webhook processed successfully + summary: Entitlement Deleted Webhook tags: - - service-accounts + - webhooks + - entitlements + com.kaiten.entitlement.v1.updated: post: - description: Create a new service account (machine user) with the provided name. Service accounts can be used to generate API tokens for programmatic access. - operationId: create-service-account + description: Triggered when an entitlement is updated. + operationId: onEntitlementUpdated requestBody: content: application/json: schema: - $ref: "#/components/schemas/ServiceAccount" - description: Service account details + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Entitlement" + name: + description: Event name + enum: + - ENTITLEMENT_UPDATED + examples: + - ENTITLEMENT_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.entitlement.v1.updated + examples: + - com.kaiten.entitlement.v1.updated + type: string + required: + - name + - type + - data + type: object required: true responses: - "201": - content: - application/json: - schema: - $ref: "#/components/schemas/ServiceAccount" - description: Created service account - description: Created - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable - security: - - bearerAuth: - - write:tokens - summary: Create a new service account + "200": + description: Webhook processed successfully + summary: Entitlement Updated Webhook + tags: + - webhooks + - entitlements + com.kaiten.entitlement_group.v1.created: + post: + description: Triggered when a new entitlement group is created. + operationId: onEntitlementGroupCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/EntitlementGroup" + name: + description: Event name + enum: + - ENTITLEMENT_GROUP_CREATED + examples: + - ENTITLEMENT_GROUP_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.entitlement_group.v1.created + examples: + - com.kaiten.entitlement_group.v1.created + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Entitlement Group Created Webhook tags: - - service-accounts - /service-accounts/{serviceAccountSlug}: - get: - description: Retrieve details of a specific service account (machine user) by its slug. - operationId: get-service-account - parameters: - - description: Service account slug - in: path - name: serviceAccountSlug - required: true - schema: - description: Service account slug - examples: - - service-account-slug - type: string + - webhooks + - entitlement-groups + com.kaiten.entitlement_group.v1.deleted: + post: + description: Triggered when an entitlement group is deleted. + operationId: onEntitlementGroupDeleted + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/EntitlementGroup" + name: + description: Event name + enum: + - ENTITLEMENT_GROUP_DELETED + examples: + - ENTITLEMENT_GROUP_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.entitlement_group.v1.deleted + examples: + - com.kaiten.entitlement_group.v1.deleted + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/ServiceAccount" - description: Service account details - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:tokens - summary: Get a service account by slug + description: Webhook processed successfully + summary: Entitlement Group Deleted Webhook tags: - - service-accounts - put: - description: Update the name of a service account (machine user) by its slug. - operationId: update-service-account - parameters: - - description: Service account slug - in: path - name: serviceAccountSlug - required: true - schema: - description: Service account slug - examples: - - service-account-slug - type: string + - webhooks + - entitlement-groups + com.kaiten.entitlement_group.v1.updated: + post: + description: Triggered when an entitlement group is updated. + operationId: onEntitlementGroupUpdated requestBody: content: application/json: schema: - $ref: "#/components/schemas/ServiceAccount" - description: Service account update details + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/EntitlementGroup" + name: + description: Event name + enum: + - ENTITLEMENT_GROUP_UPDATED + examples: + - ENTITLEMENT_GROUP_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.entitlement_group.v1.updated + examples: + - com.kaiten.entitlement_group.v1.updated + type: string + required: + - name + - type + - data + type: object required: true responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:tokens - summary: Update a service account + "200": + description: Webhook processed successfully + summary: Entitlement Group Updated Webhook tags: - - service-accounts - /service-accounts/{serviceAccountSlug}/tokens: - get: - description: Returns a cursor-paginated page of API tokens associated with a service account. The organization context is derived from the authenticated user's JWT token. Token secret values are never returned, only metadata. - operationId: get-service-account-tokens - parameters: - - description: Service account slug - in: path - name: serviceAccountSlug - required: true - schema: - description: Service account slug - examples: - - service-account-slug - type: string - - description: Opaque pagination cursor from a previous response's nextCursor - explode: false - in: query - name: cursor - schema: - description: Opaque pagination cursor from a previous response's nextCursor - type: string - - description: Maximum number of entries to return (default 50, max 200) - explode: false - in: query - name: limit - schema: - description: Maximum number of entries to return (default 50, max 200) - format: int32 - maximum: 200 - minimum: 1 - type: integer + - webhooks + - entitlement-groups + com.kaiten.feature_flag.v1.created: + post: + description: Triggered when a new feature flag is created. + operationId: onFeatureFlagCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/FeatureFlag" + name: + description: Event name + enum: + - FEATURE_FLAG_CREATED + examples: + - FEATURE_FLAG_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.feature_flag.v1.created + examples: + - com.kaiten.feature_flag.v1.created + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/PageToken" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:tokens - summary: List all tokens for a service account + description: Webhook processed successfully + summary: Feature Flag Created Webhook tags: - - service-accounts + - webhooks + - featureflags + com.kaiten.feature_flag.v1.deleted: post: - description: Create a new API token for a service account. The token value is only returned once upon creation and cannot be retrieved again. The organization context is derived from the authenticated user's JWT token. - operationId: create-service-account-token - parameters: - - description: Service account slug - in: path - name: serviceAccountSlug - required: true - schema: - description: Service account slug - examples: - - service-account-slug - format: text - type: string + description: Triggered when a feature flag is deleted. + operationId: onFeatureFlagDeleted requestBody: content: application/json: schema: - $ref: "#/components/schemas/PlainToken" - description: Token creation details + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/FeatureFlag" + name: + description: Event name + enum: + - FEATURE_FLAG_DELETED + examples: + - FEATURE_FLAG_DELETED + type: string + type: + description: Event type + enum: + - com.kaiten.feature_flag.v1.deleted + examples: + - com.kaiten.feature_flag.v1.deleted + type: string + required: + - name + - type + - data + type: object required: true responses: - "201": - content: - application/json: - schema: - $ref: "#/components/schemas/PlainToken" - description: Created token with secret value (only shown once) - description: Created - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "409": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Conflict - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - "503": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Service Unavailable - security: - - bearerAuth: - - write:tokens - summary: Create a new token for a service account + "200": + description: Webhook processed successfully + summary: Feature Flag Deleted Webhook tags: - - service-accounts - /service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}: - delete: - description: Revoke an API token for a service account. Once revoked, the token can no longer be used for authentication. The organization context is derived from the authenticated user's JWT token. - operationId: delete-service-account-token - parameters: - - description: Service account slug - in: path - name: serviceAccountSlug - required: true - schema: - description: Service account slug - examples: - - service-account-slug - format: text - type: string - - description: Token slug to revoke - in: path - name: tokenSlug - required: true - schema: - description: Token slug to revoke - examples: - - my-token-slug - format: text - type: string + - webhooks + - featureflags + com.kaiten.feature_flag.v1.evaluated: + post: + description: Triggered on every flag evaluation. The payload carries no evaluation context, so no targeting key or user attribute is exposed. + operationId: onFeatureFlagEvaluated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/FeatureFlagEvaluated" + name: + description: Event name + enum: + - FEATURE_FLAG_EVALUATED + examples: + - FEATURE_FLAG_EVALUATED + type: string + type: + description: Event type + enum: + - com.kaiten.feature_flag.v1.evaluated + examples: + - com.kaiten.feature_flag.v1.evaluated + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Feature Flag Evaluated Webhook + tags: + - webhooks + - featureflags + com.kaiten.feature_flag.v1.updated: + post: + description: Triggered when a feature flag is updated. + operationId: onFeatureFlagUpdated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/FeatureFlag" + name: + description: Event name + enum: + - FEATURE_FLAG_UPDATED + examples: + - FEATURE_FLAG_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.feature_flag.v1.updated + examples: + - com.kaiten.feature_flag.v1.updated + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Feature Flag Updated Webhook + tags: + - webhooks + - featureflags + com.kaiten.identity.v1.system_token_issued: + post: + description: "Triggered when a platform credential mints an organization-scoped credential for the `system:kaiten` platform identity inside this organization. Carries the platform credential that performed the mint and the scopes granted, never the credential value. Expect this at the rate an integration refreshes: roughly 120 per day per process at a 15-minute lifetime." + operationId: onSystemOrganizationTokenIssued + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/SystemTokenIssuance" + name: + description: Event name + enum: + - SYSTEM_ORGANIZATION_TOKEN_ISSUED + examples: + - SYSTEM_ORGANIZATION_TOKEN_ISSUED + type: string + type: + description: Event type + enum: + - com.kaiten.identity.v1.system_token_issued + examples: + - com.kaiten.identity.v1.system_token_issued + type: string + required: + - name + - type + - data + type: object + required: true responses: - "204": - description: No Content - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:tokens - summary: Revoke a token for a service account + "200": + description: Webhook processed successfully + summary: System Organization Token Issued Webhook tags: - - service-accounts - /usage/reports/export: - get: - description: Streams every usage report of the organization in the range, across instances and entitlements, as CSV or NDJSON, ordered by reportedAt. Filters narrow it to one instance or one entitlement, including deleted ones by ID. Use it to keep the usage history before deleting the organization. - operationId: exportOrganizationUsageReports - parameters: - - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - explode: false - in: query - name: from - schema: - description: Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - format: date-time - type: string - - description: End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. - explode: false - in: query - name: to - schema: - description: End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. - format: date-time - type: string - - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat." - explode: false - in: query - name: format - schema: - description: "csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat." - examples: - - csv - type: string - - description: Only this instance's reports - explode: false - in: query - name: instanceSlug - schema: - description: Only this instance's reports - type: string - - description: Only this instance's reports. Reaches a deleted instance, whose reports are kept. - explode: false - in: query - name: instanceId - schema: - description: Only this instance's reports. Reaches a deleted instance, whose reports are kept. - format: uuid - type: string - - description: Only this entitlement's reports - explode: false - in: query - name: entitlementSlug - schema: - description: Only this entitlement's reports - type: string - - description: Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. - explode: false - in: query - name: entitlementId - schema: - description: Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. - format: uuid - type: string + - webhooks + - identity + com.kaiten.instance.addon.v1.added: + post: + description: Triggered when an add-on is attached to an instance. + operationId: onInstanceAddonAdded + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/InstanceAddonUpdate" + name: + description: Event name + enum: + - INSTANCE_ADDON_ADDED + examples: + - INSTANCE_ADDON_ADDED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.addon.v1.added + examples: + - com.kaiten.instance.addon.v1.added + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/x-ndjson: - schema: - type: string - text/csv: - schema: - type: string - description: "The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json" - headers: - Content-Disposition: - description: attachment, with a file name naming the range - schema: - type: string - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "404": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Not Found - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:instances - summary: Export the organization's usage reports + description: Webhook processed successfully + summary: Instance Add-on Added Webhook tags: + - webhooks - instances - /v1/notification-preferences: - get: - description: "Every notifiable event, with this user's effective value per channel: their own choice where they made one, the catalogue default otherwise. Events absent from the catalogue of a deployment never appear, which is what keeps high-volume system events out of the feed." - operationId: getNotificationPreferences + com.kaiten.instance.addon.v1.quantity_changed: + post: + description: Triggered when the quantity of an instance's add-on changes. + operationId: onInstanceAddonQuantityChanged + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/InstanceAddonUpdate" + name: + description: Event name + enum: + - INSTANCE_ADDON_QUANTITY_CHANGED + examples: + - INSTANCE_ADDON_QUANTITY_CHANGED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.addon.v1.quantity_changed + examples: + - com.kaiten.instance.addon.v1.quantity_changed + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Instance Add-on Quantity Changed Webhook + tags: + - webhooks + - instances + com.kaiten.instance.addon.v1.removed: + post: + description: Triggered when an add-on is removed from an instance. + operationId: onInstanceAddonRemoved + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/InstanceAddonUpdate" + name: + description: Event name + enum: + - INSTANCE_ADDON_REMOVED + examples: + - INSTANCE_ADDON_REMOVED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.addon.v1.removed + examples: + - com.kaiten.instance.addon.v1.removed + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/PreferenceMatrix" - description: OK - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:notifications - summary: Read the caller's notification preferences + description: Webhook processed successfully + summary: Instance Add-on Removed Webhook tags: - - notifications - put: - description: Stores the signed-in user's choices and answers with the whole matrix. A value that equals the catalogue default is stored as no row at all, so a later change to that default still reaches this user. - operationId: putNotificationPreferences + - webhooks + - instances + com.kaiten.instance.billing.v1.canceled: + post: + description: "Triggered when a subscription is canceled: at its period's end, immediately, or during its trial." + operationId: onInstanceBillingCanceled requestBody: content: application/json: schema: - $ref: "#/components/schemas/PreferenceChoices" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Cancellation" + name: + description: Event name + enum: + - INSTANCE_BILLING_CANCELED + examples: + - INSTANCE_BILLING_CANCELED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.billing.v1.canceled + examples: + - com.kaiten.instance.billing.v1.canceled + type: string + required: + - name + - type + - data + type: object required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/PreferenceMatrix" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:notifications - summary: Set the caller's notification preferences + description: Webhook processed successfully + summary: Instance Billing Canceled Webhook tags: - - notifications - /v1/notifications: - get: - description: Returns the signed-in user's notification feed, newest first, with the unread count. Notifications are a view over this organization's audit trail, narrowed to the events the user subscribes to; the id of a notification is the id of the audit trail entry it reports. - operationId: listNotifications - parameters: - - description: Which notifications to return (default all) - explode: false - in: query - name: status - schema: - description: Which notifications to return (default all) - enum: - - all - - unread - type: string - - description: "Only notifications about these kinds of object; repeat the parameter for several (default: all)" - explode: true - in: query - name: objectType - schema: - description: "Only notifications about these kinds of object; repeat the parameter for several (default: all)" - items: - enum: - - instance - - customer - - release - - deployment_zone - - component - - license - - token - type: string - type: - - array - - "null" - - description: Opaque cursor from a previous response's next_cursor - explode: false - in: query - name: cursor - schema: - description: Opaque cursor from a previous response's next_cursor - type: string - - description: Page size (default 20, max 50) - explode: false - in: query - name: limit - schema: - description: Page size (default 20, max 50) - format: int32 - maximum: 50 - minimum: 1 - type: integer + - webhooks + - billing + com.kaiten.instance.billing.v1.cancellation_reverted: + post: + description: Triggered when a scheduled cancellation is reverted before the boundary. + operationId: onInstanceBillingCancellationReverted + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/CancellationChange" + name: + description: Event name + enum: + - INSTANCE_BILLING_CANCELLATION_REVERTED + examples: + - INSTANCE_BILLING_CANCELLATION_REVERTED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.billing.v1.cancellation_reverted + examples: + - com.kaiten.instance.billing.v1.cancellation_reverted + type: string + required: + - name + - type + - data + type: object + required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/List" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - read:notifications - summary: List the caller's notifications + description: Webhook processed successfully + summary: Instance Billing Cancellation Reverted Webhook + tags: + - webhooks + - billing + com.kaiten.instance.billing.v1.cancellation_scheduled: + post: + description: Triggered when a subscription is set to cancel at the end of its period. + operationId: onInstanceBillingCancellationScheduled + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/CancellationChange" + name: + description: Event name + enum: + - INSTANCE_BILLING_CANCELLATION_SCHEDULED + examples: + - INSTANCE_BILLING_CANCELLATION_SCHEDULED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.billing.v1.cancellation_scheduled + examples: + - com.kaiten.instance.billing.v1.cancellation_scheduled + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Instance Billing Cancellation Scheduled Webhook tags: - - notifications - /v1/notifications/mark-read: + - webhooks + - billing + com.kaiten.instance.billing.v1.plan_change_cancelled: post: - description: "Marks the given notifications read for the signed-in user, or all of them with all: true. Ids belonging to another organization are ignored rather than rejected, so a retry of a partially applied call is safe." - operationId: markNotificationsRead + description: "Triggered when a scheduled plan change is dropped: by request, or by a cancellation." + operationId: onInstanceBillingPlanChangeCancelled requestBody: content: application/json: schema: - $ref: "#/components/schemas/ReadSelection" + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/PlanChangeSchedule" + name: + description: Event name + enum: + - INSTANCE_BILLING_PLAN_CHANGE_CANCELLED + examples: + - INSTANCE_BILLING_PLAN_CHANGE_CANCELLED + type: string + type: + description: Event type + enum: + - com.kaiten.instance.billing.v1.plan_change_cancelled + examples: + - com.kaiten.instance.billing.v1.plan_change_cancelled + type: string + required: + - name + - type + - data + type: object required: true responses: "200": - content: - application/json: - schema: - $ref: "#/components/schemas/MarkReadResult" - description: OK - "400": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Bad Request - "401": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unauthorized - "403": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Forbidden - "422": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Unprocessable Entity - "500": - content: - application/problem+json: - schema: - $ref: "#/components/schemas/Problem" - description: Internal Server Error - security: - - bearerAuth: - - write:notifications - summary: Mark notifications read + description: Webhook processed successfully + summary: Instance Billing Plan Change Cancelled Webhook tags: - - notifications -security: - - bearerAuth: [] -servers: - - url: /api -webhooks: - com.kaiten.component.v1.created: + - webhooks + - billing + com.kaiten.instance.billing.v1.plan_change_scheduled: post: - description: Triggered when a new component is created. - operationId: onComponentCreated + description: Triggered when a plan change is scheduled for the next boundary, or replaced. + operationId: onInstanceBillingPlanChangeScheduled requestBody: content: application/json: @@ -10675,20 +26020,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Component" + $ref: "#/components/schemas/PlanChangeSchedule" name: description: Event name enum: - - COMPONENT_CREATED + - INSTANCE_BILLING_PLAN_CHANGE_SCHEDULED examples: - - COMPONENT_CREATED + - INSTANCE_BILLING_PLAN_CHANGE_SCHEDULED type: string type: description: Event type enum: - - com.kaiten.component.v1.created + - com.kaiten.instance.billing.v1.plan_change_scheduled examples: - - com.kaiten.component.v1.created + - com.kaiten.instance.billing.v1.plan_change_scheduled type: string required: - name @@ -10699,14 +26044,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Component Created Webhook + summary: Instance Billing Plan Change Scheduled Webhook tags: - webhooks - - components - com.kaiten.component.v1.deleted: + - billing + com.kaiten.instance.billing.v1.plan_changed: post: - description: Triggered when a component is deleted. - operationId: onComponentDeleted + description: Triggered when a scheduled plan change is applied at a boundary. + operationId: onInstanceBillingPlanChanged requestBody: content: application/json: @@ -10714,20 +26059,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Component" + $ref: "#/components/schemas/PlanChange" name: description: Event name enum: - - COMPONENT_DELETED + - INSTANCE_BILLING_PLAN_CHANGED examples: - - COMPONENT_DELETED + - INSTANCE_BILLING_PLAN_CHANGED type: string type: description: Event type enum: - - com.kaiten.component.v1.deleted + - com.kaiten.instance.billing.v1.plan_changed examples: - - com.kaiten.component.v1.deleted + - com.kaiten.instance.billing.v1.plan_changed type: string required: - name @@ -10738,14 +26083,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Component Deleted Webhook + summary: Instance Billing Plan Changed Webhook tags: - webhooks - - components - com.kaiten.component.v1.updated: + - billing + com.kaiten.instance.billing.v1.provider_changed: post: - description: Triggered when a component is updated or auto-versioned. - operationId: onComponentUpdated + description: Triggered when a subscription moves to another payment provider, from its next invoice on. + operationId: onInstanceBillingProviderChanged requestBody: content: application/json: @@ -10753,20 +26098,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Component" + $ref: "#/components/schemas/ProviderChange" name: description: Event name enum: - - COMPONENT_UPDATED + - INSTANCE_BILLING_PROVIDER_CHANGED examples: - - COMPONENT_UPDATED + - INSTANCE_BILLING_PROVIDER_CHANGED type: string type: description: Event type enum: - - com.kaiten.component.v1.updated + - com.kaiten.instance.billing.v1.provider_changed examples: - - com.kaiten.component.v1.updated + - com.kaiten.instance.billing.v1.provider_changed type: string required: - name @@ -10777,14 +26122,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Component Updated Webhook + summary: Instance Billing Provider Changed Webhook tags: - webhooks - - components - com.kaiten.customer.v1.created: + - billing + com.kaiten.instance.billing.v1.started: post: - description: Triggered when a new customer is created. - operationId: onCustomerCreated + description: Triggered when an instance is subscribed, or a CANCELED subscription subscribed again. + operationId: onInstanceBillingStarted requestBody: content: application/json: @@ -10792,20 +26137,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Customer" + $ref: "#/components/schemas/BillingStarted" name: description: Event name enum: - - CUSTOMER_CREATED + - INSTANCE_BILLING_STARTED examples: - - CUSTOMER_CREATED + - INSTANCE_BILLING_STARTED type: string type: description: Event type enum: - - com.kaiten.customer.v1.created + - com.kaiten.instance.billing.v1.started examples: - - com.kaiten.customer.v1.created + - com.kaiten.instance.billing.v1.started type: string required: - name @@ -10816,14 +26161,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Customer Created Webhook + summary: Instance Billing Started Webhook tags: - webhooks - - customers - com.kaiten.customer.v1.creation_rejected: + - billing + com.kaiten.instance.billing.v1.status_changed: post: - description: Triggered when a customer creation is refused because the organization has reached its customer entitlement cap. No customer is created. - operationId: onCustomerCreationRejected + description: Triggered when a trial converts, or a subscription becomes PAST_DUE or leaves it. + operationId: onInstanceBillingStatusChanged requestBody: content: application/json: @@ -10831,20 +26176,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/CustomerCreationRejected" + $ref: "#/components/schemas/StatusChange" name: description: Event name enum: - - CUSTOMER_CREATION_REJECTED + - INSTANCE_BILLING_STATUS_CHANGED examples: - - CUSTOMER_CREATION_REJECTED + - INSTANCE_BILLING_STATUS_CHANGED type: string type: description: Event type enum: - - com.kaiten.customer.v1.creation_rejected + - com.kaiten.instance.billing.v1.status_changed examples: - - com.kaiten.customer.v1.creation_rejected + - com.kaiten.instance.billing.v1.status_changed type: string required: - name @@ -10855,14 +26200,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Customer Creation Rejected Webhook + summary: Instance Billing Status Changed Webhook tags: - webhooks - - customers - com.kaiten.customer.v1.deleted: + - billing + com.kaiten.instance.entitlement.v1.cap_exceeded: post: - description: Triggered when a customer is deleted. - operationId: onCustomerDeleted + description: Triggered when a SOFT-enforcement entitlement's usage crosses from below the cap to above it. Fires once per crossing. + operationId: onInstanceEntitlementCapExceeded requestBody: content: application/json: @@ -10870,20 +26215,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Customer" + $ref: "#/components/schemas/InstanceEntitlementCapExceeded" name: description: Event name enum: - - CUSTOMER_DELETED + - INSTANCE_ENTITLEMENT_CAP_EXCEEDED examples: - - CUSTOMER_DELETED + - INSTANCE_ENTITLEMENT_CAP_EXCEEDED type: string type: description: Event type enum: - - com.kaiten.customer.v1.deleted + - com.kaiten.instance.entitlement.v1.cap_exceeded examples: - - com.kaiten.customer.v1.deleted + - com.kaiten.instance.entitlement.v1.cap_exceeded type: string required: - name @@ -10894,14 +26239,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Customer Deleted Webhook + summary: Instance Entitlement Cap Exceeded Webhook tags: - webhooks - - customers - com.kaiten.customer.v1.updated: + - instances + com.kaiten.instance.entitlement.v1.usage_period_rolled_over: post: - description: Triggered when a customer is updated. - operationId: onCustomerUpdated + description: "Triggered once per usage window closed by a report: the entitlement's own stored bucket, and one synthetic event per window skipped entirely since the last report." + operationId: onInstanceEntitlementUsagePeriodRolledOver requestBody: content: application/json: @@ -10909,20 +26254,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Customer" + $ref: "#/components/schemas/InstanceEntitlementUsagePeriodRolledOver" name: description: Event name enum: - - CUSTOMER_UPDATED + - INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER examples: - - CUSTOMER_UPDATED + - INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER type: string type: description: Event type enum: - - com.kaiten.customer.v1.updated + - com.kaiten.instance.entitlement.v1.usage_period_rolled_over examples: - - com.kaiten.customer.v1.updated + - com.kaiten.instance.entitlement.v1.usage_period_rolled_over type: string required: - name @@ -10933,14 +26278,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Customer Updated Webhook + summary: Entitlement Usage Period Rolled Over Webhook tags: - webhooks - - customers - com.kaiten.deployment_zone.v1.created: + - instances + com.kaiten.instance.entitlement.v1.usage_reached: post: - description: Triggered when a new deployment zone is created. - operationId: onDeploymentZoneCreated + description: Triggered when an instance's entitlement usage reaches its threshold. + operationId: onInstanceEntitlementUsageReached requestBody: content: application/json: @@ -10948,20 +26293,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/DeploymentZone" + $ref: "#/components/schemas/EntitlementUsage" name: description: Event name enum: - - DEPLOYMENT_ZONE_CREATED + - INSTANCE_ENTITLEMENT_USAGE_REACHED examples: - - DEPLOYMENT_ZONE_CREATED + - INSTANCE_ENTITLEMENT_USAGE_REACHED type: string type: description: Event type enum: - - com.kaiten.deployment_zone.v1.created + - com.kaiten.instance.entitlement.v1.usage_reached examples: - - com.kaiten.deployment_zone.v1.created + - com.kaiten.instance.entitlement.v1.usage_reached type: string required: - name @@ -10972,14 +26317,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Deployment Zone Created Webhook + summary: Instance Entitlement Usage Reached Webhook tags: - webhooks - - deploymentZones - com.kaiten.deployment_zone.v1.deleted: + - instances + com.kaiten.instance.entitlement.v1.usage_report_accepted: post: - description: Triggered when a deployment zone is deleted. - operationId: onDeploymentZoneDeleted + description: Triggered when a usage report is persisted, including a SOFT-enforcement overage. + operationId: onInstanceEntitlementUsageReportAccepted requestBody: content: application/json: @@ -10987,20 +26332,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/DeploymentZone" + $ref: "#/components/schemas/InstanceEntitlementUsageReportAccepted" name: description: Event name enum: - - DEPLOYMENT_ZONE_DELETED + - ENTITLEMENT_USAGE_REPORT_ACCEPTED examples: - - DEPLOYMENT_ZONE_DELETED + - ENTITLEMENT_USAGE_REPORT_ACCEPTED type: string type: description: Event type enum: - - com.kaiten.deployment_zone.v1.deleted + - com.kaiten.instance.entitlement.v1.usage_report_accepted examples: - - com.kaiten.deployment_zone.v1.deleted + - com.kaiten.instance.entitlement.v1.usage_report_accepted type: string required: - name @@ -11011,14 +26356,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Deployment Zone Deleted Webhook + summary: Entitlement Usage Report Accepted Webhook tags: - webhooks - - deploymentZones - com.kaiten.deployment_zone.v1.release_deployed: + - instances + com.kaiten.instance.entitlement.v1.usage_report_rejected: post: - description: Triggered when a release is deployed to a deployment zone, either at zone creation or when an existing zone's release changes. - operationId: onReleaseDeployed + description: Triggered when a usage report is refused because it would take a HARD-enforcement entitlement past its cap. The usage is not persisted. + operationId: onInstanceEntitlementUsageReportRejected requestBody: content: application/json: @@ -11026,20 +26371,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Deployment" + $ref: "#/components/schemas/InstanceEntitlementUsageReportAccepted" name: description: Event name enum: - - RELEASE_DEPLOYED + - ENTITLEMENT_USAGE_REPORT_REJECTED examples: - - RELEASE_DEPLOYED + - ENTITLEMENT_USAGE_REPORT_REJECTED type: string type: description: Event type enum: - - com.kaiten.deployment_zone.v1.release_deployed + - com.kaiten.instance.entitlement.v1.usage_report_rejected examples: - - com.kaiten.deployment_zone.v1.release_deployed + - com.kaiten.instance.entitlement.v1.usage_report_rejected type: string required: - name @@ -11050,14 +26395,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Release Deployed Webhook + summary: Entitlement Usage Report Rejected Webhook tags: - webhooks - - deploymentZones - com.kaiten.deployment_zone.v1.updated: + - instances + com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached: post: - description: Triggered when a deployment zone is updated. - operationId: onDeploymentZoneUpdated + description: Triggered when an instance's entitlement usage crosses its configured early-warning percentage boundary, before the cap is reached. Fires once per crossing. + operationId: onInstanceEntitlementUsageWarningThresholdReached requestBody: content: application/json: @@ -11065,20 +26410,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/DeploymentZone" + $ref: "#/components/schemas/InstanceEntitlementUsageWarningThresholdReached" name: description: Event name enum: - - DEPLOYMENT_ZONE_UPDATED + - INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED examples: - - DEPLOYMENT_ZONE_UPDATED + - INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED type: string type: description: Event type enum: - - com.kaiten.deployment_zone.v1.updated + - com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached examples: - - com.kaiten.deployment_zone.v1.updated + - com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached type: string required: - name @@ -11089,14 +26434,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Deployment Zone Updated Webhook + summary: Instance Entitlement Usage Warning Threshold Reached Webhook tags: - webhooks - - deploymentZones - com.kaiten.entitlement.v1.created: + - instances + com.kaiten.instance.entitlement.v1.value_get: post: - description: Triggered when a new entitlement is created. - operationId: onEntitlementCreated + description: Triggered on every read of an instance entitlement's usage value. This is a read audit signal, not a state change. + operationId: onInstanceEntitlementValueGet requestBody: content: application/json: @@ -11104,20 +26449,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Entitlement" + $ref: "#/components/schemas/InstanceEntitlementValueGet" name: description: Event name enum: - - ENTITLEMENT_CREATED + - ENTITLEMENT_VALUE_GET examples: - - ENTITLEMENT_CREATED + - ENTITLEMENT_VALUE_GET type: string type: description: Event type enum: - - com.kaiten.entitlement.v1.created + - com.kaiten.instance.entitlement.v1.value_get examples: - - com.kaiten.entitlement.v1.created + - com.kaiten.instance.entitlement.v1.value_get type: string required: - name @@ -11128,14 +26473,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Created Webhook + summary: Instance Entitlement Value Read Webhook tags: - webhooks - - entitlements - com.kaiten.entitlement.v1.deleted: + - instances + com.kaiten.instance.invoice.v1.handoff_acknowledged: post: - description: Triggered when an entitlement is deleted. - operationId: onEntitlementDeleted + description: Triggered when the organization's accounting system acknowledges an invoice from the handoff queue, or the invoice is marked paid while still waiting there. + operationId: onInstanceInvoiceHandoffAcknowledged requestBody: content: application/json: @@ -11143,20 +26488,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Entitlement" + $ref: "#/components/schemas/HandoffAcknowledgement" name: description: Event name enum: - - ENTITLEMENT_DELETED + - INSTANCE_INVOICE_HANDOFF_ACKNOWLEDGED examples: - - ENTITLEMENT_DELETED + - INSTANCE_INVOICE_HANDOFF_ACKNOWLEDGED type: string type: description: Event type enum: - - com.kaiten.entitlement.v1.deleted + - com.kaiten.instance.invoice.v1.handoff_acknowledged examples: - - com.kaiten.entitlement.v1.deleted + - com.kaiten.instance.invoice.v1.handoff_acknowledged type: string required: - name @@ -11167,14 +26512,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Deleted Webhook + summary: Instance Invoice Handoff Acknowledged Webhook tags: - webhooks - - entitlements - com.kaiten.entitlement.v1.updated: + - billing + com.kaiten.instance.invoice.v1.held: post: - description: Triggered when an entitlement is updated. - operationId: onEntitlementUpdated + description: Triggered when a period closes into an invoice held as a DRAFT, because the usage journal it was measured from failed a consistency check. It is neither issued nor handed off until released or recomposed. + operationId: onInstanceInvoiceHeld requestBody: content: application/json: @@ -11182,20 +26527,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Entitlement" + $ref: "#/components/schemas/HeldInvoice" name: description: Event name enum: - - ENTITLEMENT_UPDATED + - INSTANCE_INVOICE_HELD examples: - - ENTITLEMENT_UPDATED + - INSTANCE_INVOICE_HELD type: string type: description: Event type enum: - - com.kaiten.entitlement.v1.updated + - com.kaiten.instance.invoice.v1.held examples: - - com.kaiten.entitlement.v1.updated + - com.kaiten.instance.invoice.v1.held type: string required: - name @@ -11206,14 +26551,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Updated Webhook + summary: Instance Invoice Held Webhook tags: - webhooks - - entitlements - com.kaiten.entitlement_group.v1.created: + - billing + com.kaiten.instance.invoice.v1.issued: post: - description: Triggered when a new entitlement group is created. - operationId: onEntitlementGroupCreated + description: Triggered once per invoice with something owed, when it is issued. For an invoice the organization collects itself, it is the signal to claim it from the handoff queue, which stays the source of truth. + operationId: onInstanceInvoiceIssued requestBody: content: application/json: @@ -11221,20 +26566,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/EntitlementGroup" + $ref: "#/components/schemas/IssuedInvoice" name: description: Event name enum: - - ENTITLEMENT_GROUP_CREATED + - INSTANCE_INVOICE_ISSUED examples: - - ENTITLEMENT_GROUP_CREATED + - INSTANCE_INVOICE_ISSUED type: string type: description: Event type enum: - - com.kaiten.entitlement_group.v1.created + - com.kaiten.instance.invoice.v1.issued examples: - - com.kaiten.entitlement_group.v1.created + - com.kaiten.instance.invoice.v1.issued type: string required: - name @@ -11245,14 +26590,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Group Created Webhook + summary: Instance Invoice Issued Webhook tags: - webhooks - - entitlement-groups - com.kaiten.entitlement_group.v1.deleted: + - billing + com.kaiten.instance.invoice.v1.marked_uncollectible: post: - description: Triggered when an entitlement group is deleted. - operationId: onEntitlementGroupDeleted + description: Triggered when an invoice is written off. + operationId: onInstanceInvoiceMarkedUncollectible requestBody: content: application/json: @@ -11260,20 +26605,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/EntitlementGroup" + $ref: "#/components/schemas/UncollectibleInvoice" name: description: Event name enum: - - ENTITLEMENT_GROUP_DELETED + - INSTANCE_INVOICE_MARKED_UNCOLLECTIBLE examples: - - ENTITLEMENT_GROUP_DELETED + - INSTANCE_INVOICE_MARKED_UNCOLLECTIBLE type: string type: description: Event type enum: - - com.kaiten.entitlement_group.v1.deleted + - com.kaiten.instance.invoice.v1.marked_uncollectible examples: - - com.kaiten.entitlement_group.v1.deleted + - com.kaiten.instance.invoice.v1.marked_uncollectible type: string required: - name @@ -11284,14 +26629,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Group Deleted Webhook + summary: Instance Invoice Marked Uncollectible Webhook tags: - webhooks - - entitlement-groups - com.kaiten.entitlement_group.v1.updated: + - billing + com.kaiten.instance.invoice.v1.paid: post: - description: Triggered when an entitlement group is updated. - operationId: onEntitlementGroupUpdated + description: "Triggered when an invoice is paid: marked paid by the organization, or issued paid because nothing was owed." + operationId: onInstanceInvoicePaid requestBody: content: application/json: @@ -11299,20 +26644,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/EntitlementGroup" + $ref: "#/components/schemas/PaidInvoice" name: description: Event name enum: - - ENTITLEMENT_GROUP_UPDATED + - INSTANCE_INVOICE_PAID examples: - - ENTITLEMENT_GROUP_UPDATED + - INSTANCE_INVOICE_PAID type: string type: description: Event type enum: - - com.kaiten.entitlement_group.v1.updated + - com.kaiten.instance.invoice.v1.paid examples: - - com.kaiten.entitlement_group.v1.updated + - com.kaiten.instance.invoice.v1.paid type: string required: - name @@ -11323,14 +26668,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Group Updated Webhook + summary: Instance Invoice Paid Webhook tags: - webhooks - - entitlement-groups - com.kaiten.feature_flag.v1.created: + - billing + com.kaiten.instance.invoice.v1.payment_failed: post: - description: Triggered when a new feature flag is created. - operationId: onFeatureFlagCreated + description: Triggered when the automatic charge of an invoice is refused, or needs the customer to authenticate it on the invoice's hosted page. + operationId: onInstanceInvoicePaymentFailed requestBody: content: application/json: @@ -11338,20 +26683,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/FeatureFlag" + $ref: "#/components/schemas/PaymentFailedInvoice" name: description: Event name enum: - - FEATURE_FLAG_CREATED + - INSTANCE_INVOICE_PAYMENT_FAILED examples: - - FEATURE_FLAG_CREATED + - INSTANCE_INVOICE_PAYMENT_FAILED type: string type: description: Event type enum: - - com.kaiten.feature_flag.v1.created + - com.kaiten.instance.invoice.v1.payment_failed examples: - - com.kaiten.feature_flag.v1.created + - com.kaiten.instance.invoice.v1.payment_failed type: string required: - name @@ -11362,14 +26707,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Feature Flag Created Webhook + summary: Instance Invoice Payment Failed Webhook tags: - webhooks - - featureflags - com.kaiten.feature_flag.v1.deleted: + - billing + com.kaiten.instance.invoice.v1.push_failed: post: - description: Triggered when a feature flag is deleted. - operationId: onFeatureFlagDeleted + description: Triggered when pushing an invoice to its payment provider has failed as many times as the alert threshold, then once a day while it keeps failing. + operationId: onInstanceInvoicePushFailed requestBody: content: application/json: @@ -11377,20 +26722,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/FeatureFlag" + $ref: "#/components/schemas/PushFailedInvoice" name: description: Event name enum: - - FEATURE_FLAG_DELETED + - INSTANCE_INVOICE_PUSH_FAILED examples: - - FEATURE_FLAG_DELETED + - INSTANCE_INVOICE_PUSH_FAILED type: string type: description: Event type enum: - - com.kaiten.feature_flag.v1.deleted + - com.kaiten.instance.invoice.v1.push_failed examples: - - com.kaiten.feature_flag.v1.deleted + - com.kaiten.instance.invoice.v1.push_failed type: string required: - name @@ -11401,14 +26746,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Feature Flag Deleted Webhook + summary: Instance Invoice Push Failed Webhook tags: - webhooks - - featureflags - com.kaiten.feature_flag.v1.evaluated: + - billing + com.kaiten.instance.invoice.v1.pushed: post: - description: Triggered on every flag evaluation. The payload carries no evaluation context, so no targeting key or user attribute is exposed. - operationId: onFeatureFlagEvaluated + description: Triggered when an invoice's payment provider has issued it, right after INSTANCE_INVOICE_ISSUED. + operationId: onInstanceInvoicePushed requestBody: content: application/json: @@ -11416,20 +26761,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/FeatureFlagEvaluated" + $ref: "#/components/schemas/PushedInvoice" name: description: Event name enum: - - FEATURE_FLAG_EVALUATED + - INSTANCE_INVOICE_PUSHED examples: - - FEATURE_FLAG_EVALUATED + - INSTANCE_INVOICE_PUSHED type: string type: description: Event type enum: - - com.kaiten.feature_flag.v1.evaluated + - com.kaiten.instance.invoice.v1.pushed examples: - - com.kaiten.feature_flag.v1.evaluated + - com.kaiten.instance.invoice.v1.pushed type: string required: - name @@ -11440,14 +26785,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Feature Flag Evaluated Webhook + summary: Instance Invoice Pushed Webhook tags: - webhooks - - featureflags - com.kaiten.feature_flag.v1.updated: + - billing + com.kaiten.instance.invoice.v1.reconciliation_mismatch: post: - description: Triggered when a feature flag is updated. - operationId: onFeatureFlagUpdated + description: "Triggered when an invoice's payment provider holds amounts that differ from Kaiten's. Kaiten never corrects itself: void and recompose the invoice." + operationId: onInstanceInvoiceReconciliationMismatch requestBody: content: application/json: @@ -11455,20 +26800,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/FeatureFlag" + $ref: "#/components/schemas/MismatchedInvoice" name: description: Event name enum: - - FEATURE_FLAG_UPDATED + - INSTANCE_INVOICE_RECONCILIATION_MISMATCH examples: - - FEATURE_FLAG_UPDATED + - INSTANCE_INVOICE_RECONCILIATION_MISMATCH type: string type: description: Event type enum: - - com.kaiten.feature_flag.v1.updated + - com.kaiten.instance.invoice.v1.reconciliation_mismatch examples: - - com.kaiten.feature_flag.v1.updated + - com.kaiten.instance.invoice.v1.reconciliation_mismatch type: string required: - name @@ -11479,14 +26824,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Feature Flag Updated Webhook + summary: Instance Invoice Reconciliation Mismatch Webhook tags: - webhooks - - featureflags - com.kaiten.identity.v1.system_token_issued: + - billing + com.kaiten.instance.invoice.v1.released: post: - description: "Triggered when a platform credential mints an organization-scoped credential for the `system:kaiten` platform identity inside this organization. Carries the platform credential that performed the mint and the scopes granted, never the credential value. Expect this at the rate an integration refreshes: roughly 120 per day per process at a 15-minute lifetime." - operationId: onSystemOrganizationTokenIssued + description: "Triggered when a held invoice leaves its hold: released by the organization, recomposed from a sound journal, or found sound by a later check. It is issued in the same transaction." + operationId: onInstanceInvoiceReleased requestBody: content: application/json: @@ -11494,20 +26839,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/SystemTokenIssuance" + $ref: "#/components/schemas/ReleasedInvoice" name: description: Event name enum: - - SYSTEM_ORGANIZATION_TOKEN_ISSUED + - INSTANCE_INVOICE_RELEASED examples: - - SYSTEM_ORGANIZATION_TOKEN_ISSUED + - INSTANCE_INVOICE_RELEASED type: string type: description: Event type enum: - - com.kaiten.identity.v1.system_token_issued + - com.kaiten.instance.invoice.v1.released examples: - - com.kaiten.identity.v1.system_token_issued + - com.kaiten.instance.invoice.v1.released type: string required: - name @@ -11518,14 +26863,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: System Organization Token Issued Webhook + summary: Instance Invoice Released Webhook tags: - webhooks - - identity - com.kaiten.instance.entitlement.v1.cap_exceeded: + - billing + com.kaiten.instance.invoice.v1.voided: post: - description: Triggered when a SOFT-enforcement entitlement's usage crosses from below the cap to above it. Fires once per crossing. - operationId: onInstanceEntitlementCapExceeded + description: Triggered when an invoice is voided. Its boundary can then be recomposed into a replacement. + operationId: onInstanceInvoiceVoided requestBody: content: application/json: @@ -11533,20 +26878,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceEntitlementCapExceeded" + $ref: "#/components/schemas/VoidedInvoice" name: description: Event name enum: - - INSTANCE_ENTITLEMENT_CAP_EXCEEDED + - INSTANCE_INVOICE_VOIDED examples: - - INSTANCE_ENTITLEMENT_CAP_EXCEEDED + - INSTANCE_INVOICE_VOIDED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.cap_exceeded + - com.kaiten.instance.invoice.v1.voided examples: - - com.kaiten.instance.entitlement.v1.cap_exceeded + - com.kaiten.instance.invoice.v1.voided type: string required: - name @@ -11557,14 +26902,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Entitlement Cap Exceeded Webhook + summary: Instance Invoice Voided Webhook tags: - webhooks - - instances - com.kaiten.instance.entitlement.v1.usage_period_rolled_over: + - billing + com.kaiten.instance.v1.created: post: - description: "Triggered once per usage window closed by a report: the entitlement's own stored bucket, and one synthetic event per window skipped entirely since the last report." - operationId: onInstanceEntitlementUsagePeriodRolledOver + description: Triggered when a new instance is created. + operationId: onInstanceCreated requestBody: content: application/json: @@ -11572,20 +26917,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceEntitlementUsagePeriodRolledOver" + $ref: "#/components/schemas/Instance" name: description: Event name enum: - - INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER + - INSTANCE_CREATED examples: - - INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER + - INSTANCE_CREATED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.usage_period_rolled_over + - com.kaiten.instance.v1.created examples: - - com.kaiten.instance.entitlement.v1.usage_period_rolled_over + - com.kaiten.instance.v1.created type: string required: - name @@ -11596,14 +26941,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Usage Period Rolled Over Webhook + summary: Instance Created Webhook tags: - webhooks - instances - com.kaiten.instance.entitlement.v1.usage_reached: + com.kaiten.instance.v1.deleted: post: - description: Triggered when an instance's entitlement usage reaches its threshold. - operationId: onInstanceEntitlementUsageReached + description: Triggered when an instance is deleted. + operationId: onInstanceDeleted requestBody: content: application/json: @@ -11611,20 +26956,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/EntitlementUsage" + $ref: "#/components/schemas/Instance" name: description: Event name enum: - - INSTANCE_ENTITLEMENT_USAGE_REACHED + - INSTANCE_DELETED examples: - - INSTANCE_ENTITLEMENT_USAGE_REACHED + - INSTANCE_DELETED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.usage_reached + - com.kaiten.instance.v1.deleted examples: - - com.kaiten.instance.entitlement.v1.usage_reached + - com.kaiten.instance.v1.deleted type: string required: - name @@ -11635,14 +26980,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Entitlement Usage Reached Webhook + summary: Instance Deleted Webhook tags: - webhooks - instances - com.kaiten.instance.entitlement.v1.usage_report_accepted: + com.kaiten.instance.v1.deployed: post: - description: Triggered when a usage report is persisted, including a SOFT-enforcement overage. - operationId: onInstanceEntitlementUsageReportAccepted + description: Triggered when an instance is deployed to a deployment zone. + operationId: onInstanceDeployed requestBody: content: application/json: @@ -11650,20 +26995,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceEntitlementUsageReportAccepted" + $ref: "#/components/schemas/Instance" name: description: Event name enum: - - ENTITLEMENT_USAGE_REPORT_ACCEPTED + - INSTANCE_DEPLOYED examples: - - ENTITLEMENT_USAGE_REPORT_ACCEPTED + - INSTANCE_DEPLOYED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.usage_report_accepted + - com.kaiten.instance.v1.deployed examples: - - com.kaiten.instance.entitlement.v1.usage_report_accepted + - com.kaiten.instance.v1.deployed type: string required: - name @@ -11674,14 +27019,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Usage Report Accepted Webhook + summary: Instance Deployed Webhook tags: - webhooks - instances - com.kaiten.instance.entitlement.v1.usage_report_rejected: + com.kaiten.instance.v1.lifecycle_stage_changed: post: - description: Triggered when a usage report is refused because it would take a HARD-enforcement entitlement past its cap. The usage is not persisted. - operationId: onInstanceEntitlementUsageReportRejected + description: Triggered when an instance commercial lifecycle stage changes. + operationId: onInstanceLifecycleStageChanged requestBody: content: application/json: @@ -11689,20 +27034,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceEntitlementUsageReportAccepted" + $ref: "#/components/schemas/InstanceLifecycleStageChanged" name: description: Event name enum: - - ENTITLEMENT_USAGE_REPORT_REJECTED + - INSTANCE_LIFECYCLE_STAGE_CHANGED examples: - - ENTITLEMENT_USAGE_REPORT_REJECTED + - INSTANCE_LIFECYCLE_STAGE_CHANGED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.usage_report_rejected + - com.kaiten.instance.v1.lifecycle_stage_changed examples: - - com.kaiten.instance.entitlement.v1.usage_report_rejected + - com.kaiten.instance.v1.lifecycle_stage_changed type: string required: - name @@ -11713,14 +27058,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Entitlement Usage Report Rejected Webhook + summary: Instance Lifecycle Stage Changed Webhook tags: - webhooks - instances - com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached: + com.kaiten.instance.v1.migrated: post: - description: Triggered when an instance's entitlement usage crosses its configured early-warning percentage boundary, before the cap is reached. Fires once per crossing. - operationId: onInstanceEntitlementUsageWarningThresholdReached + description: Triggered when an instance is migrated from one deployment zone to another. + operationId: onInstanceMigrated requestBody: content: application/json: @@ -11728,20 +27073,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceEntitlementUsageWarningThresholdReached" + $ref: "#/components/schemas/Instance" name: description: Event name enum: - - INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED + - INSTANCE_MIGRATED examples: - - INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED + - INSTANCE_MIGRATED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached + - com.kaiten.instance.v1.migrated examples: - - com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached + - com.kaiten.instance.v1.migrated type: string required: - name @@ -11752,14 +27097,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Entitlement Usage Warning Threshold Reached Webhook + summary: Instance Migrated Webhook tags: - webhooks - instances - com.kaiten.instance.entitlement.v1.value_get: + com.kaiten.instance.v1.status_changed: post: - description: Triggered on every read of an instance entitlement's usage value. This is a read audit signal, not a state change. - operationId: onInstanceEntitlementValueGet + description: Triggered when an instance operational status changes. + operationId: onInstanceStatusChanged requestBody: content: application/json: @@ -11767,20 +27112,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceEntitlementValueGet" + $ref: "#/components/schemas/InstanceStatusChanged" name: description: Event name enum: - - ENTITLEMENT_VALUE_GET + - INSTANCE_STATUS_CHANGED examples: - - ENTITLEMENT_VALUE_GET + - INSTANCE_STATUS_CHANGED type: string type: description: Event type enum: - - com.kaiten.instance.entitlement.v1.value_get + - com.kaiten.instance.v1.status_changed examples: - - com.kaiten.instance.entitlement.v1.value_get + - com.kaiten.instance.v1.status_changed type: string required: - name @@ -11791,14 +27136,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Entitlement Value Read Webhook + summary: Instance Status Changed Webhook tags: - webhooks - instances - com.kaiten.instance.v1.created: + com.kaiten.instance.v1.updated: post: - description: Triggered when a new instance is created. - operationId: onInstanceCreated + description: Triggered when an instance is updated. + operationId: onInstanceUpdated requestBody: content: application/json: @@ -11810,16 +27155,16 @@ webhooks: name: description: Event name enum: - - INSTANCE_CREATED + - INSTANCE_UPDATED examples: - - INSTANCE_CREATED + - INSTANCE_UPDATED type: string type: description: Event type enum: - - com.kaiten.instance.v1.created + - com.kaiten.instance.v1.updated examples: - - com.kaiten.instance.v1.created + - com.kaiten.instance.v1.updated type: string required: - name @@ -11830,14 +27175,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Created Webhook + summary: Instance Updated Webhook tags: - webhooks - instances - com.kaiten.instance.v1.deleted: + com.kaiten.instance.voucher.v1.expired: post: - description: Triggered when an instance is deleted. - operationId: onInstanceDeleted + description: Triggered when a PRICE redemption has discounted its last invoice. + operationId: onInstanceVoucherExpired requestBody: content: application/json: @@ -11845,20 +27190,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Instance" + $ref: "#/components/schemas/Redemption" name: description: Event name enum: - - INSTANCE_DELETED + - INSTANCE_VOUCHER_EXPIRED examples: - - INSTANCE_DELETED + - INSTANCE_VOUCHER_EXPIRED type: string type: description: Event type enum: - - com.kaiten.instance.v1.deleted + - com.kaiten.instance.voucher.v1.expired examples: - - com.kaiten.instance.v1.deleted + - com.kaiten.instance.voucher.v1.expired type: string required: - name @@ -11869,14 +27214,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Deleted Webhook + summary: Instance Voucher Expired Webhook tags: - webhooks - - instances - com.kaiten.instance.v1.deployed: + - vouchers + com.kaiten.instance.voucher.v1.redeemed: post: - description: Triggered when an instance is deployed to a deployment zone. - operationId: onInstanceDeployed + description: Triggered when an instance redeems a voucher. + operationId: onInstanceVoucherRedeemed requestBody: content: application/json: @@ -11884,20 +27229,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Instance" + $ref: "#/components/schemas/Redemption" name: description: Event name enum: - - INSTANCE_DEPLOYED + - INSTANCE_VOUCHER_REDEEMED examples: - - INSTANCE_DEPLOYED + - INSTANCE_VOUCHER_REDEEMED type: string type: description: Event type enum: - - com.kaiten.instance.v1.deployed + - com.kaiten.instance.voucher.v1.redeemed examples: - - com.kaiten.instance.v1.deployed + - com.kaiten.instance.voucher.v1.redeemed type: string required: - name @@ -11908,14 +27253,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Deployed Webhook + summary: Instance Voucher Redeemed Webhook tags: - webhooks - - instances - com.kaiten.instance.v1.lifecycle_stage_changed: + - vouchers + com.kaiten.instance.voucher.v1.revoked: post: - description: Triggered when an instance commercial lifecycle stage changes. - operationId: onInstanceLifecycleStageChanged + description: Triggered when a redemption is revoked. + operationId: onInstanceVoucherRevoked requestBody: content: application/json: @@ -11923,20 +27268,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceLifecycleStageChanged" + $ref: "#/components/schemas/Redemption" name: description: Event name enum: - - INSTANCE_LIFECYCLE_STAGE_CHANGED + - INSTANCE_VOUCHER_REVOKED examples: - - INSTANCE_LIFECYCLE_STAGE_CHANGED + - INSTANCE_VOUCHER_REVOKED type: string type: description: Event type enum: - - com.kaiten.instance.v1.lifecycle_stage_changed + - com.kaiten.instance.voucher.v1.revoked examples: - - com.kaiten.instance.v1.lifecycle_stage_changed + - com.kaiten.instance.voucher.v1.revoked type: string required: - name @@ -11947,14 +27292,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Lifecycle Stage Changed Webhook + summary: Instance Voucher Revoked Webhook tags: - webhooks - - instances - com.kaiten.instance.v1.migrated: + - vouchers + com.kaiten.license.entitlement.v1.assigned: post: - description: Triggered when an instance is migrated from one deployment zone to another. - operationId: onInstanceMigrated + description: Triggered when an entitlement is assigned to a license. + operationId: onLicenseEntitlementAssigned requestBody: content: application/json: @@ -11962,20 +27307,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Instance" + $ref: "#/components/schemas/LicenseEntitlement" name: description: Event name enum: - - INSTANCE_MIGRATED + - LICENSE_ENTITLEMENT_ASSIGNED examples: - - INSTANCE_MIGRATED + - LICENSE_ENTITLEMENT_ASSIGNED type: string type: description: Event type enum: - - com.kaiten.instance.v1.migrated + - com.kaiten.license.entitlement.v1.assigned examples: - - com.kaiten.instance.v1.migrated + - com.kaiten.license.entitlement.v1.assigned type: string required: - name @@ -11986,14 +27331,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Migrated Webhook + summary: License Entitlement Assigned Webhook tags: - webhooks - - instances - com.kaiten.instance.v1.status_changed: + - licenses + com.kaiten.license.entitlement.v1.unassigned: post: - description: Triggered when an instance operational status changes. - operationId: onInstanceStatusChanged + description: Triggered when an entitlement is unassigned from a license. + operationId: onLicenseEntitlementUnassigned requestBody: content: application/json: @@ -12001,20 +27346,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/InstanceStatusChanged" + $ref: "#/components/schemas/LicenseEntitlement" name: description: Event name enum: - - INSTANCE_STATUS_CHANGED + - LICENSE_ENTITLEMENT_UNASSIGNED examples: - - INSTANCE_STATUS_CHANGED + - LICENSE_ENTITLEMENT_UNASSIGNED type: string type: description: Event type enum: - - com.kaiten.instance.v1.status_changed + - com.kaiten.license.entitlement.v1.unassigned examples: - - com.kaiten.instance.v1.status_changed + - com.kaiten.license.entitlement.v1.unassigned type: string required: - name @@ -12025,14 +27370,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Status Changed Webhook + summary: License Entitlement Unassigned Webhook tags: - webhooks - - instances - com.kaiten.instance.v1.updated: + - licenses + com.kaiten.license.entitlement.v1.updated: post: - description: Triggered when an instance is updated. - operationId: onInstanceUpdated + description: Triggered when a license entitlement is updated. + operationId: onLicenseEntitlementUpdated requestBody: content: application/json: @@ -12040,20 +27385,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/Instance" + $ref: "#/components/schemas/LicenseEntitlement" name: description: Event name enum: - - INSTANCE_UPDATED + - LICENSE_ENTITLEMENT_UPDATED examples: - - INSTANCE_UPDATED + - LICENSE_ENTITLEMENT_UPDATED type: string type: description: Event type enum: - - com.kaiten.instance.v1.updated + - com.kaiten.license.entitlement.v1.updated examples: - - com.kaiten.instance.v1.updated + - com.kaiten.license.entitlement.v1.updated type: string required: - name @@ -12064,14 +27409,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: Instance Updated Webhook + summary: License Entitlement Updated Webhook tags: - webhooks - - instances - com.kaiten.license.entitlement.v1.assigned: + - licenses + com.kaiten.license.price.v1.created: post: - description: Triggered when an entitlement is assigned to a license. - operationId: onLicenseEntitlementAssigned + description: Triggered when a price is added to a licence version. + operationId: onLicensePriceCreated requestBody: content: application/json: @@ -12079,20 +27424,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/LicenseEntitlement" + $ref: "#/components/schemas/Event" name: description: Event name enum: - - LICENSE_ENTITLEMENT_ASSIGNED + - LICENSE_PRICE_CREATED examples: - - LICENSE_ENTITLEMENT_ASSIGNED + - LICENSE_PRICE_CREATED type: string type: description: Event type enum: - - com.kaiten.license.entitlement.v1.assigned + - com.kaiten.license.price.v1.created examples: - - com.kaiten.license.entitlement.v1.assigned + - com.kaiten.license.price.v1.created type: string required: - name @@ -12103,14 +27448,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: License Entitlement Assigned Webhook + summary: License Price Created Webhook tags: - webhooks - licenses - com.kaiten.license.entitlement.v1.unassigned: + com.kaiten.license.price.v1.deprecated: post: - description: Triggered when an entitlement is unassigned from a license. - operationId: onLicenseEntitlementUnassigned + description: Triggered when a licence price is deprecated. + operationId: onLicensePriceDeprecated requestBody: content: application/json: @@ -12118,20 +27463,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/LicenseEntitlement" + $ref: "#/components/schemas/Event" name: description: Event name enum: - - LICENSE_ENTITLEMENT_UNASSIGNED + - LICENSE_PRICE_DEPRECATED examples: - - LICENSE_ENTITLEMENT_UNASSIGNED + - LICENSE_PRICE_DEPRECATED type: string type: description: Event type enum: - - com.kaiten.license.entitlement.v1.unassigned + - com.kaiten.license.price.v1.deprecated examples: - - com.kaiten.license.entitlement.v1.unassigned + - com.kaiten.license.price.v1.deprecated type: string required: - name @@ -12142,14 +27487,14 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: License Entitlement Unassigned Webhook + summary: License Price Deprecated Webhook tags: - webhooks - licenses - com.kaiten.license.entitlement.v1.updated: + com.kaiten.license.price.v1.updated: post: - description: Triggered when a license entitlement is updated. - operationId: onLicenseEntitlementUpdated + description: Triggered when a price of a DRAFT licence version is edited. + operationId: onLicensePriceUpdated requestBody: content: application/json: @@ -12157,20 +27502,20 @@ webhooks: additionalProperties: false properties: data: - $ref: "#/components/schemas/LicenseEntitlement" + $ref: "#/components/schemas/UpdatedEvent" name: description: Event name enum: - - LICENSE_ENTITLEMENT_UPDATED + - LICENSE_PRICE_UPDATED examples: - - LICENSE_ENTITLEMENT_UPDATED + - LICENSE_PRICE_UPDATED type: string type: description: Event type enum: - - com.kaiten.license.entitlement.v1.updated + - com.kaiten.license.price.v1.updated examples: - - com.kaiten.license.entitlement.v1.updated + - com.kaiten.license.price.v1.updated type: string required: - name @@ -12181,7 +27526,7 @@ webhooks: responses: "200": description: Webhook processed successfully - summary: License Entitlement Updated Webhook + summary: License Price Updated Webhook tags: - webhooks - licenses @@ -12809,3 +28154,198 @@ webhooks: tags: - webhooks - releases + com.kaiten.voucher.v1.archived: + post: + description: Triggered when a voucher is archived. + operationId: onVoucherArchived + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Voucher" + name: + description: Event name + enum: + - VOUCHER_ARCHIVED + examples: + - VOUCHER_ARCHIVED + type: string + type: + description: Event type + enum: + - com.kaiten.voucher.v1.archived + examples: + - com.kaiten.voucher.v1.archived + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Voucher Archived Webhook + tags: + - webhooks + - vouchers + com.kaiten.voucher.v1.created: + post: + description: Triggered when a voucher is created. The code is never in the payload. + operationId: onVoucherCreated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Voucher" + name: + description: Event name + enum: + - VOUCHER_CREATED + examples: + - VOUCHER_CREATED + type: string + type: + description: Event type + enum: + - com.kaiten.voucher.v1.created + examples: + - com.kaiten.voucher.v1.created + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Voucher Created Webhook + tags: + - webhooks + - vouchers + com.kaiten.voucher.v1.exhausted: + post: + description: Triggered by the redemption that reaches maxRedemptions. + operationId: onVoucherExhausted + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/ExhaustedEvent" + name: + description: Event name + enum: + - VOUCHER_EXHAUSTED + examples: + - VOUCHER_EXHAUSTED + type: string + type: + description: Event type + enum: + - com.kaiten.voucher.v1.exhausted + examples: + - com.kaiten.voucher.v1.exhausted + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Voucher Exhausted Webhook + tags: + - webhooks + - vouchers + com.kaiten.voucher.v1.published: + post: + description: Triggered when a draft voucher becomes redeemable. + operationId: onVoucherPublished + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Voucher" + name: + description: Event name + enum: + - VOUCHER_PUBLISHED + examples: + - VOUCHER_PUBLISHED + type: string + type: + description: Event type + enum: + - com.kaiten.voucher.v1.published + examples: + - com.kaiten.voucher.v1.published + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Voucher Published Webhook + tags: + - webhooks + - vouchers + com.kaiten.voucher.v1.updated: + post: + description: Triggered when a voucher changes. + operationId: onVoucherUpdated + requestBody: + content: + application/json: + schema: + additionalProperties: false + properties: + data: + $ref: "#/components/schemas/Voucher" + name: + description: Event name + enum: + - VOUCHER_UPDATED + examples: + - VOUCHER_UPDATED + type: string + type: + description: Event type + enum: + - com.kaiten.voucher.v1.updated + examples: + - com.kaiten.voucher.v1.updated + type: string + required: + - name + - type + - data + type: object + required: true + responses: + "200": + description: Webhook processed successfully + summary: Voucher Updated Webhook + tags: + - webhooks + - vouchers diff --git a/packages/client/src/client/client.ts b/packages/client/src/client/client.ts index 0855e93..53a04b1 100644 --- a/packages/client/src/client/client.ts +++ b/packages/client/src/client/client.ts @@ -1,6 +1,7 @@ import { evaluateFlag as evaluateFlagApi, evaluateFlagsBulk, + createSessionCheckout as createSessionCheckoutApi, getCustomer as getCustomerApi, getEntitlementGroupUsage, getEntitlementUsageMetrics, @@ -12,6 +13,7 @@ import { getLicenseEntitlements, getLicenses, listCustomers, + listSessionInvoices as listSessionInvoicesApi, listUsageReports, reportEntitlementUsageMetric, } from "../core/index.ts"; @@ -31,6 +33,13 @@ import { type PublicCatalogResponse, } from "./public-catalog.ts"; import { isEvaluationSuccess } from "./feature-flags.ts"; +import { + checkoutFrom, + invoicePageFrom, + type CheckoutOrder, + type CheckoutResult, + type SessionInvoicePage, +} from "./session.ts"; import { KaitenTransport } from "../core/index.ts"; import { LICENSING_CATALOG_QUERY, LICENSING_SNAPSHOT_QUERY } from "../graphql/documents.ts"; import type { @@ -150,6 +159,26 @@ export interface KaitenFlagsModule { evaluateAll: (context?: Record) => Promise; } +/** + * What a customer session (`kst_`) does from the customer's browser. The + * client must be created with `authScheme: "bearer"` and a `tokenProvider` + * returning the session your backend minted with + * `CustomerSessions.createCustomerSession` (`@kaitencloud/server`); it is + * called on every request, so return a fresh one before `expiresAt`. + */ +export interface KaitenSessionModule { + /** What the checkout would bill today. Changes nothing. */ + previewCheckout: (order: CheckoutOrder) => Promise; + /** + * Subscribes the session's instance. Answers `requires_payment_method` with + * a setup page when a card has to be saved first: send the customer there, + * then call again with its `setupSessionId`. + */ + checkout: (order: CheckoutOrder) => Promise; + /** The customer's issued invoices, newest first, with how to pay each. */ + invoices: (options?: { cursor?: string; limit?: number }) => Promise; +} + // Result of buildCatalog(): the plan catalog plus the raw licenses and their // entitlements keyed by slug, so the snapshot can reuse the active license's data // instead of fetching it (and its entitlements) a second time. @@ -361,6 +390,7 @@ export class KaitenClient implements KaitenClientLike { public readonly licenses: KaitenLicensesModule; public readonly usage: KaitenUsageModule; public readonly flags: KaitenFlagsModule; + public readonly session: KaitenSessionModule; /** Set once an API refuses usage report keys: later reports go out without them. */ private transactionIdsUnsupported = false; @@ -414,6 +444,12 @@ export class KaitenClient implements KaitenClientLike { this.getEntitlementGroupUsage(groupSlug, instanceSlug), }; + this.session = { + previewCheckout: (order) => this.sessionCheckout(order, true), + checkout: (order) => this.sessionCheckout(order, false), + invoices: (options) => this.sessionInvoices(options), + }; + this.flags = { evaluate: (key, context) => this.evaluateFlag(key, context), evaluateAll: (context) => this.evaluateFlags(context), @@ -745,6 +781,39 @@ export class KaitenClient implements KaitenClientLike { // Composed client-side from existing licenses endpoints — there is no bespoke // catalog endpoint server-side (Option A, see ARCHITECTURE.md). + // A customer session is a bearer token; a publishable key reaches only the + // catalogue, so the session routes refuse it -- said here, before a request + // the API would answer 403. + private requireSession(operation: string): void { + if (this.authScheme !== "bearer") { + throw new TypeError( + `Kaiten: ${operation} needs a customer session (kst_) sent with authScheme "bearer"; ` + + "mint one from your backend with CustomerSessions.createCustomerSession.", + ); + } + } + + private async sessionCheckout(order: CheckoutOrder, dryRun: boolean): Promise { + this.requireSession("checkout"); + const wire = await this.transport.run( + (client) => createSessionCheckoutApi({ client, body: { ...order, dryRun } }), + "POST /public/session/checkout", + ); + return checkoutFrom(wire); + } + + private async sessionInvoices( + options: { cursor?: string; limit?: number } = {}, + ): Promise { + this.requireSession("session.invoices"); + const wire = await this.transport.run( + (client) => + listSessionInvoicesApi({ client, query: { cursor: options.cursor, limit: options.limit } }), + "GET /public/session/invoices", + ); + return invoicePageFrom(wire); + } + async getCatalog(): Promise { // A publishable key reads the public catalogue and nothing else, so public // mode never falls back to GraphQL or the REST fan-out: both answer 401 to a diff --git a/packages/client/src/client/public-catalog.ts b/packages/client/src/client/public-catalog.ts index 30cccde..486c25e 100644 --- a/packages/client/src/client/public-catalog.ts +++ b/packages/client/src/client/public-catalog.ts @@ -1,14 +1,15 @@ // The public catalogue, read with a publishable key: GET /api/public/catalog. // -// The wire shape is written here rather than generated, because the vendored -// contract (contracts/openapi.yaml) follows released kaiten versions and this -// route is newer than the last one. When contract-drift brings it in, these -// types can give way to the generated ones; the mapping stays. -// // The API does not mirror the SDK's shapes; this maps them (§14.5 of the // billing spec): amounts stay in minor units, periods become intervals, the // default monthly and annual flat fees become `price` and `annualPrice`. +import type { + PublicAddOn as PublicAddOnWire, + PublicCatalog as PublicCatalogWire, + PublicPlanEntitlement as PublicPlanEntitlementWire, + PublicPrice as PublicPriceWire, +} from "../core/generated/types.gen.ts"; import type { Addon, BillingInterval, @@ -21,85 +22,7 @@ import type { export const PUBLIC_CATALOG_PATH = "/public/catalog"; -export interface PublicCatalogResponse { - plans: PublicPlanWire[]; - addOns: PublicAddOnWire[]; - capabilities: { checkout: boolean; paymentMethods: boolean }; -} - -interface PublicPriceWire { - id: string; - billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; - billingTiming: "ADVANCE" | "ARREARS"; - billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; - currency: string; - unitAmount?: number; - unitAmountDecimal: string; - metered?: { - entitlementSlug: string; - saleUnitFactor: string; - saleUnitSingular?: string; - saleUnitPlural?: string; - }; - displayLabel?: string; - displayOrder: number; - isDefault: boolean; -} - -interface PublicPlanEntitlementWire { - slug: string; - name: string; - description?: string; - type: "BOOLEAN" | "NUMBER" | "CONFIG"; - value: unknown; - unlimited: boolean; - limitCapExceededOveragePercent?: number; - icon?: string; - unitSingular?: string; - unitPlural?: string; - saleUnitSingular?: string; - saleUnitPlural?: string; - saleUnitFactor?: string; - displayOrder: number; -} - -interface PublicPlanWire { - familySlug: string; - licenseSlug: string; - licenseId: string; - name: string; - description: string; - lifecycleState: "PUBLISHED"; - pricingType: "FREE" | "PAID" | "CUSTOM"; - trialPeriodDays: number | null; - requiresPaymentMethod: boolean; - selfServe: boolean; - selfServeCtaUrl: string | null; - currency: string | null; - prices: PublicPriceWire[]; - compatibleAddonFamilies: string[]; - entitlements: PublicPlanEntitlementWire[]; -} - -interface PublicAddOnWire { - familySlug: string; - addonSlug: string; - addonId: string; - name: string; - description: string; - pricingType: "FREE" | "PAID" | "CUSTOM"; - maxQuantity: number | null; - prices: PublicPriceWire[]; - entitlements: { - slug: string; - name: string; - type: "BOOLEAN" | "NUMBER" | "CONFIG"; - value: unknown; - overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; - limitCapExceededOveragePercent?: number; - }[]; - compatibleLicenseFamilies: string[]; -} +export type PublicCatalogResponse = PublicCatalogWire; const PERIODS: Record< NonNullable, @@ -111,7 +34,8 @@ const PERIODS: Record< ANNUAL: { interval: "year" }, }; -function toPlanPrice(price: PublicPriceWire): PlanPrice { +/** Shows an API price as a `PlanPrice`. */ +export function planPriceFromPublic(price: PublicPriceWire): PlanPrice { const out: PlanPrice = { id: price.id, amount: price.unitAmount ?? Number(price.unitAmountDecimal), @@ -174,7 +98,7 @@ function toAddon(addon: PublicAddOnWire): Addon { name: addon.name, description: addon.description, maxQuantity: addon.maxQuantity, - prices: addon.prices.map(toPlanPrice), + prices: addon.prices.map(planPriceFromPublic), entitlements: addon.entitlements.map((grant) => ({ slug: grant.slug, name: grant.name, @@ -206,7 +130,7 @@ export function catalogFromPublic(response: PublicCatalogResponse): KaitenCatalo slug: wire.licenseSlug, name: wire.name, description: wire.description, - prices: wire.prices.map(toPlanPrice), + prices: wire.prices.map(planPriceFromPublic), entitlements: wire.entitlements.map(toPlanEntitlement), addOns: wire.compatibleAddonFamilies.flatMap((family) => { const addon = addOnsByFamily.get(family); diff --git a/packages/client/src/client/session.ts b/packages/client/src/client/session.ts new file mode 100644 index 0000000..3999e68 --- /dev/null +++ b/packages/client/src/client/session.ts @@ -0,0 +1,206 @@ +// What a customer session (kst_) does from the customer's browser: +// /api/public/session/*. The vendor's backend mints the session +// (`@kaitencloud/server`: `CustomerSessions.createCustomerSession`) and hands +// the token to the page, which passes it as a bearer token -- through +// `tokenProvider`, called on every request, so the host can mint a new one +// before `expiresAt` without remounting anything. +// +// The API's shapes are mapped to the SDK's conventions: amounts stay in minor +// units, `currency` becomes `currencyCode`, and a price reads as a `PlanPrice`. +// Totals always come from the server; nothing here adds amounts up. + +import type { + DueToday as DueTodayWire, + PageSessionInvoice as PageSessionInvoiceWire, + PublicPrice as PublicPriceWire, + SessionCheckout as SessionCheckoutWire, + SessionInvoice as SessionInvoiceWire, + SessionLine as SessionLineWire, + SessionSubscription as SessionSubscriptionWire, +} from "../core/generated/types.gen.ts"; +import { planPriceFromPublic } from "./public-catalog.ts"; +import type { PlanPrice } from "./types.ts"; + +/** A checkout: the plan's price, and what comes with it. */ +export interface CheckoutOrder { + /** An ACTIVE flat-fee price of a plan in the public catalogue (`PlanPrice.id`). */ + licensePriceId: string; + /** Public add-ons that fit the plan (`Plan.addOns`), with their quantity. */ + addOns?: { addonSlug: string; quantity?: number }[]; + voucherCode?: string; + /** Where invoices go. Required when the customer has none. */ + billingEmail?: string; + /** `false` skips the plan's trial. */ + trial?: boolean; + /** The `setupSessionId` a `requires_payment_method` answer gave, once the customer is back. */ + setupSessionId?: string; + /** Where the setup page sends the customer back. Required when a card has to be saved. */ + returnUrl?: string; +} + +/** What a checkout bills today. */ +export interface CheckoutDue { + currencyCode: string; + subtotal: number; + discountTotal: number; + total: number; + lines: SessionInvoiceLine[]; +} + +/** How paying the first invoice went. */ +export interface CheckoutPayment { + /** + * - `paid` + * - `requires_action`: the customer confirms the payment (3-D Secure) on `hostedInvoiceUrl`. + * - `failed`: the charge was refused; offer another card, or `hostedInvoiceUrl`. + * - `processing`: not known yet; poll `session.invoices()`. + * - `not_required`: nothing was due today. + */ + status: "paid" | "requires_action" | "failed" | "processing" | "not_required"; + hostedInvoiceUrl: string | null; +} + +export type CheckoutResult = + | { status: "preview"; dueToday: CheckoutDue; trialEndsAt: string | null } + | { + status: "requires_payment_method"; + setupUrl: string; + setupSessionId: string; + expiresAt: string; + } + | { + status: "subscribed"; + subscription: SessionSubscription; + activationInvoice: SessionInvoice | null; + payment: CheckoutPayment; + }; + +export interface SessionSubscription { + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + providerKind: "NOOP" | "STRIPE"; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + currencyCode: string; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + basePrice: PlanPrice; + currentPeriodStart: string; + /** The renewal date, or the end of the trial. */ + currentPeriodEnd: string; + trialEndsAt: string | null; + cancelAtPeriodEnd: boolean; +} + +export interface SessionInvoice { + id: string; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + status: "MANUAL" | "PUSHED" | "PAID" | "PAYMENT_FAILED" | "UNCOLLECTIBLE" | "VOID"; + currencyCode: string; + subtotal: number; + discountTotal: number; + total: number; + issuedAt: string | null; + dueAt: string | null; + paidAt: string | null; + serviceFrom: string; + serviceTo: string; + providerInvoiceNumber: string | null; + externalReference: string | null; + /** Where the customer pays, or confirms a payment. */ + hostedInvoiceUrl: string | null; + invoicePdfUrl: string | null; + lines: SessionInvoiceLine[]; +} + +export interface SessionInvoiceLine { + seq: number; + type: "BASE" | "ADDON" | "USAGE" | "OVERAGE" | "DISCOUNT"; + label: string; + description: string; + /** In sale units, a decimal string. */ + quantity: string; + /** Minor units, a decimal string; empty on a DISCOUNT line. */ + unitAmountDecimal: string; + /** Minor units; negative on a DISCOUNT line. */ + amount: number; + serviceFrom: string; + serviceTo: string; +} + +export interface SessionInvoicePage { + items: SessionInvoice[]; + hasMore: boolean; + nextCursor: string | null; +} + +function lineFrom(line: SessionLineWire): SessionInvoiceLine { + return { ...line }; +} + +function dueFrom(due: DueTodayWire): CheckoutDue { + return { + currencyCode: due.currency, + subtotal: due.subtotal, + discountTotal: due.discountTotal, + total: due.total, + lines: due.lines.map(lineFrom), + }; +} + +export function sessionInvoiceFrom(invoice: SessionInvoiceWire): SessionInvoice { + const { currency, lines, ...rest } = invoice; + return { ...rest, currencyCode: currency, lines: lines.map(lineFrom) }; +} + +function subscriptionFrom(subscription: SessionSubscriptionWire): SessionSubscription { + const { currency, basePrice, ...rest } = subscription; + return { + ...rest, + currencyCode: currency, + basePrice: planPriceFromPublic(basePrice as PublicPriceWire), + trialEndsAt: subscription.trialEndsAt ?? null, + }; +} + +/** Maps POST /api/public/session/checkout. */ +export function checkoutFrom(wire: SessionCheckoutWire): CheckoutResult { + switch (wire.status) { + case "preview": + return { + status: "preview", + dueToday: dueFrom( + wire.dueToday ?? { currency: "", subtotal: 0, discountTotal: 0, total: 0, lines: [] }, + ), + trialEndsAt: wire.trialEndsAt ?? null, + }; + case "requires_payment_method": + return { + status: "requires_payment_method", + setupUrl: wire.setupUrl ?? "", + setupSessionId: wire.setupSessionId ?? "", + expiresAt: wire.expiresAt ?? "", + }; + default: + if (!wire.subscription || !wire.payment) { + throw new TypeError("Kaiten: a subscribed checkout answered without its subscription"); + } + return { + status: "subscribed", + subscription: subscriptionFrom(wire.subscription), + activationInvoice: wire.activationInvoice + ? sessionInvoiceFrom(wire.activationInvoice) + : null, + payment: { + status: wire.payment.status, + hostedInvoiceUrl: wire.payment.hostedInvoiceUrl ?? null, + }, + }; + } +} + +/** Maps GET /api/public/session/invoices. */ +export function invoicePageFrom(wire: PageSessionInvoiceWire): SessionInvoicePage { + return { + items: wire.items.map(sessionInvoiceFrom), + hasMore: wire.hasMore, + nextCursor: wire.nextCursor ?? null, + }; +} diff --git a/packages/client/src/core/generated/index.ts b/packages/client/src/core/generated/index.ts index 1ace4d9..642c444 100644 --- a/packages/client/src/core/generated/index.ts +++ b/packages/client/src/core/generated/index.ts @@ -1,14 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts export { + ackHandoff, activateConnector, addEntitlementToGroup, + archiveAddon, archiveLicense, archiveMetadataField, + archiveVoucher, + assignAddonEntitlement, associateEntitlementWithLicense, + attachInstanceAddon, + cancelPlanChange, + cancelSubscription, + claimHandoff, + closeBillingPeriods, + completePaymentMethodSession, + createAddon, + createAddonPrice, createComponent, createCustomer, createCustomerIntegration, + createCustomerSession, createDeploymentZone, createEntitlement, createEntitlementGroup, @@ -16,11 +29,18 @@ export { createInstance, createInstanceIntegration, createLicense, + createLicensePrice, createMetadataField, + createPaymentMethodSession, + createPortalSession, + createPublishableKey, createRelease, createServiceAccount, createServiceAccountToken, + createSessionCheckout, + createVoucher, deactivateConnector, + deleteAddon, deleteComponent, deleteConnectorSettings, deleteCustomer, @@ -35,18 +55,30 @@ export { deleteLicenseEntitlement, deleteRelease, deleteServiceAccountToken, + deprecateAddonPrice, + deprecateLicensePrice, + detachInstanceAddon, + detachPaymentMethod, dryRunMetadataField, evaluateFlag, evaluateFlagsBulk, + exportInvoices, exportOrganizationUsageReports, exportUsageReports, + getAddon, + getAddonEntitlement, + getAddonFamily, getAuditTrails, + getBillingCapabilities, + getBillingHealth, + getBillingSettings, getComponent, getConnector, getConnectorSettings, getConnectorSettingsSchema, getConnectorState, getCustomer, + getCustomerBilling, getCustomerIntegration, getCustomerIntegrationByExternalId, getDeploymentZoneBySlug, @@ -58,44 +90,92 @@ export { getFeatureFlag, getFeatureFlags, getInstance, + getInstanceBilling, getInstanceIntegration, getInstanceIntegrationByExternalId, getInstances, + getInvoice, getLicense, getLicenseEntitlement, getLicenseEntitlements, getLicenseFamily, + getLicensePrice, getLicenses, getNotificationPreferences, getOpenfeatureManifest, + getPublicCatalog, getReleaseBySlug, getServiceAccount, getServiceAccounts, getServiceAccountTokens, getTargetingContext, + getUpcomingInvoice, + getVoucher, lintTargetingRule, + listAddonCompatibility, + listAddonEntitlements, + listAddonFamilies, + listAddonPrices, + listAddons, listComponents, listConnectors, listCustomers, listDeploymentZones, listEntitlementGroups, listEntitlements, + listHandoff, + listInstanceAddons, + listInstanceInvoices, + listInstanceVouchers, + listInvoiceLineReports, + listInvoices, listLicenseFamilies, + listLicensePrices, listMetadataFields, listNotifications, + listPublishableKeys, listReleases, + listSessionInvoices, listUsageReports, + listVoucherRedemptions, + listVouchers, + lookupVoucher, + markInvoicePaid, markNotificationsRead, type Options, patchInstance, + previewLicenseInvoice, + publishAddon, publishLicense, + publishVoucher, putNotificationPreferences, + reactivateSubscription, + recomposeInvoice, + redeemVoucher, + releaseInvoiceHold, + removeAddonCompatibility, removeEntitlementFromGroup, reorderMetadataFields, reportEntitlementUsageMetric, + retryInvoicePush, + revokeCustomerSession, + revokeInstanceVoucher, + revokePublishableKey, + schedulePlanChange, + setAddonCompatibility, + setInstanceAddonQuantity, + subscribeInstance, + syncBillingProvider, + syncInvoice, testTargetingRule, + unarchiveAddon, unarchiveLicense, unarchiveMetadataField, + unassignAddonEntitlement, + updateAddon, + updateAddonEntitlement, + updateAddonFamily, + updateBillingSettings, updateComponent, updateConnectorSettings, updateCustomer, @@ -105,15 +185,28 @@ export { updateEntitlementGroup, updateFeatureFlag, updateInstance, + updateInstanceBilling, updateInstanceIntegration, updateLicense, updateLicenseEntitlement, + updateLicenseFamily, + updateLicensePrice, updateMetadataField, + updatePublishableKey, updateServiceAccount, + updateVoucher, upsertCustomerIntegrationByExternalId, upsertInstanceIntegrationByExternalId, + validateVoucher, + voidInvoice, + writeOffInvoice, } from "./sdk.gen.js"; export type { + AckHandoffData, + AckHandoffError, + AckHandoffErrors, + AckHandoffResponse, + AckHandoffResponses, ActivateConnectorData, ActivateConnectorError, ActivateConnectorErrors, @@ -123,6 +216,27 @@ export type { AddEntitlementToGroupError, AddEntitlementToGroupErrors, AddEntitlementToGroupResponses, + Addon, + AddonChanges, + AddonEntitlement, + AddonEntitlementWritable, + AddonFamily, + AddonFamilyVisibility, + AddonFamilyWritable, + AddonGrant, + AddonGrantUpdate, + AddonGrantUpdateWritable, + AddonPriceUpdate, + AddonPriceUpdateWritable, + AddonQuantity, + AddonUpdate, + AddonUpdateWritable, + AddonWritable, + ArchiveAddonData, + ArchiveAddonError, + ArchiveAddonErrors, + ArchiveAddonResponse, + ArchiveAddonResponses, ArchiveLicenseData, ArchiveLicenseError, ArchiveLicenseErrors, @@ -133,28 +247,97 @@ export type { ArchiveMetadataFieldErrors, ArchiveMetadataFieldResponse, ArchiveMetadataFieldResponses, + ArchiveVoucherData, + ArchiveVoucherError, + ArchiveVoucherErrors, + ArchiveVoucherResponse, + ArchiveVoucherResponses, + AssignAddonEntitlementData, + AssignAddonEntitlementError, + AssignAddonEntitlementErrors, + AssignAddonEntitlementResponse, + AssignAddonEntitlementResponses, AssociateEntitlementWithLicenseData, AssociateEntitlementWithLicenseError, AssociateEntitlementWithLicenseErrors, AssociateEntitlementWithLicenseResponse, AssociateEntitlementWithLicenseResponses, + AttachInstanceAddonData, + AttachInstanceAddonError, + AttachInstanceAddonErrors, + AttachInstanceAddonResponse, + AttachInstanceAddonResponses, AuditTrail, Basic, BasicTargeting, + BillingCapabilities, + BillingFeatures, + BillingHealth, + BillingProvider, + BillingSettings, + BillingStarted, + BillingStartedWritable, BooleanEntitlementValue, BulkEvaluationFailure, BulkEvaluationRequest, + CanceledSubscription, + CanceledSubscriptionWritable, + Cancellation, + CancellationChange, + CancellationChangeWritable, + CancellationWritable, + CancelPlanChangeData, + CancelPlanChangeError, + CancelPlanChangeErrors, + CancelPlanChangeResponse, + CancelPlanChangeResponses, + CancelSubscriptionData, + CancelSubscriptionError, + CancelSubscriptionErrors, + CancelSubscriptionResponse, + CancelSubscriptionResponses, + ClaimHandoffData, + ClaimHandoffError, + ClaimHandoffErrors, + ClaimHandoffResponse, + ClaimHandoffResponses, ClientOptions, + CloseBacklog, + CloseBillingPeriodsData, + CloseBillingPeriodsError, + CloseBillingPeriodsErrors, + CloseBillingPeriodsResponse, + CloseBillingPeriodsResponses, + ClosedInvoice, + ClosePeriodsScope, Command, + CompatibleLicenseFamilies, + CompletedPaymentMethodSession, + CompletePaymentMethodSessionData, + CompletePaymentMethodSessionError, + CompletePaymentMethodSessionErrors, + CompletePaymentMethodSessionResponse, + CompletePaymentMethodSessionResponses, Component, ComponentWritable, ConfigEntitlementValue, + Connection, Connector, ConnectorActivation, ConnectorSettings, ConnectorSettingsSchema, ConnectorSettingsWritable, ConnectorState, + CreateAddonData, + CreateAddonError, + CreateAddonErrors, + CreateAddonPriceData, + CreateAddonPriceError, + CreateAddonPriceErrors, + CreateAddonPriceResponse, + CreateAddonPriceResponses, + CreateAddonResponse, + CreateAddonResponses, CreateComponentData, CreateComponentError, CreateComponentErrors, @@ -170,6 +353,12 @@ export type { CreateCustomerIntegrationResponses, CreateCustomerResponse, CreateCustomerResponses, + CreateCustomerSessionData, + CreateCustomerSessionError, + CreateCustomerSessionErrors, + CreateCustomerSessionResponse, + CreateCustomerSessionResponses, + CreatedCustomerSession, CreateDeploymentZoneData, CreateDeploymentZoneError, CreateDeploymentZoneErrors, @@ -203,6 +392,11 @@ export type { CreateLicenseData, CreateLicenseError, CreateLicenseErrors, + CreateLicensePriceData, + CreateLicensePriceError, + CreateLicensePriceErrors, + CreateLicensePriceResponse, + CreateLicensePriceResponses, CreateLicenseResponse, CreateLicenseResponses, CreateMetadataFieldData, @@ -210,6 +404,21 @@ export type { CreateMetadataFieldErrors, CreateMetadataFieldResponse, CreateMetadataFieldResponses, + CreatePaymentMethodSessionData, + CreatePaymentMethodSessionError, + CreatePaymentMethodSessionErrors, + CreatePaymentMethodSessionResponse, + CreatePaymentMethodSessionResponses, + CreatePortalSessionData, + CreatePortalSessionError, + CreatePortalSessionErrors, + CreatePortalSessionResponse, + CreatePortalSessionResponses, + CreatePublishableKeyData, + CreatePublishableKeyError, + CreatePublishableKeyErrors, + CreatePublishableKeyResponse, + CreatePublishableKeyResponses, CreateReleaseData, CreateReleaseError, CreateReleaseErrors, @@ -225,12 +434,25 @@ export type { CreateServiceAccountTokenErrors, CreateServiceAccountTokenResponse, CreateServiceAccountTokenResponses, + CreateSessionCheckoutData, + CreateSessionCheckoutError, + CreateSessionCheckoutErrors, + CreateSessionCheckoutResponse, + CreateSessionCheckoutResponses, + CreateVoucherData, + CreateVoucherError, + CreateVoucherErrors, + CreateVoucherResponse, + CreateVoucherResponses, Customer, + CustomerBilling, CustomerBody, CustomerCreationRejected, + CustomerInProvider, CustomerIntegration, CustomerIntegrationResource, CustomerIntegrationWritable, + CustomerSessionDraft, CustomerWritable, DeactivateConnectorData, DeactivateConnectorError, @@ -238,6 +460,11 @@ export type { DeactivateConnectorResponse, DeactivateConnectorResponses, DefaultVariant, + DeleteAddonData, + DeleteAddonError, + DeleteAddonErrors, + DeleteAddonResponse, + DeleteAddonResponses, DeleteComponentData, DeleteComponentError, DeleteComponentErrors, @@ -258,6 +485,7 @@ export type { DeleteCustomerIntegrationResponses, DeleteCustomerResponse, DeleteCustomerResponses, + DeletedAddon, DeleteDeploymentZoneData, DeleteDeploymentZoneError, DeleteDeploymentZoneErrors, @@ -311,11 +539,32 @@ export type { Deployment, DeploymentZone, DeploymentZoneWritable, + DeprecateAddonPriceData, + DeprecateAddonPriceError, + DeprecateAddonPriceErrors, + DeprecateAddonPriceResponse, + DeprecateAddonPriceResponses, + DeprecateLicensePriceData, + DeprecateLicensePriceError, + DeprecateLicensePriceErrors, + DeprecateLicensePriceResponse, + DeprecateLicensePriceResponses, + DetachInstanceAddonData, + DetachInstanceAddonError, + DetachInstanceAddonErrors, + DetachInstanceAddonResponse, + DetachInstanceAddonResponses, + DetachPaymentMethodData, + DetachPaymentMethodError, + DetachPaymentMethodErrors, + DetachPaymentMethodResponse, + DetachPaymentMethodResponses, DryRunMetadataFieldData, DryRunMetadataFieldError, DryRunMetadataFieldErrors, DryRunMetadataFieldResponse, DryRunMetadataFieldResponses, + DueToday, Entitlement, EntitlementGroup, EntitlementGroupSummary, @@ -339,6 +588,14 @@ export type { EvaluationFailure, EvaluationRequest, EvaluationSuccess, + Event, + EventWritable, + ExhaustedEvent, + ExportInvoicesData, + ExportInvoicesError, + ExportInvoicesErrors, + ExportInvoicesResponse, + ExportInvoicesResponses, ExportOrganizationUsageReportsData, ExportOrganizationUsageReportsError, ExportOrganizationUsageReportsErrors, @@ -352,11 +609,41 @@ export type { FeatureFlag, FeatureFlagEvaluated, FeatureFlagWritable, + GetAddonData, + GetAddonEntitlementData, + GetAddonEntitlementError, + GetAddonEntitlementErrors, + GetAddonEntitlementResponse, + GetAddonEntitlementResponses, + GetAddonError, + GetAddonErrors, + GetAddonFamilyData, + GetAddonFamilyError, + GetAddonFamilyErrors, + GetAddonFamilyResponse, + GetAddonFamilyResponses, + GetAddonResponse, + GetAddonResponses, GetAuditTrailsData, GetAuditTrailsError, GetAuditTrailsErrors, GetAuditTrailsResponse, GetAuditTrailsResponses, + GetBillingCapabilitiesData, + GetBillingCapabilitiesError, + GetBillingCapabilitiesErrors, + GetBillingCapabilitiesResponse, + GetBillingCapabilitiesResponses, + GetBillingHealthData, + GetBillingHealthError, + GetBillingHealthErrors, + GetBillingHealthResponse, + GetBillingHealthResponses, + GetBillingSettingsData, + GetBillingSettingsError, + GetBillingSettingsErrors, + GetBillingSettingsResponse, + GetBillingSettingsResponses, GetComponentData, GetComponentError, GetComponentErrors, @@ -382,6 +669,11 @@ export type { GetConnectorStateErrors, GetConnectorStateResponse, GetConnectorStateResponses, + GetCustomerBillingData, + GetCustomerBillingError, + GetCustomerBillingErrors, + GetCustomerBillingResponse, + GetCustomerBillingResponses, GetCustomerData, GetCustomerError, GetCustomerErrors, @@ -437,6 +729,11 @@ export type { GetFeatureFlagsErrors, GetFeatureFlagsResponse, GetFeatureFlagsResponses, + GetInstanceBillingData, + GetInstanceBillingError, + GetInstanceBillingErrors, + GetInstanceBillingResponse, + GetInstanceBillingResponses, GetInstanceData, GetInstanceError, GetInstanceErrors, @@ -457,6 +754,11 @@ export type { GetInstancesErrors, GetInstancesResponse, GetInstancesResponses, + GetInvoiceData, + GetInvoiceError, + GetInvoiceErrors, + GetInvoiceResponse, + GetInvoiceResponses, GetLicenseData, GetLicenseEntitlementData, GetLicenseEntitlementError, @@ -475,6 +777,11 @@ export type { GetLicenseFamilyErrors, GetLicenseFamilyResponse, GetLicenseFamilyResponses, + GetLicensePriceData, + GetLicensePriceError, + GetLicensePriceErrors, + GetLicensePriceResponse, + GetLicensePriceResponses, GetLicenseResponse, GetLicenseResponses, GetLicensesData, @@ -492,6 +799,11 @@ export type { GetOpenfeatureManifestErrors, GetOpenfeatureManifestResponse, GetOpenfeatureManifestResponses, + GetPublicCatalogData, + GetPublicCatalogError, + GetPublicCatalogErrors, + GetPublicCatalogResponse, + GetPublicCatalogResponses, GetReleaseBySlugData, GetReleaseBySlugError, GetReleaseBySlugErrors, @@ -517,9 +829,38 @@ export type { GetTargetingContextErrors, GetTargetingContextResponse, GetTargetingContextResponses, + GetUpcomingInvoiceData, + GetUpcomingInvoiceError, + GetUpcomingInvoiceErrors, + GetUpcomingInvoiceResponse, + GetUpcomingInvoiceResponses, + GetVoucherData, + GetVoucherError, + GetVoucherErrors, + GetVoucherResponse, + GetVoucherResponses, + Grant, + Handoff, + HandoffAcknowledgement, + HandoffBacklog, + HandoffBooking, + HandoffClaim, + HandoffClaimSize, + HeldInvoice, + HeldInvoices, + HeldPair, + HoldDetail, + HoldRecord, + HoldRelease, Impact, ImpactSample, Instance, + InstanceAddon, + InstanceAddonUpdate, + InstanceAddonUpdateWritable, + InstanceAddonWritable, + InstanceBilling, + InstanceBillingWritable, InstanceBody, InstanceEntitlementCapExceeded, InstanceEntitlementUsagePeriodRolledOver, @@ -533,18 +874,62 @@ export type { InstanceLifecycleStageChanged, InstanceStatusChanged, InstanceWritable, + Invoice, + InvoiceHold, + InvoiceLine, + InvoiceLineDiscount, + InvoiceLineLedger, + InvoiceLineMetering, + InvoiceLineOverage, + InvoiceLineProvider, + InvoicePayment, + InvoicePreview, + InvoicePreviewScenario, + InvoiceSummary, + InvoiceVoid, + InvoiceWriteOff, + IssuedInvoice, License, LicenseEntitlement, LicenseEntitlementWritable, LicenseFamilyView, LicenseFamilyViewWritable, + LicenseFamilyVisibility, + LicensePriceChanges, LicenseWritable, + LineDifference, + LineReportPage, LintTargetingRuleData, LintTargetingRuleError, LintTargetingRuleErrors, LintTargetingRuleResponse, LintTargetingRuleResponses, List, + ListAddonCompatibilityData, + ListAddonCompatibilityError, + ListAddonCompatibilityErrors, + ListAddonCompatibilityResponse, + ListAddonCompatibilityResponses, + ListAddonEntitlementsData, + ListAddonEntitlementsError, + ListAddonEntitlementsErrors, + ListAddonEntitlementsResponse, + ListAddonEntitlementsResponses, + ListAddonFamiliesData, + ListAddonFamiliesError, + ListAddonFamiliesErrors, + ListAddonFamiliesResponse, + ListAddonFamiliesResponses, + ListAddonPricesData, + ListAddonPricesError, + ListAddonPricesErrors, + ListAddonPricesResponse, + ListAddonPricesResponses, + ListAddonsData, + ListAddonsError, + ListAddonsErrors, + ListAddonsResponse, + ListAddonsResponses, ListComponentsData, ListComponentsError, ListComponentsErrors, @@ -575,11 +960,46 @@ export type { ListEntitlementsErrors, ListEntitlementsResponse, ListEntitlementsResponses, + ListHandoffData, + ListHandoffError, + ListHandoffErrors, + ListHandoffResponse, + ListHandoffResponses, + ListInstanceAddonsData, + ListInstanceAddonsError, + ListInstanceAddonsErrors, + ListInstanceAddonsResponse, + ListInstanceAddonsResponses, + ListInstanceInvoicesData, + ListInstanceInvoicesError, + ListInstanceInvoicesErrors, + ListInstanceInvoicesResponse, + ListInstanceInvoicesResponses, + ListInstanceVouchersData, + ListInstanceVouchersError, + ListInstanceVouchersErrors, + ListInstanceVouchersResponse, + ListInstanceVouchersResponses, + ListInvoiceLineReportsData, + ListInvoiceLineReportsError, + ListInvoiceLineReportsErrors, + ListInvoiceLineReportsResponse, + ListInvoiceLineReportsResponses, + ListInvoicesData, + ListInvoicesError, + ListInvoicesErrors, + ListInvoicesResponse, + ListInvoicesResponses, ListLicenseFamiliesData, ListLicenseFamiliesError, ListLicenseFamiliesErrors, ListLicenseFamiliesResponse, ListLicenseFamiliesResponses, + ListLicensePricesData, + ListLicensePricesError, + ListLicensePricesErrors, + ListLicensePricesResponse, + ListLicensePricesResponses, ListMetadataFieldsData, ListMetadataFieldsError, ListMetadataFieldsErrors, @@ -590,18 +1010,48 @@ export type { ListNotificationsErrors, ListNotificationsResponse, ListNotificationsResponses, + ListPublishableKeysData, + ListPublishableKeysError, + ListPublishableKeysErrors, + ListPublishableKeysResponse, + ListPublishableKeysResponses, ListReleasesData, ListReleasesError, ListReleasesErrors, ListReleasesResponse, ListReleasesResponses, + ListSessionInvoicesData, + ListSessionInvoicesError, + ListSessionInvoicesErrors, + ListSessionInvoicesResponse, + ListSessionInvoicesResponses, ListUsageReportsData, ListUsageReportsError, ListUsageReportsErrors, ListUsageReportsResponse, ListUsageReportsResponses, + ListVoucherRedemptionsData, + ListVoucherRedemptionsError, + ListVoucherRedemptionsErrors, + ListVoucherRedemptionsResponse, + ListVoucherRedemptionsResponses, + ListVouchersData, + ListVouchersError, + ListVouchersErrors, + ListVouchersResponse, + ListVouchersResponses, + LookupVoucherData, + LookupVoucherError, + LookupVoucherErrors, + LookupVoucherResponse, + LookupVoucherResponses, ManifestEnvelope, ManifestFlag, + MarkInvoicePaidData, + MarkInvoicePaidError, + MarkInvoicePaidErrors, + MarkInvoicePaidResponse, + MarkInvoicePaidResponses, MarkNotificationsReadData, MarkNotificationsReadError, MarkNotificationsReadErrors, @@ -612,9 +1062,48 @@ export type { MetadataFieldReordered, MetadataFieldSchemaProposal, MetadataFieldWritable, + Meter, + MinimumAmount, + MismatchedInvoice, + NewAddon, + NewAddonGrant, + NewAddonPrice, + NewInstanceAddon, + NewLicensePrice, + NewPaymentMethodSession, + NewPortalSession, + NewSubscription, Notification, NumberEntitlementValue, NumberEntitlementValueWritable, + OnAddonArchivedWebhookPayload, + OnAddonArchivedWebhookRequest, + OnAddonCreatedWebhookPayload, + OnAddonCreatedWebhookRequest, + OnAddonDeletedWebhookPayload, + OnAddonDeletedWebhookRequest, + OnAddonEntitlementAssignedWebhookPayload, + OnAddonEntitlementAssignedWebhookRequest, + OnAddonEntitlementUnassignedWebhookPayload, + OnAddonEntitlementUnassignedWebhookRequest, + OnAddonEntitlementUpdatedWebhookPayload, + OnAddonEntitlementUpdatedWebhookRequest, + OnAddonPriceCreatedWebhookPayload, + OnAddonPriceCreatedWebhookRequest, + OnAddonPriceDeprecatedWebhookPayload, + OnAddonPriceDeprecatedWebhookRequest, + OnAddonPublishedWebhookPayload, + OnAddonPublishedWebhookRequest, + OnAddonUnarchivedWebhookPayload, + OnAddonUnarchivedWebhookRequest, + OnAddonUpdatedWebhookPayload, + OnAddonUpdatedWebhookRequest, + OnBillingProviderConnectedWebhookPayload, + OnBillingProviderConnectedWebhookRequest, + OnBillingProviderDisconnectedWebhookPayload, + OnBillingProviderDisconnectedWebhookRequest, + OnBillingProviderSyncFailedWebhookPayload, + OnBillingProviderSyncFailedWebhookRequest, OnComponentCreatedWebhookPayload, OnComponentCreatedWebhookRequest, OnComponentDeletedWebhookPayload, @@ -627,6 +1116,12 @@ export type { OnCustomerCreationRejectedWebhookRequest, OnCustomerDeletedWebhookPayload, OnCustomerDeletedWebhookRequest, + OnCustomerPaymentMethodAttachedWebhookPayload, + OnCustomerPaymentMethodAttachedWebhookRequest, + OnCustomerPaymentMethodDetachedWebhookPayload, + OnCustomerPaymentMethodDetachedWebhookRequest, + OnCustomerPaymentMethodExpiringWebhookPayload, + OnCustomerPaymentMethodExpiringWebhookRequest, OnCustomerUpdatedWebhookPayload, OnCustomerUpdatedWebhookRequest, OnDeploymentZoneCreatedWebhookPayload, @@ -655,6 +1150,30 @@ export type { OnFeatureFlagEvaluatedWebhookRequest, OnFeatureFlagUpdatedWebhookPayload, OnFeatureFlagUpdatedWebhookRequest, + OnInstanceAddonAddedWebhookPayload, + OnInstanceAddonAddedWebhookRequest, + OnInstanceAddonQuantityChangedWebhookPayload, + OnInstanceAddonQuantityChangedWebhookRequest, + OnInstanceAddonRemovedWebhookPayload, + OnInstanceAddonRemovedWebhookRequest, + OnInstanceBillingCanceledWebhookPayload, + OnInstanceBillingCanceledWebhookRequest, + OnInstanceBillingCancellationRevertedWebhookPayload, + OnInstanceBillingCancellationRevertedWebhookRequest, + OnInstanceBillingCancellationScheduledWebhookPayload, + OnInstanceBillingCancellationScheduledWebhookRequest, + OnInstanceBillingPlanChangeCancelledWebhookPayload, + OnInstanceBillingPlanChangeCancelledWebhookRequest, + OnInstanceBillingPlanChangedWebhookPayload, + OnInstanceBillingPlanChangedWebhookRequest, + OnInstanceBillingPlanChangeScheduledWebhookPayload, + OnInstanceBillingPlanChangeScheduledWebhookRequest, + OnInstanceBillingProviderChangedWebhookPayload, + OnInstanceBillingProviderChangedWebhookRequest, + OnInstanceBillingStartedWebhookPayload, + OnInstanceBillingStartedWebhookRequest, + OnInstanceBillingStatusChangedWebhookPayload, + OnInstanceBillingStatusChangedWebhookRequest, OnInstanceCreatedWebhookPayload, OnInstanceCreatedWebhookRequest, OnInstanceDeletedWebhookPayload, @@ -675,6 +1194,28 @@ export type { OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest, OnInstanceEntitlementValueGetWebhookPayload, OnInstanceEntitlementValueGetWebhookRequest, + OnInstanceInvoiceHandoffAcknowledgedWebhookPayload, + OnInstanceInvoiceHandoffAcknowledgedWebhookRequest, + OnInstanceInvoiceHeldWebhookPayload, + OnInstanceInvoiceHeldWebhookRequest, + OnInstanceInvoiceIssuedWebhookPayload, + OnInstanceInvoiceIssuedWebhookRequest, + OnInstanceInvoiceMarkedUncollectibleWebhookPayload, + OnInstanceInvoiceMarkedUncollectibleWebhookRequest, + OnInstanceInvoicePaidWebhookPayload, + OnInstanceInvoicePaidWebhookRequest, + OnInstanceInvoicePaymentFailedWebhookPayload, + OnInstanceInvoicePaymentFailedWebhookRequest, + OnInstanceInvoicePushedWebhookPayload, + OnInstanceInvoicePushedWebhookRequest, + OnInstanceInvoicePushFailedWebhookPayload, + OnInstanceInvoicePushFailedWebhookRequest, + OnInstanceInvoiceReconciliationMismatchWebhookPayload, + OnInstanceInvoiceReconciliationMismatchWebhookRequest, + OnInstanceInvoiceReleasedWebhookPayload, + OnInstanceInvoiceReleasedWebhookRequest, + OnInstanceInvoiceVoidedWebhookPayload, + OnInstanceInvoiceVoidedWebhookRequest, OnInstanceLifecycleStageChangedWebhookPayload, OnInstanceLifecycleStageChangedWebhookRequest, OnInstanceMigratedWebhookPayload, @@ -683,6 +1224,12 @@ export type { OnInstanceStatusChangedWebhookRequest, OnInstanceUpdatedWebhookPayload, OnInstanceUpdatedWebhookRequest, + OnInstanceVoucherExpiredWebhookPayload, + OnInstanceVoucherExpiredWebhookRequest, + OnInstanceVoucherRedeemedWebhookPayload, + OnInstanceVoucherRedeemedWebhookRequest, + OnInstanceVoucherRevokedWebhookPayload, + OnInstanceVoucherRevokedWebhookRequest, OnLicenseArchivedWebhookPayload, OnLicenseArchivedWebhookRequest, OnLicenseCreatedWebhookPayload, @@ -701,6 +1248,12 @@ export type { OnLicenseFamilyDeletedWebhookRequest, OnLicenseFamilyUpdatedWebhookPayload, OnLicenseFamilyUpdatedWebhookRequest, + OnLicensePriceCreatedWebhookPayload, + OnLicensePriceCreatedWebhookRequest, + OnLicensePriceDeprecatedWebhookPayload, + OnLicensePriceDeprecatedWebhookRequest, + OnLicensePriceUpdatedWebhookPayload, + OnLicensePriceUpdatedWebhookRequest, OnLicensePublishedWebhookPayload, OnLicensePublishedWebhookRequest, OnLicenseUnarchivedWebhookPayload, @@ -725,6 +1278,18 @@ export type { OnReleaseDeployedWebhookRequest, OnSystemOrganizationTokenIssuedWebhookPayload, OnSystemOrganizationTokenIssuedWebhookRequest, + OnVoucherArchivedWebhookPayload, + OnVoucherArchivedWebhookRequest, + OnVoucherCreatedWebhookPayload, + OnVoucherCreatedWebhookRequest, + OnVoucherExhaustedWebhookPayload, + OnVoucherExhaustedWebhookRequest, + OnVoucherPublishedWebhookPayload, + OnVoucherPublishedWebhookRequest, + OnVoucherUpdatedWebhookPayload, + OnVoucherUpdatedWebhookRequest, + Outcome, + OverageLimit, PageAuditTrail, PageComponent, PageComponentWritable, @@ -740,6 +1305,7 @@ export type { PageFeatureFlagWritable, PageInstance, PageInstanceWritable, + PageInvoiceSummary, PageLicense, PageLicenseEntitlement, PageLicenseEntitlementWritable, @@ -748,38 +1314,123 @@ export type { PageLicenseWritable, PageMetadataField, PageMetadataFieldWritable, + PageQueuedInvoice, PageRelease, PageReleaseWritable, PageServiceAccount, PageServiceAccountWritable, + PageSessionInvoice, PageToken, PageTokenWritable, + PaidInvoice, PatchInstanceBody, PatchInstanceData, PatchInstanceError, PatchInstanceErrors, PatchInstanceResponse, PatchInstanceResponses, + Payment, + PaymentFailedInvoice, + PaymentMethodAttached, + PaymentMethodDetached, + PaymentMethodExpiring, + PaymentMethodLabels, + PaymentMethodSession, PlainToken, PlainTokenWritable, + PlanChange, + PlanChangeSchedule, + PlanChangeTarget, + PortalSession, PreferenceChoices, PreferenceEvent, PreferenceMatrix, PreferenceUpdate, + PreviewLicenseInvoiceData, + PreviewLicenseInvoiceError, + PreviewLicenseInvoiceErrors, + PreviewLicenseInvoiceResponse, + PreviewLicenseInvoiceResponses, + Price, + PriceWritable, Problem, + ProviderCapabilities, + ProviderChange, + ProviderRecord, + ProviderSync, + PublicAddOn, + PublicAddOnEntitlement, + PublicCatalog, + PublicCatalogCapabilities, + PublicMeter, + PublicPlan, + PublicPlanEntitlement, + PublicPrice, + PublicSurface, + PublishableKey, + PublishableKeyCreated, + PublishableKeyCreatedWritable, + PublishableKeyDraft, + PublishableKeyPatch, + PublishableKeyWritable, + PublishAddonData, + PublishAddonError, + PublishAddonErrors, + PublishAddonResponse, + PublishAddonResponses, PublishLicenseData, PublishLicenseError, PublishLicenseErrors, PublishLicenseResponse, PublishLicenseResponses, + PublishVoucherData, + PublishVoucherError, + PublishVoucherErrors, + PublishVoucherResponse, + PublishVoucherResponses, + PushedInvoice, + PushFailedInvoice, + PushFailures, PutNotificationPreferencesData, PutNotificationPreferencesError, PutNotificationPreferencesErrors, PutNotificationPreferencesResponse, PutNotificationPreferencesResponses, + QueuedInvoice, + ReactivateSubscriptionData, + ReactivateSubscriptionError, + ReactivateSubscriptionErrors, + ReactivateSubscriptionResponse, + ReactivateSubscriptionResponses, ReadSelection, + RecomposeInvoiceData, + RecomposeInvoiceError, + RecomposeInvoiceErrors, + RecomposeInvoiceResponse, + RecomposeInvoiceResponses, + Reconciliation, + RedeemableCode, + RedeemVoucherData, + RedeemVoucherError, + RedeemVoucherErrors, + RedeemVoucherResponse, + RedeemVoucherResponses, + Redemption, + RedemptionRules, + RedemptionWritable, Release, + ReleasedInvoice, + ReleaseInvoiceHoldData, + ReleaseInvoiceHoldError, + ReleaseInvoiceHoldErrors, + ReleaseInvoiceHoldResponse, + ReleaseInvoiceHoldResponses, ReleaseWritable, + RemoveAddonCompatibilityData, + RemoveAddonCompatibilityError, + RemoveAddonCompatibilityErrors, + RemoveAddonCompatibilityResponse, + RemoveAddonCompatibilityResponses, RemoveEntitlementFromGroupData, RemoveEntitlementFromGroupError, RemoveEntitlementFromGroupErrors, @@ -791,6 +1442,7 @@ export type { ReorderMetadataFieldsInput, ReorderMetadataFieldsResponse, ReorderMetadataFieldsResponses, + Report, ReportEntitlementUsageBody, ReportEntitlementUsageBodyWritable, ReportEntitlementUsageMetricData, @@ -798,13 +1450,80 @@ export type { ReportEntitlementUsageMetricErrors, ReportEntitlementUsageMetricResponse, ReportEntitlementUsageMetricResponses, + RetryInvoicePushData, + RetryInvoicePushError, + RetryInvoicePushErrors, + RetryInvoicePushResponse, + RetryInvoicePushResponses, + RevocationReason, + RevokeCustomerSessionData, + RevokeCustomerSessionError, + RevokeCustomerSessionErrors, + RevokeCustomerSessionResponse, + RevokeCustomerSessionResponses, + RevokeInstanceVoucherData, + RevokeInstanceVoucherError, + RevokeInstanceVoucherErrors, + RevokeInstanceVoucherResponse, + RevokeInstanceVoucherResponses, + RevokePublishableKeyData, + RevokePublishableKeyError, + RevokePublishableKeyErrors, + RevokePublishableKeyResponse, + RevokePublishableKeyResponses, RolloutDate, RolloutDateTargeting, RolloutPercentage, RolloutPercentageTargeting, RolloutStep, + SampleUsageAmount, + ScheduledChange, + ScheduledChangeWritable, + SchedulePlanChangeData, + SchedulePlanChangeError, + SchedulePlanChangeErrors, + SchedulePlanChangeResponse, + SchedulePlanChangeResponses, ServiceAccount, ServiceAccountWritable, + SessionCheckout, + SessionCheckoutOrder, + SessionInvoice, + SessionLine, + SessionSubscription, + SetAddonCompatibilityData, + SetAddonCompatibilityError, + SetAddonCompatibilityErrors, + SetAddonCompatibilityResponse, + SetAddonCompatibilityResponses, + SetInstanceAddonQuantityData, + SetInstanceAddonQuantityError, + SetInstanceAddonQuantityErrors, + SetInstanceAddonQuantityResponse, + SetInstanceAddonQuantityResponses, + StartedSubscription, + StartedSubscriptionWritable, + StatusChange, + SubscribeInstanceData, + SubscribeInstanceError, + SubscribeInstanceErrors, + SubscribeInstanceResponse, + SubscribeInstanceResponses, + SubscriptionAddon, + SubscriptionCancellation, + SubscriptionTerms, + SyncBillingProviderData, + SyncBillingProviderError, + SyncBillingProviderErrors, + SyncBillingProviderResponse, + SyncBillingProviderResponses, + SyncFailure, + SyncInvoiceData, + SyncInvoiceError, + SyncInvoiceErrors, + SyncInvoiceResponse, + SyncInvoiceResponses, + SyncReport, SystemTokenIssuance, TargetingContext, TargetingContextNode, @@ -821,6 +1540,12 @@ export type { TestTargetingRuleResponses, Token, TokenWritable, + TotalsDifference, + UnarchiveAddonData, + UnarchiveAddonError, + UnarchiveAddonErrors, + UnarchiveAddonResponse, + UnarchiveAddonResponses, UnarchiveLicenseData, UnarchiveLicenseError, UnarchiveLicenseErrors, @@ -831,6 +1556,32 @@ export type { UnarchiveMetadataFieldErrors, UnarchiveMetadataFieldResponse, UnarchiveMetadataFieldResponses, + UnassignAddonEntitlementData, + UnassignAddonEntitlementError, + UnassignAddonEntitlementErrors, + UnassignAddonEntitlementResponse, + UnassignAddonEntitlementResponses, + UncollectibleInvoice, + UpdateAddonData, + UpdateAddonEntitlementData, + UpdateAddonEntitlementError, + UpdateAddonEntitlementErrors, + UpdateAddonEntitlementResponse, + UpdateAddonEntitlementResponses, + UpdateAddonError, + UpdateAddonErrors, + UpdateAddonFamilyData, + UpdateAddonFamilyError, + UpdateAddonFamilyErrors, + UpdateAddonFamilyResponse, + UpdateAddonFamilyResponses, + UpdateAddonResponse, + UpdateAddonResponses, + UpdateBillingSettingsData, + UpdateBillingSettingsError, + UpdateBillingSettingsErrors, + UpdateBillingSettingsResponse, + UpdateBillingSettingsResponses, UpdateComponentData, UpdateComponentError, UpdateComponentErrors, @@ -856,6 +1607,8 @@ export type { UpdateDeploymentZoneErrors, UpdateDeploymentZoneResponse, UpdateDeploymentZoneResponses, + UpdatedEvent, + UpdatedEventWritable, UpdateEntitlementData, UpdateEntitlementError, UpdateEntitlementErrors, @@ -871,6 +1624,11 @@ export type { UpdateFeatureFlagErrors, UpdateFeatureFlagResponse, UpdateFeatureFlagResponses, + UpdateInstanceBillingData, + UpdateInstanceBillingError, + UpdateInstanceBillingErrors, + UpdateInstanceBillingResponse, + UpdateInstanceBillingResponses, UpdateInstanceData, UpdateInstanceError, UpdateInstanceErrors, @@ -889,6 +1647,16 @@ export type { UpdateLicenseEntitlementResponses, UpdateLicenseError, UpdateLicenseErrors, + UpdateLicenseFamilyData, + UpdateLicenseFamilyError, + UpdateLicenseFamilyErrors, + UpdateLicenseFamilyResponse, + UpdateLicenseFamilyResponses, + UpdateLicensePriceData, + UpdateLicensePriceError, + UpdateLicensePriceErrors, + UpdateLicensePriceResponse, + UpdateLicensePriceResponses, UpdateLicenseResponse, UpdateLicenseResponses, UpdateMetadataFieldData, @@ -896,11 +1664,21 @@ export type { UpdateMetadataFieldErrors, UpdateMetadataFieldResponse, UpdateMetadataFieldResponses, + UpdatePublishableKeyData, + UpdatePublishableKeyError, + UpdatePublishableKeyErrors, + UpdatePublishableKeyResponse, + UpdatePublishableKeyResponses, UpdateServiceAccountData, UpdateServiceAccountError, UpdateServiceAccountErrors, UpdateServiceAccountResponse, UpdateServiceAccountResponses, + UpdateVoucherData, + UpdateVoucherError, + UpdateVoucherErrors, + UpdateVoucherResponse, + UpdateVoucherResponses, UpsertCustomerIntegrationByExternalIdData, UpsertCustomerIntegrationByExternalIdError, UpsertCustomerIntegrationByExternalIdErrors, @@ -914,6 +1692,29 @@ export type { UsageReport, UsageReportPage, User, + ValidateVoucherData, + ValidateVoucherError, + ValidateVoucherErrors, + ValidateVoucherResponse, + ValidateVoucherResponses, + Validity, + ValidityWritable, Variant, + VoidedInvoice, + VoidInvoiceData, + VoidInvoiceError, + VoidInvoiceErrors, + VoidInvoiceResponse, + VoidInvoiceResponses, + Voucher, + VoucherCheck, + VoucherCode, + VoucherDraft, + VoucherWritable, Webhooks, + WriteOffInvoiceData, + WriteOffInvoiceError, + WriteOffInvoiceErrors, + WriteOffInvoiceResponse, + WriteOffInvoiceResponses, } from "./types.gen.js"; diff --git a/packages/client/src/core/generated/sdk.gen.ts b/packages/client/src/core/generated/sdk.gen.ts index 9c963b2..4d3f8d5 100644 --- a/packages/client/src/core/generated/sdk.gen.ts +++ b/packages/client/src/core/generated/sdk.gen.ts @@ -9,21 +9,57 @@ import type { TDataShape, } from "./client/index.js"; import type { + AckHandoffData, + AckHandoffErrors, + AckHandoffResponses, ActivateConnectorData, ActivateConnectorErrors, ActivateConnectorResponses, AddEntitlementToGroupData, AddEntitlementToGroupErrors, AddEntitlementToGroupResponses, + ArchiveAddonData, + ArchiveAddonErrors, + ArchiveAddonResponses, ArchiveLicenseData, ArchiveLicenseErrors, ArchiveLicenseResponses, ArchiveMetadataFieldData, ArchiveMetadataFieldErrors, ArchiveMetadataFieldResponses, + ArchiveVoucherData, + ArchiveVoucherErrors, + ArchiveVoucherResponses, + AssignAddonEntitlementData, + AssignAddonEntitlementErrors, + AssignAddonEntitlementResponses, AssociateEntitlementWithLicenseData, AssociateEntitlementWithLicenseErrors, AssociateEntitlementWithLicenseResponses, + AttachInstanceAddonData, + AttachInstanceAddonErrors, + AttachInstanceAddonResponses, + CancelPlanChangeData, + CancelPlanChangeErrors, + CancelPlanChangeResponses, + CancelSubscriptionData, + CancelSubscriptionErrors, + CancelSubscriptionResponses, + ClaimHandoffData, + ClaimHandoffErrors, + ClaimHandoffResponses, + CloseBillingPeriodsData, + CloseBillingPeriodsErrors, + CloseBillingPeriodsResponses, + CompletePaymentMethodSessionData, + CompletePaymentMethodSessionErrors, + CompletePaymentMethodSessionResponses, + CreateAddonData, + CreateAddonErrors, + CreateAddonPriceData, + CreateAddonPriceErrors, + CreateAddonPriceResponses, + CreateAddonResponses, CreateComponentData, CreateComponentErrors, CreateComponentResponses, @@ -33,6 +69,9 @@ import type { CreateCustomerIntegrationErrors, CreateCustomerIntegrationResponses, CreateCustomerResponses, + CreateCustomerSessionData, + CreateCustomerSessionErrors, + CreateCustomerSessionResponses, CreateDeploymentZoneData, CreateDeploymentZoneErrors, CreateDeploymentZoneResponses, @@ -53,10 +92,22 @@ import type { CreateInstanceResponses, CreateLicenseData, CreateLicenseErrors, + CreateLicensePriceData, + CreateLicensePriceErrors, + CreateLicensePriceResponses, CreateLicenseResponses, CreateMetadataFieldData, CreateMetadataFieldErrors, CreateMetadataFieldResponses, + CreatePaymentMethodSessionData, + CreatePaymentMethodSessionErrors, + CreatePaymentMethodSessionResponses, + CreatePortalSessionData, + CreatePortalSessionErrors, + CreatePortalSessionResponses, + CreatePublishableKeyData, + CreatePublishableKeyErrors, + CreatePublishableKeyResponses, CreateReleaseData, CreateReleaseErrors, CreateReleaseResponses, @@ -66,9 +117,18 @@ import type { CreateServiceAccountTokenData, CreateServiceAccountTokenErrors, CreateServiceAccountTokenResponses, + CreateSessionCheckoutData, + CreateSessionCheckoutErrors, + CreateSessionCheckoutResponses, + CreateVoucherData, + CreateVoucherErrors, + CreateVoucherResponses, DeactivateConnectorData, DeactivateConnectorErrors, DeactivateConnectorResponses, + DeleteAddonData, + DeleteAddonErrors, + DeleteAddonResponses, DeleteComponentData, DeleteComponentErrors, DeleteComponentResponses, @@ -111,6 +171,18 @@ import type { DeleteServiceAccountTokenData, DeleteServiceAccountTokenErrors, DeleteServiceAccountTokenResponses, + DeprecateAddonPriceData, + DeprecateAddonPriceErrors, + DeprecateAddonPriceResponses, + DeprecateLicensePriceData, + DeprecateLicensePriceErrors, + DeprecateLicensePriceResponses, + DetachInstanceAddonData, + DetachInstanceAddonErrors, + DetachInstanceAddonResponses, + DetachPaymentMethodData, + DetachPaymentMethodErrors, + DetachPaymentMethodResponses, DryRunMetadataFieldData, DryRunMetadataFieldErrors, DryRunMetadataFieldResponses, @@ -120,15 +192,36 @@ import type { EvaluateFlagsBulkData, EvaluateFlagsBulkErrors, EvaluateFlagsBulkResponses, + ExportInvoicesData, + ExportInvoicesErrors, + ExportInvoicesResponses, ExportOrganizationUsageReportsData, ExportOrganizationUsageReportsErrors, ExportOrganizationUsageReportsResponses, ExportUsageReportsData, ExportUsageReportsErrors, ExportUsageReportsResponses, + GetAddonData, + GetAddonEntitlementData, + GetAddonEntitlementErrors, + GetAddonEntitlementResponses, + GetAddonErrors, + GetAddonFamilyData, + GetAddonFamilyErrors, + GetAddonFamilyResponses, + GetAddonResponses, GetAuditTrailsData, GetAuditTrailsErrors, GetAuditTrailsResponses, + GetBillingCapabilitiesData, + GetBillingCapabilitiesErrors, + GetBillingCapabilitiesResponses, + GetBillingHealthData, + GetBillingHealthErrors, + GetBillingHealthResponses, + GetBillingSettingsData, + GetBillingSettingsErrors, + GetBillingSettingsResponses, GetComponentData, GetComponentErrors, GetComponentResponses, @@ -144,6 +237,9 @@ import type { GetConnectorStateData, GetConnectorStateErrors, GetConnectorStateResponses, + GetCustomerBillingData, + GetCustomerBillingErrors, + GetCustomerBillingResponses, GetCustomerData, GetCustomerErrors, GetCustomerIntegrationByExternalIdData, @@ -177,6 +273,9 @@ import type { GetFeatureFlagsData, GetFeatureFlagsErrors, GetFeatureFlagsResponses, + GetInstanceBillingData, + GetInstanceBillingErrors, + GetInstanceBillingResponses, GetInstanceData, GetInstanceErrors, GetInstanceIntegrationByExternalIdData, @@ -189,6 +288,9 @@ import type { GetInstancesData, GetInstancesErrors, GetInstancesResponses, + GetInvoiceData, + GetInvoiceErrors, + GetInvoiceResponses, GetLicenseData, GetLicenseEntitlementData, GetLicenseEntitlementErrors, @@ -200,6 +302,9 @@ import type { GetLicenseFamilyData, GetLicenseFamilyErrors, GetLicenseFamilyResponses, + GetLicensePriceData, + GetLicensePriceErrors, + GetLicensePriceResponses, GetLicenseResponses, GetLicensesData, GetLicensesErrors, @@ -210,6 +315,9 @@ import type { GetOpenfeatureManifestData, GetOpenfeatureManifestErrors, GetOpenfeatureManifestResponses, + GetPublicCatalogData, + GetPublicCatalogErrors, + GetPublicCatalogResponses, GetReleaseBySlugData, GetReleaseBySlugErrors, GetReleaseBySlugResponses, @@ -225,9 +333,30 @@ import type { GetTargetingContextData, GetTargetingContextErrors, GetTargetingContextResponses, + GetUpcomingInvoiceData, + GetUpcomingInvoiceErrors, + GetUpcomingInvoiceResponses, + GetVoucherData, + GetVoucherErrors, + GetVoucherResponses, LintTargetingRuleData, LintTargetingRuleErrors, LintTargetingRuleResponses, + ListAddonCompatibilityData, + ListAddonCompatibilityErrors, + ListAddonCompatibilityResponses, + ListAddonEntitlementsData, + ListAddonEntitlementsErrors, + ListAddonEntitlementsResponses, + ListAddonFamiliesData, + ListAddonFamiliesErrors, + ListAddonFamiliesResponses, + ListAddonPricesData, + ListAddonPricesErrors, + ListAddonPricesResponses, + ListAddonsData, + ListAddonsErrors, + ListAddonsResponses, ListComponentsData, ListComponentsErrors, ListComponentsResponses, @@ -246,33 +375,96 @@ import type { ListEntitlementsData, ListEntitlementsErrors, ListEntitlementsResponses, + ListHandoffData, + ListHandoffErrors, + ListHandoffResponses, + ListInstanceAddonsData, + ListInstanceAddonsErrors, + ListInstanceAddonsResponses, + ListInstanceInvoicesData, + ListInstanceInvoicesErrors, + ListInstanceInvoicesResponses, + ListInstanceVouchersData, + ListInstanceVouchersErrors, + ListInstanceVouchersResponses, + ListInvoiceLineReportsData, + ListInvoiceLineReportsErrors, + ListInvoiceLineReportsResponses, + ListInvoicesData, + ListInvoicesErrors, + ListInvoicesResponses, ListLicenseFamiliesData, ListLicenseFamiliesErrors, ListLicenseFamiliesResponses, + ListLicensePricesData, + ListLicensePricesErrors, + ListLicensePricesResponses, ListMetadataFieldsData, ListMetadataFieldsErrors, ListMetadataFieldsResponses, ListNotificationsData, ListNotificationsErrors, ListNotificationsResponses, + ListPublishableKeysData, + ListPublishableKeysErrors, + ListPublishableKeysResponses, ListReleasesData, ListReleasesErrors, ListReleasesResponses, + ListSessionInvoicesData, + ListSessionInvoicesErrors, + ListSessionInvoicesResponses, ListUsageReportsData, ListUsageReportsErrors, ListUsageReportsResponses, + ListVoucherRedemptionsData, + ListVoucherRedemptionsErrors, + ListVoucherRedemptionsResponses, + ListVouchersData, + ListVouchersErrors, + ListVouchersResponses, + LookupVoucherData, + LookupVoucherErrors, + LookupVoucherResponses, + MarkInvoicePaidData, + MarkInvoicePaidErrors, + MarkInvoicePaidResponses, MarkNotificationsReadData, MarkNotificationsReadErrors, MarkNotificationsReadResponses, PatchInstanceData, PatchInstanceErrors, PatchInstanceResponses, + PreviewLicenseInvoiceData, + PreviewLicenseInvoiceErrors, + PreviewLicenseInvoiceResponses, + PublishAddonData, + PublishAddonErrors, + PublishAddonResponses, PublishLicenseData, PublishLicenseErrors, PublishLicenseResponses, + PublishVoucherData, + PublishVoucherErrors, + PublishVoucherResponses, PutNotificationPreferencesData, PutNotificationPreferencesErrors, PutNotificationPreferencesResponses, + ReactivateSubscriptionData, + ReactivateSubscriptionErrors, + ReactivateSubscriptionResponses, + RecomposeInvoiceData, + RecomposeInvoiceErrors, + RecomposeInvoiceResponses, + RedeemVoucherData, + RedeemVoucherErrors, + RedeemVoucherResponses, + ReleaseInvoiceHoldData, + ReleaseInvoiceHoldErrors, + ReleaseInvoiceHoldResponses, + RemoveAddonCompatibilityData, + RemoveAddonCompatibilityErrors, + RemoveAddonCompatibilityResponses, RemoveEntitlementFromGroupData, RemoveEntitlementFromGroupErrors, RemoveEntitlementFromGroupResponses, @@ -282,15 +474,63 @@ import type { ReportEntitlementUsageMetricData, ReportEntitlementUsageMetricErrors, ReportEntitlementUsageMetricResponses, + RetryInvoicePushData, + RetryInvoicePushErrors, + RetryInvoicePushResponses, + RevokeCustomerSessionData, + RevokeCustomerSessionErrors, + RevokeCustomerSessionResponses, + RevokeInstanceVoucherData, + RevokeInstanceVoucherErrors, + RevokeInstanceVoucherResponses, + RevokePublishableKeyData, + RevokePublishableKeyErrors, + RevokePublishableKeyResponses, + SchedulePlanChangeData, + SchedulePlanChangeErrors, + SchedulePlanChangeResponses, + SetAddonCompatibilityData, + SetAddonCompatibilityErrors, + SetAddonCompatibilityResponses, + SetInstanceAddonQuantityData, + SetInstanceAddonQuantityErrors, + SetInstanceAddonQuantityResponses, + SubscribeInstanceData, + SubscribeInstanceErrors, + SubscribeInstanceResponses, + SyncBillingProviderData, + SyncBillingProviderErrors, + SyncBillingProviderResponses, + SyncInvoiceData, + SyncInvoiceErrors, + SyncInvoiceResponses, TestTargetingRuleData, TestTargetingRuleErrors, TestTargetingRuleResponses, + UnarchiveAddonData, + UnarchiveAddonErrors, + UnarchiveAddonResponses, UnarchiveLicenseData, UnarchiveLicenseErrors, UnarchiveLicenseResponses, UnarchiveMetadataFieldData, UnarchiveMetadataFieldErrors, UnarchiveMetadataFieldResponses, + UnassignAddonEntitlementData, + UnassignAddonEntitlementErrors, + UnassignAddonEntitlementResponses, + UpdateAddonData, + UpdateAddonEntitlementData, + UpdateAddonEntitlementErrors, + UpdateAddonEntitlementResponses, + UpdateAddonErrors, + UpdateAddonFamilyData, + UpdateAddonFamilyErrors, + UpdateAddonFamilyResponses, + UpdateAddonResponses, + UpdateBillingSettingsData, + UpdateBillingSettingsErrors, + UpdateBillingSettingsResponses, UpdateComponentData, UpdateComponentErrors, UpdateComponentResponses, @@ -315,6 +555,9 @@ import type { UpdateFeatureFlagData, UpdateFeatureFlagErrors, UpdateFeatureFlagResponses, + UpdateInstanceBillingData, + UpdateInstanceBillingErrors, + UpdateInstanceBillingResponses, UpdateInstanceData, UpdateInstanceErrors, UpdateInstanceIntegrationData, @@ -326,19 +569,40 @@ import type { UpdateLicenseEntitlementErrors, UpdateLicenseEntitlementResponses, UpdateLicenseErrors, + UpdateLicenseFamilyData, + UpdateLicenseFamilyErrors, + UpdateLicenseFamilyResponses, + UpdateLicensePriceData, + UpdateLicensePriceErrors, + UpdateLicensePriceResponses, UpdateLicenseResponses, UpdateMetadataFieldData, UpdateMetadataFieldErrors, UpdateMetadataFieldResponses, + UpdatePublishableKeyData, + UpdatePublishableKeyErrors, + UpdatePublishableKeyResponses, UpdateServiceAccountData, UpdateServiceAccountErrors, UpdateServiceAccountResponses, + UpdateVoucherData, + UpdateVoucherErrors, + UpdateVoucherResponses, UpsertCustomerIntegrationByExternalIdData, UpsertCustomerIntegrationByExternalIdErrors, UpsertCustomerIntegrationByExternalIdResponses, UpsertInstanceIntegrationByExternalIdData, UpsertInstanceIntegrationByExternalIdErrors, UpsertInstanceIntegrationByExternalIdResponses, + ValidateVoucherData, + ValidateVoucherErrors, + ValidateVoucherResponses, + VoidInvoiceData, + VoidInvoiceErrors, + VoidInvoiceResponses, + WriteOffInvoiceData, + WriteOffInvoiceErrors, + WriteOffInvoiceResponses, } from "./types.gen.js"; export type Options< @@ -359,6 +623,730 @@ export type Options< meta?: keyof ClientMeta extends never ? Record : ClientMeta; }; +/** + * List add-on families + * + * Every add-on family of the organization with its versions, newest family first. Requires billing to be enabled for the organization. + */ +export const listAddonFamilies = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get< + ListAddonFamiliesResponses, + ListAddonFamiliesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addon-families", + ...options, + }); + +/** + * Get an add-on family + * + * One add-on family with its versions and its current version. Requires billing to be enabled for the organization. + */ +export const getAddonFamily = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addon-families/{familySlug}", + ...options, + }); + +/** + * Update an add-on family + * + * Lists the family in the public catalogue, or takes it out. Families are private until made public. Emits ADDON_UPDATED on each of its versions. Requires billing to be enabled for the organization. + */ +export const updateAddonFamily = ( + options: Options, +): RequestResult => + (options.client ?? client).patch< + UpdateAddonFamilyResponses, + UpdateAddonFamilyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addon-families/{familySlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List add-on versions + * + * The organization's add-on versions, newest first. Requires billing to be enabled for the organization. + */ +export const listAddons = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons", + ...options, + }); + +/** + * Create an add-on version + * + * Creates an add-on version: the first of a new family, or the next version of the family familySlug (or familyId) names. Emits ADDON_CREATED. Requires billing to be enabled for the organization. + */ +export const createAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Delete an add-on version + * + * Deletes a version that was never attached and grants nothing (409 DeleteAddon.InUseConflict otherwise); its family goes with its last version. Emits ADDON_DELETED. Requires billing to be enabled for the organization. + */ +export const deleteAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).delete({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}", + ...options, + }); + +/** + * Get an add-on version + * + * One add-on version. Requires billing to be enabled for the organization. + */ +export const getAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}", + ...options, + }); + +/** + * Update an add-on version + * + * Replaces a version's name, description, version name, default flag and maximum quantity. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + */ +export const updateAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).put({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Archive an add-on version + * + * Withdraws a PUBLISHED version from sale: instances holding it keep it, none can attach it again (409 ArchiveAddon.NotPublished otherwise). Emits ADDON_ARCHIVED. Requires billing to be enabled for the organization. + */ +export const archiveAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/archive", + ...options, + }); + +/** + * List the licence families an add-on fits + * + * The licence families an instance must be on to attach this add-on version. None: it cannot be attached. Requires billing to be enabled for the organization. + */ +export const listAddonCompatibility = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListAddonCompatibilityResponses, + ListAddonCompatibilityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/compatible-license-families", + ...options, + }); + +/** + * Stop an add-on fitting a licence family + * + * Instances already holding the add-on keep it; no new attachment from the family. Idempotent. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + */ +export const removeAddonCompatibility = ( + options: Options, +): RequestResult => + (options.client ?? client).delete< + RemoveAddonCompatibilityResponses, + RemoveAddonCompatibilityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}", + ...options, + }); + +/** + * Make an add-on fit a licence family + * + * Lets instances on any version of the licence family attach this add-on version. Idempotent. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + */ +export const setAddonCompatibility = ( + options: Options, +): RequestResult => + (options.client ?? client).put< + SetAddonCompatibilityResponses, + SetAddonCompatibilityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}", + ...options, + }); + +/** + * List an add-on version's grants + * + * What one add-on version grants per unit of quantity. Requires billing to be enabled for the organization. + */ +export const listAddonEntitlements = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListAddonEntitlementsResponses, + ListAddonEntitlementsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements", + ...options, + }); + +/** + * Grant an entitlement through an add-on + * + * Grants an entitlement per unit of an add-on version. Refused while an instance with a live subscription holds the version (409 AssignAddonEntitlement.BillingActive). Emits ADDON_ENTITLEMENT_ASSIGNED. Requires billing to be enabled for the organization. + */ +export const assignAddonEntitlement = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + AssignAddonEntitlementResponses, + AssignAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Remove an add-on grant + * + * Removes a grant. Refused while an instance with a live subscription holds the version (409 UnassignAddonEntitlement.BillingActive) and while an ACTIVE price of the version meters it (409 UnassignAddonEntitlement.MeteredByPrice). Emits ADDON_ENTITLEMENT_UNASSIGNED. Requires billing to be enabled for the organization. + */ +export const unassignAddonEntitlement = ( + options: Options, +): RequestResult => + (options.client ?? client).delete< + UnassignAddonEntitlementResponses, + UnassignAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}", + ...options, + }); + +/** + * Get an add-on grant + * + * One grant of an add-on version. Requires billing to be enabled for the organization. + */ +export const getAddonEntitlement = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + GetAddonEntitlementResponses, + GetAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}", + ...options, + }); + +/** + * Update an add-on grant + * + * Replaces a grant's value, override behaviour and overage. Refused while an instance with a live subscription holds the version (409 UpdateAddonEntitlement.BillingActive). Emits ADDON_ENTITLEMENT_UPDATED. Requires billing to be enabled for the organization. + */ +export const updateAddonEntitlement = ( + options: Options, +): RequestResult => + (options.client ?? client).put< + UpdateAddonEntitlementResponses, + UpdateAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List an add-on version's prices + * + * The prices of one add-on version, in display order. Requires billing to be enabled for the organization. + */ +export const listAddonPrices = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/prices", + ...options, + }); + +/** + * Create an add-on price + * + * Adds a price to an add-on version, under the rules of a licence price. A price cannot change once created: create another and deprecate this one. Refused while an instance with a live subscription holds the version (409 CreateAddonPrice.BillingActive). Emits ADDON_PRICE_CREATED. Requires billing to be enabled for the organization. + */ +export const createAddonPrice = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/prices", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Deprecate an add-on price + * + * Stops offering a price. A default price cannot be deprecated (409 DeprecateAddonPrice.IsDefault): it is what bills every instance holding the version; retire it through a new version. Emits ADDON_PRICE_DEPRECATED. Requires billing to be enabled for the organization. + */ +export const deprecateAddonPrice = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + DeprecateAddonPriceResponses, + DeprecateAddonPriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/prices/{priceId}/deprecate", + ...options, + }); + +/** + * Publish an add-on version + * + * Puts a DRAFT version on sale (409 PublishAddon.NotADraft otherwise). Emits ADDON_PUBLISHED. Requires billing to be enabled for the organization. + */ +export const publishAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/publish", + ...options, + }); + +/** + * Unarchive an add-on version + * + * Puts an ARCHIVED version back on sale (409 UnarchiveAddon.NotArchived otherwise). Emits ADDON_UNARCHIVED. Requires billing to be enabled for the organization. + */ +export const unarchiveAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/unarchive", + ...options, + }); + +/** + * Get billing capabilities + * + * Whether billing is enabled for the organization, and if not why; who can collect its invoices; and which parts of billing this release ships, so a client shows only what works. Answers even when billing is disabled. + */ +export const getBillingCapabilities = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get< + GetBillingCapabilitiesResponses, + GetBillingCapabilitiesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/capabilities", + ...options, + }); + +/** + * Close due billing periods + * + * Closes the subscriptions whose period has ended now, rather than at the period-close job's next pass: each one's RENEWAL invoice is composed and issued (or held, when its usage journal fails a check) and its period advances. A subscription several periods behind closes one period at a time until it is current. Only what is due closes, at most the configured batch size per call. Requires billing to be enabled for the organization. + */ +export const closeBillingPeriods = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CloseBillingPeriodsResponses, + CloseBillingPeriodsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/close-periods", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List the handoff queue + * + * The invoices waiting for the organization's accounting system (PENDING), or already acknowledged by it, oldest issue first. Reading never leases: claim to take invoices. Requires billing to be enabled for the organization. + */ +export const listHandoff = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/handoff", + ...options, + }); + +/** + * Claim invoices from the handoff queue + * + * Leases the oldest invoices waiting for the organization's accounting system, under one lease. Two consumers claiming at once get different invoices. An invoice not acknowledged before its lease expires is claimed again: the queue delivers at least once, so a consumer deduplicates on the invoice id. A claim is not idempotent: a lost response leaves its invoices leased until leasedUntil. Requires billing to be enabled for the organization. + */ +export const claimHandoff = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/handoff/claim", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Acknowledge a handed-off invoice + * + * Records that the organization's accounting system booked an invoice from the handoff queue. Safe to repeat: the same acknowledgement again, or one that adds a reference the invoice did not have, answers 200. Another reference than the one it was acknowledged under is refused (AckHandoff.ReferenceMismatch), which a consumer can take as already handed off. Requires billing to be enabled for the organization. + */ +export const ackHandoff = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/handoff/{invoiceId}/ack", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Get the billing health + * + * What the organization's billing needs attention for, computed when read: periods waiting for their close, held invoices, invoices a payment provider keeps refusing, reconciliation mismatches, each provider's sync, overdue invoices and the handoff backlog. Requires billing to be enabled for the organization. + */ +export const getBillingHealth = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/health", + ...options, + }); + +/** + * Get billing settings + * + * The organization's billing defaults: the collection method and payment terms a subscription gets when it names none of its own. An organization that never wrote them has the defaults (SEND_INVOICE, 30 days). + */ +export const getBillingSettings = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get< + GetBillingSettingsResponses, + GetBillingSettingsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/settings", + ...options, + }); + +/** + * Update billing settings + * + * Replaces the organization's billing defaults. A subscription that names its own terms keeps them; the others take these at their next invoice. + */ +export const updateBillingSettings = ( + options: Options, +): RequestResult => + (options.client ?? client).put< + UpdateBillingSettingsResponses, + UpdateBillingSettingsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/settings", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Sync with the payment providers now + * + * Runs one sync pass now for each payment provider the organization has connected: payments, voids and finalizations done in the provider are mirrored, as the periodic pass does. Refused when none is connected (409 SyncProvider.NotConnected). Requires billing to be enabled for the organization. + */ +export const syncBillingProvider = ( + options?: Options, +): RequestResult => + (options?.client ?? client).post< + SyncBillingProviderResponses, + SyncBillingProviderErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/sync", + ...options, + }); + /** * List components * @@ -368,7 +1356,13 @@ export const listComponents = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components", ...options, }); @@ -382,7 +1376,13 @@ export const createComponent = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components", ...options, headers: { @@ -400,7 +1400,13 @@ export const deleteComponent = ( options: Options, ): RequestResult => (options.client ?? client).delete({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components/{componentSlug}", ...options, }); @@ -414,7 +1420,13 @@ export const getComponent = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components/{componentSlug}", ...options, }); @@ -428,7 +1440,13 @@ export const updateComponent = ( options: Options, ): RequestResult => (options.client ?? client).put({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components/{componentSlug}", ...options, headers: { @@ -446,7 +1464,13 @@ export const listConnectors = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors", ...options, }); @@ -460,7 +1484,13 @@ export const getConnector = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}", ...options, }); @@ -478,7 +1508,13 @@ export const deactivateConnector = ( DeactivateConnectorErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/activation", ...options, }); @@ -493,7 +1529,13 @@ export const activateConnector = ( ): RequestResult => (options.client ?? client).put( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/activation", ...options, }, @@ -512,7 +1554,13 @@ export const deleteConnectorSettings = ( DeleteConnectorSettingsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings", ...options, }); @@ -530,7 +1578,13 @@ export const getConnectorSettings = ( GetConnectorSettingsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings", ...options, }); @@ -548,7 +1602,13 @@ export const updateConnectorSettings = ( UpdateConnectorSettingsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings", ...options, headers: { @@ -574,7 +1634,13 @@ export const getConnectorSettingsSchema = GetConnectorSettingsSchemaErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings/schema", ...options, }); @@ -589,12 +1655,70 @@ export const getConnectorState = ( ): RequestResult => (options.client ?? client).get( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/state", ...options, }, ); +/** + * Create a customer session + * + * Mints a kst_ session for one of the organization's customers, optionally bound to one of its instances, for that customer's browser to call the /api/public/session routes: checkout, invoices. Call it from your backend, where the customer is signed in, and hand the token to the page; mint a new one before it expires. What the session writes is attributed to the caller. Limited to 50 sessions a second per organization. + */ +export const createCustomerSession = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CreateCustomerSessionResponses, + CreateCustomerSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customer-sessions", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Revoke a customer session + * + * The session stops authenticating on the next request: on sign-out, or when the customer's access changes. Idempotent. + */ +export const revokeCustomerSession = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + RevokeCustomerSessionResponses, + RevokeCustomerSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customer-sessions/{sessionId}/revoke", + ...options, + }); + /** * List customers * @@ -604,68 +1728,234 @@ export const listCustomers = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers", + ...options, + }); + +/** + * Create a new customer + * + * Create a new customer with the provided details. + */ +export const createCustomer = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers", ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Delete a customer + * + * Delete a customer by their slug. + */ +export const deleteCustomer = ( + options: Options, +): RequestResult => + (options.client ?? client).delete({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}", + ...options, + }); + +/** + * Get a customer by slug + * + * Returns a single customer by their slug. + */ +export const getCustomer = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}", + ...options, + }); + +/** + * Update a customer + * + * Update a customer's details. Slug and integrations are not renameable/settable through this endpoint -- omit them, or send the values already on record. + */ +export const updateCustomer = ( + options: Options, +): RequestResult => + (options.client ?? client).put({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Get a customer's billing + * + * The customer's billing e-mail and its side in each payment provider: its id there and the labels of its default payment method (never card data). 404 GetCustomerBilling.CustomerNotFound. Requires billing to be enabled for the organization. + */ +export const getCustomerBilling = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + GetCustomerBillingResponses, + GetCustomerBillingErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing", + ...options, }); /** - * Create a new customer + * Detach a customer's payment method * - * Create a new customer with the provided details. + * Removes the customer's payment method from the payment provider. 409 .InUseByAutomaticCollection while a live subscription of the customer is charged automatically, .NoPaymentMethod; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. */ -export const createCustomer = ( - options: Options, -): RequestResult => - (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], - url: "/customers", +export const detachPaymentMethod = ( + options: Options, +): RequestResult => + (options.client ?? client).delete< + DetachPaymentMethodResponses, + DetachPaymentMethodErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/payment-method", ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, }); /** - * Delete a customer + * Open a page saving a customer's payment method * - * Delete a customer by their slug. + * Ensures the customer in the payment provider, then opens the provider's hosted page where the customer saves a payment method; Kaiten never sees card data. When the customer comes back to returnUrl, complete the session server-side. 404 .CustomerNotFound; 422 .ProviderNotConnected, .InvalidReturnUrl, .CurrencyRequired; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. */ -export const deleteCustomer = ( - options: Options, -): RequestResult => - (options.client ?? client).delete({ - security: [{ scheme: "bearer", type: "http" }], - url: "/customers/{customerSlug}", +export const createPaymentMethodSession = ( + options: Options, +): RequestResult< + CreatePaymentMethodSessionResponses, + CreatePaymentMethodSessionErrors, + ThrowOnError +> => + (options.client ?? client).post< + CreatePaymentMethodSessionResponses, + CreatePaymentMethodSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/payment-method-session", ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, }); /** - * Get a customer by slug + * Complete a payment-method session * - * Returns a single customer by their slug. + * Checks the setup session with the payment provider (the redirect is never trusted) and makes the payment method saved there the one the customer's invoices are charged to. Idempotent. 404 .SessionNotFound (unknown, or another customer's); 409 .SessionNotComplete; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. */ -export const getCustomer = ( - options: Options, -): RequestResult => - (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], - url: "/customers/{customerSlug}", +export const completePaymentMethodSession = ( + options: Options, +): RequestResult< + CompletePaymentMethodSessionResponses, + CompletePaymentMethodSessionErrors, + ThrowOnError +> => + (options.client ?? client).post< + CompletePaymentMethodSessionResponses, + CompletePaymentMethodSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/payment-method-session/{sessionId}/complete", ...options, }); /** - * Update a customer + * Open a customer's billing portal * - * Update a customer's details. Slug and integrations are not renameable/settable through this endpoint -- omit them, or send the values already on record. + * Opens the payment provider's hosted portal for the customer, where it manages payment methods and invoices; changes reach Kaiten through sync. 422 .ProviderNotConnected, .CustomerNotOnProvider, .InvalidReturnUrl; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. */ -export const updateCustomer = ( - options: Options, -): RequestResult => - (options.client ?? client).put({ - security: [{ scheme: "bearer", type: "http" }], - url: "/customers/{customerSlug}", +export const createPortalSession = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CreatePortalSessionResponses, + CreatePortalSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/portal-session", ...options, headers: { "Content-Type": "application/json", @@ -690,7 +1980,13 @@ export const deleteCustomerIntegration = ( DeleteCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, }); @@ -708,7 +2004,13 @@ export const getCustomerIntegration = ( GetCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, }); @@ -730,7 +2032,13 @@ export const createCustomerIntegration = ( CreateCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, headers: { @@ -756,7 +2064,13 @@ export const updateCustomerIntegration = ( UpdateCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, headers: { @@ -778,7 +2092,13 @@ export const listDeploymentZones = ( ListDeploymentZonesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones", ...options, }); @@ -796,7 +2116,13 @@ export const createDeploymentZone = ( CreateDeploymentZoneErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones", ...options, headers: { @@ -818,7 +2144,13 @@ export const deleteDeploymentZone = ( DeleteDeploymentZoneErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones/{deploymentZoneSlug}", ...options, }); @@ -836,7 +2168,13 @@ export const getDeploymentZoneBySlug = ( GetDeploymentZoneBySlugErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones/{deploymentZoneSlug}", ...options, }); @@ -854,7 +2192,13 @@ export const updateDeploymentZone = ( UpdateDeploymentZoneErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones/{deploymentZoneSlug}", ...options, headers: { @@ -876,7 +2220,13 @@ export const listEntitlementGroups = ( ListEntitlementGroupsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups", ...options, }); @@ -894,7 +2244,13 @@ export const createEntitlementGroup = ( CreateEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups", ...options, headers: { @@ -916,7 +2272,13 @@ export const deleteEntitlementGroup = ( DeleteEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}", ...options, }); @@ -934,7 +2296,13 @@ export const getEntitlementGroup = ( GetEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}", ...options, }); @@ -952,7 +2320,13 @@ export const updateEntitlementGroup = ( UpdateEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}", ...options, headers: { @@ -974,7 +2348,13 @@ export const addEntitlementToGroup = ( AddEntitlementToGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}/entitlements", ...options, headers: { @@ -1000,7 +2380,13 @@ export const removeEntitlementFromGroup = RemoveEntitlementFromGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}", ...options, }); @@ -1018,7 +2404,13 @@ export const getEntitlementGroupUsage = ( GetEntitlementGroupUsageErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}/usage", ...options, }); @@ -1032,7 +2424,13 @@ export const listEntitlements = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements", ...options, }); @@ -1050,7 +2448,13 @@ export const createEntitlement = ( CreateEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements", ...options, headers: { @@ -1072,7 +2476,13 @@ export const deleteEntitlement = ( DeleteEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements/{entitlementSlug}", ...options, }); @@ -1086,7 +2496,13 @@ export const getEntitlement = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements/{entitlementSlug}", ...options, }); @@ -1101,7 +2517,13 @@ export const updateEntitlement = ( ): RequestResult => (options.client ?? client).put( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements/{entitlementSlug}", ...options, headers: { @@ -1120,7 +2542,13 @@ export const getFeatureFlags = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags", ...options, }); @@ -1138,7 +2566,13 @@ export const createFeatureFlag = ( CreateFeatureFlagErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags", ...options, headers: { @@ -1160,7 +2594,13 @@ export const getTargetingContext = ( GetTargetingContextErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/targeting/context", ...options, }); @@ -1178,7 +2618,13 @@ export const lintTargetingRule = ( LintTargetingRuleErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/targeting/lint", ...options, headers: { @@ -1200,7 +2646,13 @@ export const testTargetingRule = ( TestTargetingRuleErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/targeting/test", ...options, headers: { @@ -1222,7 +2674,13 @@ export const deleteFeatureFlag = ( DeleteFeatureFlagErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/{featureFlagSlug}", ...options, }); @@ -1236,7 +2694,13 @@ export const getFeatureFlag = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/{featureFlagSlug}", ...options, }); @@ -1251,7 +2715,13 @@ export const updateFeatureFlag = ( ): RequestResult => (options.client ?? client).put( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/{featureFlagSlug}", ...options, headers: { @@ -1270,7 +2740,13 @@ export const getInstances = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances", ...options, }); @@ -1278,14 +2754,312 @@ export const getInstances = ( /** * Create a new instance * - * Create a new instance with the provided details + * Create a new instance with the provided details + */ +export const createInstance = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Delete an instance + * + * Delete an instance with the provided slug + */ +export const deleteInstance = ( + options: Options, +): RequestResult => + (options.client ?? client).delete({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}", + ...options, + }); + +/** + * Get an instance by slug + * + * Retrieve an instance by their unique slug + */ +export const getInstance = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}", + ...options, + }); + +/** + * Patch an instance + * + * Partially update an instance. Currently supports the operational status and the commercial lifecycle stage. + */ +export const patchInstance = ( + options: Options, +): RequestResult => + (options.client ?? client).patch({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Update an instance + * + * Update an instance with the provided details + */ +export const updateInstance = ( + options: Options, +): RequestResult => + (options.client ?? client).put({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List an instance's add-ons + * + * The add-ons an instance holds, in attachment order, each with the prices its subscription bills. Requires billing to be enabled for the organization. + */ +export const listInstanceAddons = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListInstanceAddonsResponses, + ListInstanceAddonsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons", + ...options, + }); + +/** + * Attach an add-on to an instance + * + * Gives an instance an add-on version and a quantity. The entitlements apply at once; a subscription bills the quantity held at each boundary, without proration. One version per family: moving to another version is detach then attach. Emits INSTANCE_ADDON_ADDED. Requires billing to be enabled for the organization. + */ +export const attachInstanceAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + AttachInstanceAddonResponses, + AttachInstanceAddonErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Remove an add-on from an instance + * + * Removes an add-on from an instance. The entitlements drop at once; nothing is refunded. The attachment stays readable with includeRemoved. Emits INSTANCE_ADDON_REMOVED. Requires billing to be enabled for the organization. + */ +export const detachInstanceAddon = ( + options: Options, +): RequestResult => + (options.client ?? client).delete< + DetachInstanceAddonResponses, + DetachInstanceAddonErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons/{addonSlug}", + ...options, + }); + +/** + * Change an instance add-on's quantity + * + * Changes how many units of an add-on an instance holds. The entitlements follow at once; the next invoice bills the new quantity. Emits INSTANCE_ADDON_QUANTITY_CHANGED. Requires billing to be enabled for the organization. + */ +export const setInstanceAddonQuantity = ( + options: Options, +): RequestResult => + (options.client ?? client).patch< + SetInstanceAddonQuantityResponses, + SetInstanceAddonQuantityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons/{addonSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List audit trail entries for an instance + * + * Returns audit trail events for a given instance, optionally filtered by event name and time range. Results are cursor-paginated (default limit: 50, max: 200) — pass the previous response's nextCursor as the cursor parameter to fetch the next page. + */ +export const getAuditTrails = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/audit-trails", + ...options, + }); + +/** + * Get an instance's subscription + * + * The instance's subscription, live or CANCELED; 404 when it was never subscribed. Requires billing to be enabled for the organization. + */ +export const getInstanceBilling = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + GetInstanceBillingResponses, + GetInstanceBillingErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing", + ...options, + }); + +/** + * Change a subscription's terms or provider + * + * Changes the subscription's payment provider, collection method and payment terms from its next invoice on; null restores the organization's default. Invoices already composed keep their own, and keep routing to the provider that issued them. Moving to a provider that pushes invoices registers the customer with it first (503 UpdateInstanceBilling.ProviderUnavailable when it cannot be reached). A provider change emits INSTANCE_BILLING_PROVIDER_CHANGED. Requires billing to be enabled for the organization. + */ +export const updateInstanceBilling = ( + options: Options, +): RequestResult => + (options.client ?? client).patch< + UpdateInstanceBillingResponses, + UpdateInstanceBillingErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Subscribe an instance + * + * Starts billing an instance on a FLAT_FEE price of its licence version. A base price that bills in advance issues the first period's invoice (ACTIVATION) at once; charged automatically, it is pushed and charged before the answer when the provider answers within 20 seconds. Each period then closes into a RENEWAL. Add-ons and a voucher can be started with it, in the same transaction. A CANCELED subscription is subscribed again. While the subscription is live the instance's customer and licence cannot change. Requires billing to be enabled for the organization. */ -export const createInstance = ( - options: Options, -): RequestResult => - (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], - url: "/instances", +export const subscribeInstance = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + SubscribeInstanceResponses, + SubscribeInstanceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing", ...options, headers: { "Content-Type": "application/json", @@ -1294,62 +3068,102 @@ export const createInstance = ( }); /** - * Delete an instance + * Cancel a subscription * - * Delete an instance with the provided slug + * Cancels an instance's subscription: a trial at once with no invoice; otherwise at the period's end (repeating it changes nothing), or immediately with a FINAL invoice. Cancellation changes billing only: entitlements and licence dates stay the vendor's to change. Requires billing to be enabled for the organization. */ -export const deleteInstance = ( - options: Options, -): RequestResult => - (options.client ?? client).delete({ - security: [{ scheme: "bearer", type: "http" }], - url: "/instances/{instanceSlug}", +export const cancelSubscription = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CancelSubscriptionResponses, + CancelSubscriptionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/cancel", ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, }); /** - * Get an instance by slug + * Reactivate a subscription * - * Retrieve an instance by their unique slug + * Reverts a cancellation scheduled for the period end, before it. A canceled subscription is subscribed again instead. Requires billing to be enabled for the organization. */ -export const getInstance = ( - options: Options, -): RequestResult => - (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], - url: "/instances/{instanceSlug}", +export const reactivateSubscription = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + ReactivateSubscriptionResponses, + ReactivateSubscriptionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/reactivate", ...options, }); /** - * Patch an instance + * Cancel a scheduled plan change * - * Partially update an instance. Currently supports the operational status and the commercial lifecycle stage. + * Drops the plan change scheduled for the next boundary. Requires billing to be enabled for the organization. */ -export const patchInstance = ( - options: Options, -): RequestResult => - (options.client ?? client).patch({ - security: [{ scheme: "bearer", type: "http" }], - url: "/instances/{instanceSlug}", +export const cancelPlanChange = ( + options: Options, +): RequestResult => + (options.client ?? client).delete< + CancelPlanChangeResponses, + CancelPlanChangeErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/scheduled-change", ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, }); /** - * Update an instance + * Schedule a plan change * - * Update an instance with the provided details + * Schedules a move to another FLAT_FEE price, of any PUBLISHED licence version in the subscription's currency, for the next boundary. That boundary's RENEWAL bills the old plan's arrears and the new plan's advance, and moves the instance to the new version; there is no proration. Scheduling another target replaces the change, the same one changes nothing. A scheduled target's price cannot be deprecated, nor its version archived. Requires billing to be enabled for the organization. */ -export const updateInstance = ( - options: Options, -): RequestResult => - (options.client ?? client).put({ - security: [{ scheme: "bearer", type: "http" }], - url: "/instances/{instanceSlug}", +export const schedulePlanChange = ( + options: Options, +): RequestResult => + (options.client ?? client).put< + SchedulePlanChangeResponses, + SchedulePlanChangeErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/scheduled-change", ...options, headers: { "Content-Type": "application/json", @@ -1358,16 +3172,26 @@ export const updateInstance = ( }); /** - * List audit trail entries for an instance + * Preview an instance's upcoming invoice * - * Returns audit trail events for a given instance, optionally filtered by event name and time range. Results are cursor-paginated (default limit: 50, max: 200) — pass the previous response's nextCursor as the cursor parameter to fetch the next page. + * The invoice the subscription's next boundary will issue, composed from its usage so far, without writing anything: lines carry the period they will bill, quantities what was measured until now. wouldHold lists the meters whose usage journal fails a check and would hold the invoice. Requires billing to be enabled for the organization. */ -export const getAuditTrails = ( - options: Options, -): RequestResult => - (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], - url: "/instances/{instanceSlug}/audit-trails", +export const getUpcomingInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + GetUpcomingInvoiceResponses, + GetUpcomingInvoiceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/upcoming-invoice", ...options, }); @@ -1388,7 +3212,13 @@ export const getEntitlementsUsageMetrics = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/usage", ...options, }); @@ -1410,7 +3240,13 @@ export const getEntitlementUsageMetrics = GetEntitlementUsageMetricsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage", ...options, }); @@ -1432,7 +3268,13 @@ export const reportEntitlementUsageMetric = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage", ...options, headers: { @@ -1450,7 +3292,13 @@ export const listUsageReports = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports", ...options, }); @@ -1468,7 +3316,13 @@ export const exportUsageReports = ( ExportUsageReportsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export", ...options, }); @@ -1490,7 +3344,13 @@ export const deleteInstanceIntegration = ( DeleteInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, }); @@ -1508,7 +3368,13 @@ export const getInstanceIntegration = ( GetInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, }); @@ -1530,7 +3396,13 @@ export const createInstanceIntegration = ( CreateInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, headers: { @@ -1556,7 +3428,13 @@ export const updateInstanceIntegration = ( UpdateInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, headers: { @@ -1565,6 +3443,106 @@ export const updateInstanceIntegration = ( }, }); +/** + * List an instance's invoices + * + * The invoices of one instance's subscription, across every time it was subscribed, with the filters of listInvoices. Requires billing to be enabled for the organization. + */ +export const listInstanceInvoices = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListInstanceInvoicesResponses, + ListInstanceInvoicesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/invoices", + ...options, + }); + +/** + * List an instance's vouchers + * + * The vouchers an instance redeemed, newest first. Requires billing to be enabled for the organization. + */ +export const listInstanceVouchers = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListInstanceVouchersResponses, + ListInstanceVouchersErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/vouchers", + ...options, + }); + +/** + * Redeem a voucher + * + * Redeems a voucher for an instance. A boost applies from the next read or report, for its duration; a PRICE voucher discounts the subscription's next invoices. Emits INSTANCE_VOUCHER_REDEEMED, and VOUCHER_EXHAUSTED with the last redemption. Requires billing to be enabled for the organization. + */ +export const redeemVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/vouchers/redeem", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Revoke a redemption + * + * Stops a redemption from applying: a boost ends at once, a discount applies to no further invoice. Invoices already issued are untouched. Emits INSTANCE_VOUCHER_REVOKED. Requires billing to be enabled for the organization. + */ +export const revokeInstanceVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + RevokeInstanceVoucherResponses, + RevokeInstanceVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/vouchers/{instanceVoucherId}/revoke", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + /** * Get a customer by integration external ID * @@ -1582,7 +3560,13 @@ export const getCustomerIntegrationByExternalId = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/customer/{externalId}", ...options, }); @@ -1604,7 +3588,13 @@ export const upsertCustomerIntegrationByExternalId = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/customer/{externalId}", ...options, headers: { @@ -1630,7 +3620,13 @@ export const getInstanceIntegrationByExternalId = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/instance/{externalId}", ...options, }); @@ -1652,7 +3648,13 @@ export const upsertInstanceIntegrationByExternalId = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/instance/{externalId}", ...options, headers: { @@ -1661,6 +3663,250 @@ export const upsertInstanceIntegrationByExternalId = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices", + ...options, + }); + +/** + * Export invoices + * + * Streams the invoices the filters of listInvoices select, as CSV or NDJSON. Amounts are integer minor units with the currency's exponent beside them, so a spreadsheet never sees a float. The export carries billing e-mails: it is an authenticated read for the organization's accounting. Requires billing to be enabled for the organization. + */ +export const exportInvoices = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/export", + ...options, + }); + +/** + * Get an invoice + * + * One invoice with its lines, the customer and instance as they were when it was composed, its hold and its handoff. Addressed by id at organization level: an invoice outlives its instance and customer. Requires billing to be enabled for the organization. + */ +export const getInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}", + ...options, + }); + +/** + * List the usage reports behind an invoice line + * + * The usage reports a USAGE or OVERAGE line was measured from: its pair's reports dated in its service period, in reportSeq order. Summed by reset window and floored at 0, they give the line's measured quantity. Addressed by invoice, it answers after the instance was deleted. Requires billing to be enabled for the organization. + */ +export const listInvoiceLineReports = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListInvoiceLineReportsResponses, + ListInvoiceLineReportsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/lines/{lineId}/reports", + ...options, + }); + +/** + * Mark an invoice paid + * + * Records that a MANUAL invoice was paid. An invoice still waiting in the handoff queue is acknowledged by the same write. Marking it paid again with the same external reference answers it unchanged. An invoice a payment provider collects is settled there. Requires billing to be enabled for the organization. + */ +export const markInvoicePaid = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/mark-paid", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Recompose an invoice + * + * Composes an invoice again from the usage journal as it is now, keeping its BASE lines as they were sold. A held DRAFT is rewritten in place (200): issued when its journal is now sound, held again otherwise. A VOID invoice gets a replacement for the same boundary (201), under the subscription's current terms and billing e-mail. Any other invoice must be voided first. Requires billing to be enabled for the organization. + */ +export const recomposeInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/recompose", + ...options, + }); + +/** + * Release a held invoice + * + * Accepts a held invoice as composed and issues it: MANUAL and pending in the handoff queue, or PAID when nothing is owed. The release keeps who released it and why. Requires billing to be enabled for the organization. + */ +export const releaseInvoiceHold = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + ReleaseInvoiceHoldResponses, + ReleaseInvoiceHoldErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/release-hold", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Retry pushing an invoice to its provider + * + * Puts a DRAFT or PUSH_FAILED invoice of a payment provider back in the push queue now, which resumes the push where its last attempt stopped. A draft waiting for finalization in its provider is finalized at once. Refused for a held invoice (409 RetryInvoicePush.Held) and for any other (409 RetryInvoicePush.InvalidStatus). Requires billing to be enabled for the organization. + */ +export const retryInvoicePush = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/retry-push", + ...options, + }); + +/** + * Sync an invoice with its provider + * + * Reads an invoice from its payment provider now and applies what the provider says: its finalization, payment, write-off or void. Refused for an invoice not in a provider (409 SyncInvoice.NotPushed). Requires billing to be enabled for the organization. + */ +export const syncInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/sync", + ...options, + }); + +/** + * Void an invoice + * + * Voids an invoice not yet settled -- a DRAFT, held or not, a MANUAL one, or one a payment provider issued -- which frees its boundary for a recompose. A provider's invoice is voided there first, and here only once the provider confirms (503 VoidInvoice.ProviderUnavailable leaves it unchanged); one the provider reports paid is refused. A paid or written-off invoice cannot be voided. A handoff still pending stays so, and its consumer sees the VOID. Voiding a VOID invoice again answers it unchanged. Requires billing to be enabled for the organization. + */ +export const voidInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/void", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Write off an invoice + * + * Records that the organization gave up collecting a MANUAL invoice: it becomes UNCOLLECTIBLE. A handoff still pending stays so, and its consumer sees the new status. Writing off an UNCOLLECTIBLE invoice again answers it unchanged. Requires billing to be enabled for the organization. + */ +export const writeOffInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/write-off", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + /** * List license families * @@ -1674,7 +3920,13 @@ export const listLicenseFamilies = ( ListLicenseFamiliesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/license-families", ...options, }); @@ -1693,9 +3945,43 @@ export const getLicenseFamily = ( ): RequestResult => (options.client ?? client).get({ querySerializer: { parameters: { include: { array: { explode: false } } } }, - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/license-families/{familySlug}", + ...options, + }); + +/** + * Update a license family + * + * Lists the family in the public catalogue, or takes it out. Families are private until made public. + */ +export const updateLicenseFamily = ( + options: Options, +): RequestResult => + (options.client ?? client).patch< + UpdateLicenseFamilyResponses, + UpdateLicenseFamilyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/license-families/{familySlug}", ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, }); /** @@ -1707,7 +3993,13 @@ export const getLicenses = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses", ...options, }); @@ -1723,7 +4015,13 @@ export const createLicense = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses", ...options, headers: { @@ -1741,7 +4039,13 @@ export const deleteLicense = ( options: Options, ): RequestResult => (options.client ?? client).delete({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}", ...options, }); @@ -1755,7 +4059,13 @@ export const getLicense = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}", ...options, }); @@ -1769,7 +4079,13 @@ export const updateLicense = ( options: Options, ): RequestResult => (options.client ?? client).put({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}", ...options, headers: { @@ -1787,7 +4103,13 @@ export const archiveLicense = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/archive", ...options, }); @@ -1805,7 +4127,13 @@ export const getLicenseEntitlements = ( GetLicenseEntitlementsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements", ...options, }); @@ -1827,7 +4155,13 @@ export const associateEntitlementWithLicense = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements", ...options, headers: { @@ -1849,7 +4183,13 @@ export const deleteLicenseEntitlement = ( DeleteLicenseEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}", ...options, }); @@ -1867,7 +4207,13 @@ export const getLicenseEntitlement = ( GetLicenseEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}", ...options, }); @@ -1885,7 +4231,13 @@ export const updateLicenseEntitlement = ( UpdateLicenseEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}", ...options, headers: { @@ -1894,6 +4246,156 @@ export const updateLicenseEntitlement = ( }, }); +/** + * Preview a license invoice + * + * Composes the RENEWAL invoice a subscription to this licence version would be billed at a boundary now, without writing anything: the sample usage rated in arrears over the billing period that ends, and the base price for the period that starts (or the one that ends, for an ARREARS base). Works on DRAFT versions, to check prices before publishing. Requires billing to be enabled for the organization. + */ +export const previewLicenseInvoice = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + PreviewLicenseInvoiceResponses, + PreviewLicenseInvoiceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/invoice-preview", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List a license version's prices + * + * The prices of one licence version, in display order. Requires billing to be enabled for the organization. + */ +export const listLicensePrices = ( + options: Options, +): RequestResult => + (options.client ?? client).get( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices", + ...options, + }, + ); + +/** + * Create a license price + * + * Adds a price to a licence version. A metered price's sale-unit factor is captured from its entitlement now and never changes. Requires billing to be enabled for the organization. + */ +export const createLicensePrice = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CreateLicensePriceResponses, + CreateLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Get a license price + * + * One price of a licence version. Requires billing to be enabled for the organization. + */ +export const getLicensePrice = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices/{priceId}", + ...options, + }); + +/** + * Update a license price + * + * Edits a price of a DRAFT licence version; the prices of a published version are immutable (UpdateLicensePrice.VersionNotDraft). Currency and billing model cannot change. Requires billing to be enabled for the organization. + */ +export const updateLicensePrice = ( + options: Options, +): RequestResult => + (options.client ?? client).patch< + UpdateLicensePriceResponses, + UpdateLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices/{priceId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Deprecate a license price + * + * Retires a price from the catalogue: it keeps billing what is already pinned to it, is no longer offered, and stops being a default. Deprecation cannot be undone. Requires billing to be enabled for the organization. + */ +export const deprecateLicensePrice = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + DeprecateLicensePriceResponses, + DeprecateLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices/{priceId}/deprecate", + ...options, + }); + /** * Publish a license version * @@ -1903,7 +4405,13 @@ export const publishLicense = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/publish", ...options, }); @@ -1917,7 +4425,13 @@ export const unarchiveLicense = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/unarchive", ...options, }); @@ -1935,7 +4449,13 @@ export const listMetadataFields = ( ListMetadataFieldsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields", ...options, }); @@ -1953,7 +4473,13 @@ export const createMetadataField = ( CreateMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields", ...options, headers: { @@ -1975,7 +4501,13 @@ export const reorderMetadataFields = ( ReorderMetadataFieldsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/reorder", ...options, headers: { @@ -1997,7 +4529,13 @@ export const updateMetadataField = ( UpdateMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}", ...options, headers: { @@ -2019,7 +4557,13 @@ export const archiveMetadataField = ( ArchiveMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}/archive", ...options, }); @@ -2037,7 +4581,13 @@ export const dryRunMetadataField = ( DryRunMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}/dry-run", ...options, headers: { @@ -2059,7 +4609,13 @@ export const unarchiveMetadataField = ( UnarchiveMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}/unarchive", ...options, }); @@ -2078,7 +4634,13 @@ export const evaluateFlagsBulk = ( EvaluateFlagsBulkErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/ofrep/v1/evaluate/flags", ...options, headers: { @@ -2096,7 +4658,13 @@ export const evaluateFlag = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/ofrep/v1/evaluate/flags/{key}", ...options, headers: { @@ -2118,11 +4686,187 @@ export const getOpenfeatureManifest = ( GetOpenfeatureManifestErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/openfeature/v0/manifest", ...options, }); +/** + * Get the public catalogue + * + * What a pricing page shows: for each licence family the organization made public, its default version with its ACTIVE prices and user-facing entitlements, and the same for public add-on families. Read with a publishable key (X-Kaiten-Publishable-Key); the organization is the key's. Amounts are in minor units; never sum metered prices into a headline. Cacheable for 60 seconds. + */ +export const getPublicCatalog = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [{ name: "X-Kaiten-Publishable-Key", type: "apiKey" }], + url: "/public/catalog", + ...options, + }); + +/** + * Check out + * + * Subscribes the session's instance to a price of the public catalogue, with add-ons and a voucher, in one call. With dryRun, answers 200 status=preview and what would be billed today, changing nothing. When a payment method has to be saved first, answers 200 status=requires_payment_method with a setup page: send the customer there, then call again with its setupSessionId. Otherwise answers 201 status=subscribed: the invoice of the first period has been pushed and charged, and payment.status says how that went -- poll GET /public/session/invoices on processing or requires_action. Needs a session bound to an instance. + */ +export const createSessionCheckout = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CreateSessionCheckoutResponses, + CreateSessionCheckoutErrors, + ThrowOnError + >({ + security: [ + { + key: "customerSession", + scheme: "bearer", + type: "http", + }, + ], + url: "/public/session/checkout", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * List the customer's invoices + * + * The session's customer's issued invoices -- its instance's, for a session bound to one -- newest first, with how to pay each. An invoice still awaiting the outcome of its payment is read from the payment provider first, at most every 30 seconds: poll this after a checkout answered processing or requires_action. + */ +export const listSessionInvoices = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get< + ListSessionInvoicesResponses, + ListSessionInvoicesErrors, + ThrowOnError + >({ + security: [ + { + key: "customerSession", + scheme: "bearer", + type: "http", + }, + ], + url: "/public/session/invoices", + ...options, + }); + +/** + * List publishable keys + * + * The organization's publishable keys, newest first. The keys themselves are never returned, only their last four characters. + */ +export const listPublishableKeys = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get< + ListPublishableKeysResponses, + ListPublishableKeysErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys", + ...options, + }); + +/** + * Create a publishable key + * + * Issues a pk_ key for a web page to read the organization's public catalogue (GET /api/public/catalog) and nothing else. The key is returned once; only its digest is stored. + */ +export const createPublishableKey = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + CreatePublishableKeyResponses, + CreatePublishableKeyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Update a publishable key + * + * Changes a live key's label or allowed origins. A revoked key answers 409. + */ +export const updatePublishableKey = ( + options: Options, +): RequestResult => + (options.client ?? client).patch< + UpdatePublishableKeyResponses, + UpdatePublishableKeyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys/{keyId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Revoke a publishable key + * + * The key stops authenticating on the next request. Idempotent; revocation is final. + */ +export const revokePublishableKey = ( + options: Options, +): RequestResult => + (options.client ?? client).post< + RevokePublishableKeyResponses, + RevokePublishableKeyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys/{keyId}/revoke", + ...options, + }); + /** * List releases * @@ -2132,7 +4876,13 @@ export const listReleases = ( options?: Options, ): RequestResult => (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases", ...options, }); @@ -2146,7 +4896,13 @@ export const createRelease = ( options: Options, ): RequestResult => (options.client ?? client).post({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases", ...options, headers: { @@ -2164,7 +4920,13 @@ export const deleteRelease = ( options: Options, ): RequestResult => (options.client ?? client).delete({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases/{releaseSlug}", ...options, }); @@ -2178,7 +4940,13 @@ export const getReleaseBySlug = ( options: Options, ): RequestResult => (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases/{releaseSlug}", ...options, }); @@ -2196,7 +4964,13 @@ export const getServiceAccounts = ( GetServiceAccountsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts", ...options, }); @@ -2214,7 +4988,13 @@ export const createServiceAccount = ( CreateServiceAccountErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts", ...options, headers: { @@ -2233,7 +5013,13 @@ export const getServiceAccount = ( ): RequestResult => (options.client ?? client).get( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}", ...options, }, @@ -2252,7 +5038,13 @@ export const updateServiceAccount = ( UpdateServiceAccountErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}", ...options, headers: { @@ -2274,7 +5066,13 @@ export const getServiceAccountTokens = ( GetServiceAccountTokensErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}/tokens", ...options, }); @@ -2296,7 +5094,13 @@ export const createServiceAccountToken = ( CreateServiceAccountTokenErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}/tokens", ...options, headers: { @@ -2322,7 +5126,13 @@ export const deleteServiceAccountToken = ( DeleteServiceAccountTokenErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}", ...options, }); @@ -2344,7 +5154,13 @@ export const exportOrganizationUsageReports = ({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/usage/reports/export", ...options, }); @@ -2366,7 +5182,13 @@ export const getNotificationPreferences = GetNotificationPreferencesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notification-preferences", ...options, }); @@ -2388,7 +5210,13 @@ export const putNotificationPreferences = PutNotificationPreferencesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notification-preferences", ...options, headers: { @@ -2410,7 +5238,13 @@ export const listNotifications = ( ListNotificationsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notifications", ...options, }); @@ -2428,7 +5262,13 @@ export const markNotificationsRead = ( MarkNotificationsReadErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notifications/mark-read", ...options, headers: { @@ -2436,3 +5276,203 @@ export const markNotificationsRead = ( ...options.headers, }, }); + +/** + * List vouchers + * + * The organization's vouchers, newest first, with their codes. Requires billing to be enabled for the organization. + */ +export const listVouchers = ( + options?: Options, +): RequestResult => + (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers", + ...options, + }); + +/** + * Create a voucher + * + * Creates a DRAFT voucher: a PRICE discount or an ENTITLEMENT_BOOST. The code is generated when none is given, and returned. Emits VOUCHER_CREATED, without the code. Requires billing to be enabled for the organization. + */ +export const createVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Find a voucher by code + * + * Finds the voucher a code names, matched without case or separators. The code travels in the body, never in a URL. Requires billing to be enabled for the organization. + */ +export const lookupVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/lookup", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Validate a voucher code + * + * Runs the redemption checks without redeeming: the voucher's own, and, with instanceSlug, the instance's. Answers 200 with valid, and the first failing reason (and eligibility rule) otherwise. Requires billing to be enabled for the organization. + */ +export const validateVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/validate", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Get a voucher + * + * One voucher, with its code. Requires billing to be enabled for the organization. + */ +export const getVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}", + ...options, + }); + +/** + * Update a voucher + * + * Replaces a DRAFT voucher, but its type. An ACTIVE voucher takes a new name, description, expiresAt and maxRedemptions (at least redemptionsCount); its other members must stay as they are (409 UpdateVoucher.NotEditable). Emits VOUCHER_UPDATED. Requires billing to be enabled for the organization. + */ +export const updateVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).put({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Archive a voucher + * + * Stops a voucher from being redeemed. Redemptions already made keep applying until revoked. Emits VOUCHER_ARCHIVED. Requires billing to be enabled for the organization. + */ +export const archiveVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}/archive", + ...options, + }); + +/** + * Publish a voucher + * + * Makes a DRAFT voucher redeemable (409 PublishVoucher.NotADraft otherwise). Emits VOUCHER_PUBLISHED. Requires billing to be enabled for the organization. + */ +export const publishVoucher = ( + options: Options, +): RequestResult => + (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}/publish", + ...options, + }); + +/** + * List a voucher's redemptions + * + * Every redemption of a voucher, newest first. Requires billing to be enabled for the organization. + */ +export const listVoucherRedemptions = ( + options: Options, +): RequestResult => + (options.client ?? client).get< + ListVoucherRedemptionsResponses, + ListVoucherRedemptionsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}/redemptions", + ...options, + }); diff --git a/packages/client/src/core/generated/types.gen.ts b/packages/client/src/core/generated/types.gen.ts index 1e85cf1..ca068c9 100644 --- a/packages/client/src/core/generated/types.gen.ts +++ b/packages/client/src/core/generated/types.gen.ts @@ -5,9 +5,26 @@ export type ClientOptions = { }; export type Webhooks = + | OnAddonEntitlementAssignedWebhookRequest + | OnAddonEntitlementUnassignedWebhookRequest + | OnAddonEntitlementUpdatedWebhookRequest + | OnAddonPriceCreatedWebhookRequest + | OnAddonPriceDeprecatedWebhookRequest + | OnAddonArchivedWebhookRequest + | OnAddonCreatedWebhookRequest + | OnAddonDeletedWebhookRequest + | OnAddonPublishedWebhookRequest + | OnAddonUnarchivedWebhookRequest + | OnAddonUpdatedWebhookRequest + | OnBillingProviderConnectedWebhookRequest + | OnBillingProviderDisconnectedWebhookRequest + | OnBillingProviderSyncFailedWebhookRequest | OnComponentCreatedWebhookRequest | OnComponentDeletedWebhookRequest | OnComponentUpdatedWebhookRequest + | OnCustomerPaymentMethodAttachedWebhookRequest + | OnCustomerPaymentMethodDetachedWebhookRequest + | OnCustomerPaymentMethodExpiringWebhookRequest | OnCustomerCreatedWebhookRequest | OnCustomerCreationRejectedWebhookRequest | OnCustomerDeletedWebhookRequest @@ -27,6 +44,18 @@ export type Webhooks = | OnFeatureFlagEvaluatedWebhookRequest | OnFeatureFlagUpdatedWebhookRequest | OnSystemOrganizationTokenIssuedWebhookRequest + | OnInstanceAddonAddedWebhookRequest + | OnInstanceAddonQuantityChangedWebhookRequest + | OnInstanceAddonRemovedWebhookRequest + | OnInstanceBillingCanceledWebhookRequest + | OnInstanceBillingCancellationRevertedWebhookRequest + | OnInstanceBillingCancellationScheduledWebhookRequest + | OnInstanceBillingPlanChangeCancelledWebhookRequest + | OnInstanceBillingPlanChangeScheduledWebhookRequest + | OnInstanceBillingPlanChangedWebhookRequest + | OnInstanceBillingProviderChangedWebhookRequest + | OnInstanceBillingStartedWebhookRequest + | OnInstanceBillingStatusChangedWebhookRequest | OnInstanceEntitlementCapExceededWebhookRequest | OnInstanceEntitlementUsagePeriodRolledOverWebhookRequest | OnInstanceEntitlementUsageReachedWebhookRequest @@ -34,6 +63,17 @@ export type Webhooks = | OnInstanceEntitlementUsageReportRejectedWebhookRequest | OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest | OnInstanceEntitlementValueGetWebhookRequest + | OnInstanceInvoiceHandoffAcknowledgedWebhookRequest + | OnInstanceInvoiceHeldWebhookRequest + | OnInstanceInvoiceIssuedWebhookRequest + | OnInstanceInvoiceMarkedUncollectibleWebhookRequest + | OnInstanceInvoicePaidWebhookRequest + | OnInstanceInvoicePaymentFailedWebhookRequest + | OnInstanceInvoicePushFailedWebhookRequest + | OnInstanceInvoicePushedWebhookRequest + | OnInstanceInvoiceReconciliationMismatchWebhookRequest + | OnInstanceInvoiceReleasedWebhookRequest + | OnInstanceInvoiceVoidedWebhookRequest | OnInstanceCreatedWebhookRequest | OnInstanceDeletedWebhookRequest | OnInstanceDeployedWebhookRequest @@ -41,9 +81,15 @@ export type Webhooks = | OnInstanceMigratedWebhookRequest | OnInstanceStatusChangedWebhookRequest | OnInstanceUpdatedWebhookRequest + | OnInstanceVoucherExpiredWebhookRequest + | OnInstanceVoucherRedeemedWebhookRequest + | OnInstanceVoucherRevokedWebhookRequest | OnLicenseEntitlementAssignedWebhookRequest | OnLicenseEntitlementUnassignedWebhookRequest | OnLicenseEntitlementUpdatedWebhookRequest + | OnLicensePriceCreatedWebhookRequest + | OnLicensePriceDeprecatedWebhookRequest + | OnLicensePriceUpdatedWebhookRequest | OnLicenseArchivedWebhookRequest | OnLicenseCreatedWebhookRequest | OnLicenseDeletedWebhookRequest @@ -59,870 +105,957 @@ export type Webhooks = | OnMetadataFieldUnarchivedWebhookRequest | OnMetadataFieldUpdatedWebhookRequest | OnReleaseCreatedWebhookRequest - | OnReleaseDeletedWebhookRequest; - -export type AuditTrail = { - /** - * Event name (e.g. ENTITLEMENT_VALUE_GET) - */ - eventName: string; + | OnReleaseDeletedWebhookRequest + | OnVoucherArchivedWebhookRequest + | OnVoucherCreatedWebhookRequest + | OnVoucherExhaustedWebhookRequest + | OnVoucherPublishedWebhookRequest + | OnVoucherUpdatedWebhookRequest; + +export type Addon = { + readonly createdAt: string; + description: string; /** - * Event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get) + * The family the version belongs to */ - eventType: string; + familySlug: string; + readonly id: string; /** - * Unique audit trail entry ID + * The version the family resolves to. Only a PUBLISHED version. */ - id: string; + isDefault: boolean; /** - * Instance UUID (present for instance-scoped events) + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. */ - instanceId?: string; + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Instance slug + * The largest quantity an instance can hold; unbounded when absent */ - instanceSlug: string; + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * Event payload (JSON) + * The version's slug, unique in the organization */ - payload?: unknown; + slug: string; + readonly updatedAt: string; /** - * When the event occurred + * The version number in its family, assigned on create */ - timestamp: string; -}; - -export type Basic = { - type: "basic"; - value: string; + readonly version: number; + versionName: string; }; -export type BasicTargeting = { +export type AddonChanges = { + description: string; + isDefault: boolean; + maxQuantity?: number; name: string; - /** - * CEL expression for basicTargeting evaluation - */ - rule: string; - type: "basic"; - variant: string; + versionName?: string; }; -export type BooleanEntitlementValue = { - /** - * Value type discriminator - */ - type: "boolean"; +export type AddonEntitlement = { + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + readonly id: string; /** - * Boolean value + * The overage the add-on allows; absent inherits the licence grant's */ - value: boolean; -}; - -export type BulkEvaluationFailure = { + limitCapExceededOveragePercent?: number; /** - * Error code specific to the bulk evaluation error + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. */ - errorCode: string; + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; /** - * Optional error details description + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. */ - errorDetails?: string; -}; - -export type BulkEvaluationRequest = { - context?: { + value: { [key: string]: unknown; }; }; -export type Command = { - entitlementSlug: string; -}; - -export type Component = { +export type AddonFamily = { /** - * Timestamp when the component was created + * The default version, else the highest PUBLISHED one; absent when none is published */ - readonly createdAt: string; + currentVersion?: Addon; + readonly id: string; /** - * User who created this component + * Whether the family is listed in the public catalogue */ - readonly createdBy: User; + isPublic: boolean; /** - * Description of the component + * The highest version number the family has assigned */ - description?: string; + lastVersion: number; + slug: string; /** - * Unique identifier for the component + * Every version, newest first */ - readonly id: string; + versions: Array | null; +}; + +export type AddonFamilyVisibility = { /** - * Name of the component + * List the family's default PUBLISHED version, with its ACTIVE prices, in the public catalogue */ - name: string; + isPublic: boolean; +}; + +export type AddonGrant = { /** - * Reference to the previous version of this component + * The overage the add-on allows: -1 with an unlimited value, 0 or more otherwise. Absent inherits the licence grant's. */ - previousComponentId?: string; + limitCapExceededOveragePercent?: number; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * How a number grant combines with the licence's */ - slug?: string; + overrideBehavior?: "ADD" | "OVERRIDE" | "MAX"; /** - * Version of the component + * {type, value}, shaped like a licence grant: a number counts once per unit of quantity */ - version: string; + value: { + [key: string]: unknown; + }; }; -export type ConfigEntitlementValue = { +export type AddonGrantUpdate = { /** - * Value type discriminator + * The add-on version the grant belongs to */ - type: "object"; + addonSlug: string; + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + readonly id: string; /** - * Object configuration value + * The overage the add-on allows; absent inherits the licence grant's + */ + limitCapExceededOveragePercent?: number; + /** + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. + */ + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; + /** + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. */ value: { [key: string]: unknown; }; }; -export type Connector = { +export type AddonPriceUpdate = { /** - * Timestamp when connector was first registered + * The add-on version the price belongs to */ - created_at: string; + addonSlug: string; /** - * Slug of the BOOLEAN entitlement a license must grant for an organization to activate this connector. Absent means the connector is ungated. + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - entitlement_slug?: string; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Stable connector identifier + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - name: string; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * JSON schema used to validate connector settings payloads + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - settings_schema: { - [key: string]: unknown; - }; + billingTiming: "ADVANCE" | "ARREARS"; + readonly createdAt: string; /** - * Timestamp when connector registration was last updated + * ISO 4217 code, upper case. One currency per licence version. */ - updated_at: string; + currency: string; /** - * Registered connector version + * When the price was deprecated */ - version: string; -}; - -export type ConnectorActivation = { + deprecatedAt?: string; /** - * When this organization first activated the connector + * The invoice line's label; a default is derived when absent. */ - activatedAt: string; + displayLabel?: string; /** - * Stable connector identifier + * Order among the version's prices */ - connectorName: string; -}; - -export type ConnectorSettings = { + displayOrder: number; /** - * Stable connector identifier + * Unique identifier of the price */ - readonly connector_name: string; + readonly id: string; /** - * Connector settings payload + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - settings: { - [key: string]: unknown; - }; -}; - -export type ConnectorSettingsSchema = { + isDefault: boolean; /** - * Stable connector identifier + * What a metered price measures. Absent on FLAT_FEE prices. */ - connector_name: string; + metered?: Meter; /** - * JSON schema describing supported connector settings payload + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - schema: { - [key: string]: unknown; - }; + status: "ACTIVE" | "DEPRECATED"; /** - * Registered connector version + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - version: string; + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; + readonly updatedAt: string; }; -export type ConnectorState = { +export type AddonQuantity = { + quantity: number; +}; + +export type AddonUpdate = { /** - * Whether this organization has turned the connector on + * The members the change touched, as the API names them */ - activated: boolean; + changedFields: Array | null; /** - * When this organization activated the connector. Absent when it has not. + * The licence families the version fits after the change */ - activatedAt?: string; + compatibleLicenseFamilies: Array | null; + readonly createdAt: string; + description: string; /** - * Whether this deployment has the connector registered + * The family the version belongs to */ - available: boolean; + familySlug: string; + readonly id: string; /** - * Stable connector identifier + * The version the family resolves to. Only a PUBLISHED version. */ - connectorName: string; + isDefault: boolean; /** - * Whether this organization's licence includes the connector. True for an ungated connector. + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. */ - entitled: boolean; + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Registered connector version. Absent when the connector is not available. + * The largest quantity an instance can hold; unbounded when absent */ - version?: string; -}; - -export type Customer = { + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * Timestamp when the customer was created + * The version's slug, unique in the organization */ - readonly createdAt: string; + slug: string; + readonly updatedAt: string; /** - * User who created this customer + * The version number in its family, assigned on create */ - readonly createdBy: User; + readonly version: number; + versionName: string; +}; + +export type AuditTrail = { /** - * Optional customer domain name + * Event name (e.g. ENTITLEMENT_VALUE_GET) */ - domain?: string; + eventName: string; /** - * Optional identifier for the customer in an external system + * Event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get) */ - externalCustomerId?: string | null; + eventType: string; /** - * Unique identifier for the customer + * Unique audit trail entry ID */ - readonly id: string; + id: string; /** - * Integrations grouped by adapter name + * Instance UUID (present for instance-scoped events) */ - integrations?: { - [key: string]: CustomerIntegration; - }; + instanceId?: string; /** - * Name of the customer + * Instance slug */ - name: string; + instanceSlug: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Event payload (JSON) */ - slug?: string; + payload?: unknown; /** - * Timestamp when the customer was last updated + * When the event occurred */ - readonly updatedAt: string; + timestamp: string; +}; + +export type Basic = { + type: "basic"; + value: string; +}; + +export type BasicTargeting = { + name: string; /** - * User who last updated this customer + * CEL expression for basicTargeting evaluation */ - readonly updatedBy: User; + rule: string; + type: "basic"; + variant: string; }; -export type CustomerBody = { +export type BillingCapabilities = { /** - * Optional customer domain name + * Why they do not: billing is off on this deployment, or the organization's plan does not include it */ - domain?: string; + disabledReason?: "DEPLOYMENT_DISABLED" | "NOT_ENTITLED"; /** - * Optional integration error message + * Whether the billing routes answer for this organization */ - error?: string; + enabled: boolean; /** - * Adapter-specific integration metadata + * Which parts of billing this release ships */ - integrationMetadata?: { - [key: string]: unknown; - }; + features: BillingFeatures; /** - * Customer name + * Who can collect invoices */ - name?: string; + providers: Array; + publicSurface: PublicSurface; /** - * Customer slug + * How long usage reports are kept, in months; absent when they are kept forever or it cannot be told */ - slug?: string; + usageHistoryRetentionMonths?: number; /** - * Absolute http(s) link to the record in the third-party system + * How long a usage report's transactionId is remembered, in days */ - webUrl?: string; + usageIdempotencyWindowDays: number; }; -export type CustomerCreationRejected = { - name: string; - reason: string; - slug: string; +export type BillingFeatures = { + addons: boolean; + chargeAutomatically: boolean; + /** + * Cancellation, reactivation, plan changes and overdue tracking + */ + lifecycle: boolean; + publicSurface: boolean; + stripe: boolean; + trials: boolean; + vouchers: boolean; }; -export type CustomerIntegration = { +export type BillingHealth = { /** - * External identifier in the third-party adapter + * Subscriptions whose period ended and has not closed yet */ - external_id: string; + closeBacklog: CloseBacklog; + handoff: HandoffBacklog; + heldInvoices: HeldInvoices; + overdueInvoices: number; + pastDueSubscriptions: number; + providerSync: Array; /** - * Last synchronization error message, if any + * Invoices whose push failed at least as many times as the alert threshold */ - last_error?: string; + pushFailures: PushFailures; /** - * Adapter-specific integration metadata + * Invoices whose provider's amounts differed from Kaiten's, in the last 30 days */ - metadata?: { - [key: string]: unknown; - }; + reconciliationMismatches30d: number; +}; + +export type BillingProvider = { /** - * Timestamp of the last synchronization with the adapter + * Whether the organization may connect it on this deployment */ - readonly synced_at: string; + available: boolean; + capabilities: ProviderCapabilities; /** - * Absolute http(s) link to the record in the third-party system + * Whether it is set up for the organization; NOOP always is */ - web_url?: string; + connected: boolean; + kind: "NOOP" | "STRIPE"; + /** + * Whether the connection reaches the provider's live account rather than a test one; absent when not connected, and for NOOP + */ + livemode?: boolean; + /** + * Why it is not available; absent when it is + */ + unavailableReason?: "NOT_ENTITLED" | "VAULT_NOT_CONFIGURED"; }; -export type CustomerIntegrationResource = { +export type BillingSettings = { /** - * Optional customer domain name + * How an invoice is collected when its subscription does not say: SEND_INVOICE sends it for payment. CHARGE_AUTOMATICALLY needs a payment provider and is refused until one is available. */ - domain?: string; + defaultCollectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Last synchronization error for this integration, if any + * Days an invoice is due after it is issued, when its subscription does not say; 0 to 365. */ - error?: string; + defaultDaysUntilDue: number; /** - * Adapter-specific customer integration metadata + * Whether invoices a payment provider issues also enter the handoff queue, for an accounting system that wants every invoice. Invoices without a provider always do. */ - integrationMetadata: { - [key: string]: unknown; - }; + handoffStripeInvoices: boolean; +}; + +export type BillingStarted = { /** - * Customer name + * The instant its periods are counted from */ - name: string; + anchorAt: string; /** - * Customer slug + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - slug: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Absolute http(s) link to the record in the third-party system + * Effective: the subscription's own, else the organization's default */ - webUrl?: string; -}; - -export type DefaultVariant = - | ({ - type: "basic"; - } & Basic) - | ({ - type: "rollout_date"; - } & RolloutDate) - | ({ - type: "rollout_percentage"; - } & RolloutPercentage); - -export type Deployment = { + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Timestamp when the deployment was recorded + * The subscription's own collection method; absent when it takes the organization's */ + collectionMethodOverride?: string; createdAt: string; + currency: string; /** - * User who recorded this deployment + * The next boundary: the period closes, and its invoice is composed, after it */ - createdBy: User; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Deployment zone the release was deployed to + * Effective: the subscription's own, else the organization's default */ - deploymentZoneId: string; + daysUntilDue: number; /** - * Unique identifier for this deployment event + * The subscription's own payment terms; absent when it takes the organization's */ + daysUntilDueOverride?: number; id: string; + instanceName: string; /** - * Release that was deployed + * As it was at the subscription's last write */ - releaseId: string; -}; - -export type DeploymentZone = { + instanceSlug: string; + pastDueSince?: string; /** - * Timestamp when the deployment zone was created + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - readonly createdAt: string; + providerKind: "NOOP" | "STRIPE"; /** - * User who created this deployment zone + * Set when a CANCELED subscription was subscribed again */ - readonly createdBy: User; + resubscribed: boolean; /** - * Description of the deployment zone + * A plan change waiting for the next boundary */ - description: string; + scheduledChange?: ScheduledChange; /** - * Unique identifier for the deployment zone + * When billing started: usage before it is never billed */ - readonly id: string; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema + * When the trial ends, or ended: usage before it is never billed */ - metadata?: { - [key: string]: unknown; - }; + trialEndsAt?: string; + updatedAt: string; +}; + +export type BooleanEntitlementValue = { /** - * Name of the deployment zone + * Value type discriminator */ - name: string; + type: "boolean"; /** - * Currently deployed release ID + * Boolean value */ - releaseId?: string; + value: boolean; +}; + +export type BulkEvaluationFailure = { /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Error code specific to the bulk evaluation error */ - slug?: string; + errorCode: string; /** - * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. + * Optional error details description */ - type: string; + errorDetails?: string; +}; + +export type BulkEvaluationRequest = { + context?: { + [key: string]: unknown; + }; +}; + +export type CanceledSubscription = { /** - * Timestamp when the deployment zone was last updated + * The instant its periods are counted from */ - readonly updatedAt: string; + anchorAt: string; /** - * User who last updated the deployment zone + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - readonly updatedBy: User; -}; - -export type Entitlement = { + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. + * Effective: the subscription's own, else the organization's default */ - aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Timestamp when this entitlement was created + * The subscription's own collection method; absent when it takes the organization's */ - readonly createdAt: string; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Description of the entitlement + * The next boundary: the period closes, and its invoice is composed, after it */ - description: string | null; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. + * Effective: the subscription's own, else the organization's default */ - displayOrder?: number; + daysUntilDue: number; /** - * Groups associated with this entitlement + * The subscription's own payment terms; absent when it takes the organization's */ - readonly entitlementGroups?: Array | null; + daysUntilDueOverride?: number; /** - * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. + * The FINAL invoice of an immediate cancellation */ - icon?: string; + finalInvoice?: InvoiceSummary; + id: string; + instanceName: string; /** - * Unique identifier for the entitlement + * As it was at the subscription's last write */ - readonly id: string; + instanceSlug: string; + pastDueSince?: string; /** - * Name of the entitlement + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - name: string; + providerKind: "NOOP" | "STRIPE"; /** - * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. + * A plan change waiting for the next boundary */ - resetAnchor?: "CALENDAR" | "LICENSE_START"; + scheduledChange?: ScheduledChange; /** - * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. + * When billing started: usage before it is never billed */ - resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Number of base units one sale unit represents (1 sale unit = N base units). + * When the trial ends, or ended: usage before it is never billed */ - saleUnitFactor?: number; + trialEndsAt?: string; + updatedAt: string; +}; + +export type Cancellation = { /** - * Plural label of the unit this entitlement is sold in, when it differs from the base unit. + * The instant its periods are counted from */ - saleUnitPlural?: string; + anchorAt: string; /** - * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - saleUnitSingular?: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Effective: the subscription's own, else the organization's default */ - slug?: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Type of the entitlement + * The subscription's own collection method; absent when it takes the organization's */ - type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. + * The next boundary: the period closes, and its invoice is composed, after it */ - unitPlural?: string; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. + * Effective: the subscription's own, else the organization's default */ - unitSingular?: string; + daysUntilDue: number; /** - * Timestamp when this entitlement was last updated + * The subscription's own payment terms; absent when it takes the organization's */ - readonly updatedAt: string; + daysUntilDueOverride?: number; /** - * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. + * The FINAL invoice, when the cancellation issued one */ - userFacing?: boolean; + finalInvoiceId?: string; + id: string; + instanceName: string; /** - * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + * As it was at the subscription's last write */ - warningThresholdPercent?: number; -}; - -export type EntitlementGroup = { + instanceSlug: string; /** - * Description of the entitlement group + * How it was canceled; a trial is canceled at once in either mode */ - description: string | null; + mode: "AT_PERIOD_END" | "IMMEDIATE"; + pastDueSince?: string; /** - * Unique identifier for the entitlement group + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - readonly id: string; + providerKind: "NOOP" | "STRIPE"; /** - * Name of the entitlement group + * A plan change waiting for the next boundary */ - name: string; + scheduledChange?: ScheduledChange; /** - * URL-friendly identifier, unique per organization. Auto-generated if not provided. + * When billing started: usage before it is never billed */ - slug?: string; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type EntitlementGroupSummary = { +export type CancellationChange = { /** - * Unique identifier for the entitlement group + * The instant its periods are counted from */ - id: string; + anchorAt: string; /** - * Name of the entitlement group + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - name: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * URL-friendly identifier for the entitlement group + * Effective: the subscription's own, else the organization's default */ - slug: string; -}; - -export type EntitlementGroupUsage = { + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement. + * The subscription's own collection method; absent when it takes the organization's */ - currentPeriodEnd?: string; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement. + * The next boundary: the period closes, and its invoice is composed, after it */ - currentPeriodStart?: string; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Entitlement ID + * Effective: the subscription's own, else the organization's default */ - entitlementId: string; + daysUntilDue: number; /** - * Entitlement name + * The subscription's own payment terms; absent when it takes the organization's */ - entitlementName: string; + daysUntilDueOverride?: number; /** - * Entitlement slug + * The boundary the cancellation takes effect at */ - entitlementSlug: string; + effectiveAt: string; + id: string; + instanceName: string; /** - * Entitlement type + * As it was at the subscription's last write */ - entitlementType: string; + instanceSlug: string; + pastDueSince?: string; /** - * License limit value, discriminated by the 'type' field. Null when the license grants no value. + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - licenseValue?: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + providerKind: "NOOP" | "STRIPE"; /** - * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. + * A plan change waiting for the next boundary */ - usageValue?: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type EntitlementUsage = { + scheduledChange?: ScheduledChange; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). + * When billing started: usage before it is never billed */ - currentPeriodEnd?: string; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). + * When the trial ends, or ended: usage before it is never billed */ - currentPeriodStart?: string; + trialEndsAt?: string; + updatedAt: string; +}; + +export type CloseBacklog = { + count: number; + oldestDueAt?: string; +}; + +export type ClosePeriodsScope = { /** - * Unique identifier for the entitlement + * Close only this instance's subscription */ - entitlementId: string; + instanceSlug?: string; +}; + +export type ClosedInvoice = { + boundaryAt: string; /** - * URL-friendly identifier of the entitlement + * Set when the invoice is a held DRAFT */ + held: boolean; + id: string; + instanceSlug: string; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; +}; + +export type Command = { entitlementSlug: string; +}; + +export type CompatibleLicenseFamilies = { + familySlugs: Array; +}; + +export type CompletedPaymentMethodSession = { + paymentMethod: PaymentMethodLabels; +}; + +export type Component = { /** - * Unique identifier for the license to which this entitlement usage belongs + * Timestamp when the component was created */ - licenseId: string; + readonly createdAt: string; /** - * URL-friendly identifier of the license + * User who created this component */ - licenseSlug: string; + readonly createdBy: User; /** - * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + * Description of the component */ - limit?: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); - /** - * Resolved entitlement value, discriminated by the 'type' field - */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type ErrorDetail = { - /** - * Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' - */ - location?: string; - /** - * Error message text - */ - message?: string; + description?: string; /** - * The value at the given location + * Unique identifier for the component */ - value?: unknown; -}; - -export type EvaluationFailure = { + readonly id: string; /** - * OpenFeature compatible error code + * Name of the component */ - errorCode: string; + name: string; /** - * Error description + * Reference to the previous version of this component */ - errorDetails?: string; + previousComponentId?: string; /** - * Feature flag key + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - key: string; + slug?: string; /** - * Arbitrary metadata for the flag + * Version of the component */ - metadata?: { - [key: string]: unknown; - }; -}; - -export type EvaluationRequest = { - context?: { - [key: string]: unknown; - }; + version: string; }; -export type EvaluationSuccess = { +export type ConfigEntitlementValue = { /** - * Feature flag key + * Value type discriminator */ - key: string; + type: "object"; /** - * Arbitrary metadata for the flag + * Object configuration value */ - metadata?: { + value: { [key: string]: unknown; }; +}; + +export type Connection = { /** - * OpenFeature reason for the evaluation + * The connector that configures it */ - reason?: string; + connectorName: string; /** - * Flag evaluation result + * Whether the connection reaches the provider's live account rather than a test one */ - value?: unknown; + livemode: boolean; /** - * string of the evaluated flag value + * The payment provider */ - variant?: string; -}; - -export type FeatureFlag = { - default_variant: DefaultVariant; - description: string | null; - enabled: boolean; - event_name: string; - readonly id: string; - metadata: { - [key: string]: unknown; - }; - name: string; - slug?: string; - targetings: Targetings; - type: "boolean" | "string" | "number" | "object"; - variants: Array | null; + providerKind: "STRIPE"; }; -export type FeatureFlagEvaluated = { +export type Connector = { /** - * Set when the evaluation failed and the default was returned + * Timestamp when connector was first registered */ - error_code?: string; + created_at: string; /** - * Human-readable detail accompanying error_code + * Slug of the BOOLEAN entitlement a license must grant for an organization to activate this connector. Absent means the connector is ungated. */ - error_message?: string; + entitlement_slug?: string; /** - * Unique identifier of the evaluated flag + * Stable connector identifier */ - flag_id: string; + name: string; /** - * URL-friendly identifier of the evaluated flag + * JSON schema used to validate connector settings payloads */ - flag_slug: string; + settings_schema: { + [key: string]: unknown; + }; /** - * Name of the targeting rule that matched, when the reason is TARGETING_MATCH + * Timestamp when connector registration was last updated */ - matched_rule_name?: string; + updated_at: string; /** - * Why the value resolved as it did + * Registered connector version */ - reason: string; + version: string; +}; + +export type ConnectorActivation = { /** - * Name of the resolved variant, when the flag has one + * When this organization first activated the connector */ - variant?: string; + activatedAt: string; + /** + * Stable connector identifier + */ + connectorName: string; }; -export type Impact = { +export type ConnectorSettings = { /** - * Number of resources whose stored value for this field would no longer satisfy the candidate schema + * Stable connector identifier */ - count: number; + readonly connector_name: string; /** - * Up to 5 impacted resources, for display + * Connector settings payload */ - samples: Array | null; + settings: { + [key: string]: unknown; + }; }; -export type ImpactSample = { +export type ConnectorSettingsSchema = { /** - * Resource display name + * Stable connector identifier */ - name: string; + connector_name: string; /** - * Resource slug + * JSON schema describing supported connector settings payload */ - slug: string; + schema: { + [key: string]: unknown; + }; + /** + * Registered connector version + */ + version: string; }; -export type Instance = { +export type ConnectorState = { /** - * Timestamp when the instance was created + * Whether this organization has turned the connector on */ - readonly createdAt: string; + activated: boolean; /** - * User who created this instance + * When this organization activated the connector. Absent when it has not. */ - readonly createdBy: User; + activatedAt?: string; /** - * ID of the customer associated with this instance + * Whether this deployment has the connector registered */ - customerId: string; + available: boolean; /** - * Slug of the customer associated with this instance + * Stable connector identifier */ - readonly customerSlug: string; + connectorName: string; /** - * ID of the deployment zone associated with this instance (optional) + * Whether this organization's licence includes the connector. True for an ungated connector. */ - deploymentZoneId?: string; + entitled: boolean; /** - * Slug of the deployment zone associated with this instance (optional) + * Registered connector version. Absent when the connector is not available. */ - readonly deploymentZoneSlug?: string; + version?: string; +}; + +export type CreatedCustomerSession = { + customerSlug: string; + expiresAt: string; /** - * Brief description of the instance + * Revoke it with POST /customer-sessions/{id}/revoke */ - description: string; + id: string; + instanceSlug?: string; /** - * End date of the license for this instance + * The kst_ token: hand it to the customer's browser, which sends it as Authorization: Bearer on /api/public/session routes. Shown once; only its digest is stored. */ - endLicenseDate: string; + token: string; +}; + +export type Customer = { /** - * Unique identifier for the instance + * Where invoices sent to this customer are delivered, at most 254 characters (CreateCustomer.InvalidBillingEmail). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. Personal data: never included in event payloads. */ - readonly id: string; + billingEmail?: string; /** - * Integrations grouped by adapter name + * Timestamp when the customer was created */ - integrations?: { - [key: string]: InstanceIntegration; - }; + readonly createdAt: string; /** - * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. + * User who created this customer */ - licenseId: string; + readonly createdBy: User; /** - * Slug of the license associated with this instance + * Optional customer domain name */ - readonly licenseSlug: string; + domain?: string; /** - * Commercial lifecycle stage of the instance (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED) + * Optional identifier for the customer in an external system */ - readonly lifecycleStage?: string; + externalCustomerId?: string | null; /** - * Metadata for the instance + * Unique identifier for the customer */ - metadata?: { - [key: string]: unknown; + readonly id: string; + /** + * Integrations grouped by adapter name + */ + integrations?: { + [key: string]: CustomerIntegration; }; /** - * Name of the instance + * Name of the customer */ name: string; /** @@ -930,40 +1063,31 @@ export type Instance = { */ slug?: string; /** - * Start date of the license for this instance - */ - startLicenseDate: string; - /** - * Operational status of the instance - */ - readonly status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; - /** - * Timestamp when the instance was last updated + * Timestamp when the customer was last updated */ readonly updatedAt: string; /** - * User who last updated this instance + * User who last updated this customer */ readonly updatedBy: User; }; -export type InstanceBody = { +export type CustomerBilling = { /** - * External identifier of the related customer in the same adapter + * Where the customer's invoices are sent. Personal data */ - customerExternalId?: string; + billingEmail?: string; /** - * Deployment zone ID + * The customer in each payment provider; none for NOOP */ - deploymentZoneId?: string; + providers: Array; +}; + +export type CustomerBody = { /** - * Instance description + * Optional customer domain name */ - description?: string; - /** - * License end date - */ - endLicenseDate?: string; + domain?: string; /** * Optional integration error message */ @@ -975,2009 +1099,1985 @@ export type InstanceBody = { [key: string]: unknown; }; /** - * License ID - */ - licenseId?: string; - /** - * Instance metadata - */ - metadata?: { - [key: string]: unknown; - }; - /** - * Instance name + * Customer name */ name?: string; /** - * Instance slug + * Customer slug */ slug?: string; - /** - * License start date - */ - startLicenseDate?: string; /** * Absolute http(s) link to the record in the third-party system */ webUrl?: string; }; -export type InstanceEntitlementCapExceeded = { - /** - * URL-friendly identifier of the entitlement - */ - entitlement_slug: string; +export type CustomerCreationRejected = { + name: string; + reason: string; + slug: string; +}; + +export type CustomerInProvider = { /** - * Amount by which usage exceeds the cap + * The customer's id in the provider */ - overage: number; + externalCustomerId: string; /** - * The entitlement cap + * Its default payment method; null when there is none */ - threshold: number; + paymentMethod: PaymentMethodLabels; + providerKind: "STRIPE"; + syncedAt?: string; /** - * Current usage value, including overage + * The customer's page in the provider's dashboard */ - value: number; -}; - -export type InstanceEntitlementUsagePeriodRolledOver = { - closed_period_end: string | null; - closed_period_start: string | null; - entitlement_id: string; - entitlement_slug: string; - event_count: number; - instance_id: string; - is_synthetic: boolean; - new_period_start: string; - value: number; + webUrl?: string; }; -export type InstanceEntitlementUsageReportAccepted = { +export type CustomerIntegration = { /** - * Report behavior: append folds the value into the stored total, set overwrites it + * External identifier in the third-party adapter */ - behavior: "append" | "set"; + external_id: string; /** - * URL-friendly identifier of the entitlement the usage was reported against + * Last synchronization error message, if any */ - entitlement_slug: string; + last_error?: string; /** - * Number of reports folded into the current usage window, including this one + * Adapter-specific integration metadata */ - event_count: number; + metadata?: { + [key: string]: unknown; + }; /** - * Whether the report was persisted + * Timestamp of the last synchronization with the adapter */ - status: "ACCEPTED" | "REJECTED"; + readonly synced_at: string; /** - * Value carried by the report + * Absolute http(s) link to the record in the third-party system */ - value: number; + web_url?: string; }; -export type InstanceEntitlementUsageWarningThresholdReached = { - /** - * Usage value at which the warning fires (cap * warningThresholdPercent / 100) - */ - boundary: number; - /** - * URL-friendly identifier of the entitlement - */ - entitlement_slug: string; - /** - * The entitlement cap - */ - threshold: number; +export type CustomerIntegrationResource = { /** - * Current usage value + * Optional customer domain name */ - value: number; -}; - -export type InstanceEntitlementValueGet = { + domain?: string; /** - * Unique identifier for the entitlement + * Last synchronization error for this integration, if any */ - entitlement_id: string; + error?: string; /** - * URL-friendly identifier of the entitlement + * Adapter-specific customer integration metadata */ - entitlement_slug: string; + integrationMetadata: { + [key: string]: unknown; + }; /** - * Unique identifier for the instance the value was read for + * Customer name */ - instance_id: string; + name: string; /** - * Unique identifier for the license carrying the entitlement + * Customer slug */ - license_id: string; + slug: string; /** - * Unique identifier for the owning organization + * Absolute http(s) link to the record in the third-party system */ - organization_id: string; + webUrl?: string; +}; + +export type CustomerSessionDraft = { /** - * When the value was read + * The customer the session acts for */ - timestamp: string; + customerSlug: string; /** - * Discriminator of the resolved entitlement value + * Binds the session to one of the customer's instances; checkout, cancel and the other subscription routes need it. Omitted: the session reads the whole customer. */ - type: string; + instanceSlug?: string; /** - * Resolved entitlement value at read time + * How long the session lives, in seconds: 300 to 3600 (CreateCustomerSession.InvalidTtl otherwise). Default 30 minutes; mint a new one before it ends. */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + ttlSeconds?: number; }; -export type InstanceIntegration = { +export type DefaultVariant = + | ({ + type: "basic"; + } & Basic) + | ({ + type: "rollout_date"; + } & RolloutDate) + | ({ + type: "rollout_percentage"; + } & RolloutPercentage); + +export type DeletedAddon = { + familySlug: string; + id: string; + slug: string; +}; + +export type Deployment = { /** - * External identifier in the third-party adapter + * Timestamp when the deployment was recorded */ - external_id: string; + createdAt: string; /** - * Last synchronization error message, if any + * User who recorded this deployment */ - last_error?: string; + createdBy: User; /** - * Adapter-specific integration metadata + * Deployment zone the release was deployed to */ - metadata?: { - [key: string]: unknown; - }; + deploymentZoneId: string; /** - * Timestamp of the last synchronization with the adapter + * Unique identifier for this deployment event */ - readonly synced_at: string; + id: string; /** - * Absolute http(s) link to the record in the third-party system + * Release that was deployed */ - web_url?: string; + releaseId: string; }; -export type InstanceIntegrationResource = { +export type DeploymentZone = { /** - * External identifier of the related customer in the same adapter + * Timestamp when the deployment zone was created */ - customerExternalId?: string; + readonly createdAt: string; /** - * Deployment zone ID + * User who created this deployment zone */ - deploymentZoneId?: string; + readonly createdBy: User; /** - * Instance description + * Description of the deployment zone */ description: string; /** - * License end date - */ - endLicenseDate: string; - /** - * Last synchronization error for this integration, if any + * Unique identifier for the deployment zone */ - error?: string; + readonly id: string; /** - * Adapter-specific instance integration metadata + * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema */ - integrationMetadata: { + metadata?: { [key: string]: unknown; }; /** - * License ID + * Name of the deployment zone */ - licenseId: string; + name: string; /** - * Instance name + * Currently deployed release ID */ - name: string; + releaseId?: string; /** - * Instance slug + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - slug: string; + slug?: string; /** - * License start date + * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. */ - startLicenseDate: string; + type: string; /** - * Absolute http(s) link to the record in the third-party system + * Timestamp when the deployment zone was last updated */ - webUrl?: string; -}; - -export type InstanceLifecycleStageChanged = { - changed_by: string; - instance_id: string; - new_lifecycle_stage: string | null; - previous_lifecycle_stage: string | null; -}; - -export type InstanceStatusChanged = { - changed_by: string; - instance_id: string; - new_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; - previous_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; + readonly updatedAt: string; + /** + * User who last updated the deployment zone + */ + readonly updatedBy: User; }; -export type License = { +export type DueToday = { + currency: string; /** - * Timestamp when this license was created + * Minor units */ - readonly createdAt: string; + discountTotal: number; + lines: Array; /** - * Detailed description of the license capabilities and restrictions + * Minor units */ - description: string; + subtotal: number; /** - * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). + * Minor units */ - familyId?: string; + total: number; +}; + +export type Entitlement = { /** - * Unique identifier for the license + * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. */ - readonly id: string; + aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; /** - * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). + * Timestamp when this entitlement was created */ - isDefault: boolean; - /** - * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. - */ - lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; + readonly createdAt: string; /** - * Display name of the license + * Description of the entitlement */ - name: string; + description: string | null; /** - * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. + * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. */ - slug?: string; + displayOrder?: number; /** - * Type of the license determining its capabilities and restrictions + * Groups associated with this entitlement */ - type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; + readonly entitlementGroups?: Array | null; /** - * Timestamp when this license was last updated + * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. */ - readonly updatedAt: string; + icon?: string; /** - * Version of the license within its family, assigned by the server when the version is created and never changed afterwards: the version's derived slug ({familySlug}-v{version}, see slug) is built from it. A number is never reused within a family, even after its version is deleted. Create refuses any value (CreateLicense.VersionNotSettable); update accepts only the stored one, so a representation can be written back as it was read (UpdateLicense.VersionNotSettable). + * Unique identifier for the entitlement */ - readonly version: string; + readonly id: string; /** - * Optional human-readable name for the license version. Defaults to "Version - ". + * Name of the entitlement */ - versionName?: string; -}; - -export type LicenseEntitlement = { + name: string; /** - * Timestamp when this entitlement was created + * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. */ - readonly createdAt: string; + resetAnchor?: "CALENDAR" | "LICENSE_START"; /** - * User who created this entitlement + * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. */ - readonly createdBy: User; + resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; /** - * Groups associated with this entitlement + * Number of base units one sale unit represents (1 sale unit = N base units). */ - readonly entitlementGroups?: Array | null; + saleUnitFactor?: number; /** - * Name of the entitlement feature or service + * Plural label of the unit this entitlement is sold in, when it differs from the base unit. */ - readonly entitlementName: string; + saleUnitPlural?: string; /** - * URL-friendly identifier for the entitlement + * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). */ - entitlementSlug?: string; + saleUnitSingular?: string; /** - * Type of entitlement (BOOLEAN, NUMBER, or CONFIG) + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - readonly entitlementType?: "BOOLEAN" | "NUMBER" | "CONFIG"; + slug?: string; /** - * Unique identifier for the license this entitlement belongs to + * Type of the entitlement */ - readonly licenseId: string; + type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * URL-friendly identifier for the license this entitlement belongs to + * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. */ - readonly licenseSlug: string; + unitPlural?: string; /** - * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. + * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. */ - limitCapExceededOveragePercent?: number; + unitSingular?: string; /** * Timestamp when this entitlement was last updated */ readonly updatedAt: string; /** - * User who last updated this entitlement + * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. */ - readonly updatedBy: User; + userFacing?: boolean; /** - * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} + * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + warningThresholdPercent?: number; }; -export type LicenseFamilyView = { +export type EntitlementGroup = { /** - * Timestamp when this family was created + * Description of the entitlement group */ - readonly createdAt: string; + description: string | null; /** - * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. + * Unique identifier for the entitlement group */ - currentVersion?: License; + readonly id: string; /** - * Unique identifier for the license family + * Name of the entitlement group */ - readonly id: string; + name: string; /** - * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. + * URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - slug: string; + slug?: string; +}; + +export type EntitlementGroupSummary = { /** - * Timestamp when a version was last added to this family, or when the family was created. Renames, lifecycle moves and default changes update the versions' own updatedAt, not this one. + * Unique identifier for the entitlement group */ - readonly updatedAt: string; + id: string; /** - * Number of versions in this family, whatever their lifecycle state + * Name of the entitlement group */ - versionCount: number; + name: string; /** - * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. + * URL-friendly identifier for the entitlement group */ - versions?: Array; + slug: string; }; -export type List = { +export type EntitlementGroupUsage = { /** - * The page, newest first + * End of the current usage window (exclusive). Null for a lifetime entitlement. */ - data: Array; + currentPeriodEnd?: string; /** - * Opaque cursor for the next page; null on the last page + * Start of the current usage window (inclusive). Null for a lifetime entitlement. */ - nextCursor: string | null; + currentPeriodStart?: string; /** - * Unread notifications, capped (see MaxUnreadCount) + * Entitlement ID */ - unreadCount: number; -}; - -export type ManifestEnvelope = { - flags: Array | null; -}; - -export type ManifestFlag = { - defaultValue: unknown; - description?: string; - key: string; - name?: string; - type: string; -}; - -export type MarkReadResult = { + entitlementId: string; /** - * Unread notifications after the change + * Entitlement name */ - unreadCount: number; + entitlementName: string; /** - * Notifications newly marked read + * Entitlement slug */ - updated: number; -}; - -export type MetadataField = { + entitlementSlug: string; /** - * Timestamp when the field was archived (soft delete). Absent if active. + * Entitlement type */ - readonly archivedAt?: string; + entitlementType: string; /** - * Timestamp when the field was created + * License limit value, discriminated by the 'type' field. Null when the license grants no value. */ - readonly createdAt: string; + licenseValue?: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); /** - * User who created this field + * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. */ - readonly createdBy: User; + usageValue?: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); +}; + +export type EntitlementUsage = { /** - * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. + * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). */ - displayOrder?: number; + currentPeriodEnd?: string; /** - * Unique identifier + * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). */ - readonly id: string; + currentPeriodStart?: string; /** - * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} + * Unique identifier for the entitlement */ - jsonSchema: { - [key: string]: unknown; - }; + entitlementId: string; /** - * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. + * URL-friendly identifier of the entitlement */ - key: string; + entitlementSlug: string; /** - * Human-readable label shown in the admin UI + * Unique identifier for the license to which this entitlement usage belongs */ - label: string; + licenseId: string; /** - * Resource type this field applies to. Immutable after creation; update must echo back the stored value. + * URL-friendly identifier of the license */ - resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; + licenseSlug: string; /** - * Timestamp when the field was last updated + * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. */ - readonly updatedAt: string; + limit?: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); /** - * User who last updated this field + * Resolved entitlement value, discriminated by the 'type' field */ - readonly updatedBy: User; + value: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type MetadataFieldReordered = { +export type ErrorDetail = { /** - * Metadata field ids in their new display order + * Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' */ - ids: Array | null; -}; - -export type MetadataFieldSchemaProposal = { + location?: string; /** - * Candidate JSON Schema 2020-12 document to evaluate existing values against. + * Error message text */ - jsonSchema: { - [key: string]: unknown; - }; + message?: string; + /** + * The value at the given location + */ + value?: unknown; }; -export type Notification = { +export type EvaluationFailure = { /** - * Where clicking the notification goes + * OpenFeature compatible error code */ - actionUrl?: string; + errorCode: string; /** - * Rendered detail line, when the event has one + * Error description */ - body?: string; + errorDetails?: string; /** - * When the event occurred + * Feature flag key */ - createdAt: string; + key: string; /** - * Event this notification reports + * Arbitrary metadata for the flag */ - eventName: string; + metadata?: { + [key: string]: unknown; + }; +}; + +export type EvaluationRequest = { + context?: { + [key: string]: unknown; + }; +}; + +export type EvaluationSuccess = { /** - * CloudEvents type of the same event -- the key it is published under in this document's webhooks section, so a client can line a notification up with the payload schema and the description already published there + * Feature flag key */ - eventType: string; + key: string; /** - * Identifier of the underlying audit trail entry + * Arbitrary metadata for the flag */ - id: string; + metadata?: { + [key: string]: unknown; + }; /** - * What the notification is about -- the kind of page actionUrl opens, and what the list's objectType filter matches + * OpenFeature reason for the evaluation */ - objectType: string; + reason?: string; /** - * When this user read it; absent means unread + * Flag evaluation result */ - readAt?: string; + value?: unknown; /** - * Rendered headline + * string of the evaluated flag value */ - title: string; + variant?: string; }; -export type NumberEntitlementValue = { +export type Event = { /** - * Number of events accumulated (server-computed) + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - readonly event_count?: number; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Value type discriminator + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - type: "number"; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Numeric value + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - value: number; -}; - -export type PageAuditTrail = { + billingTiming: "ADVANCE" | "ARREARS"; + readonly createdAt: string; /** - * Whether more rows exist beyond this page. + * ISO 4217 code, upper case. One currency per licence version. */ - hasMore: boolean; - items: Array; + currency: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * When the price was deprecated */ - nextCursor?: string; -}; - -export type PageComponent = { + deprecatedAt?: string; /** - * Whether more rows exist beyond this page. + * The invoice line's label; a default is derived when absent. */ - hasMore: boolean; - items: Array; + displayLabel?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Order among the version's prices */ - nextCursor?: string; -}; - -export type PageCustomer = { + displayOrder: number; /** - * Whether more rows exist beyond this page. + * The family of that version */ - hasMore: boolean; - items: Array; + familySlug: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Unique identifier of the price */ - nextCursor?: string; -}; - -export type PageDeploymentZone = { + readonly id: string; /** - * Whether more rows exist beyond this page. + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - hasMore: boolean; - items: Array; + isDefault: boolean; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The licence version the price belongs to */ - nextCursor?: string; -}; - -export type PageEntitlement = { + licenseSlug: string; /** - * Whether more rows exist beyond this page. + * What a metered price measures. Absent on FLAT_FEE prices. */ - hasMore: boolean; - items: Array; + metered?: Meter; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - nextCursor?: string; -}; - -export type PageEntitlementGroup = { + status: "ACTIVE" | "DEPRECATED"; /** - * Whether more rows exist beyond this page. + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - hasMore: boolean; - items: Array; + unitAmount?: number; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - nextCursor?: string; + unitAmountDecimal: string; + readonly updatedAt: string; }; -export type PageFeatureFlag = { +export type ExhaustedEvent = { + id: string; + maxRedemptions?: number; + name: string; +}; + +export type FeatureFlag = { + default_variant: DefaultVariant; + description: string | null; + enabled: boolean; + event_name: string; + readonly id: string; + metadata: { + [key: string]: unknown; + }; + name: string; + slug?: string; + targetings: Targetings; + type: "boolean" | "string" | "number" | "object"; + variants: Array | null; +}; + +export type FeatureFlagEvaluated = { /** - * Whether more rows exist beyond this page. + * Set when the evaluation failed and the default was returned */ - hasMore: boolean; - items: Array; + error_code?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Human-readable detail accompanying error_code */ - nextCursor?: string; -}; - -export type PageInstance = { + error_message?: string; /** - * Whether more rows exist beyond this page. + * Unique identifier of the evaluated flag */ - hasMore: boolean; - items: Array; + flag_id: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * URL-friendly identifier of the evaluated flag */ - nextCursor?: string; -}; - -export type PageLicense = { + flag_slug: string; /** - * Whether more rows exist beyond this page. + * Name of the targeting rule that matched, when the reason is TARGETING_MATCH */ - hasMore: boolean; - items: Array; + matched_rule_name?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Why the value resolved as it did */ - nextCursor?: string; + reason: string; + /** + * Name of the resolved variant, when the flag has one + */ + variant?: string; }; -export type PageLicenseEntitlement = { +export type Grant = { + entitlementSlug: string; /** - * Whether more rows exist beyond this page. + * SET replaces the value, ADD adds to it, MULTIPLY multiplies it, UNLIMITED lifts the limit */ - hasMore: boolean; - items: Array; + modifierType: "SET" | "ADD" | "MULTIPLY" | "UNLIMITED"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * A decimal: >= 0 for SET, > 0 for ADD and MULTIPLY, absent for UNLIMITED */ - nextCursor?: string; + modifierValue?: string; }; -export type PageLicenseFamilyView = { +export type Handoff = { + acknowledgedAt?: string; + claimCount: number; /** - * Whether more rows exist beyond this page. + * The invoice's number in the organization's accounting system */ - hasMore: boolean; - items: Array; + externalReference?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The claim currently holding it */ - nextCursor?: string; + leaseId?: string; + leasedUntil?: string; + status: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; }; -export type PageMetadataField = { - /** - * Whether more rows exist beyond this page. - */ - hasMore: boolean; - items: Array; +export type HandoffAcknowledgement = { + acknowledgedBy: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The invoice's number in the organization's accounting system */ - nextCursor?: string; + externalReference?: string; + invoiceId: string; }; -export type PageRelease = { +export type HandoffBacklog = { + oldestPendingIssuedAt?: string; + pending: number; +}; + +export type HandoffBooking = { /** - * Whether more rows exist beyond this page. + * The invoice's number in the accounting system, 1 to 255 characters */ - hasMore: boolean; - items: Array; + externalReference?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The claim's lease. When given, an invoice another claim took since is refused (AckHandoff.LeaseMismatch) */ - nextCursor?: string; + leaseId?: string; }; -export type PageServiceAccount = { +export type HandoffClaim = { /** - * Whether more rows exist beyond this page. + * The leased invoices, oldest issue first, with their billing e-mail: what the accounting system needs to book them */ - hasMore: boolean; - items: Array; + invoices: Array; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Pass it back when acknowledging an invoice of this claim */ - nextCursor?: string; + leaseId: string; + /** + * When the lease expires and the invoices are claimable again + */ + leasedUntil: string; }; -export type PageToken = { +export type HandoffClaimSize = { /** - * Whether more rows exist beyond this page. + * Lease length, 60 to 3600 seconds; 900 when omitted */ - hasMore: boolean; - items: Array; + leaseSeconds?: number; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Invoices to lease, 1 to 100; 25 when omitted */ - nextCursor?: string; + limit?: number; }; -export type PatchInstanceBody = { +export type HeldInvoice = { /** - * Commercial lifecycle stage (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED). When omitted, the current stage is preserved; clearing it back to unset is not supported. + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - lifecycleStage?: string; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Operational status of the instance + * As it was when the invoice was composed */ - status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; -}; - -export type PlainToken = { - readonly createdAt: string; - readonly createdBy: User; - expiresAt?: string; - readonly id?: string; - name: string; - readonly revokedAt?: string; - readonly revokedBy?: User; - scopes: Array | null; - readonly serviceAccountId?: string; + customerSlug: string; + daysUntilDue?: number; /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * Sum of the discounts, in minor units */ - slug?: string; - readonly token?: string; -}; - -export type PreferenceChoices = { + discountTotal: number; /** - * Events to set; events left out keep their current value + * issuedAt + daysUntilDue */ - events: Array | null; -}; - -export type PreferenceEvent = { + dueAt?: string; /** - * Effective value per channel + * PENDING: waiting in the handoff queue for the organization's accounting system */ - channels: { - [key: string]: boolean; - }; - eventName: string; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + holdDetail: HoldDetail; /** - * CloudEvents type of the same event; see Notification.eventType + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - eventType: string; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Catalogue group the client renders this under + * The invoice's identifier: the key an accounting system deduplicates on */ - group: string; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Human-readable event name + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - label: string; -}; - -export type PreferenceMatrix = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Channels this deployment serves, in display order + * Who collects it. NOOP: the organization itself, through the handoff queue */ - channels: Array; + providerKind: "NOOP" | "STRIPE"; /** - * Every notifiable event + * Earliest start of its lines' service periods */ - events: Array; -}; - -export type PreferenceUpdate = { - channels: { - [key: string]: boolean; - }; - eventName: string; -}; - -export type Problem = { + serviceFrom: string; /** - * Stable, machine-readable error code. + * Latest end of its lines' service periods */ - code?: string; + serviceTo: string; /** - * A human-readable explanation specific to this occurrence of the problem. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - detail?: string; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Correlation id for the server-side log entry describing the withheld cause. + * Sum of the lines, in minor units */ - errorId?: string; + subtotal: number; /** - * Optional list of individual error details + * subtotal − discountTotal, in minor units */ - errors?: Array | null; + total: number; + updatedAt: string; +}; + +export type HeldInvoices = { + byReason: { + [key: string]: number; + }; + count: number; +}; + +export type HeldPair = { + counterReportSeq: number | null; + entitlementId: string; + expected: string; + firstSeq: number | null; + found: string; + instanceId: string; + invariant: string; + lastSeq: number | null; +}; + +export type HoldDetail = { + pairs: Array; +}; + +export type HoldRecord = { + heldAt?: string; + releaseReason?: string; + releasedAt?: string; /** - * A URI reference that identifies the specific occurrence of the problem. + * The user who released it; absent when it was released by a later check */ - instance?: string; + releasedBy?: string; +}; + +export type HoldRelease = { /** - * HTTP status code + * 1 to 500 characters */ - status?: number; + reason: string; +}; + +export type Impact = { /** - * A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + * Number of resources whose stored value for this field would no longer satisfy the candidate schema */ - title?: string; + count: number; /** - * A URI reference to human-readable documentation for the error. + * Up to 5 impacted resources, for display */ - type?: string; + samples: Array | null; }; -export type ReadSelection = { +export type ImpactSample = { /** - * Mark every notification read, up to now + * Resource display name */ - all?: boolean; + name: string; /** - * Notifications to mark read + * Resource slug */ - ids?: Array | null; + slug: string; }; -export type Release = { - /** - * List of components included in this release, fixed at creation - */ - readonly components?: Array | null; +export type Instance = { /** - * Timestamp when the release was created + * Timestamp when the instance was created */ readonly createdAt: string; /** - * User who created this release + * User who created this instance */ readonly createdBy: User; /** - * Description of the release + * ID of the customer associated with this instance */ - description?: string; + customerId: string; /** - * Unique identifier for the release + * Slug of the customer associated with this instance */ - readonly id: string; + readonly customerSlug: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * ID of the deployment zone associated with this instance (optional) */ - slug?: string; + deploymentZoneId?: string; /** - * Version of the release + * Slug of the deployment zone associated with this instance (optional) */ - version: string; -}; - -export type ReorderMetadataFieldsInput = { - ids: Array | null; -}; - -export type ReportEntitlementUsageBody = { + readonly deploymentZoneSlug?: string; /** - * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it + * Brief description of the instance */ - behavior?: "append" | "set"; + description: string; /** - * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. + * End date of the license for this instance */ - metadata?: { - [key: string]: unknown; + endLicenseDate: string; + /** + * Unique identifier for the instance + */ + readonly id: string; + /** + * Integrations grouped by adapter name + */ + integrations?: { + [key: string]: InstanceIntegration; }; /** - * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. + * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. */ - transactionId?: string; + licenseId: string; /** - * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + * Slug of the license associated with this instance */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type RolloutDate = { - end: RolloutStep; - start: RolloutStep; - type: "rollout_date"; -}; - -export type RolloutDateTargeting = { - end: RolloutStep; - name: string; + readonly licenseSlug: string; /** - * CEL expression for basicTargeting evaluation + * Commercial lifecycle stage of the instance (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED) */ - rule: string; - start: RolloutStep; - type: "rollout_date"; -}; - -export type RolloutPercentage = { - distribution: { - [key: string]: number; - }; - type: "rollout_percentage"; -}; - -export type RolloutPercentageTargeting = { - distribution: { - [key: string]: number; + readonly lifecycleStage?: string; + /** + * Metadata for the instance + */ + metadata?: { + [key: string]: unknown; }; - name: string; /** - * CEL expression for basicTargeting evaluation + * Name of the instance */ - rule: string; - type: "rollout_percentage"; -}; - -export type RolloutStep = { - date: string; - percentage: number; - variant: string; -}; - -export type ServiceAccount = { - readonly createdAt?: string; - readonly createdBy?: User; - readonly externalId?: string; - readonly id?: string; name: string; /** * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ slug?: string; - readonly tokens: Array | null; -}; - -export type SystemTokenIssuance = { - /** - * Credential class that performed the mint; "platform" is the system:kaiten identity - */ - credentialKind: string; /** - * Absent when the minted credential does not expire + * Start date of the license for this instance */ - expiresAt?: string; + startLicenseDate: string; /** - * When the credential was minted + * Operational status of the instance */ - issuedAt: string; + readonly status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; /** - * The credential that was minted + * Timestamp when the instance was last updated */ - issuedTokenId: string; + readonly updatedAt: string; /** - * Human-readable label the caller gave the minted credential + * User who last updated this instance */ - name: string; + readonly updatedBy: User; +}; + +export type InstanceAddon = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + readonly id: string; + maxQuantity?: number; /** - * Platform credential that performed the mint; revoking it revokes everything it issued + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - platformTokenId: string; + prices: Array; + quantity: number; + removedAt?: string; +}; + +export type InstanceAddonUpdate = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + readonly id: string; + instanceSlug: string; + maxQuantity?: number; /** - * Scopes granted to the minted credential + * The quantity before a quantity change */ - scopes: Array | null; + previousQuantity?: number; /** - * Server-assigned identifier of the minted credential + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - slug: string; + prices: Array; + quantity: number; + removedAt?: string; }; -export type TargetingContext = { +export type InstanceBilling = { /** - * Identifiers the server guarantees, and what is reachable below each. Not a closed set: a host may target on its own attributes too + * The instant its periods are counted from */ - roots: Array; -}; - -export type TargetingContextNode = { + anchorAt: string; /** - * What this value means, shown by the editor + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - description?: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Named children, for an object + * Effective: the subscription's own, else the organization's default */ - fields?: Array; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Keys this map currently has, for completion. Not a closed set + * The subscription's own collection method; absent when it takes the organization's */ - knownKeys?: Array; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Name as it is written in a rule + * The next boundary: the period closes, and its invoice is composed, after it */ - name: string; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Whether this value may be absent, in which case has() is worth using + * Effective: the subscription's own, else the organization's default */ - optional?: boolean; + daysUntilDue: number; /** - * Shape of this node's value + * The subscription's own payment terms; absent when it takes the organization's */ - type: "string" | "number" | "boolean" | "object" | "map" | "dyn"; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Shape shared by every entry, for a map + * As it was at the subscription's last write */ - values?: TargetingContextNode; -}; - -export type TargetingRuleDraft = { + instanceSlug: string; + pastDueSince?: string; /** - * The CEL targeting rule to check. May be blank, which is itself a mistake this reports + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - rule: string; -}; - -export type TargetingRuleIssue = { + providerKind: "NOOP" | "STRIPE"; /** - * 1-based column the problem starts on, or 0 when it has no position + * A plan change waiting for the next boundary */ - column: number; + scheduledChange?: ScheduledChange; /** - * 1-based column just past the problem, or 0 when only a point is known + * When billing started: usage before it is never billed */ - endColumn?: number; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * 1-based line the problem ends on, or 0 when only a point is known + * When the trial ends, or ended: usage before it is never billed */ - endLine?: number; + trialEndsAt?: string; + updatedAt: string; +}; + +export type InstanceBody = { /** - * 1-based line the problem starts on, or 0 when it has no position + * External identifier of the related customer in the same adapter */ - line: number; + customerExternalId?: string; /** - * What is wrong, in the same words the write path refuses it with + * Deployment zone ID */ - message: string; -}; - -export type TargetingRuleRehearsal = { + deploymentZoneId?: string; /** - * Why the engine could not answer, when it could not — e.g. the rule reads a host attribute this context does not carry. At a real evaluation the rule would simply not match + * Instance description */ - evaluationError?: string; + description?: string; /** - * The __kaiten namespace as enriched for this context — what a rule actually reads. Empty sub-roots mean the context resolved nothing for them + * License end date */ - facts: { - [key: string]: unknown; - }; + endLicenseDate?: string; /** - * Problems the lint found. The rule is only run when there are none + * Optional integration error message */ - issues: Array; + error?: string; /** - * Whether the rule matched this context. Meaningful only when valid and evaluationError is empty + * Adapter-specific integration metadata */ - matched: boolean; + integrationMetadata?: { + [key: string]: unknown; + }; /** - * Whether the rule lints clean + * License ID */ - valid: boolean; -}; - -export type TargetingRuleTrial = { + licenseId?: string; /** - * The evaluation context to rehearse against, as a client would send it. Anything under __kaiten is discarded, exactly as at a real evaluation + * Instance metadata */ - context?: { + metadata?: { [key: string]: unknown; }; /** - * The CEL targeting rule to rehearse + * Instance name */ - rule: string; + name?: string; /** - * The key the evaluation would be bucketed on. Resolves license and entitlement facts when it names a customer slug + * Instance slug */ - targetingKey?: string; -}; - -export type TargetingRuleVerdict = { + slug?: string; /** - * Every problem found, positioned where it is written. Empty when the rule is accepted + * License start date */ - issues: Array; + startLicenseDate?: string; /** - * Whether the write path would accept this rule + * Absolute http(s) link to the record in the third-party system */ - valid: boolean; + webUrl?: string; }; -/** - * Polymorphic list of targeting rules (Basic, RolloutDate, RolloutPercentage) - */ -export type Targetings = Array< - BasicTargeting | RolloutDateTargeting | RolloutPercentageTargeting -> | null; - -export type Token = { - readonly createdAt: string; - readonly createdBy: User; - expiresAt?: string; - readonly id?: string; - name: string; - readonly revokedAt?: string; - readonly revokedBy?: User; - scopes: Array | null; - readonly serviceAccountId?: string; +export type InstanceEntitlementCapExceeded = { /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * URL-friendly identifier of the entitlement */ - slug?: string; -}; - -export type UsageReport = { + entitlement_slug: string; /** - * The entitlement's aggregation method when the report was accepted + * Amount by which usage exceeds the cap */ - aggregationMethod: string; + overage: number; /** - * append adds the value through the aggregation method; set overwrites the counter + * The entitlement cap */ - behavior: "append" | "set"; + threshold: number; /** - * valueAfter minus valueBefore; negative for a set that lowered the counter + * Current usage value, including overage */ - delta: string; + value: number; +}; + +export type InstanceEntitlementUsagePeriodRolledOver = { + closed_period_end: string | null; + closed_period_start: string | null; + entitlement_id: string; + entitlement_slug: string; + event_count: number; + instance_id: string; + is_synthetic: boolean; + new_period_start: string; + value: number; +}; + +export type InstanceEntitlementUsageReportAccepted = { /** - * The entitlement the report was made for. It may since have been deleted. + * Report behavior: append folds the value into the stored total, set overwrites it */ - entitlementId: string; + behavior: "append" | "set"; /** - * Reports counted in the window after this one + * URL-friendly identifier of the entitlement the usage was reported against */ - eventCountAfter: number; + entitlement_slug: string; /** - * The instance the report was made for. It may since have been deleted. + * Number of reports folded into the current usage window, including this one */ - instanceId: string; + event_count: number; /** - * The instance's licence when the report was accepted + * Whether the report was persisted */ - licenseId: string; + status: "ACCEPTED" | "REJECTED"; /** - * The limit in force when the report was accepted. Null when unlimited. + * Value carried by the report */ - limitValue?: string; + value: number; +}; + +export type InstanceEntitlementUsageWarningThresholdReached = { /** - * How much the usage above limitValue moved: max(0, valueAfter - limitValue) - max(0, valueBefore - limitValue). 0 when unlimited. + * Usage value at which the warning fires (cap * warningThresholdPercent / 100) */ - overageDelta: string; + boundary: number; /** - * The overage allowed above limitValue, in percent, when the report was accepted. Null when unlimited. + * URL-friendly identifier of the entitlement */ - overagePercent?: number; + entitlement_slug: string; /** - * The report's metadata, when it was stored + * The entitlement cap */ - properties?: { - [key: string]: unknown; - }; + threshold: number; /** - * Position of the report among the pair's accepted reports, from 1, without gaps + * Current usage value */ - reportSeq: number; + value: number; +}; + +export type InstanceEntitlementValueGet = { /** - * When the server accepted the report (UTC, millisecond precision) + * Unique identifier for the entitlement */ - reportedAt: string; + entitlement_id: string; /** - * The value as sent: a delta for append, an absolute value for set + * URL-friendly identifier of the entitlement */ - reportedValue: string; + entitlement_slug: string; /** - * The report's idempotency key, when it was sent with one + * Unique identifier for the instance the value was read for */ - transactionId?: string; + instance_id: string; /** - * The counter after the report + * Unique identifier for the license carrying the entitlement */ - valueAfter: string; + license_id: string; /** - * The counter before the report, after any window reset + * Unique identifier for the owning organization */ - valueBefore: string; + organization_id: string; /** - * End of the usage window the report counted in (exclusive). Null for a lifetime entitlement. + * When the value was read */ - windowEnd?: string; + timestamp: string; /** - * Start of the usage window the report counted in (inclusive). Null for a lifetime entitlement. + * Discriminator of the resolved entitlement value */ - windowStart?: string; + type: string; + /** + * Resolved entitlement value at read time + */ + value: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type UsageReportPage = { +export type InstanceIntegration = { /** - * The reports, in reportSeq order + * External identifier in the third-party adapter */ - items: Array; + external_id: string; /** - * Pass as afterSeq to read the next page. Absent on the last page. + * Last synchronization error message, if any */ - nextAfterSeq?: number; -}; - -export type User = { + last_error?: string; /** - * ID of the user + * Adapter-specific integration metadata */ - id: string; + metadata?: { + [key: string]: unknown; + }; /** - * Name of the user + * Timestamp of the last synchronization with the adapter */ - name?: string; -}; - -export type Variant = { - description: string; - name: string; - value: unknown; + readonly synced_at: string; + /** + * Absolute http(s) link to the record in the third-party system + */ + web_url?: string; }; -export type ComponentWritable = { +export type InstanceIntegrationResource = { /** - * Description of the component + * External identifier of the related customer in the same adapter */ - description?: string; + customerExternalId?: string; /** - * Name of the component + * Deployment zone ID */ - name: string; + deploymentZoneId?: string; /** - * Reference to the previous version of this component + * Instance description */ - previousComponentId?: string; + description: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * License end date */ - slug?: string; + endLicenseDate: string; /** - * Version of the component + * Last synchronization error for this integration, if any */ - version: string; -}; - -export type ConnectorSettingsWritable = { + error?: string; /** - * Connector settings payload + * Adapter-specific instance integration metadata */ - settings: { + integrationMetadata: { [key: string]: unknown; }; -}; - -export type CustomerWritable = { /** - * Optional customer domain name + * License ID */ - domain?: string; + licenseId: string; /** - * Optional identifier for the customer in an external system + * Instance name */ - externalCustomerId?: string | null; + name: string; /** - * Integrations grouped by adapter name + * Instance slug */ - integrations?: { - [key: string]: CustomerIntegrationWritable; - }; + slug: string; /** - * Name of the customer + * License start date */ - name: string; + startLicenseDate: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Absolute http(s) link to the record in the third-party system */ - slug?: string; + webUrl?: string; }; -export type CustomerIntegrationWritable = { +export type InstanceLifecycleStageChanged = { + changed_by: string; + instance_id: string; + new_lifecycle_stage: string | null; + previous_lifecycle_stage: string | null; +}; + +export type InstanceStatusChanged = { + changed_by: string; + instance_id: string; + new_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; + previous_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; +}; + +export type Invoice = { /** - * External identifier in the third-party adapter + * The address the invoice is for, as it was when composed. Personal data: it appears in no event */ - external_id: string; + billingEmail?: string; /** - * Last synchronization error message, if any + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - last_error?: string; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Adapter-specific integration metadata + * As it was when the invoice was composed */ - metadata?: { - [key: string]: unknown; - }; + customerSlug: string; + daysUntilDue?: number; /** - * Absolute http(s) link to the record in the third-party system + * Sum of the discounts, in minor units */ - web_url?: string; -}; - -export type DeploymentZoneWritable = { + discountTotal: number; /** - * Description of the deployment zone + * issuedAt + daysUntilDue */ - description: string; + dueAt?: string; + handoff: Handoff; /** - * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema + * PENDING: waiting in the handoff queue for the organization's accounting system */ - metadata?: { - [key: string]: unknown; - }; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Name of the deployment zone + * When the invoice was held and released */ - name: string; + hold?: HoldRecord; /** - * Currently deployed release ID + * Every meter whose journal failed a check */ - releaseId?: string; + holdDetail?: HoldDetail; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - slug?: string; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. + * The invoice's identifier: the key an accounting system deduplicates on */ - type: string; -}; - -export type EntitlementWritable = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseId: string; + licenseSlug: string; + lines: Array; + paidAt?: string; /** - * Description of the entitlement + * The invoice in its payment provider; absent for NOOP */ - description: string | null; + provider?: ProviderRecord; /** - * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. + * Who collects it. NOOP: the organization itself, through the handoff queue */ - displayOrder?: number; + providerKind: "NOOP" | "STRIPE"; /** - * Groups associated with this entitlement, identified by slug + * The invoice recomposed from this VOID one */ - groupSlugs?: Array | null; + replacedByInvoiceId?: string; /** - * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. + * The VOID invoice this one was recomposed from */ - icon?: string; + replacesInvoiceId?: string; /** - * Name of the entitlement + * Earliest start of its lines' service periods */ - name: string; + serviceFrom: string; /** - * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. + * Latest end of its lines' service periods */ - resetAnchor?: "CALENDAR" | "LICENSE_START"; + serviceTo: string; /** - * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Number of base units one sale unit represents (1 sale unit = N base units). + * Sum of the lines, in minor units */ - saleUnitFactor?: number; + subtotal: number; /** - * Plural label of the unit this entitlement is sold in, when it differs from the base unit. + * subtotal − discountTotal, in minor units */ - saleUnitPlural?: string; + total: number; + uncollectibleAt?: string; + updatedAt: string; + voidReason?: string; + voidedAt?: string; +}; + +export type InvoiceHold = { + entitlementId: string; /** - * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). + * The check that failed */ - saleUnitSingular?: string; + invariant: string; +}; + +export type InvoiceLine = { /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * The add-on version an ADDON line bills */ - slug?: string; + addonId?: string; /** - * Type of the entitlement + * The add-on price an ADDON line bills */ - type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + addonPriceId?: string; /** - * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. + * round_half_up(quantity × unitAmountDecimal), in minor units; negative on a DISCOUNT line */ - unitPlural?: string; + amount: number; /** - * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. + * The price's billing model; absent on a DISCOUNT line */ - unitSingular?: string; + billingModel?: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. + * ADVANCE lines bill the period that starts at the boundary, ARREARS lines the one that ends there; absent on a DISCOUNT line */ - userFacing?: boolean; + billingTiming?: "ADVANCE" | "ARREARS"; /** - * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + * Set on a preview line whose sample exceeded what the licence accepts: reports above that are rejected, so the excess is not billed */ - warningThresholdPercent?: number; -}; - -export type EntitlementGroupWritable = { + capped?: boolean; /** - * Description of the entitlement group + * The arithmetic of the line */ - description: string | null; + description: string; /** - * Name of the entitlement group + * How a DISCOUNT line was computed */ - name: string; + discount?: InvoiceLineDiscount; /** - * URL-friendly identifier, unique per organization. Auto-generated if not provided. + * The metered entitlement, on USAGE and OVERAGE lines */ - slug?: string; -}; - -export type EntitlementGroupUsageWritable = { + entitlementId?: string; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement. + * Its slug, as it was when the line was composed */ - currentPeriodEnd?: string; + entitlementSlug?: string; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement. + * The line's identifier, stable for the invoice's life; absent on a preview */ - currentPeriodStart?: string; + id?: string; /** - * Entitlement ID + * The instance's attachment an ADDON line bills */ - entitlementId: string; + instanceAddonId?: string; /** - * Entitlement name + * The redemption a DISCOUNT line applies */ - entitlementName: string; + instanceVoucherId?: string; /** - * Entitlement slug + * The price's display label, else a derived one */ - entitlementSlug: string; + label: string; /** - * Entitlement type + * The licence price the line bills; absent on an ADDON line */ - entitlementType: string; + licensePriceId?: string; /** - * License limit value, discriminated by the 'type' field. Null when the license grants no value. + * How a USAGE or OVERAGE line's quantity was measured */ - licenseValue?: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + metering?: InvoiceLineMetering; /** - * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. + * The arithmetic of an OVERAGE line */ - usageValue?: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type EntitlementUsageWritable = { + overage?: InvoiceLineOverage; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). + * The line in the payment provider, once pushed */ - currentPeriodEnd?: string; + provider?: InvoiceLineProvider; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). + * In sale units, a decimal string: 1 on a BASE line, the quantity held on an ADDON line */ - currentPeriodStart?: string; + quantity: string; /** - * Unique identifier for the entitlement + * Position on the invoice, from 1 */ - entitlementId: string; + seq: number; /** - * URL-friendly identifier of the entitlement + * Start of the period the line bills (inclusive) */ - entitlementSlug: string; + serviceFrom: string; /** - * Unique identifier for the license to which this entitlement usage belongs + * End of the period the line bills (exclusive) */ - licenseId: string; + serviceTo: string; /** - * URL-friendly identifier of the license + * BASE: the subscription's FLAT_FEE price. ADDON: an add-on's FLAT_FEE price times the quantity held at the boundary. USAGE: a USAGE_BASED price's metered usage. OVERAGE: an OVERAGE price's usage above the licence's limit. DISCOUNT: a PRICE voucher's discount, negative. */ - licenseSlug: string; + type: "BASE" | "ADDON" | "USAGE" | "OVERAGE" | "DISCOUNT"; /** - * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + * The price's unit amount in minor units; absent on a DISCOUNT line */ - limit?: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + unitAmountDecimal?: string; /** - * Resolved entitlement value, discriminated by the 'type' field + * The voucher a DISCOUNT line applies */ - value: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type FeatureFlagWritable = { - default_variant: DefaultVariant; - description: string | null; - enabled: boolean; - event_name: string; - metadata: { - [key: string]: unknown; - }; - name: string; - slug?: string; - targetings: Targetings; - type: "boolean" | "string" | "number" | "object"; - variants: Array | null; + voucherId?: string; }; -export type InstanceWritable = { +export type InvoiceLineDiscount = { /** - * ID of the customer associated with this instance + * Which invoice of the redemption this is, from 1 */ - customerId: string; + application: number; /** - * ID of the deployment zone associated with this instance (optional) + * How many invoices the redemption discounts; absent for FOREVER */ - deploymentZoneId?: string; + applicationsMax?: number; + appliesTo: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; /** - * Brief description of the instance + * What its targets still amounted to before it, exact, in minor units */ - description: string; + base: string; + currency?: string; + discountType: "PERCENTAGE" | "FIXED_AMOUNT"; /** - * End date of the license for this instance + * The percentage, or the amount in minor units */ - endLicenseDate: string; + discountValue: string; /** - * Integrations grouped by adapter name + * The lines it discounts */ - integrations?: { - [key: string]: InstanceIntegrationWritable; - }; + targetSeqs: Array | null; +}; + +export type InvoiceLineLedger = { /** - * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. + * First report of the period, null when it has none */ - licenseId: string; + firstSeq: number | null; /** - * Metadata for the instance + * The instance whose reports these are: with the line's entitlement, the pair the journal is kept by. It outlives the instance */ - metadata?: { - [key: string]: unknown; - }; + instanceId?: string; /** - * Name of the instance + * Last report of the period, null when it has none */ - name: string; + lastSeq: number | null; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Reports in the period */ - slug?: string; + rows: number; /** - * Start date of the license for this instance + * Sum of the reports' movements, before any floor */ - startLicenseDate: string; + sumDelta: string; + /** + * Sum of their movements above the limit, before any floor + */ + sumOverage: string | null; }; -export type InstanceEntitlementValueGetWritable = { +export type InvoiceLineMetering = { /** - * Unique identifier for the entitlement + * The usage journal rows the line was measured from */ - entitlement_id: string; + ledger?: InvoiceLineLedger; /** - * URL-friendly identifier of the entitlement + * In measured units: the usage for a USAGE line, the overage for an OVERAGE line */ - entitlement_slug: string; + measuredQuantity: string; /** - * Unique identifier for the instance the value was read for + * Windows whose net movement was negative and counted as 0 */ - instance_id: string; + negativeSegmentsFloored: number; /** - * Unique identifier for the license carrying the entitlement + * Measured units in one sale unit */ - license_id: string; + saleUnitFactor: string; /** - * Unique identifier for the owning organization + * Reset windows the period spans */ - organization_id: string; + windows: number; +}; + +export type InvoiceLineOverage = { /** - * When the value was read + * The limits applied, in the order they first applied */ - timestamp: string; + limits: Array; /** - * Discriminator of the resolved entitlement value + * Usage above the applied limit */ - type: string; + overageMeasured: string; /** - * Resolved entitlement value at read time + * Usage in measured units */ - value: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + usageMeasured: string; }; -export type InstanceIntegrationWritable = { +export type InvoiceLineProvider = { /** - * External identifier in the third-party adapter + * The provider's amount, read back for reconciliation */ - external_id: string; + amount?: number; /** - * Last synchronization error message, if any + * The provider's id of the line */ - last_error?: string; + externalLineId: string; +}; + +export type InvoicePayment = { /** - * Adapter-specific integration metadata + * The invoice's number in the organization's accounting system, 1 to 255 characters. It also acknowledges an invoice still waiting in the handoff queue */ - metadata?: { - [key: string]: unknown; - }; + externalReference?: string; /** - * Absolute http(s) link to the record in the third-party system + * A note, such as the transfer's reference, kept only in the paid event */ - web_url?: string; + note?: string; + /** + * When it was paid, now or earlier; now when omitted + */ + paidAt?: string; }; -export type LicenseWritable = { +export type InvoicePreview = { /** - * Detailed description of the license capabilities and restrictions + * When the preview was composed */ - description: string; + asOf: string; /** - * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). + * The boundary the invoice bills */ - familyId?: string; + boundaryAt: string; /** - * Write-only on create: slug of the family this license is a new version of. familyId names the same family by identifier; sent together they must agree. Omit both to create a new family, of which this license becomes version 1. Never returned -- see familyId. Refused on update: a version cannot move between families. + * ISO 4217 code */ - familySlug?: string; + currency: string; /** - * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). + * Sum of the discounts, in minor units */ - isDefault: boolean; + discountTotal: number; /** - * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. + * The boundary previewed */ - lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; /** - * Display name of the license + * The licence version previewed */ - name: string; + licenseSlug: string; + lines: Array; /** - * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. + * Earliest start of the lines' service periods; absent without lines */ - slug?: string; + serviceFrom?: string; /** - * Type of the license determining its capabilities and restrictions + * Latest end of the lines' service periods; absent without lines */ - type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; + serviceTo?: string; /** - * Optional human-readable name for the license version. Defaults to "Version - ". + * Always PREVIEW */ - versionName?: string; -}; - -export type LicenseEntitlementWritable = { + status: "PREVIEW"; /** - * URL-friendly identifier for the entitlement + * Sum of the lines, in minor units */ - entitlementSlug?: string; + subtotal: number; /** - * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. + * subtotal − discountTotal, in minor units */ - limitCapExceededOveragePercent?: number; + total: number; /** - * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} + * Meters whose usage journal fails a consistency check, which would hold the invoice. Always empty for a sample. */ - value: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + wouldHold: Array; }; -export type LicenseFamilyViewWritable = { +export type InvoicePreviewScenario = { /** - * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. + * The FLAT_FEE price billed as the base (PreviewLicenseInvoice.PriceNotFound). Defaults to the version's default FLAT_FEE price (PreviewLicenseInvoice.NoBasePrice when it has none). */ - currentVersion?: LicenseWritable; + basePriceId?: string; /** - * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. + * Usage of the metered entitlements over the period that ends, one entry per entitlement. An entitlement left out used nothing. */ - slug: string; + sampleUsage?: Array | null; +}; + +export type InvoiceSummary = { /** - * Number of versions in this family, whatever their lifecycle state + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - versionCount: number; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. + * As it was when the invoice was composed */ - versions?: Array; -}; - -export type MetadataFieldWritable = { + customerSlug: string; + daysUntilDue?: number; /** - * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. + * Sum of the discounts, in minor units */ - displayOrder?: number; + discountTotal: number; /** - * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} + * issuedAt + daysUntilDue */ - jsonSchema: { - [key: string]: unknown; - }; + dueAt?: string; /** - * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. + * PENDING: waiting in the handoff queue for the organization's accounting system */ - key: string; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Human-readable label shown in the admin UI + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - label: string; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Resource type this field applies to. Immutable after creation; update must echo back the stored value. + * The invoice's identifier: the key an accounting system deduplicates on */ - resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; -}; - -export type NumberEntitlementValueWritable = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Value type discriminator + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - type: "number"; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Numeric value + * Who collects it. NOOP: the organization itself, through the handoff queue */ - value: number; -}; - -export type PageComponentWritable = { + providerKind: "NOOP" | "STRIPE"; /** - * Whether more rows exist beyond this page. + * Earliest start of its lines' service periods */ - hasMore: boolean; - items: Array; + serviceFrom: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Latest end of its lines' service periods */ - nextCursor?: string; -}; - -export type PageCustomerWritable = { + serviceTo: string; /** - * Whether more rows exist beyond this page. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - hasMore: boolean; - items: Array; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Sum of the lines, in minor units */ - nextCursor?: string; + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type PageDeploymentZoneWritable = { +export type InvoiceVoid = { /** - * Whether more rows exist beyond this page. + * 1 to 500 characters */ - hasMore: boolean; - items: Array; + reason: string; +}; + +export type InvoiceWriteOff = { /** - * Opaque cursor for the next page. Absent when hasMore is false. + * 1 to 500 characters */ - nextCursor?: string; + reason: string; }; -export type PageEntitlementWritable = { +export type IssuedInvoice = { /** - * Whether more rows exist beyond this page. + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - hasMore: boolean; - items: Array; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * As it was when the invoice was composed */ - nextCursor?: string; -}; - -export type PageEntitlementGroupWritable = { + customerSlug: string; + daysUntilDue?: number; /** - * Whether more rows exist beyond this page. + * Sum of the discounts, in minor units */ - hasMore: boolean; - items: Array; + discountTotal: number; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * issuedAt + daysUntilDue */ - nextCursor?: string; -}; - -export type PageFeatureFlagWritable = { + dueAt?: string; /** - * Whether more rows exist beyond this page. + * PENDING: waiting in the handoff queue for the organization's accounting system */ - hasMore: boolean; - items: Array; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - nextCursor?: string; -}; - -export type PageInstanceWritable = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Whether more rows exist beyond this page. + * The invoice's identifier: the key an accounting system deduplicates on */ - hasMore: boolean; - items: Array; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - nextCursor?: string; -}; - -export type PageLicenseWritable = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseId: string; + licenseSlug: string; + lines: Array; /** - * Whether more rows exist beyond this page. + * Set when the lines did not fit the event: read the invoice for all of them */ - hasMore: boolean; - items: Array; + linesTruncated?: boolean; + paidAt?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Who collects it. NOOP: the organization itself, through the handoff queue */ - nextCursor?: string; -}; - -export type PageLicenseEntitlementWritable = { + providerKind: "NOOP" | "STRIPE"; /** - * Whether more rows exist beyond this page. + * Earliest start of its lines' service periods */ - hasMore: boolean; - items: Array; + serviceFrom: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Latest end of its lines' service periods */ - nextCursor?: string; -}; - -export type PageLicenseFamilyViewWritable = { + serviceTo: string; /** - * Whether more rows exist beyond this page. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - hasMore: boolean; - items: Array; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Sum of the lines, in minor units */ - nextCursor?: string; + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type PageMetadataFieldWritable = { +export type License = { /** - * Whether more rows exist beyond this page. + * Timestamp when this license was created */ - hasMore: boolean; - items: Array; + readonly createdAt: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Detailed description of the license capabilities and restrictions */ - nextCursor?: string; -}; - -export type PageReleaseWritable = { + description: string; /** - * Whether more rows exist beyond this page. + * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). */ - hasMore: boolean; - items: Array; + familyId?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Unique identifier for the license */ - nextCursor?: string; -}; - -export type PageServiceAccountWritable = { + readonly id: string; /** - * Whether more rows exist beyond this page. + * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). */ - hasMore: boolean; - items: Array; + isDefault: boolean; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. */ - nextCursor?: string; -}; - -export type PageTokenWritable = { + lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Whether more rows exist beyond this page. + * Display name of the license */ - hasMore: boolean; - items: Array; + name: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * How this version is sold. FREE and PAID can be bought self-serve; CUSTOM sends a buyer to selfServeCtaUrl or a conversation. Always present in responses. On create it defaults to CUSTOM; on update, omit it to keep the stored value. */ - nextCursor?: string; -}; - -export type PlainTokenWritable = { - expiresAt?: string; - name: string; - scopes: Array | null; + pricingType?: "FREE" | "PAID" | "CUSTOM"; /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * Whether self-serve signup captures a payment method before activation. Always present in responses; false when omitted on create. On update, omit it to keep the stored value. + */ + requiresPaymentMethod?: boolean; + /** + * Where a buyer is sent when this version cannot be bought self-serve: an http(s) URL of at most 2048 characters (CreateLicense.InvalidSelfServeCtaUrl). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. + */ + selfServeCtaUrl?: string; + /** + * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. */ slug?: string; -}; - -export type ReleaseWritable = { /** - * List of component IDs to link to this release + * Trial length, in days, a subscription to this version starts with by default. Absent when there is none. Must be at least 1 on create (CreateLicense.InvalidTrialPeriodDays). On update, omit it to keep the stored value, or send 0 to remove the trial. */ - componentIds?: Array | null; + trialPeriodDays?: number; /** - * Description of the release + * Type of the license determining its capabilities and restrictions */ - description?: string; + type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Timestamp when this license was last updated */ - slug?: string; + readonly updatedAt: string; /** - * Version of the release + * Version of the license within its family, assigned by the server when the version is created and never changed afterwards: the version's derived slug ({familySlug}-v{version}, see slug) is built from it. A number is never reused within a family, even after its version is deleted. Create refuses any value (CreateLicense.VersionNotSettable); update accepts only the stored one, so a representation can be written back as it was read (UpdateLicense.VersionNotSettable). */ - version: string; + readonly version: string; + /** + * Optional human-readable name for the license version. Defaults to "Version - ". + */ + versionName?: string; }; -export type ReportEntitlementUsageBodyWritable = { +export type LicenseEntitlement = { /** - * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it + * Timestamp when this entitlement was created */ - behavior?: "append" | "set"; + readonly createdAt: string; /** - * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. + * User who created this entitlement */ - metadata?: { - [key: string]: unknown; - }; + readonly createdBy: User; /** - * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. + * Groups associated with this entitlement */ - transactionId?: string; + readonly entitlementGroups?: Array | null; /** - * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + * Name of the entitlement feature or service + */ + readonly entitlementName: string; + /** + * URL-friendly identifier for the entitlement + */ + entitlementSlug?: string; + /** + * Type of entitlement (BOOLEAN, NUMBER, or CONFIG) + */ + readonly entitlementType?: "BOOLEAN" | "NUMBER" | "CONFIG"; + /** + * Unique identifier for the license this entitlement belongs to + */ + readonly licenseId: string; + /** + * URL-friendly identifier for the license this entitlement belongs to + */ + readonly licenseSlug: string; + /** + * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. + */ + limitCapExceededOveragePercent?: number; + /** + * Timestamp when this entitlement was last updated + */ + readonly updatedAt: string; + /** + * User who last updated this entitlement + */ + readonly updatedBy: User; + /** + * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} */ value: | ({ type: "number"; - } & NumberEntitlementValueWritable) + } & NumberEntitlementValue) | ({ type: "boolean"; } & BooleanEntitlementValue) @@ -2986,5150 +3086,4809 @@ export type ReportEntitlementUsageBodyWritable = { } & ConfigEntitlementValue); }; -export type ServiceAccountWritable = { - name: string; +export type LicenseFamilyView = { /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Timestamp when this family was created */ - slug?: string; -}; - -export type TokenWritable = { - expiresAt?: string; - name: string; - scopes: Array | null; + readonly createdAt: string; /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. */ - slug?: string; -}; - -export type ListComponentsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/components"; -}; - -export type ListComponentsErrors = { + currentVersion?: License; /** - * Bad Request + * Unique identifier for the license family */ - 400: Problem; + readonly id: string; /** - * Unauthorized + * Whether the family's default PUBLISHED version is listed in the public catalogue. Private by default. */ - 401: Problem; + isPublic: boolean; /** - * Forbidden + * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. */ - 403: Problem; + slug: string; /** - * Unprocessable Entity + * Timestamp when a version was last added to this family, or when the family was created. Renames, lifecycle moves and default changes update the versions' own updatedAt, not this one. */ - 422: Problem; + readonly updatedAt: string; /** - * Internal Server Error + * Number of versions in this family, whatever their lifecycle state */ - 500: Problem; -}; - -export type ListComponentsError = ListComponentsErrors[keyof ListComponentsErrors]; - -export type ListComponentsResponses = { + versionCount: number; /** - * OK + * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. */ - 200: PageComponent; + versions?: Array; }; -export type ListComponentsResponse = ListComponentsResponses[keyof ListComponentsResponses]; - -export type CreateComponentData = { - body: ComponentWritable; - path?: never; - query?: never; - url: "/components"; +export type LicenseFamilyVisibility = { + /** + * List the family's default PUBLISHED version, with its ACTIVE prices, in the public catalogue + */ + isPublic: boolean; }; -export type CreateComponentErrors = { +export type LicensePriceChanges = { /** - * Bad Request + * See createLicensePrice. */ - 400: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Unauthorized + * See createLicensePrice. */ - 401: Problem; + billingTiming?: "ADVANCE" | "ARREARS"; + displayLabel?: string; + displayOrder?: number; + isDefault?: boolean; /** - * Forbidden + * See createLicensePrice. */ - 403: Problem; + meteredEntitlementSlug?: string; /** - * Not Found + * See createLicensePrice. */ - 404: Problem; + unitAmountDecimal?: string; +}; + +export type LineDifference = { + externalLineId: string; + kaitenAmount: number; + lineId: string; + providerAmount: number; + seq: number; +}; + +export type LineReportPage = { /** - * Conflict + * The reports, in reportSeq order */ - 409: Problem; + items: Array; /** - * Unprocessable Entity + * Pass as afterSeq to read the next page. Absent on the last page. */ - 422: Problem; + nextAfterSeq?: number; +}; + +export type List = { /** - * Internal Server Error + * The page, newest first */ - 500: Problem; + data: Array; /** - * Service Unavailable + * Opaque cursor for the next page; null on the last page */ - 503: Problem; -}; - -export type CreateComponentError = CreateComponentErrors[keyof CreateComponentErrors]; - -export type CreateComponentResponses = { + nextCursor: string | null; /** - * Created + * Unread notifications, capped (see MaxUnreadCount) */ - 201: Component; + unreadCount: number; }; -export type CreateComponentResponse = CreateComponentResponses[keyof CreateComponentResponses]; +export type ManifestEnvelope = { + flags: Array | null; +}; -export type DeleteComponentData = { - body?: never; - path: { - /** - * Component slug - */ - componentSlug: string; - }; - query?: never; - url: "/components/{componentSlug}"; +export type ManifestFlag = { + defaultValue: unknown; + description?: string; + key: string; + name?: string; + type: string; }; -export type DeleteComponentErrors = { +export type MarkReadResult = { /** - * Bad Request + * Unread notifications after the change */ - 400: Problem; + unreadCount: number; /** - * Unauthorized + * Notifications newly marked read */ - 401: Problem; + updated: number; +}; + +export type MetadataField = { /** - * Forbidden + * Timestamp when the field was archived (soft delete). Absent if active. */ - 403: Problem; + readonly archivedAt?: string; /** - * Not Found + * Timestamp when the field was created */ - 404: Problem; + readonly createdAt: string; /** - * Conflict + * User who created this field */ - 409: Problem; + readonly createdBy: User; /** - * Unprocessable Entity + * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. */ - 422: Problem; + displayOrder?: number; /** - * Internal Server Error + * Unique identifier */ - 500: Problem; -}; - -export type DeleteComponentError = DeleteComponentErrors[keyof DeleteComponentErrors]; - -export type DeleteComponentResponses = { + readonly id: string; /** - * No Content + * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} */ - 204: void; -}; - -export type DeleteComponentResponse = DeleteComponentResponses[keyof DeleteComponentResponses]; - -export type GetComponentData = { - body?: never; - path: { - /** - * Component slug - */ - componentSlug: string; + jsonSchema: { + [key: string]: unknown; }; - query?: never; - url: "/components/{componentSlug}"; -}; - -export type GetComponentErrors = { /** - * Unauthorized + * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. */ - 401: Problem; + key: string; /** - * Forbidden + * Human-readable label shown in the admin UI */ - 403: Problem; + label: string; /** - * Not Found + * Resource type this field applies to. Immutable after creation; update must echo back the stored value. */ - 404: Problem; + resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; /** - * Unprocessable Entity + * Timestamp when the field was last updated */ - 422: Problem; + readonly updatedAt: string; /** - * Internal Server Error + * User who last updated this field */ - 500: Problem; + readonly updatedBy: User; }; -export type GetComponentError = GetComponentErrors[keyof GetComponentErrors]; +export type MetadataFieldReordered = { + /** + * Metadata field ids in their new display order + */ + ids: Array | null; +}; -export type GetComponentResponses = { +export type MetadataFieldSchemaProposal = { /** - * OK + * Candidate JSON Schema 2020-12 document to evaluate existing values against. */ - 200: Component; + jsonSchema: { + [key: string]: unknown; + }; }; -export type GetComponentResponse = GetComponentResponses[keyof GetComponentResponses]; +export type Meter = { + /** + * The metered entitlement + */ + entitlementSlug: string; + /** + * Measured units in one sale unit, captured when the price was created (1 when the entitlement has no sale unit): 10000 bills per 10,000 tokens. + */ + saleUnitFactor: string; + saleUnitPlural?: string; + saleUnitSingular?: string; +}; -export type UpdateComponentData = { - body: ComponentWritable; - path: { - /** - * Component slug - */ - componentSlug: string; - }; - query?: never; - url: "/components/{componentSlug}"; +export type MinimumAmount = { + currency: string; + /** + * In minor units + */ + unitAmountDecimal: string; }; -export type UpdateComponentErrors = { +export type MismatchedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Conflict + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 409: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Unprocessable Entity + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 422: Problem; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Internal Server Error + * The invoice's identifier: the key an accounting system deduplicates on */ - 500: Problem; -}; - -export type UpdateComponentError = UpdateComponentErrors[keyof UpdateComponentErrors]; - -export type UpdateComponentResponses = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * OK + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 200: Component; -}; - -export type UpdateComponentResponse = UpdateComponentResponses[keyof UpdateComponentResponses]; - -export type ListConnectorsData = { - body?: never; - path?: never; - query?: never; - url: "/connectors"; -}; - -export type ListConnectorsErrors = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Unauthorized + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 401: Problem; + providerKind: "NOOP" | "STRIPE"; + reconciliationDetail: Reconciliation; /** - * Forbidden + * Earliest start of its lines' service periods */ - 403: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; -}; - -export type ListConnectorsError = ListConnectorsErrors[keyof ListConnectorsErrors]; - -export type ListConnectorsResponses = { + serviceTo: string; /** - * OK + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 200: Array | null; -}; - -export type ListConnectorsResponse = ListConnectorsResponses[keyof ListConnectorsResponses]; - -export type GetConnectorData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}"; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type GetConnectorErrors = { +export type NewAddon = { + description: string; /** - * Bad Request + * Make this a new version of this family */ - 400: Problem; + familyId?: string; /** - * Unauthorized + * Make this a new version of this family */ - 401: Problem; + familySlug?: string; /** - * Forbidden + * Make this version its family's default; the previous default loses it */ - 403: Problem; + isDefault?: boolean; + lifecycleState?: "DRAFT" | "PUBLISHED"; /** - * Not Found + * The largest quantity an instance can hold */ - 404: Problem; + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * Unprocessable Entity + * The version's slug. Default: {familySlug}-v{n} for a new version of a family, a slug generated from the name for a new family. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Default: Version - {n} */ - 500: Problem; + versionName?: string; }; -export type GetConnectorError = GetConnectorErrors[keyof GetConnectorErrors]; - -export type GetConnectorResponses = { +export type NewAddonGrant = { + entitlementSlug: string; /** - * OK + * The overage the add-on allows: -1 with an unlimited value, 0 or more otherwise. Absent inherits the licence grant's. */ - 200: Connector; -}; - -export type GetConnectorResponse = GetConnectorResponses[keyof GetConnectorResponses]; - -export type DeactivateConnectorData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; + limitCapExceededOveragePercent?: number; + /** + * How a number grant combines with the licence's + */ + overrideBehavior?: "ADD" | "OVERRIDE" | "MAX"; + /** + * {type, value}, shaped like a licence grant: a number counts once per unit of quantity + */ + value: { + [key: string]: unknown; }; - query?: never; - url: "/connectors/{connectorName}/activation"; }; -export type DeactivateConnectorErrors = { +export type NewAddonPrice = { + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Bad Request + * Required on a FLAT_FEE price: it bills subscriptions of that period. Refused on a metered one. */ - 400: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Unauthorized + * Defaults to ADVANCE for a FLAT_FEE price and ARREARS for a metered one, which must be ARREARS. */ - 401: Problem; + billingTiming?: "ADVANCE" | "ARREARS"; /** - * Forbidden + * ISO 4217 code, upper case. One currency per add-on version. */ - 403: Problem; + currency: string; + displayLabel?: string; + displayOrder?: number; /** - * Unprocessable Entity + * Makes this FLAT_FEE price the one that bills its period; the previous default of the period loses it. */ - 422: Problem; + isDefault?: boolean; /** - * Internal Server Error + * The entitlement a metered price measures: granted by the add-on version, with a reset period, SUM or COUNT, NUMBER or NUMBER_AI_CREDIT. */ - 500: Problem; -}; - -export type DeactivateConnectorError = DeactivateConnectorErrors[keyof DeactivateConnectorErrors]; - -export type DeactivateConnectorResponses = { + meteredEntitlementSlug?: string; /** - * No Content + * Amount in minor units: per unit and period for FLAT_FEE, per sale unit for metered prices. */ - 204: void; + unitAmountDecimal: string; }; -export type DeactivateConnectorResponse = - DeactivateConnectorResponses[keyof DeactivateConnectorResponses]; - -export type ActivateConnectorData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/activation"; +export type NewInstanceAddon = { + /** + * The add-on version to attach + */ + addonSlug: string; + quantity?: number; }; -export type ActivateConnectorErrors = { +export type NewLicensePrice = { /** - * Bad Request + * FLAT_FEE: an amount per billing period. USAGE_BASED: per sale unit of usage. OVERAGE: per sale unit of usage above the licence's limit. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * Required on a FLAT_FEE price, refused on a metered one (CreateLicensePrice.InvalidPeriod). */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Forbidden + * Defaults to ADVANCE for a FLAT_FEE price and ARREARS for a metered one, which must be ARREARS (CreateLicensePrice.InvalidTiming). */ - 403: Problem; + billingTiming?: "ADVANCE" | "ARREARS"; /** - * Not Found + * ISO 4217 code, upper case (CreateLicensePrice.InvalidCurrency). One currency per licence version (CreateLicensePrice.CurrencyMismatch). */ - 404: Problem; + currency: string; /** - * Unprocessable Entity + * The invoice line's label. */ - 422: Problem; + displayLabel?: string; /** - * Internal Server Error + * Order among the version's prices. */ - 500: Problem; + displayOrder?: number; /** - * Service Unavailable + * Makes this FLAT_FEE price the default of its billing period (CreateLicensePrice.DefaultConflict when another is). */ - 503: Problem; + isDefault?: boolean; + /** + * The entitlement a metered price measures: granted by the version, with a reset period, SUM or COUNT, NUMBER or NUMBER_AI_CREDIT, and metered by no other active price of the version. + */ + meteredEntitlementSlug?: string; + /** + * Amount in minor units: per period for FLAT_FEE, per sale unit for metered prices. A non-negative decimal of at most 12 integer digits and 12 decimal places (CreateLicensePrice.InvalidAmount). + */ + unitAmountDecimal: string; }; -export type ActivateConnectorError = ActivateConnectorErrors[keyof ActivateConnectorErrors]; - -export type ActivateConnectorResponses = { +export type NewPaymentMethodSession = { /** - * OK + * The currency the payment method is set up in; required when the customer has no live subscription, whose currency is used otherwise */ - 200: ConnectorActivation; + currency?: string; + /** + * Where the customer comes back to: https, or http on localhost. The session id is appended as kaiten_setup_session + */ + returnUrl: string; }; -export type ActivateConnectorResponse = - ActivateConnectorResponses[keyof ActivateConnectorResponses]; - -export type DeleteConnectorSettingsData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings"; +export type NewPortalSession = { + /** + * https, or http on localhost + */ + returnUrl: string; }; -export type DeleteConnectorSettingsErrors = { +export type NewSubscription = { /** - * Bad Request + * Add-ons to attach with the subscription, under the rules of POST /instances/{instanceSlug}/addons; the ACTIVATION invoice bills them. One refused refuses the subscribe: 422 SubscribeInstance.AddonInvalid, the add-on's own code in errors[0].value.code. */ - 400: Problem; + addOns?: Array | null; /** - * Unauthorized + * An ACTIVE FLAT_FEE price of the instance's licence version, which must be PUBLISHED. The subscription stays pinned to it, even once deprecated. */ - 401: Problem; + basePriceId: string; /** - * Forbidden + * Omitted: the organization's default, read at each invoice. CHARGE_AUTOMATICALLY needs a provider that charges automatically (SubscribeInstance.CollectionMethodUnsupported). */ - 403: Problem; + collectionMethod?: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * Payment terms in days, 0 to 365. Omitted: the organization's default, read at each invoice. */ - 422: Problem; + daysUntilDue?: number; /** - * Internal Server Error + * Who issues and collects the invoices. NOOP (the default): the organization itself, through the handoff queue. A provider must be connected (SubscribeInstance.ProviderNotConnected); one that pushes invoices needs the customer's billing e-mail for SEND_INVOICE (.BillingEmailMissing) and the price's currency (.UnsupportedCurrency), and registers the customer first. */ - 500: Problem; -}; - -export type DeleteConnectorSettingsError = - DeleteConnectorSettingsErrors[keyof DeleteConnectorSettingsErrors]; - -export type DeleteConnectorSettingsResponses = { + providerKind?: "NOOP" | "STRIPE"; /** - * No Content + * The anchor periods are counted from, truncated to the second: now when omitted, else at most one billing period ago. A period that has already ended closes on the next pass. */ - 204: void; -}; - -export type DeleteConnectorSettingsResponse = - DeleteConnectorSettingsResponses[keyof DeleteConnectorSettingsResponses]; - -export type GetConnectorSettingsData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings"; -}; - -export type GetConnectorSettingsErrors = { + startAt?: string; /** - * Bad Request + * Days of trial from the anchor: nothing is billed, and no usage counts, until it ends; the period close then issues the first invoice. 0 is no trial. Omitted: the licence's trialPeriodDays, else no trial. */ - 400: Problem; + trialDays?: number; /** - * Unauthorized + * A voucher to redeem with the subscription, once its add-ons are attached; a PRICE voucher applies from the ACTIVATION invoice. Refused: 422 SubscribeInstance.VoucherInvalid, the redemption's own code in errors[0].value.code. */ - 401: Problem; + voucherCode?: string; +}; + +export type Notification = { /** - * Forbidden + * Where clicking the notification goes */ - 403: Problem; + actionUrl?: string; /** - * Not Found + * Rendered detail line, when the event has one */ - 404: Problem; + body?: string; /** - * Unprocessable Entity + * When the event occurred */ - 422: Problem; + createdAt: string; /** - * Internal Server Error + * Event this notification reports */ - 500: Problem; -}; - -export type GetConnectorSettingsError = - GetConnectorSettingsErrors[keyof GetConnectorSettingsErrors]; - -export type GetConnectorSettingsResponses = { + eventName: string; /** - * OK + * CloudEvents type of the same event -- the key it is published under in this document's webhooks section, so a client can line a notification up with the payload schema and the description already published there */ - 200: ConnectorSettings; -}; - -export type GetConnectorSettingsResponse = - GetConnectorSettingsResponses[keyof GetConnectorSettingsResponses]; - -export type UpdateConnectorSettingsData = { + eventType: string; /** - * Connector settings payload to upsert + * Identifier of the underlying audit trail entry */ - body: ConnectorSettingsWritable; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings"; -}; - -export type UpdateConnectorSettingsErrors = { + id: string; /** - * Bad Request + * What the notification is about -- the kind of page actionUrl opens, and what the list's objectType filter matches */ - 400: Problem; + objectType: string; /** - * Unauthorized + * When this user read it; absent means unread */ - 401: Problem; + readAt?: string; /** - * Forbidden + * Rendered headline */ - 403: Problem; + title: string; +}; + +export type NumberEntitlementValue = { /** - * Not Found + * Number of events accumulated (server-computed) */ - 404: Problem; + readonly event_count?: number; /** - * Unprocessable Entity + * Value type discriminator */ - 422: Problem; + type: "number"; /** - * Internal Server Error + * Numeric value */ - 500: Problem; + value: number; }; -export type UpdateConnectorSettingsError = - UpdateConnectorSettingsErrors[keyof UpdateConnectorSettingsErrors]; - -export type UpdateConnectorSettingsResponses = { +export type Outcome = { /** - * OK + * Invoices read and applied */ - 200: ConnectorSettings; -}; - -export type UpdateConnectorSettingsResponse = - UpdateConnectorSettingsResponses[keyof UpdateConnectorSettingsResponses]; - -export type GetConnectorSettingsSchemaData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings/schema"; -}; - -export type GetConnectorSettingsSchemaErrors = { + applied: number; + error?: string; /** - * Bad Request + * Invoices that could not be read or applied */ - 400: Problem; + failed: number; + providerKind: "NOOP" | "STRIPE"; + status: "SUCCESS" | "PARTIAL" | "FAILED"; + syncedAt: string; +}; + +export type OverageLimit = { /** - * Unauthorized + * The limit, null when unlimited */ - 401: Problem; + limitValue: string | null; /** - * Forbidden + * Usage accepted above the limit, as a percent of it */ - 403: Problem; + overagePercent: number; /** - * Not Found + * Usage reports measured against it; 0 for a sample */ - 404: Problem; + rows: number; +}; + +export type PageAuditTrail = { /** - * Unprocessable Entity + * Whether more rows exist beyond this page. */ - 422: Problem; + hasMore: boolean; + items: Array; /** - * Internal Server Error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: Problem; + nextCursor?: string; }; -export type GetConnectorSettingsSchemaError = - GetConnectorSettingsSchemaErrors[keyof GetConnectorSettingsSchemaErrors]; - -export type GetConnectorSettingsSchemaResponses = { +export type PageComponent = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: ConnectorSettingsSchema; -}; - -export type GetConnectorSettingsSchemaResponse = - GetConnectorSettingsSchemaResponses[keyof GetConnectorSettingsSchemaResponses]; - -export type GetConnectorStateData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/state"; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type GetConnectorStateErrors = { +export type PageCustomer = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageDeploymentZone = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageEntitlement = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; /** - * Service Unavailable + * Opaque cursor for the next page. Absent when hasMore is false. */ - 503: Problem; + nextCursor?: string; }; -export type GetConnectorStateError = GetConnectorStateErrors[keyof GetConnectorStateErrors]; - -export type GetConnectorStateResponses = { +export type PageEntitlementGroup = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: ConnectorState; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type GetConnectorStateResponse = - GetConnectorStateResponses[keyof GetConnectorStateResponses]; - -export type ListCustomersData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/customers"; +export type PageFeatureFlag = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListCustomersErrors = { +export type PageInstance = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageInvoiceSummary = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageLicense = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListCustomersError = ListCustomersErrors[keyof ListCustomersErrors]; - -export type ListCustomersResponses = { +export type PageLicenseEntitlement = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: PageCustomer; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListCustomersResponse = ListCustomersResponses[keyof ListCustomersResponses]; - -export type CreateCustomerData = { - body: CustomerWritable; - path?: never; - query?: never; - url: "/customers"; +export type PageLicenseFamilyView = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateCustomerErrors = { +export type PageMetadataField = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageQueuedInvoice = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Not Found + * Opaque cursor for the next page. Absent when hasMore is false. */ - 404: Problem; + nextCursor?: string; +}; + +export type PageRelease = { /** - * Conflict + * Whether more rows exist beyond this page. */ - 409: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageServiceAccount = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; /** - * Service Unavailable + * Opaque cursor for the next page. Absent when hasMore is false. */ - 503: Problem; + nextCursor?: string; }; -export type CreateCustomerError = CreateCustomerErrors[keyof CreateCustomerErrors]; - -export type CreateCustomerResponses = { +export type PageSessionInvoice = { /** - * Created + * Whether more rows exist beyond this page. */ - 201: Customer; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateCustomerResponse = CreateCustomerResponses[keyof CreateCustomerResponses]; - -export type DeleteCustomerData = { - body?: never; - path: { - customerSlug: string; - }; - query?: never; - url: "/customers/{customerSlug}"; +export type PageToken = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type DeleteCustomerErrors = { +export type PaidInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; + externalReference?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type DeleteCustomerError = DeleteCustomerErrors[keyof DeleteCustomerErrors]; - -export type DeleteCustomerResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * No Content + * The invoice's identifier: the key an accounting system deduplicates on */ - 204: void; -}; - -export type DeleteCustomerResponse = DeleteCustomerResponses[keyof DeleteCustomerResponses]; - -export type GetCustomerData = { - body?: never; - path: { - customerSlug: string; - }; - query?: never; - url: "/customers/{customerSlug}"; -}; - -export type GetCustomerErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; /** - * Forbidden + * The note given when it was marked paid, kept only here */ - 403: Problem; + note?: string; + paidAt?: string; /** - * Not Found + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 404: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unprocessable Entity + * Earliest start of its lines' service periods */ - 422: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; + serviceTo: string; + /** + * MARK_PAID: recorded by the organization. ZERO_TOTAL: nothing was owed + */ + source: "MARK_PAID" | "PROVIDER" | "ZERO_TOTAL"; + /** + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose + */ + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors]; - -export type GetCustomerResponses = { +export type PatchInstanceBody = { /** - * OK + * Commercial lifecycle stage (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED). When omitted, the current stage is preserved; clearing it back to unset is not supported. */ - 200: Customer; + lifecycleStage?: string; + /** + * Operational status of the instance + */ + status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; }; -export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses]; - -export type UpdateCustomerData = { - body: CustomerWritable; - path: { - customerSlug: string; - }; - query?: never; - url: "/customers/{customerSlug}"; +export type Payment = { + hostedInvoiceUrl?: string; + /** + * paid. requires_action: the customer must confirm the payment on hostedInvoiceUrl. failed: the charge was refused; save another payment method, or pay on hostedInvoiceUrl. processing: the outcome is not known yet; poll GET /public/session/invoices. not_required: nothing is due today. + */ + status: "paid" | "requires_action" | "failed" | "processing" | "not_required"; }; -export type UpdateCustomerErrors = { +export type PaymentFailedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * The provider's decline or failure code, such as card_declined, expired_card, authentication_required or no_payment_method */ - 422: Problem; + failureCode: string; /** - * Internal Server Error + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 500: Problem; -}; - -export type UpdateCustomerError = UpdateCustomerErrors[keyof UpdateCustomerErrors]; - -export type UpdateCustomerResponses = { + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * No Content + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 204: void; -}; - -export type UpdateCustomerResponse = UpdateCustomerResponses[keyof UpdateCustomerResponses]; - -export type DeleteCustomerIntegrationData = { - body?: never; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; -}; - -export type DeleteCustomerIntegrationErrors = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Bad Request + * The invoice's identifier: the key an accounting system deduplicates on */ - 400: Problem; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Forbidden + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Not Found + * The customer must authenticate the payment on the invoice's hosted page */ - 404: Problem; + requiresAction: boolean; /** - * Unprocessable Entity + * Earliest start of its lines' service periods */ - 422: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; -}; - -export type DeleteCustomerIntegrationError = - DeleteCustomerIntegrationErrors[keyof DeleteCustomerIntegrationErrors]; - -export type DeleteCustomerIntegrationResponses = { + serviceTo: string; /** - * No Content + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 204: void; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type DeleteCustomerIntegrationResponse = - DeleteCustomerIntegrationResponses[keyof DeleteCustomerIntegrationResponses]; +export type PaymentMethodAttached = { + attachedAt: string; + customerSlug: string; + providerKind: "STRIPE"; + status: "ACTIVE"; +}; -export type GetCustomerIntegrationData = { - body?: never; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; +export type PaymentMethodDetached = { + customerSlug: string; + providerKind: "STRIPE"; }; -export type GetCustomerIntegrationErrors = { +export type PaymentMethodExpiring = { + customerSlug: string; /** - * Unauthorized + * The last instant of the payment method's expiry month */ - 401: Problem; + expiresAt: string; + providerKind: "STRIPE"; +}; + +export type PaymentMethodLabels = { + attachedAt?: string; + brand?: string; + expMonth?: number; + expYear?: number; + last4?: string; /** - * Forbidden + * ACTIVE: charged automatically. EXPIRED, FAILED: a charge said it is no longer usable; save another one */ - 403: Problem; + status: "ACTIVE" | "EXPIRED" | "FAILED"; +}; + +export type PaymentMethodSession = { + expiresAt: string; /** - * Not Found + * Complete it with POST …/payment-method-session/{sessionId}/complete once the customer is back */ - 404: Problem; + sessionId: string; /** - * Unprocessable Entity + * The provider's page; send the customer there */ - 422: Problem; + url: string; +}; + +export type PlainToken = { + readonly createdAt: string; + readonly createdBy: User; + expiresAt?: string; + readonly id?: string; + name: string; + readonly revokedAt?: string; + readonly revokedBy?: User; + scopes: Array | null; + readonly serviceAccountId?: string; /** - * Internal Server Error + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. */ - 500: Problem; + slug?: string; + readonly token?: string; }; -export type GetCustomerIntegrationError = - GetCustomerIntegrationErrors[keyof GetCustomerIntegrationErrors]; - -export type GetCustomerIntegrationResponses = { +export type PlanChange = { + fromLicenseSlug: string; + fromPriceId: string; + instanceSlug: string; /** - * OK + * The RENEWAL that billed the old plan's arrears and the new plan's advance */ - 200: CustomerIntegration; + invoiceId: string; + toLicenseSlug: string; + toPriceId: string; }; -export type GetCustomerIntegrationResponse = - GetCustomerIntegrationResponses[keyof GetCustomerIntegrationResponses]; +export type PlanChangeSchedule = { + effectiveAt: string; + fromPriceId: string; + instanceSlug: string; + toPriceId: string; +}; -export type CreateCustomerIntegrationData = { +export type PlanChangeTarget = { /** - * Integration payload + * An ACTIVE FLAT_FEE price of a PUBLISHED licence version, in the subscription's currency */ - body: CustomerIntegrationWritable; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; + licensePriceId: string; }; -export type CreateCustomerIntegrationErrors = { +export type PortalSession = { + url: string; +}; + +export type PreferenceChoices = { /** - * Bad Request + * Events to set; events left out keep their current value */ - 400: Problem; + events: Array | null; +}; + +export type PreferenceEvent = { /** - * Unauthorized + * Effective value per channel */ - 401: Problem; + channels: { + [key: string]: boolean; + }; + eventName: string; /** - * Forbidden + * CloudEvents type of the same event; see Notification.eventType */ - 403: Problem; + eventType: string; /** - * Not Found + * Catalogue group the client renders this under */ - 404: Problem; + group: string; /** - * Conflict + * Human-readable event name */ - 409: Problem; + label: string; +}; + +export type PreferenceMatrix = { /** - * Unprocessable Entity + * Channels this deployment serves, in display order */ - 422: Problem; + channels: Array; /** - * Internal Server Error + * Every notifiable event */ - 500: Problem; + events: Array; }; -export type CreateCustomerIntegrationError = - CreateCustomerIntegrationErrors[keyof CreateCustomerIntegrationErrors]; +export type PreferenceUpdate = { + channels: { + [key: string]: boolean; + }; + eventName: string; +}; -export type CreateCustomerIntegrationResponses = { +export type Price = { /** - * Created + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 201: CustomerIntegration; -}; - -export type CreateCustomerIntegrationResponse = - CreateCustomerIntegrationResponses[keyof CreateCustomerIntegrationResponses]; - -export type UpdateCustomerIntegrationData = { + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Integration payload + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - body: CustomerIntegrationWritable; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; -}; - -export type UpdateCustomerIntegrationErrors = { + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Bad Request + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 400: Problem; + billingTiming: "ADVANCE" | "ARREARS"; + readonly createdAt: string; /** - * Unauthorized + * ISO 4217 code, upper case. One currency per licence version. */ - 401: Problem; + currency: string; /** - * Forbidden + * When the price was deprecated */ - 403: Problem; + deprecatedAt?: string; /** - * Not Found + * The invoice line's label; a default is derived when absent. */ - 404: Problem; + displayLabel?: string; /** - * Conflict + * Order among the version's prices */ - 409: Problem; + displayOrder: number; /** - * Unprocessable Entity + * Unique identifier of the price */ - 422: Problem; + readonly id: string; /** - * Internal Server Error + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 500: Problem; -}; - -export type UpdateCustomerIntegrationError = - UpdateCustomerIntegrationErrors[keyof UpdateCustomerIntegrationErrors]; - -export type UpdateCustomerIntegrationResponses = { + isDefault: boolean; /** - * OK + * What a metered price measures. Absent on FLAT_FEE prices. */ - 200: CustomerIntegration; -}; - -export type UpdateCustomerIntegrationResponse = - UpdateCustomerIntegrationResponses[keyof UpdateCustomerIntegrationResponses]; - -export type ListDeploymentZonesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/deployment-zones"; -}; - -export type ListDeploymentZonesErrors = { + metered?: Meter; /** - * Bad Request + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 400: Problem; + status: "ACTIVE" | "DEPRECATED"; /** - * Unauthorized + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 401: Problem; + unitAmount?: number; /** - * Forbidden + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - 403: Problem; + unitAmountDecimal: string; + readonly updatedAt: string; +}; + +export type Problem = { /** - * Unprocessable Entity + * Stable, machine-readable error code. */ - 422: Problem; + code?: string; /** - * Internal Server Error + * A human-readable explanation specific to this occurrence of the problem. */ - 500: Problem; -}; - -export type ListDeploymentZonesError = ListDeploymentZonesErrors[keyof ListDeploymentZonesErrors]; - -export type ListDeploymentZonesResponses = { + detail?: string; /** - * OK + * Correlation id for the server-side log entry describing the withheld cause. */ - 200: PageDeploymentZone; + errorId?: string; + /** + * Optional list of individual error details + */ + errors?: Array | null; + /** + * A URI reference that identifies the specific occurrence of the problem. + */ + instance?: string; + /** + * HTTP status code + */ + status?: number; + /** + * A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + */ + title?: string; + /** + * A URI reference to human-readable documentation for the error. + */ + type?: string; }; -export type ListDeploymentZonesResponse = - ListDeploymentZonesResponses[keyof ListDeploymentZonesResponses]; +export type ProviderCapabilities = { + automaticCollection: boolean; + billingPortal: boolean; + paymentMethodCapture: boolean; +}; -export type CreateDeploymentZoneData = { - body: DeploymentZoneWritable; - path?: never; - query?: never; - url: "/deployment-zones"; +export type ProviderChange = { + /** + * Invoices already composed keep their provider + */ + effectiveFrom: "next_composition"; + from: "NOOP" | "STRIPE"; + instanceSlug: string; + to: "NOOP" | "STRIPE"; }; -export type CreateDeploymentZoneErrors = { +export type ProviderRecord = { + externalCustomerId?: string; + externalInvoiceId?: string; + hostedInvoiceUrl?: string; /** - * Bad Request + * The provider's invoice number */ - 400: Problem; + invoiceNumber?: string; + invoicePdfUrl?: string; /** - * Unauthorized + * Why the last automatic charge failed, as the provider coded it: authentication_required (the customer must confirm the payment on the hosted invoice page), card_declined, expired_card, no_payment_method... */ - 401: Problem; + lastPaymentError?: string; /** - * Forbidden + * The provider's code and message of the last failed push step */ - 403: Problem; + lastPushError?: string; /** - * Conflict + * When the push queue tries it next; absent when it waits for a human (finalization in the provider) or is pushed */ - 409: Problem; + nextPushAt?: string; + pushAttempts: number; + pushedAt?: string; + reconciledAt?: string; /** - * Unprocessable Entity + * What differs, on a MISMATCH */ - 422: Problem; + reconciliationDetail?: Reconciliation; + reconciliationStatus?: "MATCHED" | "MISMATCH"; /** - * Internal Server Error + * The provider's status, mirrored verbatim */ - 500: Problem; + status?: "draft" | "open" | "paid" | "uncollectible" | "void"; + syncedAt?: string; /** - * Service Unavailable + * The provider's total excluding tax, read back */ - 503: Problem; + totalExcludingTax?: number; }; -export type CreateDeploymentZoneError = - CreateDeploymentZoneErrors[keyof CreateDeploymentZoneErrors]; - -export type CreateDeploymentZoneResponses = { +export type ProviderSync = { + consecutiveFailures: number; /** - * Created + * Seconds since the last pass */ - 201: DeploymentZone; -}; - -export type CreateDeploymentZoneResponse = - CreateDeploymentZoneResponses[keyof CreateDeploymentZoneResponses]; - -export type DeleteDeploymentZoneData = { - body?: never; - path: { - deploymentZoneSlug: string; - }; - query?: never; - url: "/deployment-zones/{deploymentZoneSlug}"; + lagSeconds?: number; + lastFullSweepAt?: string; + lastSyncError?: string; + lastSyncStatus?: "SUCCESS" | "PARTIAL" | "FAILED"; + lastSyncedAt?: string; + providerKind: "NOOP" | "STRIPE"; }; -export type DeleteDeploymentZoneErrors = { +export type PublicAddOn = { + addonId: string; + addonSlug: string; /** - * Bad Request + * Public licence families this add-on fits */ - 400: Problem; + compatibleLicenseFamilies: Array; + description: string; /** - * Unauthorized + * User-facing entitlements one unit grants */ - 401: Problem; + entitlements: Array; + familySlug: string; /** - * Forbidden + * Most units one instance may attach; null when unbounded */ - 403: Problem; + maxQuantity: number | null; + name: string; + prices: Array; + pricingType: "FREE" | "PAID" | "CUSTOM"; +}; + +export type PublicAddOnEntitlement = { + limitCapExceededOveragePercent?: number; + name: string; /** - * Not Found + * How the grant combines with the plan's: added to it, replacing it, or the larger of the two */ - 404: Problem; + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; + slug: string; + type: "BOOLEAN" | "NUMBER" | "CONFIG"; + value: unknown; +}; + +export type PublicCatalog = { /** - * Unprocessable Entity + * The default version of each public add-on family; empty when include omits addons */ - 422: Problem; + addOns: Array; + capabilities: PublicCatalogCapabilities; /** - * Internal Server Error + * The default version of each public licence family, by family slug */ - 500: Problem; + plans: Array; }; -export type DeleteDeploymentZoneError = - DeleteDeploymentZoneErrors[keyof DeleteDeploymentZoneErrors]; - -export type DeleteDeploymentZoneResponses = { +export type PublicCatalogCapabilities = { /** - * No Content + * Whether self-serve checkout is available through the public surface. False in this release: checkout ships with customer sessions. */ - 204: void; + checkout: boolean; + /** + * Whether the organization's billing provider captures payment methods + */ + paymentMethods: boolean; }; -export type DeleteDeploymentZoneResponse = - DeleteDeploymentZoneResponses[keyof DeleteDeploymentZoneResponses]; - -export type GetDeploymentZoneBySlugData = { - body?: never; - path: { - deploymentZoneSlug: string; - }; - query?: never; - url: "/deployment-zones/{deploymentZoneSlug}"; +export type PublicMeter = { + entitlementSlug: string; + /** + * Measured units in one sale unit + */ + saleUnitFactor: string; + saleUnitPlural?: string; + saleUnitSingular?: string; }; -export type GetDeploymentZoneBySlugErrors = { +export type PublicPlan = { /** - * Unauthorized + * Public add-on families whose listed version fits this plan */ - 401: Problem; + compatibleAddonFamilies: Array; /** - * Forbidden + * ISO 4217 code of the plan's prices; null when it has none */ - 403: Problem; + currency: string | null; + description: string; /** - * Not Found + * User-facing entitlements the plan grants, in display order */ - 404: Problem; + entitlements: Array; + familySlug: string; + licenseId: string; /** - * Unprocessable Entity + * The version's own slug */ - 422: Problem; + licenseSlug: string; /** - * Internal Server Error + * Always PUBLISHED: only the default version is listed, and a default version is published */ - 500: Problem; -}; - -export type GetDeploymentZoneBySlugError = - GetDeploymentZoneBySlugErrors[keyof GetDeploymentZoneBySlugErrors]; - -export type GetDeploymentZoneBySlugResponses = { + lifecycleState: "PUBLISHED"; + name: string; /** - * OK + * ACTIVE prices, in display order */ - 200: DeploymentZone; + prices: Array; + /** + * CUSTOM: priced on request; render selfServeCtaUrl + */ + pricingType: "FREE" | "PAID" | "CUSTOM"; + /** + * A card is captured before subscribing, even when nothing is due + */ + requiresPaymentMethod: boolean; + /** + * Whether a customer can subscribe to this plan alone: not CUSTOM, with a default ACTIVE flat-fee price, and either FREE or sold through a provider that captures payment methods. Otherwise render selfServeCtaUrl. + */ + selfServe: boolean; + /** + * Where to send a customer who cannot subscribe alone ("Contact us") + */ + selfServeCtaUrl: string | null; + /** + * Length of the free trial; null when the plan has none + */ + trialPeriodDays: number | null; }; -export type GetDeploymentZoneBySlugResponse = - GetDeploymentZoneBySlugResponses[keyof GetDeploymentZoneBySlugResponses]; - -export type UpdateDeploymentZoneData = { - body: DeploymentZoneWritable; - path: { - deploymentZoneSlug: string; - }; - query?: never; - url: "/deployment-zones/{deploymentZoneSlug}"; +export type PublicPlanEntitlement = { + description?: string; + displayOrder: number; + icon?: string; + /** + * How far usage may exceed a NUMBER grant before it is refused: 0 is a hard limit, -1 is unlimited; absent for other types + */ + limitCapExceededOveragePercent?: number; + name: string; + saleUnitFactor?: string; + saleUnitPlural?: string; + saleUnitSingular?: string; + slug: string; + type: "BOOLEAN" | "NUMBER" | "CONFIG"; + unitPlural?: string; + unitSingular?: string; + /** + * A NUMBER grant with no limit + */ + unlimited: boolean; + /** + * The granted value: a boolean, a number, or a configuration object + */ + value: unknown; }; -export type UpdateDeploymentZoneErrors = { +export type PublicPrice = { /** - * Bad Request + * FLAT_FEE: per billing period. USAGE_BASED: per sale unit of usage. OVERAGE: per sale unit of usage above the limit. Never sum metered prices into a headline. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * The period a FLAT_FEE price is charged for; absent on metered prices */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + billingTiming: "ADVANCE" | "ARREARS"; + currency: string; + displayLabel?: string; + displayOrder: number; + id: string; /** - * Forbidden + * The FLAT_FEE price shown for its billing period */ - 403: Problem; + isDefault: boolean; /** - * Not Found + * What a metered price measures; absent on FLAT_FEE prices */ - 404: Problem; + metered?: PublicMeter; /** - * Unprocessable Entity + * The amount in minor units, when it is a whole number of them; absent otherwise (render unitAmountDecimal) */ - 422: Problem; + unitAmount?: number; /** - * Internal Server Error + * The amount in minor units, up to 12 decimal places */ - 500: Problem; + unitAmountDecimal: string; }; -export type UpdateDeploymentZoneError = - UpdateDeploymentZoneErrors[keyof UpdateDeploymentZoneErrors]; +export type PublicSurface = { + enabled: boolean; +}; -export type UpdateDeploymentZoneResponses = { +export type PublishableKey = { /** - * No Content + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. */ - 204: void; -}; - -export type UpdateDeploymentZoneResponse = - UpdateDeploymentZoneResponses[keyof UpdateDeploymentZoneResponses]; - -export type ListEntitlementGroupsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/entitlement-groups"; -}; - -export type ListEntitlementGroupsErrors = { + allowedOrigins: Array; + readonly createdAt: string; /** - * Bad Request + * Unique identifier of the key */ - 400: Problem; + readonly id: string; /** - * Unauthorized + * The last four characters of the key */ - 401: Problem; + readonly keyHint: string; /** - * Forbidden + * What the key is for, to tell keys apart */ - 403: Problem; + label: string; /** - * Unprocessable Entity + * When the key last authenticated a request, to the minute */ - 422: Problem; + readonly lastUsedAt?: string; /** - * Internal Server Error + * When the key was revoked; absent while it is live */ - 500: Problem; + readonly revokedAt?: string; + readonly updatedAt: string; }; -export type ListEntitlementGroupsError = - ListEntitlementGroupsErrors[keyof ListEntitlementGroupsErrors]; - -export type ListEntitlementGroupsResponses = { +export type PublishableKeyCreated = { /** - * OK + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. */ - 200: PageEntitlementGroup; -}; - -export type ListEntitlementGroupsResponse = - ListEntitlementGroupsResponses[keyof ListEntitlementGroupsResponses]; - -export type CreateEntitlementGroupData = { - body: EntitlementGroupWritable; - path?: never; - query?: never; - url: "/entitlement-groups"; -}; - -export type CreateEntitlementGroupErrors = { - /** - * Bad Request - */ - 400: Problem; + allowedOrigins: Array; + readonly createdAt: string; /** - * Unauthorized + * Unique identifier of the key */ - 401: Problem; + readonly id: string; /** - * Forbidden + * The key itself. Shown once: only its digest is stored. */ - 403: Problem; + readonly key: string; /** - * Conflict + * The last four characters of the key */ - 409: Problem; + readonly keyHint: string; /** - * Unprocessable Entity + * What the key is for, to tell keys apart */ - 422: Problem; + label: string; /** - * Internal Server Error + * When the key last authenticated a request, to the minute */ - 500: Problem; + readonly lastUsedAt?: string; /** - * Service Unavailable + * When the key was revoked; absent while it is live */ - 503: Problem; + readonly revokedAt?: string; + readonly updatedAt: string; }; -export type CreateEntitlementGroupError = - CreateEntitlementGroupErrors[keyof CreateEntitlementGroupErrors]; - -export type CreateEntitlementGroupResponses = { +export type PublishableKeyDraft = { /** - * Created + * Browser origins allowed to send the key, as scheme://host[:port]: https, or http for localhost. Empty: no browser origin may. */ - 201: EntitlementGroup; + allowedOrigins: Array; + /** + * What the key is for + */ + label: string; }; -export type CreateEntitlementGroupResponse = - CreateEntitlementGroupResponses[keyof CreateEntitlementGroupResponses]; - -export type DeleteEntitlementGroupData = { - body?: never; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}"; +export type PublishableKeyPatch = { + /** + * Replaces the allowed browser origins. Takes effect on the next request. + */ + allowedOrigins?: Array; + /** + * What the key is for + */ + label?: string; }; -export type DeleteEntitlementGroupErrors = { +export type PushFailedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type DeleteEntitlementGroupError = - DeleteEntitlementGroupErrors[keyof DeleteEntitlementGroupErrors]; - -export type DeleteEntitlementGroupResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * No Content + * The invoice's identifier: the key an accounting system deduplicates on */ - 204: void; -}; - -export type DeleteEntitlementGroupResponse = - DeleteEntitlementGroupResponses[keyof DeleteEntitlementGroupResponses]; - -export type GetEntitlementGroupData = { - body?: never; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}"; -}; - -export type GetEntitlementGroupErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; /** - * Forbidden + * The provider's code and message, never a request body */ - 403: Problem; + lastPushError: string; + licenseSlug: string; + paidAt?: string; /** - * Not Found + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 404: Problem; + providerKind: "NOOP" | "STRIPE"; + pushAttempts: number; /** - * Unprocessable Entity + * Earliest start of its lines' service periods */ - 422: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; -}; - -export type GetEntitlementGroupError = GetEntitlementGroupErrors[keyof GetEntitlementGroupErrors]; - -export type GetEntitlementGroupResponses = { + serviceTo: string; /** - * OK + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 200: EntitlementGroup; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type GetEntitlementGroupResponse = - GetEntitlementGroupResponses[keyof GetEntitlementGroupResponses]; - -export type UpdateEntitlementGroupData = { - body: EntitlementGroupWritable; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}"; +export type PushFailures = { + count: number; + oldestFailedAt?: string; }; -export type UpdateEntitlementGroupErrors = { +export type PushedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; + externalInvoiceId: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type UpdateEntitlementGroupError = - UpdateEntitlementGroupErrors[keyof UpdateEntitlementGroupErrors]; - -export type UpdateEntitlementGroupResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * No Content + * The invoice's identifier: the key an accounting system deduplicates on */ - 204: void; -}; - -export type UpdateEntitlementGroupResponse = - UpdateEntitlementGroupResponses[keyof UpdateEntitlementGroupResponses]; - -export type AddEntitlementToGroupData = { - body: Command; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}/entitlements"; -}; - -export type AddEntitlementToGroupErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Bad Request + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 400: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; + providerInvoiceNumber?: string; /** - * Unauthorized + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 401: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Forbidden + * Earliest start of its lines' service periods */ - 403: Problem; + serviceFrom: string; /** - * Not Found + * Latest end of its lines' service periods */ - 404: Problem; + serviceTo: string; /** - * Conflict + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 409: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Unprocessable Entity + * Sum of the lines, in minor units */ - 422: Problem; + subtotal: number; /** - * Internal Server Error + * subtotal − discountTotal, in minor units */ - 500: Problem; + total: number; + updatedAt: string; }; -export type AddEntitlementToGroupError = - AddEntitlementToGroupErrors[keyof AddEntitlementToGroupErrors]; - -export type AddEntitlementToGroupResponses = { +export type QueuedInvoice = { /** - * Created + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 201: unknown; -}; - -export type RemoveEntitlementFromGroupData = { - body?: never; - path: { - entitlementGroupSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}"; -}; - -export type RemoveEntitlementFromGroupErrors = { + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Bad Request + * As it was when the invoice was composed */ - 400: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Unauthorized + * Sum of the discounts, in minor units */ - 401: Problem; + discountTotal: number; /** - * Forbidden + * issuedAt + daysUntilDue */ - 403: Problem; + dueAt?: string; + handoff: Handoff; /** - * Not Found + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 404: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Unprocessable Entity + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 422: Problem; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Internal Server Error + * The invoice's identifier: the key an accounting system deduplicates on */ - 500: Problem; -}; - -export type RemoveEntitlementFromGroupError = - RemoveEntitlementFromGroupErrors[keyof RemoveEntitlementFromGroupErrors]; - -export type RemoveEntitlementFromGroupResponses = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * No Content + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 204: void; -}; - -export type RemoveEntitlementFromGroupResponse = - RemoveEntitlementFromGroupResponses[keyof RemoveEntitlementFromGroupResponses]; - -export type GetEntitlementGroupUsageData = { - body?: never; - path: { - entitlementGroupSlug: string; - }; - query: { - /** - * Instance slug to get usage for - */ - instance: string; - }; - url: "/entitlement-groups/{entitlementGroupSlug}/usage"; -}; - -export type GetEntitlementGroupUsageErrors = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Bad Request + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 400: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unauthorized + * Earliest start of its lines' service periods */ - 401: Problem; + serviceFrom: string; /** - * Forbidden + * Latest end of its lines' service periods */ - 403: Problem; + serviceTo: string; /** - * Not Found + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 404: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Unprocessable Entity + * Sum of the lines, in minor units */ - 422: Problem; - /** - * Internal Server Error - */ - 500: Problem; -}; - -export type GetEntitlementGroupUsageError = - GetEntitlementGroupUsageErrors[keyof GetEntitlementGroupUsageErrors]; - -export type GetEntitlementGroupUsageResponses = { + subtotal: number; /** - * OK + * subtotal − discountTotal, in minor units */ - 200: Array | null; -}; - -export type GetEntitlementGroupUsageResponse = - GetEntitlementGroupUsageResponses[keyof GetEntitlementGroupUsageResponses]; - -export type ListEntitlementsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/entitlements"; + total: number; + updatedAt: string; }; -export type ListEntitlementsErrors = { - /** - * Bad Request - */ - 400: Problem; +export type ReadSelection = { /** - * Unauthorized + * Mark every notification read, up to now */ - 401: Problem; + all?: boolean; /** - * Forbidden + * Notifications to mark read */ - 403: Problem; + ids?: Array | null; +}; + +export type Reconciliation = { /** - * Unprocessable Entity + * Provider lines Kaiten does not have */ - 422: Problem; + extraInProvider: Array; /** - * Internal Server Error + * Whether the provider's subtotal was compared, its tax being included in the amounts */ - 500: Problem; -}; - -export type ListEntitlementsError = ListEntitlementsErrors[keyof ListEntitlementsErrors]; - -export type ListEntitlementsResponses = { + inclusiveTax: boolean; + lines: Array; /** - * OK + * Kaiten lines the provider does not have */ - 200: PageEntitlement; + missingInProvider: Array; + totals: TotalsDifference; }; -export type ListEntitlementsResponse = ListEntitlementsResponses[keyof ListEntitlementsResponses]; - -export type CreateEntitlementData = { - body: EntitlementWritable; - path?: never; - query?: never; - url: "/entitlements"; +export type RedeemableCode = { + code: string; }; -export type CreateEntitlementErrors = { - /** - * Bad Request - */ - 400: Problem; - /** - * Unauthorized - */ - 401: Problem; +export type Redemption = { /** - * Forbidden + * Invoices a PRICE voucher discounted */ - 403: Problem; + applicationsCount: number; /** - * Not Found + * 1 for ONE_TIME, durationInPeriods for REPEATING; absent for FOREVER */ - 404: Problem; + applicationsMax?: number; + codeHint: string; /** - * Conflict + * When a boost stops applying; absent for a PRICE voucher, counted in invoices, and for FOREVER */ - 409: Problem; + effectiveExpiresAt?: string; + effectiveStartsAt: string; + expiredAt?: string; + readonly id: string; + instanceSlug: string; + redeemedAt: string; + revokedAt?: string; + revokedReason?: string; + status: "ACTIVE" | "EXPIRED" | "REVOKED"; + voucherId: string; + voucherName: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; +}; + +export type RedemptionRules = { /** - * Unprocessable Entity + * Only for an instance with a live ANNUAL subscription */ - 422: Problem; + annualOnly?: boolean; /** - * Internal Server Error + * Only for a customer none of whose instances has paid an invoice */ - 500: Problem; + firstTimeOnly?: boolean; /** - * Service Unavailable + * Only for a live subscription whose base price is at least this */ - 503: Problem; + minimumSubscriptionAmount?: MinimumAmount; }; -export type CreateEntitlementError = CreateEntitlementErrors[keyof CreateEntitlementErrors]; - -export type CreateEntitlementResponses = { +export type Release = { /** - * Created + * List of components included in this release, fixed at creation */ - 201: Entitlement; -}; - -export type CreateEntitlementResponse = - CreateEntitlementResponses[keyof CreateEntitlementResponses]; - -export type DeleteEntitlementData = { - body?: never; - path: { - entitlementSlug: string; - }; - query?: never; - url: "/entitlements/{entitlementSlug}"; -}; - -export type DeleteEntitlementErrors = { + readonly components?: Array | null; /** - * Bad Request + * Timestamp when the release was created */ - 400: Problem; + readonly createdAt: string; /** - * Unauthorized + * User who created this release */ - 401: Problem; + readonly createdBy: User; /** - * Forbidden + * Description of the release */ - 403: Problem; + description?: string; /** - * Not Found + * Unique identifier for the release */ - 404: Problem; + readonly id: string; /** - * Unprocessable Entity + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Version of the release */ - 500: Problem; + version: string; }; -export type DeleteEntitlementError = DeleteEntitlementErrors[keyof DeleteEntitlementErrors]; - -export type DeleteEntitlementResponses = { +export type ReleasedInvoice = { /** - * No Content + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 204: void; -}; - -export type DeleteEntitlementResponse = - DeleteEntitlementResponses[keyof DeleteEntitlementResponses]; - -export type GetEntitlementData = { - body?: never; - path: { - entitlementSlug: string; - }; - query?: never; - url: "/entitlements/{entitlementSlug}"; -}; - -export type GetEntitlementErrors = { + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * The hold it left, which the invoice no longer shows */ - 500: Problem; -}; - -export type GetEntitlementError = GetEntitlementErrors[keyof GetEntitlementErrors]; - -export type GetEntitlementResponses = { + holdDetail: HoldDetail; /** - * OK + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 200: Entitlement; -}; - -export type GetEntitlementResponse = GetEntitlementResponses[keyof GetEntitlementResponses]; - -export type UpdateEntitlementData = { - body: EntitlementWritable; - path: { - entitlementSlug: string; - }; - query?: never; - url: "/entitlements/{entitlementSlug}"; -}; - -export type UpdateEntitlementErrors = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Bad Request + * The invoice's identifier: the key an accounting system deduplicates on */ - 400: Problem; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Forbidden + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; + releaseReason: string; /** - * Not Found + * The user who released it, or system when a later check found the journal sound */ - 404: Problem; + releasedBy: string; /** - * Conflict + * Earliest start of its lines' service periods */ - 409: Problem; + serviceFrom: string; /** - * Unprocessable Entity + * Latest end of its lines' service periods */ - 422: Problem; + serviceTo: string; /** - * Internal Server Error + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 500: Problem; -}; - -export type UpdateEntitlementError = UpdateEntitlementErrors[keyof UpdateEntitlementErrors]; - -export type UpdateEntitlementResponses = { + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * No Content + * Sum of the lines, in minor units */ - 204: void; + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type UpdateEntitlementResponse = - UpdateEntitlementResponses[keyof UpdateEntitlementResponses]; - -export type GetFeatureFlagsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/feature-flags"; +export type ReorderMetadataFieldsInput = { + ids: Array | null; }; -export type GetFeatureFlagsErrors = { - /** - * Bad Request - */ - 400: Problem; +export type Report = { /** - * Unauthorized + * Periods closed into an invoice */ - 401: Problem; + closed: number; /** - * Forbidden + * Subscriptions the batch looked at */ - 403: Problem; + examined: number; /** - * Not Found + * Set when due subscriptions are left beyond the batch */ - 404: Problem; + hasMore: boolean; /** - * Unprocessable Entity + * Of those, invoices held as DRAFTs for their usage journal */ - 422: Problem; + held: number; + invoices: Array; /** - * Internal Server Error + * Subscriptions left for later: held by another transaction, their meters' clock not at the boundary, or failed (logged) */ - 500: Problem; + skipped: number; }; -export type GetFeatureFlagsError = GetFeatureFlagsErrors[keyof GetFeatureFlagsErrors]; - -export type GetFeatureFlagsResponses = { +export type ReportEntitlementUsageBody = { /** - * OK - */ - 200: PageFeatureFlag; -}; - -export type GetFeatureFlagsResponse = GetFeatureFlagsResponses[keyof GetFeatureFlagsResponses]; - -export type CreateFeatureFlagData = { - /** - * Feature flag details - */ - body: FeatureFlagWritable; - path?: never; - query?: never; - url: "/feature-flags"; -}; - -export type CreateFeatureFlagErrors = { - /** - * Bad Request - */ - 400: Problem; - /** - * Unauthorized - */ - 401: Problem; - /** - * Forbidden - */ - 403: Problem; - /** - * Conflict + * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it */ - 409: Problem; + behavior?: "append" | "set"; /** - * Unprocessable Entity + * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. */ - 422: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Internal Server Error + * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. */ - 500: Problem; + transactionId?: string; /** - * Service Unavailable + * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. */ - 503: Problem; + value: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type CreateFeatureFlagError = CreateFeatureFlagErrors[keyof CreateFeatureFlagErrors]; +export type RevocationReason = { + reason: string; +}; -export type CreateFeatureFlagResponses = { +export type RolloutDate = { + end: RolloutStep; + start: RolloutStep; + type: "rollout_date"; +}; + +export type RolloutDateTargeting = { + end: RolloutStep; + name: string; /** - * Created feature flag + * CEL expression for basicTargeting evaluation */ - 201: FeatureFlag; + rule: string; + start: RolloutStep; + type: "rollout_date"; }; -export type CreateFeatureFlagResponse = - CreateFeatureFlagResponses[keyof CreateFeatureFlagResponses]; - -export type GetTargetingContextData = { - body?: never; - path?: never; - query?: never; - url: "/feature-flags/targeting/context"; +export type RolloutPercentage = { + distribution: { + [key: string]: number; + }; + type: "rollout_percentage"; }; -export type GetTargetingContextErrors = { +export type RolloutPercentageTargeting = { + distribution: { + [key: string]: number; + }; + name: string; /** - * Unauthorized + * CEL expression for basicTargeting evaluation */ - 401: Problem; + rule: string; + type: "rollout_percentage"; +}; + +export type RolloutStep = { + date: string; + percentage: number; + variant: string; +}; + +export type SampleUsageAmount = { /** - * Forbidden + * An entitlement an ACTIVE price of the version meters */ - 403: Problem; + entitlementSlug: string; /** - * Internal Server Error + * Usage in the entitlement's measured units, a non-negative decimal string. Rated as one reset window against the version's grant: usage above limit × (1 + overage percent / 100) would be rejected, so it is capped, and the line says capped. */ - 500: Problem; + quantity: string; }; -export type GetTargetingContextError = GetTargetingContextErrors[keyof GetTargetingContextErrors]; - -export type GetTargetingContextResponses = { +export type ScheduledChange = { /** - * OK + * The boundary it applies at: the current period's end */ - 200: TargetingContext; + effectiveAt: string; + /** + * The FLAT_FEE price the subscription moves to + */ + price: Price; + scheduledAt: string; }; -export type GetTargetingContextResponse = - GetTargetingContextResponses[keyof GetTargetingContextResponses]; - -export type LintTargetingRuleData = { - body: TargetingRuleDraft; - path?: never; - query?: never; - url: "/feature-flags/targeting/lint"; +export type ServiceAccount = { + readonly createdAt?: string; + readonly createdBy?: User; + readonly externalId?: string; + readonly id?: string; + name: string; + /** + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; + readonly tokens: Array | null; }; -export type LintTargetingRuleErrors = { +export type SessionCheckout = { /** - * Bad Request + * subscribed: the invoice of the first period; absent during a trial */ - 400: Problem; + activationInvoice?: SessionInvoice; /** - * Unauthorized + * preview: what the checkout bills today; zero, with no lines, during a trial */ - 401: Problem; + dueToday?: DueToday; /** - * Forbidden + * requires_payment_method: when the setup page expires */ - 403: Problem; + expiresAt?: string; /** - * Unprocessable Entity + * subscribed: how paying the activation invoice went */ - 422: Problem; + payment?: Payment; /** - * Internal Server Error + * requires_payment_method: send it back as setupSessionId once the customer returns */ - 500: Problem; -}; - -export type LintTargetingRuleError = LintTargetingRuleErrors[keyof LintTargetingRuleErrors]; - -export type LintTargetingRuleResponses = { + setupSessionId?: string; /** - * OK + * requires_payment_method: the provider's page where the customer saves a payment method */ - 200: TargetingRuleVerdict; -}; - -export type LintTargetingRuleResponse = - LintTargetingRuleResponses[keyof LintTargetingRuleResponses]; - -export type TestTargetingRuleData = { - body: TargetingRuleTrial; - path?: never; - query?: never; - url: "/feature-flags/targeting/test"; + setupUrl?: string; + status: "preview" | "requires_payment_method" | "subscribed"; + /** + * subscribed: the subscription started + */ + subscription?: SessionSubscription; + /** + * preview: when the trial would end, if there is one + */ + trialEndsAt?: string; }; -export type TestTargetingRuleErrors = { +export type SessionCheckoutOrder = { /** - * Bad Request + * Public add-ons that fit the plan */ - 400: Problem; + addOns?: Array | null; /** - * Unauthorized + * Where invoices go. Required when the customer has none; stored on the customer when given. */ - 401: Problem; + billingEmail?: string; /** - * Forbidden + * Answer what the checkout would bill today, and change nothing */ - 403: Problem; + dryRun?: boolean; /** - * Unprocessable Entity + * An ACTIVE flat-fee price of a plan in the public catalogue. The instance is moved to that price's version when it is on another one. */ - 422: Problem; + licensePriceId: string; /** - * Internal Server Error + * Where the setup page sends the customer back, with kaiten_setup_session appended. Required when a payment method has to be captured. Its origin must be one the organization's publishable keys allow. */ - 500: Problem; -}; - -export type TestTargetingRuleError = TestTargetingRuleErrors[keyof TestTargetingRuleErrors]; - -export type TestTargetingRuleResponses = { + returnUrl?: string; /** - * OK + * The setupSessionId a requires_payment_method answer gave, once the customer is back from the setup page: the payment method saved there is checked with the provider and used. */ - 200: TargetingRuleRehearsal; -}; - -export type TestTargetingRuleResponse = - TestTargetingRuleResponses[keyof TestTargetingRuleResponses]; - -export type DeleteFeatureFlagData = { - body?: never; - path: { - featureFlagSlug: string; - }; - query?: never; - url: "/feature-flags/{featureFlagSlug}"; + setupSessionId?: string; + /** + * false skips the plan's trial. Omitted: the plan's trial, if it has one. + */ + trial?: boolean; + /** + * Validated and redeemed in the checkout; any refusal answers .VoucherInvalid + */ + voucherCode?: string; }; -export type DeleteFeatureFlagErrors = { +export type SessionInvoice = { + currency: string; /** - * Unauthorized + * Minor units */ - 401: Problem; + discountTotal: number; + dueAt: string | null; /** - * Forbidden + * The vendor's own number for an invoice it collects itself */ - 403: Problem; + externalReference: string | null; /** - * Not Found + * Where the customer pays the invoice, or confirms a payment that needs authenticating */ - 404: Problem; + hostedInvoiceUrl: string | null; + id: string; + invoicePdfUrl: string | null; + issuedAt: string | null; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + lines: Array; + paidAt: string | null; + providerInvoiceNumber: string | null; + serviceFrom: string; + serviceTo: string; /** - * Unprocessable Entity + * PUSHED: issued and awaiting payment. PAYMENT_FAILED: a charge failed; pay on hostedInvoiceUrl. MANUAL: issued, the vendor collects it. */ - 422: Problem; + status: "MANUAL" | "PUSHED" | "PAID" | "PAYMENT_FAILED" | "UNCOLLECTIBLE" | "VOID"; /** - * Internal Server Error + * Minor units */ - 500: Problem; + subtotal: number; + /** + * Minor units + */ + total: number; }; -export type DeleteFeatureFlagError = DeleteFeatureFlagErrors[keyof DeleteFeatureFlagErrors]; - -export type DeleteFeatureFlagResponses = { +export type SessionLine = { /** - * No Content + * Minor units; negative on a DISCOUNT line */ - 204: void; + amount: number; + description: string; + label: string; + /** + * In sale units, a decimal string + */ + quantity: string; + seq: number; + serviceFrom: string; + serviceTo: string; + type: "BASE" | "ADDON" | "USAGE" | "OVERAGE" | "DISCOUNT"; + /** + * Minor units; empty on a DISCOUNT line + */ + unitAmountDecimal: string; }; -export type DeleteFeatureFlagResponse = - DeleteFeatureFlagResponses[keyof DeleteFeatureFlagResponses]; - -export type GetFeatureFlagData = { - body?: never; - path: { - featureFlagSlug: string; - }; - query?: never; - url: "/feature-flags/{featureFlagSlug}"; +export type SessionSubscription = { + basePrice: PublicPrice; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + currency: string; + /** + * When the current period ends: the renewal date, or the trial's end + */ + currentPeriodEnd: string; + currentPeriodStart: string; + providerKind: "NOOP" | "STRIPE"; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + trialEndsAt: string | null; }; -export type GetFeatureFlagErrors = { +export type StartedSubscription = { /** - * Unauthorized + * The invoice of the first period, when the base price bills in advance; absent otherwise. Charged automatically, it is pushed and charged before this answer when the provider answers within 20 seconds: its status says how it went. */ - 401: Problem; + activationInvoice?: InvoiceSummary; /** - * Forbidden + * The instant its periods are counted from */ - 403: Problem; + anchorAt: string; /** - * Not Found + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 404: Problem; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Unprocessable Entity + * Effective: the subscription's own, else the organization's default */ - 422: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Internal Server Error + * The subscription's own collection method; absent when it takes the organization's */ - 500: Problem; -}; - -export type GetFeatureFlagError = GetFeatureFlagErrors[keyof GetFeatureFlagErrors]; - -export type GetFeatureFlagResponses = { + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * OK + * The next boundary: the period closes, and its invoice is composed, after it */ - 200: FeatureFlag; -}; - -export type GetFeatureFlagResponse = GetFeatureFlagResponses[keyof GetFeatureFlagResponses]; - -export type UpdateFeatureFlagData = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Feature flag details + * Effective: the subscription's own, else the organization's default */ - body: FeatureFlagWritable; - path: { - featureFlagSlug: string; - }; - query?: never; - url: "/feature-flags/{featureFlagSlug}"; -}; - -export type UpdateFeatureFlagErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Unauthorized + * As it was at the subscription's last write */ - 401: Problem; + instanceSlug: string; + pastDueSince?: string; /** - * Forbidden + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Not Found + * A plan change waiting for the next boundary */ - 404: Problem; + scheduledChange?: ScheduledChange; /** - * Unprocessable Entity + * When billing started: usage before it is never billed */ - 422: Problem; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Internal Server Error + * When the trial ends, or ended: usage before it is never billed */ - 500: Problem; + trialEndsAt?: string; + updatedAt: string; }; -export type UpdateFeatureFlagError = UpdateFeatureFlagErrors[keyof UpdateFeatureFlagErrors]; +export type StatusChange = { + from: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + instanceBillingId: string; + instanceSlug: string; + reason: "TRIAL_ENDED" | "INVOICE_OVERDUE" | "PAYMENT_FAILED" | "SETTLED"; + to: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; +}; -export type UpdateFeatureFlagResponses = { +export type SubscriptionAddon = { /** - * No Content + * The add-on version to attach */ - 204: void; -}; - -export type UpdateFeatureFlagResponse = - UpdateFeatureFlagResponses[keyof UpdateFeatureFlagResponses]; - -export type GetInstancesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/instances"; + addonSlug: string; + quantity?: number; }; -export type GetInstancesErrors = { +export type SubscriptionCancellation = { /** - * Bad Request + * AT_PERIOD_END (the default): the period paid for runs out, then the FINAL invoice is issued. IMMEDIATE: the FINAL invoice is issued now, flat fees billed in full and nothing refunded. */ - 400: Problem; + mode?: "AT_PERIOD_END" | "IMMEDIATE"; /** - * Unauthorized + * Up to 500 characters */ - 401: Problem; + reason?: string; +}; + +export type SubscriptionTerms = { /** - * Forbidden + * null: the organization's default. CHARGE_AUTOMATICALLY needs a provider that charges automatically (UpdateInstanceBilling.CollectionMethodUnsupported). */ - 403: Problem; + collectionMethod?: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * 0 to 365; null: the organization's default */ - 422: Problem; + daysUntilDue?: number | null; /** - * Internal Server Error + * Who issues and collects the invoices, from the next one on. NOOP: the organization itself, through the handoff queue. A provider must be connected (UpdateInstanceBilling.ProviderNotConnected); one that pushes invoices needs the customer's billing e-mail for SEND_INVOICE (.BillingEmailMissing) and the subscription's currency (.UnsupportedCurrency). */ - 500: Problem; + providerKind?: "NOOP" | "STRIPE"; }; -export type GetInstancesError = GetInstancesErrors[keyof GetInstancesErrors]; - -export type GetInstancesResponses = { - /** - * OK - */ - 200: PageInstance; +export type SyncFailure = { + consecutiveFailures: number; + lastSyncError: string; + lastSyncedAt: string; + providerKind: string; }; -export type GetInstancesResponse = GetInstancesResponses[keyof GetInstancesResponses]; - -export type CreateInstanceData = { - body: InstanceWritable; - path?: never; - query?: never; - url: "/instances"; +export type SyncReport = { + providers: Array; }; -export type CreateInstanceErrors = { +export type SystemTokenIssuance = { /** - * Bad Request + * Credential class that performed the mint; "platform" is the system:kaiten identity */ - 400: Problem; + credentialKind: string; /** - * Unauthorized + * Absent when the minted credential does not expire */ - 401: Problem; + expiresAt?: string; /** - * Forbidden + * When the credential was minted */ - 403: Problem; + issuedAt: string; /** - * Not Found + * The credential that was minted */ - 404: Problem; + issuedTokenId: string; /** - * Conflict + * Human-readable label the caller gave the minted credential */ - 409: Problem; + name: string; /** - * Unprocessable Entity + * Platform credential that performed the mint; revoking it revokes everything it issued */ - 422: Problem; + platformTokenId: string; /** - * Internal Server Error + * Scopes granted to the minted credential */ - 500: Problem; + scopes: Array | null; /** - * Service Unavailable + * Server-assigned identifier of the minted credential */ - 503: Problem; + slug: string; }; -export type CreateInstanceError = CreateInstanceErrors[keyof CreateInstanceErrors]; - -export type CreateInstanceResponses = { +export type TargetingContext = { /** - * Created + * Identifiers the server guarantees, and what is reachable below each. Not a closed set: a host may target on its own attributes too */ - 201: Instance; -}; - -export type CreateInstanceResponse = CreateInstanceResponses[keyof CreateInstanceResponses]; - -export type DeleteInstanceData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; + roots: Array; }; -export type DeleteInstanceErrors = { +export type TargetingContextNode = { /** - * Bad Request + * What this value means, shown by the editor */ - 400: Problem; + description?: string; /** - * Unauthorized + * Named children, for an object */ - 401: Problem; + fields?: Array; /** - * Forbidden + * Keys this map currently has, for completion. Not a closed set */ - 403: Problem; + knownKeys?: Array; /** - * Not Found + * Name as it is written in a rule */ - 404: Problem; + name: string; /** - * Unprocessable Entity + * Whether this value may be absent, in which case has() is worth using */ - 422: Problem; + optional?: boolean; /** - * Internal Server Error + * Shape of this node's value */ - 500: Problem; -}; - -export type DeleteInstanceError = DeleteInstanceErrors[keyof DeleteInstanceErrors]; - -export type DeleteInstanceResponses = { + type: "string" | "number" | "boolean" | "object" | "map" | "dyn"; /** - * No Content + * Shape shared by every entry, for a map */ - 204: void; + values?: TargetingContextNode; }; -export type DeleteInstanceResponse = DeleteInstanceResponses[keyof DeleteInstanceResponses]; - -export type GetInstanceData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; +export type TargetingRuleDraft = { + /** + * The CEL targeting rule to check. May be blank, which is itself a mistake this reports + */ + rule: string; }; -export type GetInstanceErrors = { +export type TargetingRuleIssue = { /** - * Unauthorized + * 1-based column the problem starts on, or 0 when it has no position */ - 401: Problem; + column: number; /** - * Forbidden + * 1-based column just past the problem, or 0 when only a point is known */ - 403: Problem; + endColumn?: number; /** - * Not Found + * 1-based line the problem ends on, or 0 when only a point is known */ - 404: Problem; + endLine?: number; /** - * Unprocessable Entity + * 1-based line the problem starts on, or 0 when it has no position */ - 422: Problem; + line: number; /** - * Internal Server Error + * What is wrong, in the same words the write path refuses it with */ - 500: Problem; + message: string; }; -export type GetInstanceError = GetInstanceErrors[keyof GetInstanceErrors]; - -export type GetInstanceResponses = { +export type TargetingRuleRehearsal = { /** - * OK + * Why the engine could not answer, when it could not — e.g. the rule reads a host attribute this context does not carry. At a real evaluation the rule would simply not match */ - 200: Instance; -}; - -export type GetInstanceResponse = GetInstanceResponses[keyof GetInstanceResponses]; - -export type PatchInstanceData = { - body: PatchInstanceBody; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; -}; - -export type PatchInstanceErrors = { + evaluationError?: string; /** - * Bad Request + * The __kaiten namespace as enriched for this context — what a rule actually reads. Empty sub-roots mean the context resolved nothing for them */ - 400: Problem; + facts: { + [key: string]: unknown; + }; /** - * Unauthorized + * Problems the lint found. The rule is only run when there are none */ - 401: Problem; + issues: Array; /** - * Forbidden + * Whether the rule matched this context. Meaningful only when valid and evaluationError is empty */ - 403: Problem; + matched: boolean; /** - * Not Found + * Whether the rule lints clean */ - 404: Problem; + valid: boolean; +}; + +export type TargetingRuleTrial = { /** - * Unprocessable Entity + * The evaluation context to rehearse against, as a client would send it. Anything under __kaiten is discarded, exactly as at a real evaluation */ - 422: Problem; + context?: { + [key: string]: unknown; + }; /** - * Internal Server Error + * The CEL targeting rule to rehearse */ - 500: Problem; + rule: string; + /** + * The key the evaluation would be bucketed on. Resolves license and entitlement facts when it names a customer slug + */ + targetingKey?: string; }; -export type PatchInstanceError = PatchInstanceErrors[keyof PatchInstanceErrors]; - -export type PatchInstanceResponses = { +export type TargetingRuleVerdict = { /** - * No Content + * Every problem found, positioned where it is written. Empty when the rule is accepted */ - 204: void; + issues: Array; + /** + * Whether the write path would accept this rule + */ + valid: boolean; }; -export type PatchInstanceResponse = PatchInstanceResponses[keyof PatchInstanceResponses]; +/** + * Polymorphic list of targeting rules (Basic, RolloutDate, RolloutPercentage) + */ +export type Targetings = Array< + BasicTargeting | RolloutDateTargeting | RolloutPercentageTargeting +> | null; -export type UpdateInstanceData = { - body: InstanceWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; +export type Token = { + readonly createdAt: string; + readonly createdBy: User; + expiresAt?: string; + readonly id?: string; + name: string; + readonly revokedAt?: string; + readonly revokedBy?: User; + scopes: Array | null; + readonly serviceAccountId?: string; + /** + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + */ + slug?: string; }; -export type UpdateInstanceErrors = { +export type TotalsDifference = { + kaitenTotal: number; + providerSubtotal?: number; + providerTotalExcludingTax: number; +}; + +export type UncollectibleInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Conflict + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 409: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Unprocessable Entity + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 422: Problem; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Internal Server Error + * The invoice's identifier: the key an accounting system deduplicates on */ - 500: Problem; -}; - -export type UpdateInstanceError = UpdateInstanceErrors[keyof UpdateInstanceErrors]; - -export type UpdateInstanceResponses = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * No Content + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 204: void; -}; - -export type UpdateInstanceResponse = UpdateInstanceResponses[keyof UpdateInstanceResponses]; - -export type GetAuditTrailsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: { - /** - * Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) - */ - event_name?: string; - /** - * RFC3339 timestamp — include entries with timestamp ≥ this value - */ - after?: string; - /** - * RFC3339 timestamp — include entries with timestamp ≤ this value - */ - before?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - }; - url: "/instances/{instanceSlug}/audit-trails"; -}; - -export type GetAuditTrailsErrors = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Bad Request + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 400: Problem; + providerKind: "NOOP" | "STRIPE"; + reason: string; /** - * Unauthorized + * Earliest start of its lines' service periods */ - 401: Problem; + serviceFrom: string; /** - * Forbidden + * Latest end of its lines' service periods */ - 403: Problem; + serviceTo: string; /** - * Not Found + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 404: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Unprocessable Entity + * Sum of the lines, in minor units */ - 422: Problem; + subtotal: number; /** - * Internal Server Error + * subtotal − discountTotal, in minor units */ - 500: Problem; + total: number; + updatedAt: string; }; -export type GetAuditTrailsError = GetAuditTrailsErrors[keyof GetAuditTrailsErrors]; - -export type GetAuditTrailsResponses = { +export type UpdatedEvent = { /** - * OK + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 200: PageAuditTrail; -}; - -export type GetAuditTrailsResponse = GetAuditTrailsResponses[keyof GetAuditTrailsResponses]; - -export type GetEntitlementsUsageMetricsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}/entitlements/usage"; -}; - -export type GetEntitlementsUsageMetricsErrors = { + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Bad Request + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 400: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Unauthorized + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 401: Problem; + billingTiming: "ADVANCE" | "ARREARS"; /** - * Forbidden + * The members the update changed, as the API names them */ - 403: Problem; + changedFields: Array | null; + readonly createdAt: string; /** - * Not Found + * ISO 4217 code, upper case. One currency per licence version. */ - 404: Problem; + currency: string; /** - * Unprocessable Entity + * When the price was deprecated */ - 422: Problem; + deprecatedAt?: string; /** - * Internal Server Error + * The invoice line's label; a default is derived when absent. */ - 500: Problem; -}; - -export type GetEntitlementsUsageMetricsError = - GetEntitlementsUsageMetricsErrors[keyof GetEntitlementsUsageMetricsErrors]; - -export type GetEntitlementsUsageMetricsResponses = { + displayLabel?: string; /** - * OK + * Order among the version's prices */ - 200: Array | null; -}; - -export type GetEntitlementsUsageMetricsResponse = - GetEntitlementsUsageMetricsResponses[keyof GetEntitlementsUsageMetricsResponses]; - -export type GetEntitlementUsageMetricsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; -}; - -export type GetEntitlementUsageMetricsErrors = { + displayOrder: number; /** - * Bad Request + * The family of that version */ - 400: Problem; + familySlug: string; /** - * Unauthorized + * Unique identifier of the price */ - 401: Problem; + readonly id: string; /** - * Forbidden + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 403: Problem; + isDefault: boolean; /** - * Not Found + * The licence version the price belongs to */ - 404: Problem; + licenseSlug: string; /** - * Unprocessable Entity + * What a metered price measures. Absent on FLAT_FEE prices. */ - 422: Problem; + metered?: Meter; /** - * Internal Server Error + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 500: Problem; -}; - -export type GetEntitlementUsageMetricsError = - GetEntitlementUsageMetricsErrors[keyof GetEntitlementUsageMetricsErrors]; - -export type GetEntitlementUsageMetricsResponses = { + status: "ACTIVE" | "DEPRECATED"; /** - * OK + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 200: EntitlementUsage; -}; - -export type GetEntitlementUsageMetricsResponse = - GetEntitlementUsageMetricsResponses[keyof GetEntitlementUsageMetricsResponses]; - -export type ReportEntitlementUsageMetricData = { - body: ReportEntitlementUsageBodyWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; + readonly updatedAt: string; }; -export type ReportEntitlementUsageMetricErrors = { +export type UsageReport = { /** - * Bad Request + * The entitlement's aggregation method when the report was accepted */ - 400: Problem; + aggregationMethod: string; /** - * Unauthorized + * append adds the value through the aggregation method; set overwrites the counter */ - 401: Problem; + behavior: "append" | "set"; /** - * Forbidden + * valueAfter minus valueBefore; negative for a set that lowered the counter */ - 403: Problem; + delta: string; /** - * Not Found + * The entitlement the report was made for. It may since have been deleted. */ - 404: Problem; + entitlementId: string; /** - * Conflict + * Reports counted in the window after this one */ - 409: Problem; + eventCountAfter: number; /** - * Unprocessable Entity + * The instance the report was made for. It may since have been deleted. */ - 422: Problem; + instanceId: string; /** - * Internal Server Error + * The instance's licence when the report was accepted */ - 500: Problem; + licenseId: string; /** - * Service Unavailable + * The limit in force when the report was accepted. Null when unlimited. */ - 503: Problem; -}; - -export type ReportEntitlementUsageMetricError = - ReportEntitlementUsageMetricErrors[keyof ReportEntitlementUsageMetricErrors]; - -export type ReportEntitlementUsageMetricResponses = { + limitValue?: string; /** - * OK + * How much the usage above limitValue moved: max(0, valueAfter - limitValue) - max(0, valueBefore - limitValue). 0 when unlimited. */ - 200: EntitlementUsage; -}; - -export type ReportEntitlementUsageMetricResponse = - ReportEntitlementUsageMetricResponses[keyof ReportEntitlementUsageMetricResponses]; - -export type ListUsageReportsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: { - /** - * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. - */ - from?: string; - /** - * End of the range, exclusive (RFC 3339). Defaults to now. - */ - to?: string; - /** - * Return the reports after this reportSeq: the nextAfterSeq of the previous page - */ - afterSeq?: number; - /** - * Maximum number of reports to return (default 100, max 500) - */ - limit?: number; - /** - * Only the report sent with this idempotency key - */ - transactionId?: string; + overageDelta: string; + /** + * The overage allowed above limitValue, in percent, when the report was accepted. Null when unlimited. + */ + overagePercent?: number; + /** + * The report's metadata, when it was stored + */ + properties?: { + [key: string]: unknown; }; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports"; -}; - -export type ListUsageReportsErrors = { /** - * Bad Request + * Position of the report among the pair's accepted reports, from 1, without gaps */ - 400: Problem; + reportSeq: number; /** - * Unauthorized + * When the server accepted the report (UTC, millisecond precision) */ - 401: Problem; + reportedAt: string; /** - * Forbidden + * The value as sent: a delta for append, an absolute value for set */ - 403: Problem; + reportedValue: string; /** - * Not Found + * The report's idempotency key, when it was sent with one */ - 404: Problem; + transactionId?: string; /** - * Unprocessable Entity + * The counter after the report */ - 422: Problem; + valueAfter: string; /** - * Internal Server Error + * The counter before the report, after any window reset */ - 500: Problem; + valueBefore: string; + /** + * End of the usage window the report counted in (exclusive). Null for a lifetime entitlement. + */ + windowEnd?: string; + /** + * Start of the usage window the report counted in (inclusive). Null for a lifetime entitlement. + */ + windowStart?: string; }; -export type ListUsageReportsError = ListUsageReportsErrors[keyof ListUsageReportsErrors]; +export type UsageReportPage = { + /** + * The reports, in reportSeq order + */ + items: Array; + /** + * Pass as afterSeq to read the next page. Absent on the last page. + */ + nextAfterSeq?: number; +}; -export type ListUsageReportsResponses = { +export type User = { /** - * OK + * ID of the user */ - 200: UsageReportPage; + id: string; + /** + * Name of the user + */ + name?: string; }; -export type ListUsageReportsResponse = ListUsageReportsResponses[keyof ListUsageReportsResponses]; +export type Validity = { + /** + * The first failing check + */ + reason?: + | "NOT_FOUND" + | "NOT_ACTIVE" + | "NOT_YET_VALID" + | "EXPIRED" + | "EXHAUSTED" + | "ALREADY_REDEEMED" + | "NOT_ELIGIBLE" + | "CURRENCY_MISMATCH"; + /** + * With NOT_ELIGIBLE: the eligibility rule + */ + rule?: + | "RESTRICTED_CUSTOMER" + | "LICENSE_NOT_APPLICABLE" + | "ADDON_NOT_APPLICABLE" + | "FIRST_TIME_ONLY" + | "ANNUAL_ONLY" + | "MINIMUM_SUBSCRIPTION_AMOUNT" + | "NOTHING_TO_BOOST"; + valid: boolean; + /** + * The voucher, without its code, when the code names one + */ + voucher?: Voucher; +}; -export type ExportUsageReportsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: { - /** - * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - */ - from?: string; - /** - * End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. - */ - to?: string; - /** - * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat. - */ - format?: string; - }; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export"; +export type Variant = { + description: string; + name: string; + value: unknown; }; -export type ExportUsageReportsErrors = { +export type VoidedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type ExportUsageReportsError = ExportUsageReportsErrors[keyof ExportUsageReportsErrors]; - -export type ExportUsageReportsResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + * The invoice's identifier: the key an accounting system deduplicates on */ - 200: string; -}; - -export type ExportUsageReportsResponse = - ExportUsageReportsResponses[keyof ExportUsageReportsResponses]; - -export type DeleteInstanceIntegrationData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; -}; - -export type DeleteInstanceIntegrationErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Bad Request + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 400: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Unauthorized + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 401: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Forbidden + * Earliest start of its lines' service periods */ - 403: Problem; + serviceFrom: string; /** - * Not Found + * Latest end of its lines' service periods */ - 404: Problem; + serviceTo: string; /** - * Unprocessable Entity + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 422: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Internal Server Error + * Sum of the lines, in minor units */ - 500: Problem; -}; - -export type DeleteInstanceIntegrationError = - DeleteInstanceIntegrationErrors[keyof DeleteInstanceIntegrationErrors]; - -export type DeleteInstanceIntegrationResponses = { + subtotal: number; /** - * No Content + * subtotal − discountTotal, in minor units */ - 204: void; + total: number; + updatedAt: string; + voidReason: string; }; -export type DeleteInstanceIntegrationResponse = - DeleteInstanceIntegrationResponses[keyof DeleteInstanceIntegrationResponses]; - -export type GetInstanceIntegrationData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; -}; - -export type GetInstanceIntegrationErrors = { +export type Voucher = { /** - * Unauthorized + * Only instances holding one of these add-on versions can redeem it; any when empty */ - 401: Problem; + applicableAddonIds: Array; + applicableAddonPriceIds: Array; /** - * Forbidden + * Only instances on these licence versions can redeem it; any when empty */ - 403: Problem; + applicableLicenseIds: Array; + applicableLicensePriceIds: Array; /** - * Not Found + * The code to redeem. Returned to read:vouchers callers only; never in an event. */ - 404: Problem; + code?: string; /** - * Unprocessable Entity + * The last four characters of the normalized code */ - 422: Problem; + codeHint: string; + readonly createdAt: string; /** - * Internal Server Error + * The currency of a FIXED_AMOUNT discount */ - 500: Problem; -}; - -export type GetInstanceIntegrationError = - GetInstanceIntegrationErrors[keyof GetInstanceIntegrationErrors]; - -export type GetInstanceIntegrationResponses = { + currency?: string; + description?: string; /** - * OK + * PRICE: how many invoices it discounts (one, durationInPeriods, or every one). BOOST: how long a redemption lasts, in the subscription's billing periods. */ - 200: InstanceIntegration; + duration: "ONE_TIME" | "REPEATING" | "FOREVER"; + durationInPeriods?: number; + expiresAt?: string; + /** + * What an ENTITLEMENT_BOOST changes + */ + grants: Array; + readonly id: string; + maxRedemptions?: number; + name: string; + priceAppliesTo?: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; + priceDiscountType?: "PERCENTAGE" | "FIXED_AMOUNT"; + /** + * A percentage in (0, 100], or an integer amount in minor units of currency + */ + priceDiscountValue?: string; + redemptionRules: RedemptionRules; + redemptionsCount: number; + /** + * Only this customer's instances can redeem it + */ + restrictedCustomerSlug?: string; + startsAt?: string; + status: "DRAFT" | "ACTIVE" | "EXPIRED" | "EXHAUSTED" | "ARCHIVED"; + readonly updatedAt: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; }; -export type GetInstanceIntegrationResponse = - GetInstanceIntegrationResponses[keyof GetInstanceIntegrationResponses]; - -export type CreateInstanceIntegrationData = { +export type VoucherCheck = { + code: string; /** - * Integration payload + * Also run the checks that need the redeeming instance */ - body: InstanceIntegrationWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; + instanceSlug?: string; }; -export type CreateInstanceIntegrationErrors = { +export type VoucherCode = { + code: string; +}; + +export type VoucherDraft = { + applicableAddonIds?: Array | null; /** - * Bad Request + * With SELECTED_PRICES: the add-on prices it discounts */ - 400: Problem; + applicableAddonPriceIds?: Array | null; + applicableLicenseIds?: Array | null; /** - * Unauthorized + * With SELECTED_PRICES: the licence prices it discounts */ - 401: Problem; + applicableLicensePriceIds?: Array | null; /** - * Forbidden + * 8 to 64 of [A-Za-z0-9_-]. Generated when absent: 16 characters, 80 random bits. Matched without case or separators. */ - 403: Problem; + code?: string; /** - * Not Found + * Required with FIXED_AMOUNT, refused otherwise */ - 404: Problem; + currency?: string; + description?: string; + duration: "ONE_TIME" | "REPEATING" | "FOREVER"; /** - * Conflict + * Required with REPEATING, refused otherwise */ - 409: Problem; + durationInPeriods?: number; + expiresAt?: string; /** - * Unprocessable Entity + * Required on an ENTITLEMENT_BOOST, refused on a PRICE voucher */ - 422: Problem; + grants?: Array | null; + maxRedemptions?: number; + name: string; + priceAppliesTo?: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; + priceDiscountType?: "PERCENTAGE" | "FIXED_AMOUNT"; /** - * Internal Server Error + * A percentage in (0, 100], or an integer amount in minor units */ - 500: Problem; + priceDiscountValue?: string; + redemptionRules?: RedemptionRules; + restrictedCustomerSlug?: string; + startsAt?: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; }; -export type CreateInstanceIntegrationError = - CreateInstanceIntegrationErrors[keyof CreateInstanceIntegrationErrors]; - -export type CreateInstanceIntegrationResponses = { +export type AddonWritable = { + description: string; /** - * Created + * The family the version belongs to */ - 201: InstanceIntegration; + familySlug: string; + /** + * The version the family resolves to. Only a PUBLISHED version. + */ + isDefault: boolean; + /** + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. + */ + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; + /** + * The largest quantity an instance can hold; unbounded when absent + */ + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; + /** + * The version's slug, unique in the organization + */ + slug: string; + versionName: string; }; -export type CreateInstanceIntegrationResponse = - CreateInstanceIntegrationResponses[keyof CreateInstanceIntegrationResponses]; - -export type UpdateInstanceIntegrationData = { +export type AddonEntitlementWritable = { + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * Integration payload + * The overage the add-on allows; absent inherits the licence grant's */ - body: InstanceIntegrationWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; + limitCapExceededOveragePercent?: number; + /** + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. + */ + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; + /** + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. + */ + value: { + [key: string]: unknown; }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; }; -export type UpdateInstanceIntegrationErrors = { +export type AddonFamilyWritable = { /** - * Bad Request + * The default version, else the highest PUBLISHED one; absent when none is published */ - 400: Problem; + currentVersion?: AddonWritable; /** - * Unauthorized + * Whether the family is listed in the public catalogue */ - 401: Problem; + isPublic: boolean; /** - * Forbidden + * The highest version number the family has assigned */ - 403: Problem; + lastVersion: number; + slug: string; /** - * Not Found + * Every version, newest first */ - 404: Problem; + versions: Array | null; +}; + +export type AddonGrantUpdateWritable = { /** - * Conflict + * The add-on version the grant belongs to */ - 409: Problem; + addonSlug: string; + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * Unprocessable Entity + * The overage the add-on allows; absent inherits the licence grant's */ - 422: Problem; + limitCapExceededOveragePercent?: number; /** - * Internal Server Error + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. */ - 500: Problem; -}; - -export type UpdateInstanceIntegrationError = - UpdateInstanceIntegrationErrors[keyof UpdateInstanceIntegrationErrors]; - -export type UpdateInstanceIntegrationResponses = { + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; /** - * OK + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. */ - 200: InstanceIntegration; -}; - -export type UpdateInstanceIntegrationResponse = - UpdateInstanceIntegrationResponses[keyof UpdateInstanceIntegrationResponses]; - -export type GetCustomerIntegrationByExternalIdData = { - body?: never; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; + value: { + [key: string]: unknown; }; - query?: never; - url: "/integration/{adapter}/customer/{externalId}"; }; -export type GetCustomerIntegrationByExternalIdErrors = { - /** - * Unauthorized - */ - 401: Problem; +export type AddonPriceUpdateWritable = { /** - * Forbidden + * The add-on version the price belongs to */ - 403: Problem; + addonSlug: string; /** - * Not Found + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 404: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unprocessable Entity + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 422: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Internal Server Error + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 500: Problem; -}; - -export type GetCustomerIntegrationByExternalIdError = - GetCustomerIntegrationByExternalIdErrors[keyof GetCustomerIntegrationByExternalIdErrors]; - -export type GetCustomerIntegrationByExternalIdResponses = { + billingTiming: "ADVANCE" | "ARREARS"; /** - * OK + * ISO 4217 code, upper case. One currency per licence version. */ - 200: CustomerIntegrationResource; -}; - -export type GetCustomerIntegrationByExternalIdResponse = - GetCustomerIntegrationByExternalIdResponses[keyof GetCustomerIntegrationByExternalIdResponses]; - -export type UpsertCustomerIntegrationByExternalIdData = { - body: CustomerBody; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; - }; - query?: never; - url: "/integration/{adapter}/customer/{externalId}"; -}; - -export type UpsertCustomerIntegrationByExternalIdErrors = { + currency: string; /** - * Bad Request + * When the price was deprecated */ - 400: Problem; + deprecatedAt?: string; /** - * Unauthorized + * The invoice line's label; a default is derived when absent. */ - 401: Problem; + displayLabel?: string; /** - * Forbidden + * Order among the version's prices */ - 403: Problem; + displayOrder: number; /** - * Not Found + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 404: Problem; + isDefault: boolean; /** - * Conflict + * What a metered price measures. Absent on FLAT_FEE prices. */ - 409: Problem; + metered?: Meter; /** - * Unprocessable Entity + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 422: Problem; + status: "ACTIVE" | "DEPRECATED"; /** - * Internal Server Error + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 500: Problem; + unitAmount?: number; /** - * Service Unavailable + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - 503: Problem; + unitAmountDecimal: string; }; -export type UpsertCustomerIntegrationByExternalIdError = - UpsertCustomerIntegrationByExternalIdErrors[keyof UpsertCustomerIntegrationByExternalIdErrors]; - -export type UpsertCustomerIntegrationByExternalIdResponses = { +export type AddonUpdateWritable = { /** - * OK + * The members the change touched, as the API names them */ - 200: CustomerIntegrationResource; -}; - -export type UpsertCustomerIntegrationByExternalIdResponse = - UpsertCustomerIntegrationByExternalIdResponses[keyof UpsertCustomerIntegrationByExternalIdResponses]; - -export type GetInstanceIntegrationByExternalIdData = { - body?: never; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; - }; - query?: never; - url: "/integration/{adapter}/instance/{externalId}"; -}; - -export type GetInstanceIntegrationByExternalIdErrors = { + changedFields: Array | null; /** - * Unauthorized + * The licence families the version fits after the change */ - 401: Problem; + compatibleLicenseFamilies: Array | null; + description: string; /** - * Forbidden + * The family the version belongs to */ - 403: Problem; + familySlug: string; /** - * Not Found + * The version the family resolves to. Only a PUBLISHED version. */ - 404: Problem; + isDefault: boolean; /** - * Unprocessable Entity + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. */ - 422: Problem; + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Internal Server Error + * The largest quantity an instance can hold; unbounded when absent */ - 500: Problem; -}; - -export type GetInstanceIntegrationByExternalIdError = - GetInstanceIntegrationByExternalIdErrors[keyof GetInstanceIntegrationByExternalIdErrors]; - -export type GetInstanceIntegrationByExternalIdResponses = { + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * OK + * The version's slug, unique in the organization */ - 200: InstanceIntegrationResource; -}; - -export type GetInstanceIntegrationByExternalIdResponse = - GetInstanceIntegrationByExternalIdResponses[keyof GetInstanceIntegrationByExternalIdResponses]; - -export type UpsertInstanceIntegrationByExternalIdData = { - body: InstanceBody; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; - }; - query?: never; - url: "/integration/{adapter}/instance/{externalId}"; + slug: string; + versionName: string; }; -export type UpsertInstanceIntegrationByExternalIdErrors = { +export type BillingStartedWritable = { /** - * Bad Request + * The instant its periods are counted from */ - 400: Problem; + anchorAt: string; /** - * Unauthorized + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 401: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Forbidden + * Effective: the subscription's own, else the organization's default */ - 403: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Not Found + * The subscription's own collection method; absent when it takes the organization's */ - 404: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Conflict + * The next boundary: the period closes, and its invoice is composed, after it */ - 409: Problem; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Unprocessable Entity + * Effective: the subscription's own, else the organization's default */ - 422: Problem; + daysUntilDue: number; /** - * Internal Server Error + * The subscription's own payment terms; absent when it takes the organization's */ - 500: Problem; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Service Unavailable + * As it was at the subscription's last write */ - 503: Problem; -}; - -export type UpsertInstanceIntegrationByExternalIdError = - UpsertInstanceIntegrationByExternalIdErrors[keyof UpsertInstanceIntegrationByExternalIdErrors]; - -export type UpsertInstanceIntegrationByExternalIdResponses = { + instanceSlug: string; + pastDueSince?: string; /** - * OK + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 200: InstanceIntegrationResource; -}; - -export type UpsertInstanceIntegrationByExternalIdResponse = - UpsertInstanceIntegrationByExternalIdResponses[keyof UpsertInstanceIntegrationByExternalIdResponses]; - -export type ListLicenseFamiliesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/license-families"; + providerKind: "NOOP" | "STRIPE"; + /** + * Set when a CANCELED subscription was subscribed again + */ + resubscribed: boolean; + /** + * A plan change waiting for the next boundary + */ + scheduledChange?: ScheduledChangeWritable; + /** + * When billing started: usage before it is never billed + */ + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type ListLicenseFamiliesErrors = { +export type CanceledSubscriptionWritable = { /** - * Bad Request + * The instant its periods are counted from */ - 400: Problem; + anchorAt: string; /** - * Unauthorized + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 401: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Forbidden + * Effective: the subscription's own, else the organization's default */ - 403: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * The subscription's own collection method; absent when it takes the organization's */ - 422: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Internal Server Error + * The next boundary: the period closes, and its invoice is composed, after it */ - 500: Problem; -}; - -export type ListLicenseFamiliesError = ListLicenseFamiliesErrors[keyof ListLicenseFamiliesErrors]; - -export type ListLicenseFamiliesResponses = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * OK + * Effective: the subscription's own, else the organization's default */ - 200: PageLicenseFamilyView; -}; - -export type ListLicenseFamiliesResponse = - ListLicenseFamiliesResponses[keyof ListLicenseFamiliesResponses]; - -export type GetLicenseFamilyData = { - body?: never; - path: { - /** - * License family slug - */ - familySlug: string; - }; - query?: { - /** - * Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply. - */ - version?: number; - /** - * Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type. - */ - include?: Array<"versions">; - }; - url: "/license-families/{familySlug}"; -}; - -export type GetLicenseFamilyErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; /** - * Unauthorized + * The FINAL invoice of an immediate cancellation */ - 401: Problem; + finalInvoice?: InvoiceSummary; + id: string; + instanceName: string; /** - * Forbidden + * As it was at the subscription's last write */ - 403: Problem; + instanceSlug: string; + pastDueSince?: string; /** - * Not Found + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 404: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unprocessable Entity + * A plan change waiting for the next boundary */ - 422: Problem; + scheduledChange?: ScheduledChangeWritable; /** - * Internal Server Error + * When billing started: usage before it is never billed */ - 500: Problem; -}; - -export type GetLicenseFamilyError = GetLicenseFamilyErrors[keyof GetLicenseFamilyErrors]; - -export type GetLicenseFamilyResponses = { + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * OK + * When the trial ends, or ended: usage before it is never billed */ - 200: LicenseFamilyView; -}; - -export type GetLicenseFamilyResponse = GetLicenseFamilyResponses[keyof GetLicenseFamilyResponses]; - -export type GetLicensesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/licenses"; + trialEndsAt?: string; + updatedAt: string; }; -export type GetLicensesErrors = { +export type CancellationWritable = { /** - * Bad Request + * The instant its periods are counted from */ - 400: Problem; + anchorAt: string; /** - * Unauthorized + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 401: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Forbidden + * Effective: the subscription's own, else the organization's default */ - 403: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * The subscription's own collection method; absent when it takes the organization's */ - 422: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Internal Server Error + * The next boundary: the period closes, and its invoice is composed, after it */ - 500: Problem; -}; - -export type GetLicensesError = GetLicensesErrors[keyof GetLicensesErrors]; - -export type GetLicensesResponses = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * OK + * Effective: the subscription's own, else the organization's default */ - 200: PageLicense; -}; - -export type GetLicensesResponse = GetLicensesResponses[keyof GetLicensesResponses]; - -export type CreateLicenseData = { - body: LicenseWritable; - path?: never; - query?: never; - url: "/licenses"; -}; - -export type CreateLicenseErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; /** - * Unauthorized + * The FINAL invoice, when the cancellation issued one */ - 401: Problem; + finalInvoiceId?: string; + id: string; + instanceName: string; /** - * Forbidden + * As it was at the subscription's last write */ - 403: Problem; + instanceSlug: string; /** - * Not Found + * How it was canceled; a trial is canceled at once in either mode */ - 404: Problem; + mode: "AT_PERIOD_END" | "IMMEDIATE"; + pastDueSince?: string; /** - * Conflict + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 409: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unprocessable Entity + * A plan change waiting for the next boundary */ - 422: Problem; + scheduledChange?: ScheduledChangeWritable; /** - * Internal Server Error + * When billing started: usage before it is never billed */ - 500: Problem; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Service Unavailable + * When the trial ends, or ended: usage before it is never billed */ - 503: Problem; + trialEndsAt?: string; + updatedAt: string; }; -export type CreateLicenseError = CreateLicenseErrors[keyof CreateLicenseErrors]; - -export type CreateLicenseResponses = { +export type CancellationChangeWritable = { /** - * Created + * The instant its periods are counted from */ - 201: License; -}; - -export type CreateLicenseResponse = CreateLicenseResponses[keyof CreateLicenseResponses]; - -export type DeleteLicenseData = { - body?: never; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}"; -}; - -export type DeleteLicenseErrors = { + anchorAt: string; /** - * Bad Request + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 400: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Unauthorized + * Effective: the subscription's own, else the organization's default */ - 401: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Forbidden + * The subscription's own collection method; absent when it takes the organization's */ - 403: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Not Found + * The next boundary: the period closes, and its invoice is composed, after it */ - 404: Problem; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Conflict + * Effective: the subscription's own, else the organization's default */ - 409: Problem; + daysUntilDue: number; /** - * Unprocessable Entity + * The subscription's own payment terms; absent when it takes the organization's */ - 422: Problem; + daysUntilDueOverride?: number; /** - * Internal Server Error + * The boundary the cancellation takes effect at */ - 500: Problem; -}; - -export type DeleteLicenseError = DeleteLicenseErrors[keyof DeleteLicenseErrors]; - -export type DeleteLicenseResponses = { + effectiveAt: string; + id: string; + instanceName: string; /** - * No Content + * As it was at the subscription's last write */ - 204: void; -}; - -export type DeleteLicenseResponse = DeleteLicenseResponses[keyof DeleteLicenseResponses]; - -export type GetLicenseData = { - body?: never; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}"; + instanceSlug: string; + pastDueSince?: string; + /** + * Who collects its invoices. NOOP: the organization itself, through the handoff queue + */ + providerKind: "NOOP" | "STRIPE"; + /** + * A plan change waiting for the next boundary + */ + scheduledChange?: ScheduledChangeWritable; + /** + * When billing started: usage before it is never billed + */ + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type GetLicenseErrors = { +export type ComponentWritable = { /** - * Unauthorized + * Description of the component */ - 401: Problem; + description?: string; /** - * Forbidden + * Name of the component */ - 403: Problem; + name: string; /** - * Not Found + * Reference to the previous version of this component */ - 404: Problem; + previousComponentId?: string; /** - * Unprocessable Entity + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Version of the component */ - 500: Problem; + version: string; }; -export type GetLicenseError = GetLicenseErrors[keyof GetLicenseErrors]; - -export type GetLicenseResponses = { +export type ConnectorSettingsWritable = { /** - * OK + * Connector settings payload */ - 200: License; -}; - -export type GetLicenseResponse = GetLicenseResponses[keyof GetLicenseResponses]; - -export type UpdateLicenseData = { - body: LicenseWritable; - path: { - /** - * License slug - */ - licenseSlug: string; + settings: { + [key: string]: unknown; }; - query?: never; - url: "/licenses/{licenseSlug}"; }; -export type UpdateLicenseErrors = { - /** - * Bad Request - */ - 400: Problem; +export type CustomerWritable = { /** - * Unauthorized + * Where invoices sent to this customer are delivered, at most 254 characters (CreateCustomer.InvalidBillingEmail). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. Personal data: never included in event payloads. */ - 401: Problem; + billingEmail?: string; /** - * Forbidden + * Optional customer domain name */ - 403: Problem; + domain?: string; /** - * Not Found + * Optional identifier for the customer in an external system */ - 404: Problem; + externalCustomerId?: string | null; /** - * Conflict + * Integrations grouped by adapter name */ - 409: Problem; + integrations?: { + [key: string]: CustomerIntegrationWritable; + }; /** - * Unprocessable Entity + * Name of the customer */ - 422: Problem; + name: string; /** - * Internal Server Error + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 500: Problem; + slug?: string; }; -export type UpdateLicenseError = UpdateLicenseErrors[keyof UpdateLicenseErrors]; - -export type UpdateLicenseResponses = { +export type CustomerIntegrationWritable = { /** - * No Content + * External identifier in the third-party adapter */ - 204: void; -}; - -export type UpdateLicenseResponse = UpdateLicenseResponses[keyof UpdateLicenseResponses]; - -export type ArchiveLicenseData = { - body?: never; - path: { - /** - * License version slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/archive"; -}; - -export type ArchiveLicenseErrors = { + external_id: string; /** - * Bad Request + * Last synchronization error message, if any */ - 400: Problem; + last_error?: string; /** - * Unauthorized + * Adapter-specific integration metadata */ - 401: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Forbidden + * Absolute http(s) link to the record in the third-party system */ - 403: Problem; + web_url?: string; +}; + +export type DeploymentZoneWritable = { /** - * Not Found + * Description of the deployment zone */ - 404: Problem; + description: string; /** - * Conflict + * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema */ - 409: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Unprocessable Entity + * Name of the deployment zone */ - 422: Problem; + name: string; /** - * Internal Server Error + * Currently deployed release ID */ - 500: Problem; -}; - -export type ArchiveLicenseError = ArchiveLicenseErrors[keyof ArchiveLicenseErrors]; - -export type ArchiveLicenseResponses = { + releaseId?: string; /** - * OK + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 200: License; -}; - -export type ArchiveLicenseResponse = ArchiveLicenseResponses[keyof ArchiveLicenseResponses]; - -export type GetLicenseEntitlementsData = { - body?: never; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/licenses/{licenseSlug}/entitlements"; + slug?: string; + /** + * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. + */ + type: string; }; -export type GetLicenseEntitlementsErrors = { +export type EntitlementWritable = { /** - * Bad Request + * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. */ - 400: Problem; + aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; /** - * Unauthorized + * Description of the entitlement */ - 401: Problem; + description: string | null; /** - * Forbidden + * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. */ - 403: Problem; + displayOrder?: number; /** - * Not Found + * Groups associated with this entitlement, identified by slug */ - 404: Problem; + groupSlugs?: Array | null; /** - * Unprocessable Entity + * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. */ - 422: Problem; + icon?: string; /** - * Internal Server Error + * Name of the entitlement */ - 500: Problem; -}; - -export type GetLicenseEntitlementsError = - GetLicenseEntitlementsErrors[keyof GetLicenseEntitlementsErrors]; - -export type GetLicenseEntitlementsResponses = { + name: string; /** - * OK + * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. */ - 200: PageLicenseEntitlement; -}; - -export type GetLicenseEntitlementsResponse = - GetLicenseEntitlementsResponses[keyof GetLicenseEntitlementsResponses]; - -export type AssociateEntitlementWithLicenseData = { - body: LicenseEntitlementWritable; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements"; -}; - -export type AssociateEntitlementWithLicenseErrors = { + resetAnchor?: "CALENDAR" | "LICENSE_START"; /** - * Bad Request + * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. */ - 400: Problem; + resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; /** - * Unauthorized + * Number of base units one sale unit represents (1 sale unit = N base units). */ - 401: Problem; + saleUnitFactor?: number; /** - * Forbidden + * Plural label of the unit this entitlement is sold in, when it differs from the base unit. */ - 403: Problem; + saleUnitPlural?: string; /** - * Not Found + * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). */ - 404: Problem; + saleUnitSingular?: string; /** - * Conflict + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 409: Problem; + slug?: string; /** - * Unprocessable Entity + * Type of the entitlement */ - 422: Problem; + type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * Internal Server Error + * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. */ - 500: Problem; + unitPlural?: string; /** - * Service Unavailable + * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. */ - 503: Problem; -}; - -export type AssociateEntitlementWithLicenseError = - AssociateEntitlementWithLicenseErrors[keyof AssociateEntitlementWithLicenseErrors]; - -export type AssociateEntitlementWithLicenseResponses = { + unitSingular?: string; /** - * No Content + * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. */ - 204: void; + userFacing?: boolean; + /** + * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + */ + warningThresholdPercent?: number; }; -export type AssociateEntitlementWithLicenseResponse = - AssociateEntitlementWithLicenseResponses[keyof AssociateEntitlementWithLicenseResponses]; - -export type DeleteLicenseEntitlementData = { - body?: never; - path: { - licenseSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +export type EntitlementGroupWritable = { + /** + * Description of the entitlement group + */ + description: string | null; + /** + * Name of the entitlement group + */ + name: string; + /** + * URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; }; -export type DeleteLicenseEntitlementErrors = { +export type EntitlementGroupUsageWritable = { /** - * Bad Request + * End of the current usage window (exclusive). Null for a lifetime entitlement. */ - 400: Problem; + currentPeriodEnd?: string; /** - * Unauthorized + * Start of the current usage window (inclusive). Null for a lifetime entitlement. */ - 401: Problem; + currentPeriodStart?: string; /** - * Forbidden + * Entitlement ID */ - 403: Problem; + entitlementId: string; /** - * Not Found + * Entitlement name */ - 404: Problem; + entitlementName: string; /** - * Unprocessable Entity + * Entitlement slug */ - 422: Problem; + entitlementSlug: string; /** - * Internal Server Error + * Entitlement type */ - 500: Problem; -}; - -export type DeleteLicenseEntitlementError = - DeleteLicenseEntitlementErrors[keyof DeleteLicenseEntitlementErrors]; - -export type DeleteLicenseEntitlementResponses = { + entitlementType: string; /** - * No Content + * License limit value, discriminated by the 'type' field. Null when the license grants no value. */ - 204: void; -}; - -export type DeleteLicenseEntitlementResponse = - DeleteLicenseEntitlementResponses[keyof DeleteLicenseEntitlementResponses]; - -export type GetLicenseEntitlementData = { - body?: never; - path: { - licenseSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; + licenseValue?: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); + /** + * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. + */ + usageValue?: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type GetLicenseEntitlementErrors = { +export type EntitlementUsageWritable = { /** - * Unauthorized + * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). */ - 401: Problem; + currentPeriodEnd?: string; /** - * Forbidden + * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). */ - 403: Problem; + currentPeriodStart?: string; /** - * Not Found + * Unique identifier for the entitlement */ - 404: Problem; + entitlementId: string; /** - * Unprocessable Entity + * URL-friendly identifier of the entitlement */ - 422: Problem; + entitlementSlug: string; /** - * Internal Server Error + * Unique identifier for the license to which this entitlement usage belongs */ - 500: Problem; -}; - -export type GetLicenseEntitlementError = - GetLicenseEntitlementErrors[keyof GetLicenseEntitlementErrors]; - -export type GetLicenseEntitlementResponses = { + licenseId: string; /** - * OK + * URL-friendly identifier of the license */ - 200: LicenseEntitlement; -}; - -export type GetLicenseEntitlementResponse = - GetLicenseEntitlementResponses[keyof GetLicenseEntitlementResponses]; - -export type UpdateLicenseEntitlementData = { - body: LicenseEntitlementWritable; - path: { - licenseSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; + licenseSlug: string; + /** + * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + */ + limit?: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); + /** + * Resolved entitlement value, discriminated by the 'type' field + */ + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type UpdateLicenseEntitlementErrors = { +export type EventWritable = { /** - * Bad Request + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Forbidden + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 403: Problem; + billingTiming: "ADVANCE" | "ARREARS"; /** - * Not Found + * ISO 4217 code, upper case. One currency per licence version. */ - 404: Problem; + currency: string; /** - * Unprocessable Entity + * When the price was deprecated */ - 422: Problem; + deprecatedAt?: string; /** - * Internal Server Error + * The invoice line's label; a default is derived when absent. */ - 500: Problem; -}; - -export type UpdateLicenseEntitlementError = - UpdateLicenseEntitlementErrors[keyof UpdateLicenseEntitlementErrors]; - -export type UpdateLicenseEntitlementResponses = { + displayLabel?: string; /** - * No Content + * Order among the version's prices */ - 204: void; -}; - -export type UpdateLicenseEntitlementResponse = - UpdateLicenseEntitlementResponses[keyof UpdateLicenseEntitlementResponses]; - -export type PublishLicenseData = { - body?: never; - path: { - /** - * License version slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/publish"; -}; - -export type PublishLicenseErrors = { - /** - * Bad Request - */ - 400: Problem; + displayOrder: number; /** - * Unauthorized + * The family of that version */ - 401: Problem; + familySlug: string; /** - * Forbidden + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 403: Problem; + isDefault: boolean; /** - * Not Found + * The licence version the price belongs to */ - 404: Problem; + licenseSlug: string; /** - * Conflict + * What a metered price measures. Absent on FLAT_FEE prices. */ - 409: Problem; + metered?: Meter; /** - * Unprocessable Entity + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 422: Problem; + status: "ACTIVE" | "DEPRECATED"; /** - * Internal Server Error + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 500: Problem; -}; - -export type PublishLicenseError = PublishLicenseErrors[keyof PublishLicenseErrors]; - -export type PublishLicenseResponses = { + unitAmount?: number; /** - * OK + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - 200: License; + unitAmountDecimal: string; }; -export type PublishLicenseResponse = PublishLicenseResponses[keyof PublishLicenseResponses]; - -export type UnarchiveLicenseData = { - body?: never; - path: { - /** - * License version slug - */ - licenseSlug: string; +export type FeatureFlagWritable = { + default_variant: DefaultVariant; + description: string | null; + enabled: boolean; + event_name: string; + metadata: { + [key: string]: unknown; }; - query?: never; - url: "/licenses/{licenseSlug}/unarchive"; + name: string; + slug?: string; + targetings: Targetings; + type: "boolean" | "string" | "number" | "object"; + variants: Array | null; }; -export type UnarchiveLicenseErrors = { - /** - * Bad Request - */ - 400: Problem; - /** - * Unauthorized - */ - 401: Problem; - /** - * Forbidden - */ - 403: Problem; +export type InstanceWritable = { /** - * Not Found + * ID of the customer associated with this instance */ - 404: Problem; + customerId: string; /** - * Conflict + * ID of the deployment zone associated with this instance (optional) */ - 409: Problem; + deploymentZoneId?: string; /** - * Unprocessable Entity + * Brief description of the instance */ - 422: Problem; + description: string; /** - * Internal Server Error + * End date of the license for this instance */ - 500: Problem; -}; - -export type UnarchiveLicenseError = UnarchiveLicenseErrors[keyof UnarchiveLicenseErrors]; - -export type UnarchiveLicenseResponses = { + endLicenseDate: string; /** - * OK + * Integrations grouped by adapter name */ - 200: License; -}; - -export type UnarchiveLicenseResponse = UnarchiveLicenseResponses[keyof UnarchiveLicenseResponses]; - -export type ListMetadataFieldsData = { - body?: never; - path?: never; - query: { - resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; + integrations?: { + [key: string]: InstanceIntegrationWritable; }; - url: "/metadata-fields"; -}; - -export type ListMetadataFieldsErrors = { /** - * Bad Request + * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. */ - 400: Problem; + licenseId: string; /** - * Unauthorized + * Metadata for the instance */ - 401: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Forbidden + * Name of the instance */ - 403: Problem; + name: string; /** - * Unprocessable Entity + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Start date of the license for this instance */ - 500: Problem; + startLicenseDate: string; }; -export type ListMetadataFieldsError = ListMetadataFieldsErrors[keyof ListMetadataFieldsErrors]; - -export type ListMetadataFieldsResponses = { +export type InstanceAddonWritable = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + maxQuantity?: number; /** - * OK + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - 200: PageMetadataField; -}; - -export type ListMetadataFieldsResponse = - ListMetadataFieldsResponses[keyof ListMetadataFieldsResponses]; - -export type CreateMetadataFieldData = { - body: MetadataFieldWritable; - path?: never; - query?: never; - url: "/metadata-fields"; + prices: Array; + quantity: number; + removedAt?: string; }; -export type CreateMetadataFieldErrors = { +export type InstanceAddonUpdateWritable = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + instanceSlug: string; + maxQuantity?: number; /** - * Bad Request + * The quantity before a quantity change */ - 400: Problem; + previousQuantity?: number; /** - * Unauthorized + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - 401: Problem; + prices: Array; + quantity: number; + removedAt?: string; +}; + +export type InstanceBillingWritable = { /** - * Forbidden + * The instant its periods are counted from */ - 403: Problem; + anchorAt: string; /** - * Conflict + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 409: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Unprocessable Entity + * Effective: the subscription's own, else the organization's default */ - 422: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Internal Server Error + * The subscription's own collection method; absent when it takes the organization's */ - 500: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Service Unavailable + * The next boundary: the period closes, and its invoice is composed, after it */ - 503: Problem; -}; - -export type CreateMetadataFieldError = CreateMetadataFieldErrors[keyof CreateMetadataFieldErrors]; - -export type CreateMetadataFieldResponses = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Created + * Effective: the subscription's own, else the organization's default */ - 201: MetadataField; -}; - -export type CreateMetadataFieldResponse = - CreateMetadataFieldResponses[keyof CreateMetadataFieldResponses]; - -export type ReorderMetadataFieldsData = { - body: ReorderMetadataFieldsInput; - path?: never; - query?: never; - url: "/metadata-fields/reorder"; -}; - -export type ReorderMetadataFieldsErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Unauthorized + * As it was at the subscription's last write */ - 401: Problem; + instanceSlug: string; + pastDueSince?: string; /** - * Forbidden + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Not Found + * A plan change waiting for the next boundary */ - 404: Problem; + scheduledChange?: ScheduledChangeWritable; /** - * Unprocessable Entity + * When billing started: usage before it is never billed */ - 422: Problem; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Internal Server Error + * When the trial ends, or ended: usage before it is never billed */ - 500: Problem; + trialEndsAt?: string; + updatedAt: string; }; -export type ReorderMetadataFieldsError = - ReorderMetadataFieldsErrors[keyof ReorderMetadataFieldsErrors]; - -export type ReorderMetadataFieldsResponses = { +export type InstanceEntitlementValueGetWritable = { /** - * No Content + * Unique identifier for the entitlement */ - 204: void; -}; - -export type ReorderMetadataFieldsResponse = - ReorderMetadataFieldsResponses[keyof ReorderMetadataFieldsResponses]; - -export type UpdateMetadataFieldData = { - body: MetadataFieldWritable; - path: { - id: string; - }; - query?: never; - url: "/metadata-fields/{id}"; -}; - -export type UpdateMetadataFieldErrors = { + entitlement_id: string; /** - * Bad Request + * URL-friendly identifier of the entitlement */ - 400: Problem; + entitlement_slug: string; /** - * Unauthorized + * Unique identifier for the instance the value was read for */ - 401: Problem; + instance_id: string; /** - * Forbidden + * Unique identifier for the license carrying the entitlement */ - 403: Problem; + license_id: string; /** - * Not Found + * Unique identifier for the owning organization */ - 404: Problem; + organization_id: string; /** - * Conflict + * When the value was read */ - 409: Problem; + timestamp: string; /** - * Unprocessable Entity + * Discriminator of the resolved entitlement value */ - 422: Problem; + type: string; /** - * Internal Server Error + * Resolved entitlement value at read time */ - 500: Problem; + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type UpdateMetadataFieldError = UpdateMetadataFieldErrors[keyof UpdateMetadataFieldErrors]; - -export type UpdateMetadataFieldResponses = { +export type InstanceIntegrationWritable = { /** - * OK + * External identifier in the third-party adapter */ - 200: MetadataField; -}; - -export type UpdateMetadataFieldResponse = - UpdateMetadataFieldResponses[keyof UpdateMetadataFieldResponses]; - -export type ArchiveMetadataFieldData = { - body?: never; - path: { - id: string; + external_id: string; + /** + * Last synchronization error message, if any + */ + last_error?: string; + /** + * Adapter-specific integration metadata + */ + metadata?: { + [key: string]: unknown; }; - query?: never; - url: "/metadata-fields/{id}/archive"; + /** + * Absolute http(s) link to the record in the third-party system + */ + web_url?: string; }; -export type ArchiveMetadataFieldErrors = { +export type LicenseWritable = { /** - * Bad Request + * Detailed description of the license capabilities and restrictions */ - 400: Problem; + description: string; /** - * Unauthorized + * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). */ - 401: Problem; + familyId?: string; /** - * Forbidden + * Write-only on create: slug of the family this license is a new version of. familyId names the same family by identifier; sent together they must agree. Omit both to create a new family, of which this license becomes version 1. Never returned -- see familyId. Refused on update: a version cannot move between families. */ - 403: Problem; + familySlug?: string; /** - * Not Found + * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). */ - 404: Problem; + isDefault: boolean; /** - * Unprocessable Entity + * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. */ - 422: Problem; + lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Internal Server Error + * Display name of the license */ - 500: Problem; -}; - -export type ArchiveMetadataFieldError = - ArchiveMetadataFieldErrors[keyof ArchiveMetadataFieldErrors]; - -export type ArchiveMetadataFieldResponses = { + name: string; /** - * OK + * How this version is sold. FREE and PAID can be bought self-serve; CUSTOM sends a buyer to selfServeCtaUrl or a conversation. Always present in responses. On create it defaults to CUSTOM; on update, omit it to keep the stored value. */ - 200: MetadataField; -}; - -export type ArchiveMetadataFieldResponse = - ArchiveMetadataFieldResponses[keyof ArchiveMetadataFieldResponses]; - -export type DryRunMetadataFieldData = { - body: MetadataFieldSchemaProposal; - path: { - id: string; - }; - query?: never; - url: "/metadata-fields/{id}/dry-run"; -}; - -export type DryRunMetadataFieldErrors = { + pricingType?: "FREE" | "PAID" | "CUSTOM"; /** - * Bad Request + * Whether self-serve signup captures a payment method before activation. Always present in responses; false when omitted on create. On update, omit it to keep the stored value. */ - 400: Problem; + requiresPaymentMethod?: boolean; /** - * Unauthorized + * Where a buyer is sent when this version cannot be bought self-serve: an http(s) URL of at most 2048 characters (CreateLicense.InvalidSelfServeCtaUrl). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. */ - 401: Problem; + selfServeCtaUrl?: string; /** - * Forbidden + * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. */ - 403: Problem; + slug?: string; /** - * Not Found + * Trial length, in days, a subscription to this version starts with by default. Absent when there is none. Must be at least 1 on create (CreateLicense.InvalidTrialPeriodDays). On update, omit it to keep the stored value, or send 0 to remove the trial. */ - 404: Problem; + trialPeriodDays?: number; /** - * Unprocessable Entity + * Type of the license determining its capabilities and restrictions */ - 422: Problem; + type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; /** - * Internal Server Error + * Optional human-readable name for the license version. Defaults to "Version - ". */ - 500: Problem; + versionName?: string; }; -export type DryRunMetadataFieldError = DryRunMetadataFieldErrors[keyof DryRunMetadataFieldErrors]; - -export type DryRunMetadataFieldResponses = { +export type LicenseEntitlementWritable = { /** - * OK + * URL-friendly identifier for the entitlement */ - 200: Impact; -}; - -export type DryRunMetadataFieldResponse = - DryRunMetadataFieldResponses[keyof DryRunMetadataFieldResponses]; - -export type UnarchiveMetadataFieldData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/metadata-fields/{id}/unarchive"; -}; - -export type UnarchiveMetadataFieldErrors = { + entitlementSlug?: string; /** - * Bad Request + * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. */ - 400: Problem; + limitCapExceededOveragePercent?: number; /** - * Unauthorized + * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} */ - 401: Problem; + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); +}; + +export type LicenseFamilyViewWritable = { /** - * Forbidden + * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. */ - 403: Problem; + currentVersion?: LicenseWritable; /** - * Not Found + * Whether the family's default PUBLISHED version is listed in the public catalogue. Private by default. */ - 404: Problem; + isPublic: boolean; /** - * Conflict + * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. */ - 409: Problem; + slug: string; /** - * Unprocessable Entity + * Number of versions in this family, whatever their lifecycle state */ - 422: Problem; + versionCount: number; /** - * Internal Server Error + * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. */ - 500: Problem; + versions?: Array; }; -export type UnarchiveMetadataFieldError = - UnarchiveMetadataFieldErrors[keyof UnarchiveMetadataFieldErrors]; - -export type UnarchiveMetadataFieldResponses = { +export type MetadataFieldWritable = { /** - * OK + * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. */ - 200: MetadataField; -}; - -export type UnarchiveMetadataFieldResponse = - UnarchiveMetadataFieldResponses[keyof UnarchiveMetadataFieldResponses]; - -export type EvaluateFlagsBulkData = { + displayOrder?: number; /** - * EvaluateVariant multiple flags in one request + * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} */ - body?: BulkEvaluationRequest; - headers?: { - /** - * The request will be processed only if ETag doesn't match any of the values listed. - */ - "If-None-Match"?: string; + jsonSchema: { + [key: string]: unknown; }; - path?: never; - query?: never; - url: "/ofrep/v1/evaluate/flags"; -}; - -export type EvaluateFlagsBulkErrors = { /** - * Bad evaluation request + * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. */ - 400: BulkEvaluationFailure; + key: string; /** - * Unauthorized - You need credentials to access the API + * Human-readable label shown in the admin UI */ - 401: unknown; + label: string; /** - * Forbidden - You are not authorized to access the API + * Resource type this field applies to. Immutable after creation; update must echo back the stored value. */ - 403: unknown; + resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; +}; + +export type NumberEntitlementValueWritable = { /** - * Rate limit reached on the Flag Management System + * Value type discriminator */ - 429: unknown; + type: "number"; /** - * Internal server error + * Numeric value */ - 500: BulkEvaluationFailure; + value: number; }; -export type EvaluateFlagsBulkError = EvaluateFlagsBulkErrors[keyof EvaluateFlagsBulkErrors]; - -export type EvaluateFlagsBulkResponses = { +export type PageComponentWritable = { /** - * OFREP successful evaluation response + * Whether more rows exist beyond this page. */ - 200: - | { - /** - * Array of evaluation results - */ - flags?: Array; - } - | BulkEvaluationFailure; -}; - -export type EvaluateFlagsBulkResponse = - EvaluateFlagsBulkResponses[keyof EvaluateFlagsBulkResponses]; - -export type EvaluateFlagData = { + hasMore: boolean; + items: Array; /** - * Evaluation context + * Opaque cursor for the next page. Absent when hasMore is false. */ - body: EvaluationRequest; - path: { - key: string; - }; - query?: never; - url: "/ofrep/v1/evaluate/flags/{key}"; + nextCursor?: string; }; -export type EvaluateFlagErrors = { +export type PageCustomerWritable = { /** - * Evaluation failed + * Whether more rows exist beyond this page. */ - 400: EvaluationFailure; + hasMore: boolean; + items: Array; /** - * Internal error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: EvaluationFailure; + nextCursor?: string; }; -export type EvaluateFlagError = EvaluateFlagErrors[keyof EvaluateFlagErrors]; - -export type EvaluateFlagResponses = { +export type PageDeploymentZoneWritable = { /** - * Flag evaluated successfully + * Whether more rows exist beyond this page. */ - 200: EvaluationSuccess; -}; - -export type EvaluateFlagResponse = EvaluateFlagResponses[keyof EvaluateFlagResponses]; - -export type GetOpenfeatureManifestData = { - body?: never; - path?: never; - query?: never; - url: "/openfeature/v0/manifest"; -}; - -export type GetOpenfeatureManifestErrors = { + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageEntitlementWritable = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Internal Server Error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: Problem; + nextCursor?: string; }; -export type GetOpenfeatureManifestError = - GetOpenfeatureManifestErrors[keyof GetOpenfeatureManifestErrors]; - -export type GetOpenfeatureManifestResponses = { +export type PageEntitlementGroupWritable = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: ManifestEnvelope; -}; - -export type GetOpenfeatureManifestResponse = - GetOpenfeatureManifestResponses[keyof GetOpenfeatureManifestResponses]; - -export type ListReleasesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/releases"; -}; - -export type ListReleasesErrors = { + hasMore: boolean; + items: Array; /** - * Bad Request + * Opaque cursor for the next page. Absent when hasMore is false. */ - 400: Problem; + nextCursor?: string; +}; + +export type PageFeatureFlagWritable = { /** - * Unauthorized + * Whether more rows exist beyond this page. */ - 401: Problem; + hasMore: boolean; + items: Array; /** - * Forbidden + * Opaque cursor for the next page. Absent when hasMore is false. */ - 403: Problem; + nextCursor?: string; +}; + +export type PageInstanceWritable = { /** - * Unprocessable Entity + * Whether more rows exist beyond this page. */ - 422: Problem; + hasMore: boolean; + items: Array; /** - * Internal Server Error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: Problem; + nextCursor?: string; }; -export type ListReleasesError = ListReleasesErrors[keyof ListReleasesErrors]; - -export type ListReleasesResponses = { +export type PageLicenseWritable = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: PageRelease; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListReleasesResponse = ListReleasesResponses[keyof ListReleasesResponses]; - -export type CreateReleaseData = { - body: ReleaseWritable; - path?: never; - query?: never; - url: "/releases"; +export type PageLicenseEntitlementWritable = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateReleaseErrors = { +export type PageLicenseFamilyViewWritable = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageMetadataFieldWritable = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Not Found + * Opaque cursor for the next page. Absent when hasMore is false. */ - 404: Problem; + nextCursor?: string; +}; + +export type PageReleaseWritable = { /** - * Conflict + * Whether more rows exist beyond this page. */ - 409: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageServiceAccountWritable = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; /** - * Service Unavailable + * Opaque cursor for the next page. Absent when hasMore is false. */ - 503: Problem; + nextCursor?: string; }; -export type CreateReleaseError = CreateReleaseErrors[keyof CreateReleaseErrors]; - -export type CreateReleaseResponses = { +export type PageTokenWritable = { /** - * Created + * Whether more rows exist beyond this page. */ - 201: Release; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateReleaseResponse = CreateReleaseResponses[keyof CreateReleaseResponses]; - -export type DeleteReleaseData = { - body?: never; - path: { - /** - * Release slug - */ - releaseSlug: string; - }; - query?: never; - url: "/releases/{releaseSlug}"; +export type PlainTokenWritable = { + expiresAt?: string; + name: string; + scopes: Array | null; + /** + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + */ + slug?: string; }; -export type DeleteReleaseErrors = { +export type PriceWritable = { /** - * Bad Request + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Forbidden + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 403: Problem; + billingTiming: "ADVANCE" | "ARREARS"; /** - * Not Found + * ISO 4217 code, upper case. One currency per licence version. */ - 404: Problem; + currency: string; /** - * Conflict + * When the price was deprecated */ - 409: Problem; + deprecatedAt?: string; /** - * Unprocessable Entity + * The invoice line's label; a default is derived when absent. */ - 422: Problem; + displayLabel?: string; /** - * Internal Server Error + * Order among the version's prices */ - 500: Problem; -}; - -export type DeleteReleaseError = DeleteReleaseErrors[keyof DeleteReleaseErrors]; - -export type DeleteReleaseResponses = { + displayOrder: number; /** - * No Content + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 204: void; + isDefault: boolean; + /** + * What a metered price measures. Absent on FLAT_FEE prices. + */ + metered?: Meter; + /** + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + */ + status: "ACTIVE" | "DEPRECATED"; + /** + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. + */ + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; }; -export type DeleteReleaseResponse = DeleteReleaseResponses[keyof DeleteReleaseResponses]; - -export type GetReleaseBySlugData = { - body?: never; - path: { - /** - * Release slug - */ - releaseSlug: string; - }; - query?: never; - url: "/releases/{releaseSlug}"; +export type PublishableKeyWritable = { + /** + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. + */ + allowedOrigins: Array; + /** + * What the key is for, to tell keys apart + */ + label: string; }; -export type GetReleaseBySlugErrors = { +export type PublishableKeyCreatedWritable = { /** - * Unauthorized + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. */ - 401: Problem; + allowedOrigins: Array; /** - * Forbidden + * What the key is for, to tell keys apart */ - 403: Problem; + label: string; +}; + +export type RedemptionWritable = { /** - * Not Found + * Invoices a PRICE voucher discounted */ - 404: Problem; + applicationsCount: number; /** - * Unprocessable Entity + * 1 for ONE_TIME, durationInPeriods for REPEATING; absent for FOREVER */ - 422: Problem; + applicationsMax?: number; + codeHint: string; /** - * Internal Server Error + * When a boost stops applying; absent for a PRICE voucher, counted in invoices, and for FOREVER */ - 500: Problem; + effectiveExpiresAt?: string; + effectiveStartsAt: string; + expiredAt?: string; + instanceSlug: string; + redeemedAt: string; + revokedAt?: string; + revokedReason?: string; + status: "ACTIVE" | "EXPIRED" | "REVOKED"; + voucherId: string; + voucherName: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; }; -export type GetReleaseBySlugError = GetReleaseBySlugErrors[keyof GetReleaseBySlugErrors]; +export type ReleaseWritable = { + /** + * List of component IDs to link to this release + */ + componentIds?: Array | null; + /** + * Description of the release + */ + description?: string; + /** + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; + /** + * Version of the release + */ + version: string; +}; -export type GetReleaseBySlugResponses = { +export type ReportEntitlementUsageBodyWritable = { /** - * OK + * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it */ - 200: Release; + behavior?: "append" | "set"; + /** + * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. + */ + metadata?: { + [key: string]: unknown; + }; + /** + * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. + */ + transactionId?: string; + /** + * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + */ + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type GetReleaseBySlugResponse = GetReleaseBySlugResponses[keyof GetReleaseBySlugResponses]; +export type ScheduledChangeWritable = { + /** + * The boundary it applies at: the current period's end + */ + effectiveAt: string; + /** + * The FLAT_FEE price the subscription moves to + */ + price: PriceWritable; + scheduledAt: string; +}; -export type GetServiceAccountsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/service-accounts"; +export type ServiceAccountWritable = { + name: string; + /** + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; }; -export type GetServiceAccountsErrors = { +export type StartedSubscriptionWritable = { /** - * Bad Request + * The invoice of the first period, when the base price bills in advance; absent otherwise. Charged automatically, it is pushed and charged before this answer when the provider answers within 20 seconds: its status says how it went. */ - 400: Problem; + activationInvoice?: InvoiceSummary; /** - * Unauthorized + * The instant its periods are counted from */ - 401: Problem; + anchorAt: string; /** - * Forbidden + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 403: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Not Found + * Effective: the subscription's own, else the organization's default */ - 404: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * The subscription's own collection method; absent when it takes the organization's */ - 422: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Internal Server Error + * The next boundary: the period closes, and its invoice is composed, after it */ - 500: Problem; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; + /** + * Effective: the subscription's own, else the organization's default + */ + daysUntilDue: number; + /** + * The subscription's own payment terms; absent when it takes the organization's + */ + daysUntilDueOverride?: number; + id: string; + instanceName: string; + /** + * As it was at the subscription's last write + */ + instanceSlug: string; + pastDueSince?: string; + /** + * Who collects its invoices. NOOP: the organization itself, through the handoff queue + */ + providerKind: "NOOP" | "STRIPE"; + /** + * A plan change waiting for the next boundary + */ + scheduledChange?: ScheduledChangeWritable; + /** + * When billing started: usage before it is never billed + */ + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type GetServiceAccountsError = GetServiceAccountsErrors[keyof GetServiceAccountsErrors]; +export type TokenWritable = { + expiresAt?: string; + name: string; + scopes: Array | null; + /** + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + */ + slug?: string; +}; -export type GetServiceAccountsResponses = { +export type UpdatedEventWritable = { /** - * OK + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 200: PageServiceAccount; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; + /** + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. + */ + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + /** + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. + */ + billingTiming: "ADVANCE" | "ARREARS"; + /** + * The members the update changed, as the API names them + */ + changedFields: Array | null; + /** + * ISO 4217 code, upper case. One currency per licence version. + */ + currency: string; + /** + * When the price was deprecated + */ + deprecatedAt?: string; + /** + * The invoice line's label; a default is derived when absent. + */ + displayLabel?: string; + /** + * Order among the version's prices + */ + displayOrder: number; + /** + * The family of that version + */ + familySlug: string; + /** + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. + */ + isDefault: boolean; + /** + * The licence version the price belongs to + */ + licenseSlug: string; + /** + * What a metered price measures. Absent on FLAT_FEE prices. + */ + metered?: Meter; + /** + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + */ + status: "ACTIVE" | "DEPRECATED"; + /** + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. + */ + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; }; -export type GetServiceAccountsResponse = - GetServiceAccountsResponses[keyof GetServiceAccountsResponses]; +export type ValidityWritable = { + /** + * The first failing check + */ + reason?: + | "NOT_FOUND" + | "NOT_ACTIVE" + | "NOT_YET_VALID" + | "EXPIRED" + | "EXHAUSTED" + | "ALREADY_REDEEMED" + | "NOT_ELIGIBLE" + | "CURRENCY_MISMATCH"; + /** + * With NOT_ELIGIBLE: the eligibility rule + */ + rule?: + | "RESTRICTED_CUSTOMER" + | "LICENSE_NOT_APPLICABLE" + | "ADDON_NOT_APPLICABLE" + | "FIRST_TIME_ONLY" + | "ANNUAL_ONLY" + | "MINIMUM_SUBSCRIPTION_AMOUNT" + | "NOTHING_TO_BOOST"; + valid: boolean; + /** + * The voucher, without its code, when the code names one + */ + voucher?: VoucherWritable; +}; -export type CreateServiceAccountData = { +export type VoucherWritable = { /** - * Service account details + * Only instances holding one of these add-on versions can redeem it; any when empty */ - body: ServiceAccountWritable; + applicableAddonIds: Array; + applicableAddonPriceIds: Array; + /** + * Only instances on these licence versions can redeem it; any when empty + */ + applicableLicenseIds: Array; + applicableLicensePriceIds: Array; + /** + * The code to redeem. Returned to read:vouchers callers only; never in an event. + */ + code?: string; + /** + * The last four characters of the normalized code + */ + codeHint: string; + /** + * The currency of a FIXED_AMOUNT discount + */ + currency?: string; + description?: string; + /** + * PRICE: how many invoices it discounts (one, durationInPeriods, or every one). BOOST: how long a redemption lasts, in the subscription's billing periods. + */ + duration: "ONE_TIME" | "REPEATING" | "FOREVER"; + durationInPeriods?: number; + expiresAt?: string; + /** + * What an ENTITLEMENT_BOOST changes + */ + grants: Array; + maxRedemptions?: number; + name: string; + priceAppliesTo?: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; + priceDiscountType?: "PERCENTAGE" | "FIXED_AMOUNT"; + /** + * A percentage in (0, 100], or an integer amount in minor units of currency + */ + priceDiscountValue?: string; + redemptionRules: RedemptionRules; + redemptionsCount: number; + /** + * Only this customer's instances can redeem it + */ + restrictedCustomerSlug?: string; + startsAt?: string; + status: "DRAFT" | "ACTIVE" | "EXPIRED" | "EXHAUSTED" | "ARCHIVED"; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; +}; + +export type ListAddonFamiliesData = { + body?: never; path?: never; query?: never; - url: "/service-accounts"; + url: "/addon-families"; }; -export type CreateServiceAccountErrors = { +export type ListAddonFamiliesErrors = { /** * Bad Request */ @@ -8146,10 +7905,6 @@ export type CreateServiceAccountErrors = { * Not Found */ 404: Problem; - /** - * Conflict - */ - 409: Problem; /** * Unprocessable Entity */ @@ -8164,32 +7919,31 @@ export type CreateServiceAccountErrors = { 503: Problem; }; -export type CreateServiceAccountError = - CreateServiceAccountErrors[keyof CreateServiceAccountErrors]; +export type ListAddonFamiliesError = ListAddonFamiliesErrors[keyof ListAddonFamiliesErrors]; -export type CreateServiceAccountResponses = { +export type ListAddonFamiliesResponses = { /** - * Created service account + * OK */ - 201: ServiceAccount; + 200: Array; }; -export type CreateServiceAccountResponse = - CreateServiceAccountResponses[keyof CreateServiceAccountResponses]; +export type ListAddonFamiliesResponse = + ListAddonFamiliesResponses[keyof ListAddonFamiliesResponses]; -export type GetServiceAccountData = { +export type GetAddonFamilyData = { body?: never; path: { /** - * Service account slug + * Add-on family slug */ - serviceAccountSlug: string; + familySlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}"; + url: "/addon-families/{familySlug}"; }; -export type GetServiceAccountErrors = { +export type GetAddonFamilyErrors = { /** * Bad Request */ @@ -8214,36 +7968,36 @@ export type GetServiceAccountErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type GetServiceAccountError = GetServiceAccountErrors[keyof GetServiceAccountErrors]; +export type GetAddonFamilyError = GetAddonFamilyErrors[keyof GetAddonFamilyErrors]; -export type GetServiceAccountResponses = { +export type GetAddonFamilyResponses = { /** - * Service account details + * OK */ - 200: ServiceAccount; + 200: AddonFamily; }; -export type GetServiceAccountResponse = - GetServiceAccountResponses[keyof GetServiceAccountResponses]; +export type GetAddonFamilyResponse = GetAddonFamilyResponses[keyof GetAddonFamilyResponses]; -export type UpdateServiceAccountData = { - /** - * Service account update details - */ - body: ServiceAccountWritable; +export type UpdateAddonFamilyData = { + body: AddonFamilyVisibility; path: { /** - * Service account slug + * Add-on family slug */ - serviceAccountSlug: string; + familySlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}"; + url: "/addon-families/{familySlug}"; }; -export type UpdateServiceAccountErrors = { +export type UpdateAddonFamilyErrors = { /** * Bad Request */ @@ -8268,43 +8022,41 @@ export type UpdateServiceAccountErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type UpdateServiceAccountError = - UpdateServiceAccountErrors[keyof UpdateServiceAccountErrors]; +export type UpdateAddonFamilyError = UpdateAddonFamilyErrors[keyof UpdateAddonFamilyErrors]; -export type UpdateServiceAccountResponses = { +export type UpdateAddonFamilyResponses = { /** - * No Content + * OK */ - 204: void; + 200: AddonFamily; }; -export type UpdateServiceAccountResponse = - UpdateServiceAccountResponses[keyof UpdateServiceAccountResponses]; +export type UpdateAddonFamilyResponse = + UpdateAddonFamilyResponses[keyof UpdateAddonFamilyResponses]; -export type GetServiceAccountTokensData = { +export type ListAddonsData = { body?: never; - path: { - /** - * Service account slug - */ - serviceAccountSlug: string; - }; + path?: never; query?: { /** - * Opaque pagination cursor from a previous response's nextCursor + * Only versions in this state */ - cursor?: string; + lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Maximum number of entries to return (default 50, max 200) + * Only versions of this family */ - limit?: number; + familySlug?: string; }; - url: "/service-accounts/{serviceAccountSlug}/tokens"; + url: "/addons"; }; -export type GetServiceAccountTokensErrors = { +export type ListAddonsErrors = { /** * Bad Request */ @@ -8329,37 +8081,89 @@ export type GetServiceAccountTokensErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type GetServiceAccountTokensError = - GetServiceAccountTokensErrors[keyof GetServiceAccountTokensErrors]; +export type ListAddonsError = ListAddonsErrors[keyof ListAddonsErrors]; -export type GetServiceAccountTokensResponses = { +export type ListAddonsResponses = { /** * OK */ - 200: PageToken; + 200: Array; }; -export type GetServiceAccountTokensResponse = - GetServiceAccountTokensResponses[keyof GetServiceAccountTokensResponses]; +export type ListAddonsResponse = ListAddonsResponses[keyof ListAddonsResponses]; -export type CreateServiceAccountTokenData = { +export type CreateAddonData = { + body: NewAddon; + path?: never; + query?: never; + url: "/addons"; +}; + +export type CreateAddonErrors = { /** - * Token creation details + * Bad Request */ - body: PlainTokenWritable; + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateAddonError = CreateAddonErrors[keyof CreateAddonErrors]; + +export type CreateAddonResponses = { + /** + * Created + */ + 201: Addon; +}; + +export type CreateAddonResponse = CreateAddonResponses[keyof CreateAddonResponses]; + +export type DeleteAddonData = { + body?: never; path: { /** - * Service account slug + * Add-on version slug */ - serviceAccountSlug: string; + addonSlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}/tokens"; + url: "/addons/{addonSlug}"; }; -export type CreateServiceAccountTokenErrors = { +export type DeleteAddonErrors = { /** * Bad Request */ @@ -8394,36 +8198,30 @@ export type CreateServiceAccountTokenErrors = { 503: Problem; }; -export type CreateServiceAccountTokenError = - CreateServiceAccountTokenErrors[keyof CreateServiceAccountTokenErrors]; +export type DeleteAddonError = DeleteAddonErrors[keyof DeleteAddonErrors]; -export type CreateServiceAccountTokenResponses = { +export type DeleteAddonResponses = { /** - * Created token with secret value (only shown once) + * No Content */ - 201: PlainToken; + 204: void; }; -export type CreateServiceAccountTokenResponse = - CreateServiceAccountTokenResponses[keyof CreateServiceAccountTokenResponses]; +export type DeleteAddonResponse = DeleteAddonResponses[keyof DeleteAddonResponses]; -export type DeleteServiceAccountTokenData = { +export type GetAddonData = { body?: never; path: { /** - * Service account slug - */ - serviceAccountSlug: string; - /** - * Token slug to revoke + * Add-on version slug */ - tokenSlug: string; + addonSlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}"; + url: "/addons/{addonSlug}"; }; -export type DeleteServiceAccountTokenErrors = { +export type GetAddonErrors = { /** * Bad Request */ @@ -8448,58 +8246,36 @@ export type DeleteServiceAccountTokenErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type DeleteServiceAccountTokenError = - DeleteServiceAccountTokenErrors[keyof DeleteServiceAccountTokenErrors]; +export type GetAddonError = GetAddonErrors[keyof GetAddonErrors]; -export type DeleteServiceAccountTokenResponses = { +export type GetAddonResponses = { /** - * No Content + * OK */ - 204: void; + 200: Addon; }; -export type DeleteServiceAccountTokenResponse = - DeleteServiceAccountTokenResponses[keyof DeleteServiceAccountTokenResponses]; +export type GetAddonResponse = GetAddonResponses[keyof GetAddonResponses]; -export type ExportOrganizationUsageReportsData = { - body?: never; - path?: never; - query?: { - /** - * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - */ - from?: string; - /** - * End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. - */ - to?: string; - /** - * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat. - */ - format?: string; - /** - * Only this instance's reports - */ - instanceSlug?: string; - /** - * Only this instance's reports. Reaches a deleted instance, whose reports are kept. - */ - instanceId?: string; - /** - * Only this entitlement's reports - */ - entitlementSlug?: string; +export type UpdateAddonData = { + body: AddonChanges; + path: { /** - * Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. + * Add-on version slug */ - entitlementId?: string; + addonSlug: string; }; - url: "/usage/reports/export"; + query?: never; + url: "/addons/{addonSlug}"; }; -export type ExportOrganizationUsageReportsErrors = { +export type UpdateAddonErrors = { /** * Bad Request */ @@ -8516,6 +8292,10 @@ export type ExportOrganizationUsageReportsErrors = { * Not Found */ 404: Problem; + /** + * Conflict + */ + 409: Problem; /** * Unprocessable Entity */ @@ -8524,29 +8304,40 @@ export type ExportOrganizationUsageReportsErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type ExportOrganizationUsageReportsError = - ExportOrganizationUsageReportsErrors[keyof ExportOrganizationUsageReportsErrors]; +export type UpdateAddonError = UpdateAddonErrors[keyof UpdateAddonErrors]; -export type ExportOrganizationUsageReportsResponses = { +export type UpdateAddonResponses = { /** - * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + * OK */ - 200: string; + 200: Addon; }; -export type ExportOrganizationUsageReportsResponse = - ExportOrganizationUsageReportsResponses[keyof ExportOrganizationUsageReportsResponses]; +export type UpdateAddonResponse = UpdateAddonResponses[keyof UpdateAddonResponses]; -export type GetNotificationPreferencesData = { +export type ArchiveAddonData = { body?: never; - path?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; query?: never; - url: "/v1/notification-preferences"; + url: "/addons/{addonSlug}/archive"; }; -export type GetNotificationPreferencesErrors = { +export type ArchiveAddonErrors = { + /** + * Bad Request + */ + 400: Problem; /** * Unauthorized */ @@ -8555,33 +8346,52 @@ export type GetNotificationPreferencesErrors = { * Forbidden */ 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; /** * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type GetNotificationPreferencesError = - GetNotificationPreferencesErrors[keyof GetNotificationPreferencesErrors]; +export type ArchiveAddonError = ArchiveAddonErrors[keyof ArchiveAddonErrors]; -export type GetNotificationPreferencesResponses = { +export type ArchiveAddonResponses = { /** * OK */ - 200: PreferenceMatrix; + 200: Addon; }; -export type GetNotificationPreferencesResponse = - GetNotificationPreferencesResponses[keyof GetNotificationPreferencesResponses]; +export type ArchiveAddonResponse = ArchiveAddonResponses[keyof ArchiveAddonResponses]; -export type PutNotificationPreferencesData = { - body: PreferenceChoices; - path?: never; +export type ListAddonCompatibilityData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; query?: never; - url: "/v1/notification-preferences"; + url: "/addons/{addonSlug}/compatible-license-families"; }; -export type PutNotificationPreferencesErrors = { +export type ListAddonCompatibilityErrors = { /** * Bad Request */ @@ -8594,6 +8404,10 @@ export type PutNotificationPreferencesErrors = { * Forbidden */ 403: Problem; + /** + * Not Found + */ + 404: Problem; /** * Unprocessable Entity */ @@ -8602,672 +8416,11625 @@ export type PutNotificationPreferencesErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type PutNotificationPreferencesError = - PutNotificationPreferencesErrors[keyof PutNotificationPreferencesErrors]; +export type ListAddonCompatibilityError = + ListAddonCompatibilityErrors[keyof ListAddonCompatibilityErrors]; -export type PutNotificationPreferencesResponses = { +export type ListAddonCompatibilityResponses = { /** * OK */ - 200: PreferenceMatrix; + 200: CompatibleLicenseFamilies; }; -export type PutNotificationPreferencesResponse = - PutNotificationPreferencesResponses[keyof PutNotificationPreferencesResponses]; +export type ListAddonCompatibilityResponse = + ListAddonCompatibilityResponses[keyof ListAddonCompatibilityResponses]; -export type ListNotificationsData = { +export type RemoveAddonCompatibilityData = { body?: never; - path?: never; - query?: { - /** - * Which notifications to return (default all) - */ - status?: "all" | "unread"; - /** - * Only notifications about these kinds of object; repeat the parameter for several (default: all) - */ - objectType?: Array< - "instance" | "customer" | "release" | "deployment_zone" | "component" | "license" | "token" - > | null; + path: { /** - * Opaque cursor from a previous response's next_cursor + * Add-on version slug */ - cursor?: string; + addonSlug: string; /** - * Page size (default 20, max 50) + * License family slug */ - limit?: number; + familySlug: string; }; - url: "/v1/notifications"; + query?: never; + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}"; }; -export type ListNotificationsErrors = { +export type RemoveAddonCompatibilityErrors = { /** * Bad Request */ 400: Problem; /** - * Unauthorized + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RemoveAddonCompatibilityError = + RemoveAddonCompatibilityErrors[keyof RemoveAddonCompatibilityErrors]; + +export type RemoveAddonCompatibilityResponses = { + /** + * No Content + */ + 204: void; +}; + +export type RemoveAddonCompatibilityResponse = + RemoveAddonCompatibilityResponses[keyof RemoveAddonCompatibilityResponses]; + +export type SetAddonCompatibilityData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * License family slug + */ + familySlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}"; +}; + +export type SetAddonCompatibilityErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SetAddonCompatibilityError = + SetAddonCompatibilityErrors[keyof SetAddonCompatibilityErrors]; + +export type SetAddonCompatibilityResponses = { + /** + * No Content + */ + 204: void; +}; + +export type SetAddonCompatibilityResponse = + SetAddonCompatibilityResponses[keyof SetAddonCompatibilityResponses]; + +export type ListAddonEntitlementsData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements"; +}; + +export type ListAddonEntitlementsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListAddonEntitlementsError = + ListAddonEntitlementsErrors[keyof ListAddonEntitlementsErrors]; + +export type ListAddonEntitlementsResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListAddonEntitlementsResponse = + ListAddonEntitlementsResponses[keyof ListAddonEntitlementsResponses]; + +export type AssignAddonEntitlementData = { + body: NewAddonGrant; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements"; +}; + +export type AssignAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AssignAddonEntitlementError = + AssignAddonEntitlementErrors[keyof AssignAddonEntitlementErrors]; + +export type AssignAddonEntitlementResponses = { + /** + * Created + */ + 201: AddonEntitlement; +}; + +export type AssignAddonEntitlementResponse = + AssignAddonEntitlementResponses[keyof AssignAddonEntitlementResponses]; + +export type UnassignAddonEntitlementData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}"; +}; + +export type UnassignAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UnassignAddonEntitlementError = + UnassignAddonEntitlementErrors[keyof UnassignAddonEntitlementErrors]; + +export type UnassignAddonEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UnassignAddonEntitlementResponse = + UnassignAddonEntitlementResponses[keyof UnassignAddonEntitlementResponses]; + +export type GetAddonEntitlementData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}"; +}; + +export type GetAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetAddonEntitlementError = GetAddonEntitlementErrors[keyof GetAddonEntitlementErrors]; + +export type GetAddonEntitlementResponses = { + /** + * OK + */ + 200: AddonEntitlement; +}; + +export type GetAddonEntitlementResponse = + GetAddonEntitlementResponses[keyof GetAddonEntitlementResponses]; + +export type UpdateAddonEntitlementData = { + body: AddonGrant; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}"; +}; + +export type UpdateAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateAddonEntitlementError = + UpdateAddonEntitlementErrors[keyof UpdateAddonEntitlementErrors]; + +export type UpdateAddonEntitlementResponses = { + /** + * OK + */ + 200: AddonEntitlement; +}; + +export type UpdateAddonEntitlementResponse = + UpdateAddonEntitlementResponses[keyof UpdateAddonEntitlementResponses]; + +export type ListAddonPricesData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: { + /** + * Only prices in this status; both when omitted + */ + status?: "ACTIVE" | "DEPRECATED"; + }; + url: "/addons/{addonSlug}/prices"; +}; + +export type ListAddonPricesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListAddonPricesError = ListAddonPricesErrors[keyof ListAddonPricesErrors]; + +export type ListAddonPricesResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListAddonPricesResponse = ListAddonPricesResponses[keyof ListAddonPricesResponses]; + +export type CreateAddonPriceData = { + body: NewAddonPrice; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/prices"; +}; + +export type CreateAddonPriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateAddonPriceError = CreateAddonPriceErrors[keyof CreateAddonPriceErrors]; + +export type CreateAddonPriceResponses = { + /** + * Created + */ + 201: Price; +}; + +export type CreateAddonPriceResponse = CreateAddonPriceResponses[keyof CreateAddonPriceResponses]; + +export type DeprecateAddonPriceData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Price id + */ + priceId: string; + }; + query?: never; + url: "/addons/{addonSlug}/prices/{priceId}/deprecate"; +}; + +export type DeprecateAddonPriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DeprecateAddonPriceError = DeprecateAddonPriceErrors[keyof DeprecateAddonPriceErrors]; + +export type DeprecateAddonPriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type DeprecateAddonPriceResponse = + DeprecateAddonPriceResponses[keyof DeprecateAddonPriceResponses]; + +export type PublishAddonData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/publish"; +}; + +export type PublishAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type PublishAddonError = PublishAddonErrors[keyof PublishAddonErrors]; + +export type PublishAddonResponses = { + /** + * OK + */ + 200: Addon; +}; + +export type PublishAddonResponse = PublishAddonResponses[keyof PublishAddonResponses]; + +export type UnarchiveAddonData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/unarchive"; +}; + +export type UnarchiveAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UnarchiveAddonError = UnarchiveAddonErrors[keyof UnarchiveAddonErrors]; + +export type UnarchiveAddonResponses = { + /** + * OK + */ + 200: Addon; +}; + +export type UnarchiveAddonResponse = UnarchiveAddonResponses[keyof UnarchiveAddonResponses]; + +export type GetBillingCapabilitiesData = { + body?: never; + path?: never; + query?: never; + url: "/billing/capabilities"; +}; + +export type GetBillingCapabilitiesErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetBillingCapabilitiesError = + GetBillingCapabilitiesErrors[keyof GetBillingCapabilitiesErrors]; + +export type GetBillingCapabilitiesResponses = { + /** + * OK + */ + 200: BillingCapabilities; +}; + +export type GetBillingCapabilitiesResponse = + GetBillingCapabilitiesResponses[keyof GetBillingCapabilitiesResponses]; + +export type CloseBillingPeriodsData = { + body: ClosePeriodsScope; + path?: never; + query?: never; + url: "/billing/close-periods"; +}; + +export type CloseBillingPeriodsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CloseBillingPeriodsError = CloseBillingPeriodsErrors[keyof CloseBillingPeriodsErrors]; + +export type CloseBillingPeriodsResponses = { + /** + * OK + */ + 200: Report; +}; + +export type CloseBillingPeriodsResponse = + CloseBillingPeriodsResponses[keyof CloseBillingPeriodsResponses]; + +export type ListHandoffData = { + body?: never; + path?: never; + query?: { + /** + * PENDING (the default) or ACKNOWLEDGED + */ + status?: "PENDING" | "ACKNOWLEDGED"; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + }; + url: "/billing/handoff"; +}; + +export type ListHandoffErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListHandoffError = ListHandoffErrors[keyof ListHandoffErrors]; + +export type ListHandoffResponses = { + /** + * OK + */ + 200: PageQueuedInvoice; +}; + +export type ListHandoffResponse = ListHandoffResponses[keyof ListHandoffResponses]; + +export type ClaimHandoffData = { + body: HandoffClaimSize; + path?: never; + query?: never; + url: "/billing/handoff/claim"; +}; + +export type ClaimHandoffErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ClaimHandoffError = ClaimHandoffErrors[keyof ClaimHandoffErrors]; + +export type ClaimHandoffResponses = { + /** + * OK + */ + 200: HandoffClaim; +}; + +export type ClaimHandoffResponse = ClaimHandoffResponses[keyof ClaimHandoffResponses]; + +export type AckHandoffData = { + body: HandoffBooking; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/billing/handoff/{invoiceId}/ack"; +}; + +export type AckHandoffErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AckHandoffError = AckHandoffErrors[keyof AckHandoffErrors]; + +export type AckHandoffResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type AckHandoffResponse = AckHandoffResponses[keyof AckHandoffResponses]; + +export type GetBillingHealthData = { + body?: never; + path?: never; + query?: never; + url: "/billing/health"; +}; + +export type GetBillingHealthErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetBillingHealthError = GetBillingHealthErrors[keyof GetBillingHealthErrors]; + +export type GetBillingHealthResponses = { + /** + * OK + */ + 200: BillingHealth; +}; + +export type GetBillingHealthResponse = GetBillingHealthResponses[keyof GetBillingHealthResponses]; + +export type GetBillingSettingsData = { + body?: never; + path?: never; + query?: never; + url: "/billing/settings"; +}; + +export type GetBillingSettingsErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetBillingSettingsError = GetBillingSettingsErrors[keyof GetBillingSettingsErrors]; + +export type GetBillingSettingsResponses = { + /** + * OK + */ + 200: BillingSettings; +}; + +export type GetBillingSettingsResponse = + GetBillingSettingsResponses[keyof GetBillingSettingsResponses]; + +export type UpdateBillingSettingsData = { + body: BillingSettings; + path?: never; + query?: never; + url: "/billing/settings"; +}; + +export type UpdateBillingSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateBillingSettingsError = + UpdateBillingSettingsErrors[keyof UpdateBillingSettingsErrors]; + +export type UpdateBillingSettingsResponses = { + /** + * OK + */ + 200: BillingSettings; +}; + +export type UpdateBillingSettingsResponse = + UpdateBillingSettingsResponses[keyof UpdateBillingSettingsResponses]; + +export type SyncBillingProviderData = { + body?: never; + path?: never; + query?: never; + url: "/billing/sync"; +}; + +export type SyncBillingProviderErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SyncBillingProviderError = SyncBillingProviderErrors[keyof SyncBillingProviderErrors]; + +export type SyncBillingProviderResponses = { + /** + * Accepted + */ + 202: SyncReport; +}; + +export type SyncBillingProviderResponse = + SyncBillingProviderResponses[keyof SyncBillingProviderResponses]; + +export type ListComponentsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/components"; +}; + +export type ListComponentsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListComponentsError = ListComponentsErrors[keyof ListComponentsErrors]; + +export type ListComponentsResponses = { + /** + * OK + */ + 200: PageComponent; +}; + +export type ListComponentsResponse = ListComponentsResponses[keyof ListComponentsResponses]; + +export type CreateComponentData = { + body: ComponentWritable; + path?: never; + query?: never; + url: "/components"; +}; + +export type CreateComponentErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateComponentError = CreateComponentErrors[keyof CreateComponentErrors]; + +export type CreateComponentResponses = { + /** + * Created + */ + 201: Component; +}; + +export type CreateComponentResponse = CreateComponentResponses[keyof CreateComponentResponses]; + +export type DeleteComponentData = { + body?: never; + path: { + /** + * Component slug + */ + componentSlug: string; + }; + query?: never; + url: "/components/{componentSlug}"; +}; + +export type DeleteComponentErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteComponentError = DeleteComponentErrors[keyof DeleteComponentErrors]; + +export type DeleteComponentResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteComponentResponse = DeleteComponentResponses[keyof DeleteComponentResponses]; + +export type GetComponentData = { + body?: never; + path: { + /** + * Component slug + */ + componentSlug: string; + }; + query?: never; + url: "/components/{componentSlug}"; +}; + +export type GetComponentErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetComponentError = GetComponentErrors[keyof GetComponentErrors]; + +export type GetComponentResponses = { + /** + * OK + */ + 200: Component; +}; + +export type GetComponentResponse = GetComponentResponses[keyof GetComponentResponses]; + +export type UpdateComponentData = { + body: ComponentWritable; + path: { + /** + * Component slug + */ + componentSlug: string; + }; + query?: never; + url: "/components/{componentSlug}"; +}; + +export type UpdateComponentErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateComponentError = UpdateComponentErrors[keyof UpdateComponentErrors]; + +export type UpdateComponentResponses = { + /** + * OK + */ + 200: Component; +}; + +export type UpdateComponentResponse = UpdateComponentResponses[keyof UpdateComponentResponses]; + +export type ListConnectorsData = { + body?: never; + path?: never; + query?: never; + url: "/connectors"; +}; + +export type ListConnectorsErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListConnectorsError = ListConnectorsErrors[keyof ListConnectorsErrors]; + +export type ListConnectorsResponses = { + /** + * OK + */ + 200: Array | null; +}; + +export type ListConnectorsResponse = ListConnectorsResponses[keyof ListConnectorsResponses]; + +export type GetConnectorData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}"; +}; + +export type GetConnectorErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetConnectorError = GetConnectorErrors[keyof GetConnectorErrors]; + +export type GetConnectorResponses = { + /** + * OK + */ + 200: Connector; +}; + +export type GetConnectorResponse = GetConnectorResponses[keyof GetConnectorResponses]; + +export type DeactivateConnectorData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/activation"; +}; + +export type DeactivateConnectorErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeactivateConnectorError = DeactivateConnectorErrors[keyof DeactivateConnectorErrors]; + +export type DeactivateConnectorResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeactivateConnectorResponse = + DeactivateConnectorResponses[keyof DeactivateConnectorResponses]; + +export type ActivateConnectorData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/activation"; +}; + +export type ActivateConnectorErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ActivateConnectorError = ActivateConnectorErrors[keyof ActivateConnectorErrors]; + +export type ActivateConnectorResponses = { + /** + * OK + */ + 200: ConnectorActivation; +}; + +export type ActivateConnectorResponse = + ActivateConnectorResponses[keyof ActivateConnectorResponses]; + +export type DeleteConnectorSettingsData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings"; +}; + +export type DeleteConnectorSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteConnectorSettingsError = + DeleteConnectorSettingsErrors[keyof DeleteConnectorSettingsErrors]; + +export type DeleteConnectorSettingsResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteConnectorSettingsResponse = + DeleteConnectorSettingsResponses[keyof DeleteConnectorSettingsResponses]; + +export type GetConnectorSettingsData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings"; +}; + +export type GetConnectorSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetConnectorSettingsError = + GetConnectorSettingsErrors[keyof GetConnectorSettingsErrors]; + +export type GetConnectorSettingsResponses = { + /** + * OK + */ + 200: ConnectorSettings; +}; + +export type GetConnectorSettingsResponse = + GetConnectorSettingsResponses[keyof GetConnectorSettingsResponses]; + +export type UpdateConnectorSettingsData = { + /** + * Connector settings payload to upsert + */ + body: ConnectorSettingsWritable; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings"; +}; + +export type UpdateConnectorSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateConnectorSettingsError = + UpdateConnectorSettingsErrors[keyof UpdateConnectorSettingsErrors]; + +export type UpdateConnectorSettingsResponses = { + /** + * OK + */ + 200: ConnectorSettings; +}; + +export type UpdateConnectorSettingsResponse = + UpdateConnectorSettingsResponses[keyof UpdateConnectorSettingsResponses]; + +export type GetConnectorSettingsSchemaData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings/schema"; +}; + +export type GetConnectorSettingsSchemaErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetConnectorSettingsSchemaError = + GetConnectorSettingsSchemaErrors[keyof GetConnectorSettingsSchemaErrors]; + +export type GetConnectorSettingsSchemaResponses = { + /** + * OK + */ + 200: ConnectorSettingsSchema; +}; + +export type GetConnectorSettingsSchemaResponse = + GetConnectorSettingsSchemaResponses[keyof GetConnectorSettingsSchemaResponses]; + +export type GetConnectorStateData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/state"; +}; + +export type GetConnectorStateErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetConnectorStateError = GetConnectorStateErrors[keyof GetConnectorStateErrors]; + +export type GetConnectorStateResponses = { + /** + * OK + */ + 200: ConnectorState; +}; + +export type GetConnectorStateResponse = + GetConnectorStateResponses[keyof GetConnectorStateResponses]; + +export type CreateCustomerSessionData = { + body: CustomerSessionDraft; + path?: never; + query?: never; + url: "/customer-sessions"; +}; + +export type CreateCustomerSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreateCustomerSessionError = + CreateCustomerSessionErrors[keyof CreateCustomerSessionErrors]; + +export type CreateCustomerSessionResponses = { + /** + * Created + */ + 201: CreatedCustomerSession; +}; + +export type CreateCustomerSessionResponse = + CreateCustomerSessionResponses[keyof CreateCustomerSessionResponses]; + +export type RevokeCustomerSessionData = { + body?: never; + path: { + /** + * Customer session id + */ + sessionId: string; + }; + query?: never; + url: "/customer-sessions/{sessionId}/revoke"; +}; + +export type RevokeCustomerSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type RevokeCustomerSessionError = + RevokeCustomerSessionErrors[keyof RevokeCustomerSessionErrors]; + +export type RevokeCustomerSessionResponses = { + /** + * No Content + */ + 204: void; +}; + +export type RevokeCustomerSessionResponse = + RevokeCustomerSessionResponses[keyof RevokeCustomerSessionResponses]; + +export type ListCustomersData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/customers"; +}; + +export type ListCustomersErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListCustomersError = ListCustomersErrors[keyof ListCustomersErrors]; + +export type ListCustomersResponses = { + /** + * OK + */ + 200: PageCustomer; +}; + +export type ListCustomersResponse = ListCustomersResponses[keyof ListCustomersResponses]; + +export type CreateCustomerData = { + body: CustomerWritable; + path?: never; + query?: never; + url: "/customers"; +}; + +export type CreateCustomerErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateCustomerError = CreateCustomerErrors[keyof CreateCustomerErrors]; + +export type CreateCustomerResponses = { + /** + * Created + */ + 201: Customer; +}; + +export type CreateCustomerResponse = CreateCustomerResponses[keyof CreateCustomerResponses]; + +export type DeleteCustomerData = { + body?: never; + path: { + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}"; +}; + +export type DeleteCustomerErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteCustomerError = DeleteCustomerErrors[keyof DeleteCustomerErrors]; + +export type DeleteCustomerResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteCustomerResponse = DeleteCustomerResponses[keyof DeleteCustomerResponses]; + +export type GetCustomerData = { + body?: never; + path: { + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}"; +}; + +export type GetCustomerErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors]; + +export type GetCustomerResponses = { + /** + * OK + */ + 200: Customer; +}; + +export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses]; + +export type UpdateCustomerData = { + body: CustomerWritable; + path: { + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}"; +}; + +export type UpdateCustomerErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateCustomerError = UpdateCustomerErrors[keyof UpdateCustomerErrors]; + +export type UpdateCustomerResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateCustomerResponse = UpdateCustomerResponses[keyof UpdateCustomerResponses]; + +export type GetCustomerBillingData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing"; +}; + +export type GetCustomerBillingErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetCustomerBillingError = GetCustomerBillingErrors[keyof GetCustomerBillingErrors]; + +export type GetCustomerBillingResponses = { + /** + * OK + */ + 200: CustomerBilling; +}; + +export type GetCustomerBillingResponse = + GetCustomerBillingResponses[keyof GetCustomerBillingResponses]; + +export type DetachPaymentMethodData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/payment-method"; +}; + +export type DetachPaymentMethodErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DetachPaymentMethodError = DetachPaymentMethodErrors[keyof DetachPaymentMethodErrors]; + +export type DetachPaymentMethodResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DetachPaymentMethodResponse = + DetachPaymentMethodResponses[keyof DetachPaymentMethodResponses]; + +export type CreatePaymentMethodSessionData = { + body: NewPaymentMethodSession; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/payment-method-session"; +}; + +export type CreatePaymentMethodSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreatePaymentMethodSessionError = + CreatePaymentMethodSessionErrors[keyof CreatePaymentMethodSessionErrors]; + +export type CreatePaymentMethodSessionResponses = { + /** + * OK + */ + 200: PaymentMethodSession; +}; + +export type CreatePaymentMethodSessionResponse = + CreatePaymentMethodSessionResponses[keyof CreatePaymentMethodSessionResponses]; + +export type CompletePaymentMethodSessionData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * The setup session id the customer came back with + */ + sessionId: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/payment-method-session/{sessionId}/complete"; +}; + +export type CompletePaymentMethodSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CompletePaymentMethodSessionError = + CompletePaymentMethodSessionErrors[keyof CompletePaymentMethodSessionErrors]; + +export type CompletePaymentMethodSessionResponses = { + /** + * OK + */ + 200: CompletedPaymentMethodSession; +}; + +export type CompletePaymentMethodSessionResponse = + CompletePaymentMethodSessionResponses[keyof CompletePaymentMethodSessionResponses]; + +export type CreatePortalSessionData = { + body: NewPortalSession; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/portal-session"; +}; + +export type CreatePortalSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreatePortalSessionError = CreatePortalSessionErrors[keyof CreatePortalSessionErrors]; + +export type CreatePortalSessionResponses = { + /** + * OK + */ + 200: PortalSession; +}; + +export type CreatePortalSessionResponse = + CreatePortalSessionResponses[keyof CreatePortalSessionResponses]; + +export type DeleteCustomerIntegrationData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type DeleteCustomerIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteCustomerIntegrationError = + DeleteCustomerIntegrationErrors[keyof DeleteCustomerIntegrationErrors]; + +export type DeleteCustomerIntegrationResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteCustomerIntegrationResponse = + DeleteCustomerIntegrationResponses[keyof DeleteCustomerIntegrationResponses]; + +export type GetCustomerIntegrationData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type GetCustomerIntegrationErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetCustomerIntegrationError = + GetCustomerIntegrationErrors[keyof GetCustomerIntegrationErrors]; + +export type GetCustomerIntegrationResponses = { + /** + * OK + */ + 200: CustomerIntegration; +}; + +export type GetCustomerIntegrationResponse = + GetCustomerIntegrationResponses[keyof GetCustomerIntegrationResponses]; + +export type CreateCustomerIntegrationData = { + /** + * Integration payload + */ + body: CustomerIntegrationWritable; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type CreateCustomerIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreateCustomerIntegrationError = + CreateCustomerIntegrationErrors[keyof CreateCustomerIntegrationErrors]; + +export type CreateCustomerIntegrationResponses = { + /** + * Created + */ + 201: CustomerIntegration; +}; + +export type CreateCustomerIntegrationResponse = + CreateCustomerIntegrationResponses[keyof CreateCustomerIntegrationResponses]; + +export type UpdateCustomerIntegrationData = { + /** + * Integration payload + */ + body: CustomerIntegrationWritable; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type UpdateCustomerIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateCustomerIntegrationError = + UpdateCustomerIntegrationErrors[keyof UpdateCustomerIntegrationErrors]; + +export type UpdateCustomerIntegrationResponses = { + /** + * OK + */ + 200: CustomerIntegration; +}; + +export type UpdateCustomerIntegrationResponse = + UpdateCustomerIntegrationResponses[keyof UpdateCustomerIntegrationResponses]; + +export type ListDeploymentZonesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/deployment-zones"; +}; + +export type ListDeploymentZonesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListDeploymentZonesError = ListDeploymentZonesErrors[keyof ListDeploymentZonesErrors]; + +export type ListDeploymentZonesResponses = { + /** + * OK + */ + 200: PageDeploymentZone; +}; + +export type ListDeploymentZonesResponse = + ListDeploymentZonesResponses[keyof ListDeploymentZonesResponses]; + +export type CreateDeploymentZoneData = { + body: DeploymentZoneWritable; + path?: never; + query?: never; + url: "/deployment-zones"; +}; + +export type CreateDeploymentZoneErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateDeploymentZoneError = + CreateDeploymentZoneErrors[keyof CreateDeploymentZoneErrors]; + +export type CreateDeploymentZoneResponses = { + /** + * Created + */ + 201: DeploymentZone; +}; + +export type CreateDeploymentZoneResponse = + CreateDeploymentZoneResponses[keyof CreateDeploymentZoneResponses]; + +export type DeleteDeploymentZoneData = { + body?: never; + path: { + deploymentZoneSlug: string; + }; + query?: never; + url: "/deployment-zones/{deploymentZoneSlug}"; +}; + +export type DeleteDeploymentZoneErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteDeploymentZoneError = + DeleteDeploymentZoneErrors[keyof DeleteDeploymentZoneErrors]; + +export type DeleteDeploymentZoneResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteDeploymentZoneResponse = + DeleteDeploymentZoneResponses[keyof DeleteDeploymentZoneResponses]; + +export type GetDeploymentZoneBySlugData = { + body?: never; + path: { + deploymentZoneSlug: string; + }; + query?: never; + url: "/deployment-zones/{deploymentZoneSlug}"; +}; + +export type GetDeploymentZoneBySlugErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetDeploymentZoneBySlugError = + GetDeploymentZoneBySlugErrors[keyof GetDeploymentZoneBySlugErrors]; + +export type GetDeploymentZoneBySlugResponses = { + /** + * OK + */ + 200: DeploymentZone; +}; + +export type GetDeploymentZoneBySlugResponse = + GetDeploymentZoneBySlugResponses[keyof GetDeploymentZoneBySlugResponses]; + +export type UpdateDeploymentZoneData = { + body: DeploymentZoneWritable; + path: { + deploymentZoneSlug: string; + }; + query?: never; + url: "/deployment-zones/{deploymentZoneSlug}"; +}; + +export type UpdateDeploymentZoneErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateDeploymentZoneError = + UpdateDeploymentZoneErrors[keyof UpdateDeploymentZoneErrors]; + +export type UpdateDeploymentZoneResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateDeploymentZoneResponse = + UpdateDeploymentZoneResponses[keyof UpdateDeploymentZoneResponses]; + +export type ListEntitlementGroupsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/entitlement-groups"; +}; + +export type ListEntitlementGroupsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListEntitlementGroupsError = + ListEntitlementGroupsErrors[keyof ListEntitlementGroupsErrors]; + +export type ListEntitlementGroupsResponses = { + /** + * OK + */ + 200: PageEntitlementGroup; +}; + +export type ListEntitlementGroupsResponse = + ListEntitlementGroupsResponses[keyof ListEntitlementGroupsResponses]; + +export type CreateEntitlementGroupData = { + body: EntitlementGroupWritable; + path?: never; + query?: never; + url: "/entitlement-groups"; +}; + +export type CreateEntitlementGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateEntitlementGroupError = + CreateEntitlementGroupErrors[keyof CreateEntitlementGroupErrors]; + +export type CreateEntitlementGroupResponses = { + /** + * Created + */ + 201: EntitlementGroup; +}; + +export type CreateEntitlementGroupResponse = + CreateEntitlementGroupResponses[keyof CreateEntitlementGroupResponses]; + +export type DeleteEntitlementGroupData = { + body?: never; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}"; +}; + +export type DeleteEntitlementGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteEntitlementGroupError = + DeleteEntitlementGroupErrors[keyof DeleteEntitlementGroupErrors]; + +export type DeleteEntitlementGroupResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteEntitlementGroupResponse = + DeleteEntitlementGroupResponses[keyof DeleteEntitlementGroupResponses]; + +export type GetEntitlementGroupData = { + body?: never; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}"; +}; + +export type GetEntitlementGroupErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementGroupError = GetEntitlementGroupErrors[keyof GetEntitlementGroupErrors]; + +export type GetEntitlementGroupResponses = { + /** + * OK + */ + 200: EntitlementGroup; +}; + +export type GetEntitlementGroupResponse = + GetEntitlementGroupResponses[keyof GetEntitlementGroupResponses]; + +export type UpdateEntitlementGroupData = { + body: EntitlementGroupWritable; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}"; +}; + +export type UpdateEntitlementGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateEntitlementGroupError = + UpdateEntitlementGroupErrors[keyof UpdateEntitlementGroupErrors]; + +export type UpdateEntitlementGroupResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateEntitlementGroupResponse = + UpdateEntitlementGroupResponses[keyof UpdateEntitlementGroupResponses]; + +export type AddEntitlementToGroupData = { + body: Command; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}/entitlements"; +}; + +export type AddEntitlementToGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type AddEntitlementToGroupError = + AddEntitlementToGroupErrors[keyof AddEntitlementToGroupErrors]; + +export type AddEntitlementToGroupResponses = { + /** + * Created + */ + 201: unknown; +}; + +export type RemoveEntitlementFromGroupData = { + body?: never; + path: { + entitlementGroupSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}"; +}; + +export type RemoveEntitlementFromGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type RemoveEntitlementFromGroupError = + RemoveEntitlementFromGroupErrors[keyof RemoveEntitlementFromGroupErrors]; + +export type RemoveEntitlementFromGroupResponses = { + /** + * No Content + */ + 204: void; +}; + +export type RemoveEntitlementFromGroupResponse = + RemoveEntitlementFromGroupResponses[keyof RemoveEntitlementFromGroupResponses]; + +export type GetEntitlementGroupUsageData = { + body?: never; + path: { + entitlementGroupSlug: string; + }; + query: { + /** + * Instance slug to get usage for + */ + instance: string; + }; + url: "/entitlement-groups/{entitlementGroupSlug}/usage"; +}; + +export type GetEntitlementGroupUsageErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementGroupUsageError = + GetEntitlementGroupUsageErrors[keyof GetEntitlementGroupUsageErrors]; + +export type GetEntitlementGroupUsageResponses = { + /** + * OK + */ + 200: Array | null; +}; + +export type GetEntitlementGroupUsageResponse = + GetEntitlementGroupUsageResponses[keyof GetEntitlementGroupUsageResponses]; + +export type ListEntitlementsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/entitlements"; +}; + +export type ListEntitlementsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListEntitlementsError = ListEntitlementsErrors[keyof ListEntitlementsErrors]; + +export type ListEntitlementsResponses = { + /** + * OK + */ + 200: PageEntitlement; +}; + +export type ListEntitlementsResponse = ListEntitlementsResponses[keyof ListEntitlementsResponses]; + +export type CreateEntitlementData = { + body: EntitlementWritable; + path?: never; + query?: never; + url: "/entitlements"; +}; + +export type CreateEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateEntitlementError = CreateEntitlementErrors[keyof CreateEntitlementErrors]; + +export type CreateEntitlementResponses = { + /** + * Created + */ + 201: Entitlement; +}; + +export type CreateEntitlementResponse = + CreateEntitlementResponses[keyof CreateEntitlementResponses]; + +export type DeleteEntitlementData = { + body?: never; + path: { + entitlementSlug: string; + }; + query?: never; + url: "/entitlements/{entitlementSlug}"; +}; + +export type DeleteEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteEntitlementError = DeleteEntitlementErrors[keyof DeleteEntitlementErrors]; + +export type DeleteEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteEntitlementResponse = + DeleteEntitlementResponses[keyof DeleteEntitlementResponses]; + +export type GetEntitlementData = { + body?: never; + path: { + entitlementSlug: string; + }; + query?: never; + url: "/entitlements/{entitlementSlug}"; +}; + +export type GetEntitlementErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementError = GetEntitlementErrors[keyof GetEntitlementErrors]; + +export type GetEntitlementResponses = { + /** + * OK + */ + 200: Entitlement; +}; + +export type GetEntitlementResponse = GetEntitlementResponses[keyof GetEntitlementResponses]; + +export type UpdateEntitlementData = { + body: EntitlementWritable; + path: { + entitlementSlug: string; + }; + query?: never; + url: "/entitlements/{entitlementSlug}"; +}; + +export type UpdateEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateEntitlementError = UpdateEntitlementErrors[keyof UpdateEntitlementErrors]; + +export type UpdateEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateEntitlementResponse = + UpdateEntitlementResponses[keyof UpdateEntitlementResponses]; + +export type GetFeatureFlagsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/feature-flags"; +}; + +export type GetFeatureFlagsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetFeatureFlagsError = GetFeatureFlagsErrors[keyof GetFeatureFlagsErrors]; + +export type GetFeatureFlagsResponses = { + /** + * OK + */ + 200: PageFeatureFlag; +}; + +export type GetFeatureFlagsResponse = GetFeatureFlagsResponses[keyof GetFeatureFlagsResponses]; + +export type CreateFeatureFlagData = { + /** + * Feature flag details + */ + body: FeatureFlagWritable; + path?: never; + query?: never; + url: "/feature-flags"; +}; + +export type CreateFeatureFlagErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateFeatureFlagError = CreateFeatureFlagErrors[keyof CreateFeatureFlagErrors]; + +export type CreateFeatureFlagResponses = { + /** + * Created feature flag + */ + 201: FeatureFlag; +}; + +export type CreateFeatureFlagResponse = + CreateFeatureFlagResponses[keyof CreateFeatureFlagResponses]; + +export type GetTargetingContextData = { + body?: never; + path?: never; + query?: never; + url: "/feature-flags/targeting/context"; +}; + +export type GetTargetingContextErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetTargetingContextError = GetTargetingContextErrors[keyof GetTargetingContextErrors]; + +export type GetTargetingContextResponses = { + /** + * OK + */ + 200: TargetingContext; +}; + +export type GetTargetingContextResponse = + GetTargetingContextResponses[keyof GetTargetingContextResponses]; + +export type LintTargetingRuleData = { + body: TargetingRuleDraft; + path?: never; + query?: never; + url: "/feature-flags/targeting/lint"; +}; + +export type LintTargetingRuleErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type LintTargetingRuleError = LintTargetingRuleErrors[keyof LintTargetingRuleErrors]; + +export type LintTargetingRuleResponses = { + /** + * OK + */ + 200: TargetingRuleVerdict; +}; + +export type LintTargetingRuleResponse = + LintTargetingRuleResponses[keyof LintTargetingRuleResponses]; + +export type TestTargetingRuleData = { + body: TargetingRuleTrial; + path?: never; + query?: never; + url: "/feature-flags/targeting/test"; +}; + +export type TestTargetingRuleErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type TestTargetingRuleError = TestTargetingRuleErrors[keyof TestTargetingRuleErrors]; + +export type TestTargetingRuleResponses = { + /** + * OK + */ + 200: TargetingRuleRehearsal; +}; + +export type TestTargetingRuleResponse = + TestTargetingRuleResponses[keyof TestTargetingRuleResponses]; + +export type DeleteFeatureFlagData = { + body?: never; + path: { + featureFlagSlug: string; + }; + query?: never; + url: "/feature-flags/{featureFlagSlug}"; +}; + +export type DeleteFeatureFlagErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteFeatureFlagError = DeleteFeatureFlagErrors[keyof DeleteFeatureFlagErrors]; + +export type DeleteFeatureFlagResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteFeatureFlagResponse = + DeleteFeatureFlagResponses[keyof DeleteFeatureFlagResponses]; + +export type GetFeatureFlagData = { + body?: never; + path: { + featureFlagSlug: string; + }; + query?: never; + url: "/feature-flags/{featureFlagSlug}"; +}; + +export type GetFeatureFlagErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetFeatureFlagError = GetFeatureFlagErrors[keyof GetFeatureFlagErrors]; + +export type GetFeatureFlagResponses = { + /** + * OK + */ + 200: FeatureFlag; +}; + +export type GetFeatureFlagResponse = GetFeatureFlagResponses[keyof GetFeatureFlagResponses]; + +export type UpdateFeatureFlagData = { + /** + * Feature flag details + */ + body: FeatureFlagWritable; + path: { + featureFlagSlug: string; + }; + query?: never; + url: "/feature-flags/{featureFlagSlug}"; +}; + +export type UpdateFeatureFlagErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateFeatureFlagError = UpdateFeatureFlagErrors[keyof UpdateFeatureFlagErrors]; + +export type UpdateFeatureFlagResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateFeatureFlagResponse = + UpdateFeatureFlagResponses[keyof UpdateFeatureFlagResponses]; + +export type GetInstancesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/instances"; +}; + +export type GetInstancesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstancesError = GetInstancesErrors[keyof GetInstancesErrors]; + +export type GetInstancesResponses = { + /** + * OK + */ + 200: PageInstance; +}; + +export type GetInstancesResponse = GetInstancesResponses[keyof GetInstancesResponses]; + +export type CreateInstanceData = { + body: InstanceWritable; + path?: never; + query?: never; + url: "/instances"; +}; + +export type CreateInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateInstanceError = CreateInstanceErrors[keyof CreateInstanceErrors]; + +export type CreateInstanceResponses = { + /** + * Created + */ + 201: Instance; +}; + +export type CreateInstanceResponse = CreateInstanceResponses[keyof CreateInstanceResponses]; + +export type DeleteInstanceData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type DeleteInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteInstanceError = DeleteInstanceErrors[keyof DeleteInstanceErrors]; + +export type DeleteInstanceResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteInstanceResponse = DeleteInstanceResponses[keyof DeleteInstanceResponses]; + +export type GetInstanceData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type GetInstanceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstanceError = GetInstanceErrors[keyof GetInstanceErrors]; + +export type GetInstanceResponses = { + /** + * OK + */ + 200: Instance; +}; + +export type GetInstanceResponse = GetInstanceResponses[keyof GetInstanceResponses]; + +export type PatchInstanceData = { + body: PatchInstanceBody; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type PatchInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type PatchInstanceError = PatchInstanceErrors[keyof PatchInstanceErrors]; + +export type PatchInstanceResponses = { + /** + * No Content + */ + 204: void; +}; + +export type PatchInstanceResponse = PatchInstanceResponses[keyof PatchInstanceResponses]; + +export type UpdateInstanceData = { + body: InstanceWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type UpdateInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateInstanceError = UpdateInstanceErrors[keyof UpdateInstanceErrors]; + +export type UpdateInstanceResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateInstanceResponse = UpdateInstanceResponses[keyof UpdateInstanceResponses]; + +export type ListInstanceAddonsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + /** + * Also list the add-ons removed from the instance + */ + includeRemoved?: boolean; + }; + url: "/instances/{instanceSlug}/addons"; +}; + +export type ListInstanceAddonsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInstanceAddonsError = ListInstanceAddonsErrors[keyof ListInstanceAddonsErrors]; + +export type ListInstanceAddonsResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListInstanceAddonsResponse = + ListInstanceAddonsResponses[keyof ListInstanceAddonsResponses]; + +export type AttachInstanceAddonData = { + body: NewInstanceAddon; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/addons"; +}; + +export type AttachInstanceAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AttachInstanceAddonError = AttachInstanceAddonErrors[keyof AttachInstanceAddonErrors]; + +export type AttachInstanceAddonResponses = { + /** + * Created + */ + 201: InstanceAddon; +}; + +export type AttachInstanceAddonResponse = + AttachInstanceAddonResponses[keyof AttachInstanceAddonResponses]; + +export type DetachInstanceAddonData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/addons/{addonSlug}"; +}; + +export type DetachInstanceAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DetachInstanceAddonError = DetachInstanceAddonErrors[keyof DetachInstanceAddonErrors]; + +export type DetachInstanceAddonResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DetachInstanceAddonResponse = + DetachInstanceAddonResponses[keyof DetachInstanceAddonResponses]; + +export type SetInstanceAddonQuantityData = { + body: AddonQuantity; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/addons/{addonSlug}"; +}; + +export type SetInstanceAddonQuantityErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SetInstanceAddonQuantityError = + SetInstanceAddonQuantityErrors[keyof SetInstanceAddonQuantityErrors]; + +export type SetInstanceAddonQuantityResponses = { + /** + * OK + */ + 200: InstanceAddon; +}; + +export type SetInstanceAddonQuantityResponse = + SetInstanceAddonQuantityResponses[keyof SetInstanceAddonQuantityResponses]; + +export type GetAuditTrailsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + /** + * Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) + */ + event_name?: string; + /** + * RFC3339 timestamp — include entries with timestamp ≥ this value + */ + after?: string; + /** + * RFC3339 timestamp — include entries with timestamp ≤ this value + */ + before?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + }; + url: "/instances/{instanceSlug}/audit-trails"; +}; + +export type GetAuditTrailsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetAuditTrailsError = GetAuditTrailsErrors[keyof GetAuditTrailsErrors]; + +export type GetAuditTrailsResponses = { + /** + * OK + */ + 200: PageAuditTrail; +}; + +export type GetAuditTrailsResponse = GetAuditTrailsResponses[keyof GetAuditTrailsResponses]; + +export type GetInstanceBillingData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing"; +}; + +export type GetInstanceBillingErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetInstanceBillingError = GetInstanceBillingErrors[keyof GetInstanceBillingErrors]; + +export type GetInstanceBillingResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type GetInstanceBillingResponse = + GetInstanceBillingResponses[keyof GetInstanceBillingResponses]; + +export type UpdateInstanceBillingData = { + body: SubscriptionTerms; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing"; +}; + +export type UpdateInstanceBillingErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateInstanceBillingError = + UpdateInstanceBillingErrors[keyof UpdateInstanceBillingErrors]; + +export type UpdateInstanceBillingResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type UpdateInstanceBillingResponse = + UpdateInstanceBillingResponses[keyof UpdateInstanceBillingResponses]; + +export type SubscribeInstanceData = { + body: NewSubscription; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing"; +}; + +export type SubscribeInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SubscribeInstanceError = SubscribeInstanceErrors[keyof SubscribeInstanceErrors]; + +export type SubscribeInstanceResponses = { + /** + * Created + */ + 201: StartedSubscription; +}; + +export type SubscribeInstanceResponse = + SubscribeInstanceResponses[keyof SubscribeInstanceResponses]; + +export type CancelSubscriptionData = { + body: SubscriptionCancellation; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/cancel"; +}; + +export type CancelSubscriptionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CancelSubscriptionError = CancelSubscriptionErrors[keyof CancelSubscriptionErrors]; + +export type CancelSubscriptionResponses = { + /** + * OK + */ + 200: CanceledSubscription; +}; + +export type CancelSubscriptionResponse = + CancelSubscriptionResponses[keyof CancelSubscriptionResponses]; + +export type ReactivateSubscriptionData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/reactivate"; +}; + +export type ReactivateSubscriptionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ReactivateSubscriptionError = + ReactivateSubscriptionErrors[keyof ReactivateSubscriptionErrors]; + +export type ReactivateSubscriptionResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type ReactivateSubscriptionResponse = + ReactivateSubscriptionResponses[keyof ReactivateSubscriptionResponses]; + +export type CancelPlanChangeData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/scheduled-change"; +}; + +export type CancelPlanChangeErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CancelPlanChangeError = CancelPlanChangeErrors[keyof CancelPlanChangeErrors]; + +export type CancelPlanChangeResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type CancelPlanChangeResponse = CancelPlanChangeResponses[keyof CancelPlanChangeResponses]; + +export type SchedulePlanChangeData = { + body: PlanChangeTarget; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/scheduled-change"; +}; + +export type SchedulePlanChangeErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SchedulePlanChangeError = SchedulePlanChangeErrors[keyof SchedulePlanChangeErrors]; + +export type SchedulePlanChangeResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type SchedulePlanChangeResponse = + SchedulePlanChangeResponses[keyof SchedulePlanChangeResponses]; + +export type GetUpcomingInvoiceData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/upcoming-invoice"; +}; + +export type GetUpcomingInvoiceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetUpcomingInvoiceError = GetUpcomingInvoiceErrors[keyof GetUpcomingInvoiceErrors]; + +export type GetUpcomingInvoiceResponses = { + /** + * OK + */ + 200: InvoicePreview; +}; + +export type GetUpcomingInvoiceResponse = + GetUpcomingInvoiceResponses[keyof GetUpcomingInvoiceResponses]; + +export type GetEntitlementsUsageMetricsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/entitlements/usage"; +}; + +export type GetEntitlementsUsageMetricsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementsUsageMetricsError = + GetEntitlementsUsageMetricsErrors[keyof GetEntitlementsUsageMetricsErrors]; + +export type GetEntitlementsUsageMetricsResponses = { + /** + * OK + */ + 200: Array | null; +}; + +export type GetEntitlementsUsageMetricsResponse = + GetEntitlementsUsageMetricsResponses[keyof GetEntitlementsUsageMetricsResponses]; + +export type GetEntitlementUsageMetricsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; +}; + +export type GetEntitlementUsageMetricsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementUsageMetricsError = + GetEntitlementUsageMetricsErrors[keyof GetEntitlementUsageMetricsErrors]; + +export type GetEntitlementUsageMetricsResponses = { + /** + * OK + */ + 200: EntitlementUsage; +}; + +export type GetEntitlementUsageMetricsResponse = + GetEntitlementUsageMetricsResponses[keyof GetEntitlementUsageMetricsResponses]; + +export type ReportEntitlementUsageMetricData = { + body: ReportEntitlementUsageBodyWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; +}; + +export type ReportEntitlementUsageMetricErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ReportEntitlementUsageMetricError = + ReportEntitlementUsageMetricErrors[keyof ReportEntitlementUsageMetricErrors]; + +export type ReportEntitlementUsageMetricResponses = { + /** + * OK + */ + 200: EntitlementUsage; +}; + +export type ReportEntitlementUsageMetricResponse = + ReportEntitlementUsageMetricResponses[keyof ReportEntitlementUsageMetricResponses]; + +export type ListUsageReportsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: { + /** + * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. + */ + from?: string; + /** + * End of the range, exclusive (RFC 3339). Defaults to now. + */ + to?: string; + /** + * Return the reports after this reportSeq: the nextAfterSeq of the previous page + */ + afterSeq?: number; + /** + * Maximum number of reports to return (default 100, max 500) + */ + limit?: number; + /** + * Only the report sent with this idempotency key + */ + transactionId?: string; + }; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports"; +}; + +export type ListUsageReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListUsageReportsError = ListUsageReportsErrors[keyof ListUsageReportsErrors]; + +export type ListUsageReportsResponses = { + /** + * OK + */ + 200: UsageReportPage; +}; + +export type ListUsageReportsResponse = ListUsageReportsResponses[keyof ListUsageReportsResponses]; + +export type ExportUsageReportsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: { + /** + * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + */ + from?: string; + /** + * End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. + */ + to?: string; + /** + * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat. + */ + format?: string; + }; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export"; +}; + +export type ExportUsageReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ExportUsageReportsError = ExportUsageReportsErrors[keyof ExportUsageReportsErrors]; + +export type ExportUsageReportsResponses = { + /** + * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + */ + 200: string; +}; + +export type ExportUsageReportsResponse = + ExportUsageReportsResponses[keyof ExportUsageReportsResponses]; + +export type DeleteInstanceIntegrationData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type DeleteInstanceIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteInstanceIntegrationError = + DeleteInstanceIntegrationErrors[keyof DeleteInstanceIntegrationErrors]; + +export type DeleteInstanceIntegrationResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteInstanceIntegrationResponse = + DeleteInstanceIntegrationResponses[keyof DeleteInstanceIntegrationResponses]; + +export type GetInstanceIntegrationData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type GetInstanceIntegrationErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstanceIntegrationError = + GetInstanceIntegrationErrors[keyof GetInstanceIntegrationErrors]; + +export type GetInstanceIntegrationResponses = { + /** + * OK + */ + 200: InstanceIntegration; +}; + +export type GetInstanceIntegrationResponse = + GetInstanceIntegrationResponses[keyof GetInstanceIntegrationResponses]; + +export type CreateInstanceIntegrationData = { + /** + * Integration payload + */ + body: InstanceIntegrationWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type CreateInstanceIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreateInstanceIntegrationError = + CreateInstanceIntegrationErrors[keyof CreateInstanceIntegrationErrors]; + +export type CreateInstanceIntegrationResponses = { + /** + * Created + */ + 201: InstanceIntegration; +}; + +export type CreateInstanceIntegrationResponse = + CreateInstanceIntegrationResponses[keyof CreateInstanceIntegrationResponses]; + +export type UpdateInstanceIntegrationData = { + /** + * Integration payload + */ + body: InstanceIntegrationWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type UpdateInstanceIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateInstanceIntegrationError = + UpdateInstanceIntegrationErrors[keyof UpdateInstanceIntegrationErrors]; + +export type UpdateInstanceIntegrationResponses = { + /** + * OK + */ + 200: InstanceIntegration; +}; + +export type UpdateInstanceIntegrationResponse = + UpdateInstanceIntegrationResponses[keyof UpdateInstanceIntegrationResponses]; + +export type ListInstanceInvoicesData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + /** + * Only invoices in these statuses; repeat the parameter for several + */ + status?: Array< + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID" + > | null; + kind?: "ACTIVATION" | "RENEWAL" | "FINAL"; + providerKind?: "NOOP" | "STRIPE"; + /** + * Only this customer's invoices: composed under this slug, or of the customer that has it now + */ + customerSlug?: string; + /** + * Only issued invoices still unpaid past their due date + */ + overdue?: boolean; + /** + * Only DRAFTs held for their usage journal + */ + held?: boolean; + handoffStatus?: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + /** + * Issued at or after this instant (RFC 3339) + */ + issuedFrom?: string; + /** + * Issued before this instant (RFC 3339) + */ + issuedTo?: string; + /** + * Billing a boundary at or after this instant + */ + boundaryFrom?: string; + /** + * Billing a boundary before this instant + */ + boundaryTo?: string; + /** + * Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change + */ + updatedSince?: string; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + }; + url: "/instances/{instanceSlug}/invoices"; +}; + +export type ListInstanceInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInstanceInvoicesError = + ListInstanceInvoicesErrors[keyof ListInstanceInvoicesErrors]; + +export type ListInstanceInvoicesResponses = { + /** + * OK + */ + 200: PageInvoiceSummary; +}; + +export type ListInstanceInvoicesResponse = + ListInstanceInvoicesResponses[keyof ListInstanceInvoicesResponses]; + +export type ListInstanceVouchersData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + status?: "ACTIVE" | "EXPIRED" | "REVOKED"; + }; + url: "/instances/{instanceSlug}/vouchers"; +}; + +export type ListInstanceVouchersErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInstanceVouchersError = + ListInstanceVouchersErrors[keyof ListInstanceVouchersErrors]; + +export type ListInstanceVouchersResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListInstanceVouchersResponse = + ListInstanceVouchersResponses[keyof ListInstanceVouchersResponses]; + +export type RedeemVoucherData = { + body: RedeemableCode; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/vouchers/redeem"; +}; + +export type RedeemVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RedeemVoucherError = RedeemVoucherErrors[keyof RedeemVoucherErrors]; + +export type RedeemVoucherResponses = { + /** + * Created + */ + 201: Redemption; +}; + +export type RedeemVoucherResponse = RedeemVoucherResponses[keyof RedeemVoucherResponses]; + +export type RevokeInstanceVoucherData = { + body: RevocationReason; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Redemption id + */ + instanceVoucherId: string; + }; + query?: never; + url: "/instances/{instanceSlug}/vouchers/{instanceVoucherId}/revoke"; +}; + +export type RevokeInstanceVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RevokeInstanceVoucherError = + RevokeInstanceVoucherErrors[keyof RevokeInstanceVoucherErrors]; + +export type RevokeInstanceVoucherResponses = { + /** + * OK + */ + 200: Redemption; +}; + +export type RevokeInstanceVoucherResponse = + RevokeInstanceVoucherResponses[keyof RevokeInstanceVoucherResponses]; + +export type GetCustomerIntegrationByExternalIdData = { + body?: never; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/customer/{externalId}"; +}; + +export type GetCustomerIntegrationByExternalIdErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetCustomerIntegrationByExternalIdError = + GetCustomerIntegrationByExternalIdErrors[keyof GetCustomerIntegrationByExternalIdErrors]; + +export type GetCustomerIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: CustomerIntegrationResource; +}; + +export type GetCustomerIntegrationByExternalIdResponse = + GetCustomerIntegrationByExternalIdResponses[keyof GetCustomerIntegrationByExternalIdResponses]; + +export type UpsertCustomerIntegrationByExternalIdData = { + body: CustomerBody; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/customer/{externalId}"; +}; + +export type UpsertCustomerIntegrationByExternalIdErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpsertCustomerIntegrationByExternalIdError = + UpsertCustomerIntegrationByExternalIdErrors[keyof UpsertCustomerIntegrationByExternalIdErrors]; + +export type UpsertCustomerIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: CustomerIntegrationResource; +}; + +export type UpsertCustomerIntegrationByExternalIdResponse = + UpsertCustomerIntegrationByExternalIdResponses[keyof UpsertCustomerIntegrationByExternalIdResponses]; + +export type GetInstanceIntegrationByExternalIdData = { + body?: never; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/instance/{externalId}"; +}; + +export type GetInstanceIntegrationByExternalIdErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstanceIntegrationByExternalIdError = + GetInstanceIntegrationByExternalIdErrors[keyof GetInstanceIntegrationByExternalIdErrors]; + +export type GetInstanceIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: InstanceIntegrationResource; +}; + +export type GetInstanceIntegrationByExternalIdResponse = + GetInstanceIntegrationByExternalIdResponses[keyof GetInstanceIntegrationByExternalIdResponses]; + +export type UpsertInstanceIntegrationByExternalIdData = { + body: InstanceBody; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/instance/{externalId}"; +}; + +export type UpsertInstanceIntegrationByExternalIdErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpsertInstanceIntegrationByExternalIdError = + UpsertInstanceIntegrationByExternalIdErrors[keyof UpsertInstanceIntegrationByExternalIdErrors]; + +export type UpsertInstanceIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: InstanceIntegrationResource; +}; + +export type UpsertInstanceIntegrationByExternalIdResponse = + UpsertInstanceIntegrationByExternalIdResponses[keyof UpsertInstanceIntegrationByExternalIdResponses]; + +export type ListInvoicesData = { + body?: never; + path?: never; + query?: { + /** + * Only invoices in these statuses; repeat the parameter for several + */ + status?: Array< + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID" + > | null; + kind?: "ACTIVATION" | "RENEWAL" | "FINAL"; + providerKind?: "NOOP" | "STRIPE"; + /** + * Only this customer's invoices: composed under this slug, or of the customer that has it now + */ + customerSlug?: string; + /** + * Only issued invoices still unpaid past their due date + */ + overdue?: boolean; + /** + * Only DRAFTs held for their usage journal + */ + held?: boolean; + handoffStatus?: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + /** + * Issued at or after this instant (RFC 3339) + */ + issuedFrom?: string; + /** + * Issued before this instant (RFC 3339) + */ + issuedTo?: string; + /** + * Billing a boundary at or after this instant + */ + boundaryFrom?: string; + /** + * Billing a boundary before this instant + */ + boundaryTo?: string; + /** + * Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change + */ + updatedSince?: string; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + /** + * Only this instance's invoices: composed under this slug, or of the instance that has it now + */ + instanceSlug?: string; + }; + url: "/invoices"; +}; + +export type ListInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInvoicesError = ListInvoicesErrors[keyof ListInvoicesErrors]; + +export type ListInvoicesResponses = { + /** + * OK + */ + 200: PageInvoiceSummary; +}; + +export type ListInvoicesResponse = ListInvoicesResponses[keyof ListInvoicesResponses]; + +export type ExportInvoicesData = { + body?: never; + path?: never; + query?: { + /** + * Only invoices in these statuses; repeat the parameter for several + */ + status?: Array< + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID" + > | null; + kind?: "ACTIVATION" | "RENEWAL" | "FINAL"; + providerKind?: "NOOP" | "STRIPE"; + /** + * Only this customer's invoices: composed under this slug, or of the customer that has it now + */ + customerSlug?: string; + /** + * Only issued invoices still unpaid past their due date + */ + overdue?: boolean; + /** + * Only DRAFTs held for their usage journal + */ + held?: boolean; + handoffStatus?: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + /** + * Issued at or after this instant (RFC 3339) + */ + issuedFrom?: string; + /** + * Issued before this instant (RFC 3339) + */ + issuedTo?: string; + /** + * Billing a boundary at or after this instant + */ + boundaryFrom?: string; + /** + * Billing a boundary before this instant + */ + boundaryTo?: string; + /** + * Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change + */ + updatedSince?: string; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + /** + * Only this instance's invoices + */ + instanceSlug?: string; + /** + * csv (the default): RFC 4180 with a header row. json: NDJSON, one invoice with its lines per line. Anything else answers 422 ExportInvoices.InvalidFormat. + */ + format?: string; + /** + * For csv: line (the default), one row per invoice line with the invoice's columns repeated; invoice, one row per invoice. Anything else answers 422 ExportInvoices.InvalidGranularity. + */ + granularity?: string; + }; + url: "/invoices/export"; +}; + +export type ExportInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ExportInvoicesError = ExportInvoicesErrors[keyof ExportInvoicesErrors]; + +export type ExportInvoicesResponses = { + /** + * The invoices, as an attachment + */ + 200: string; +}; + +export type ExportInvoicesResponse = ExportInvoicesResponses[keyof ExportInvoicesResponses]; + +export type GetInvoiceData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}"; +}; + +export type GetInvoiceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetInvoiceError = GetInvoiceErrors[keyof GetInvoiceErrors]; + +export type GetInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type GetInvoiceResponse = GetInvoiceResponses[keyof GetInvoiceResponses]; + +export type ListInvoiceLineReportsData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + /** + * Line identifier, as the invoice's lines carry it + */ + lineId: string; + }; + query?: { + /** + * Reports after this reportSeq; 0 starts at the first + */ + afterSeq?: number; + /** + * Page size, 100 by default, 500 at most + */ + limit?: number; + /** + * json (the default): one page. csv: every report, streamed as RFC 4180 with a header row. Anything else answers 422 ListInvoiceLineReports.InvalidFormat. + */ + format?: string; + }; + url: "/invoices/{invoiceId}/lines/{lineId}/reports"; +}; + +export type ListInvoiceLineReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInvoiceLineReportsError = + ListInvoiceLineReportsErrors[keyof ListInvoiceLineReportsErrors]; + +export type ListInvoiceLineReportsResponses = { + /** + * One page of reports (json), or every report as a CSV attachment (csv) + */ + 200: LineReportPage; +}; + +export type ListInvoiceLineReportsResponse = + ListInvoiceLineReportsResponses[keyof ListInvoiceLineReportsResponses]; + +export type MarkInvoicePaidData = { + body: InvoicePayment; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/mark-paid"; +}; + +export type MarkInvoicePaidErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type MarkInvoicePaidError = MarkInvoicePaidErrors[keyof MarkInvoicePaidErrors]; + +export type MarkInvoicePaidResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type MarkInvoicePaidResponse = MarkInvoicePaidResponses[keyof MarkInvoicePaidResponses]; + +export type RecomposeInvoiceData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/recompose"; +}; + +export type RecomposeInvoiceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RecomposeInvoiceError = RecomposeInvoiceErrors[keyof RecomposeInvoiceErrors]; + +export type RecomposeInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type RecomposeInvoiceResponse = RecomposeInvoiceResponses[keyof RecomposeInvoiceResponses]; + +export type ReleaseInvoiceHoldData = { + body: HoldRelease; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/release-hold"; +}; + +export type ReleaseInvoiceHoldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ReleaseInvoiceHoldError = ReleaseInvoiceHoldErrors[keyof ReleaseInvoiceHoldErrors]; + +export type ReleaseInvoiceHoldResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type ReleaseInvoiceHoldResponse = + ReleaseInvoiceHoldResponses[keyof ReleaseInvoiceHoldResponses]; + +export type RetryInvoicePushData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/retry-push"; +}; + +export type RetryInvoicePushErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RetryInvoicePushError = RetryInvoicePushErrors[keyof RetryInvoicePushErrors]; + +export type RetryInvoicePushResponses = { + /** + * Accepted + */ + 202: Invoice; +}; + +export type RetryInvoicePushResponse = RetryInvoicePushResponses[keyof RetryInvoicePushResponses]; + +export type SyncInvoiceData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/sync"; +}; + +export type SyncInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SyncInvoiceError = SyncInvoiceErrors[keyof SyncInvoiceErrors]; + +export type SyncInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type SyncInvoiceResponse = SyncInvoiceResponses[keyof SyncInvoiceResponses]; + +export type VoidInvoiceData = { + body: InvoiceVoid; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/void"; +}; + +export type VoidInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type VoidInvoiceError = VoidInvoiceErrors[keyof VoidInvoiceErrors]; + +export type VoidInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type VoidInvoiceResponse = VoidInvoiceResponses[keyof VoidInvoiceResponses]; + +export type WriteOffInvoiceData = { + body: InvoiceWriteOff; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/write-off"; +}; + +export type WriteOffInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type WriteOffInvoiceError = WriteOffInvoiceErrors[keyof WriteOffInvoiceErrors]; + +export type WriteOffInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type WriteOffInvoiceResponse = WriteOffInvoiceResponses[keyof WriteOffInvoiceResponses]; + +export type ListLicenseFamiliesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/license-families"; +}; + +export type ListLicenseFamiliesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListLicenseFamiliesError = ListLicenseFamiliesErrors[keyof ListLicenseFamiliesErrors]; + +export type ListLicenseFamiliesResponses = { + /** + * OK + */ + 200: PageLicenseFamilyView; +}; + +export type ListLicenseFamiliesResponse = + ListLicenseFamiliesResponses[keyof ListLicenseFamiliesResponses]; + +export type GetLicenseFamilyData = { + body?: never; + path: { + /** + * License family slug + */ + familySlug: string; + }; + query?: { + /** + * Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply. + */ + version?: number; + /** + * Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type. + */ + include?: Array<"versions">; + }; + url: "/license-families/{familySlug}"; +}; + +export type GetLicenseFamilyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseFamilyError = GetLicenseFamilyErrors[keyof GetLicenseFamilyErrors]; + +export type GetLicenseFamilyResponses = { + /** + * OK + */ + 200: LicenseFamilyView; +}; + +export type GetLicenseFamilyResponse = GetLicenseFamilyResponses[keyof GetLicenseFamilyResponses]; + +export type UpdateLicenseFamilyData = { + body: LicenseFamilyVisibility; + path: { + /** + * License family slug + */ + familySlug: string; + }; + query?: never; + url: "/license-families/{familySlug}"; +}; + +export type UpdateLicenseFamilyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateLicenseFamilyError = UpdateLicenseFamilyErrors[keyof UpdateLicenseFamilyErrors]; + +export type UpdateLicenseFamilyResponses = { + /** + * OK + */ + 200: LicenseFamilyView; +}; + +export type UpdateLicenseFamilyResponse = + UpdateLicenseFamilyResponses[keyof UpdateLicenseFamilyResponses]; + +export type GetLicensesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/licenses"; +}; + +export type GetLicensesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicensesError = GetLicensesErrors[keyof GetLicensesErrors]; + +export type GetLicensesResponses = { + /** + * OK + */ + 200: PageLicense; +}; + +export type GetLicensesResponse = GetLicensesResponses[keyof GetLicensesResponses]; + +export type CreateLicenseData = { + body: LicenseWritable; + path?: never; + query?: never; + url: "/licenses"; +}; + +export type CreateLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateLicenseError = CreateLicenseErrors[keyof CreateLicenseErrors]; + +export type CreateLicenseResponses = { + /** + * Created + */ + 201: License; +}; + +export type CreateLicenseResponse = CreateLicenseResponses[keyof CreateLicenseResponses]; + +export type DeleteLicenseData = { + body?: never; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}"; +}; + +export type DeleteLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteLicenseError = DeleteLicenseErrors[keyof DeleteLicenseErrors]; + +export type DeleteLicenseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteLicenseResponse = DeleteLicenseResponses[keyof DeleteLicenseResponses]; + +export type GetLicenseData = { + body?: never; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}"; +}; + +export type GetLicenseErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseError = GetLicenseErrors[keyof GetLicenseErrors]; + +export type GetLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type GetLicenseResponse = GetLicenseResponses[keyof GetLicenseResponses]; + +export type UpdateLicenseData = { + body: LicenseWritable; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}"; +}; + +export type UpdateLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateLicenseError = UpdateLicenseErrors[keyof UpdateLicenseErrors]; + +export type UpdateLicenseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateLicenseResponse = UpdateLicenseResponses[keyof UpdateLicenseResponses]; + +export type ArchiveLicenseData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/archive"; +}; + +export type ArchiveLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ArchiveLicenseError = ArchiveLicenseErrors[keyof ArchiveLicenseErrors]; + +export type ArchiveLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type ArchiveLicenseResponse = ArchiveLicenseResponses[keyof ArchiveLicenseResponses]; + +export type GetLicenseEntitlementsData = { + body?: never; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/licenses/{licenseSlug}/entitlements"; +}; + +export type GetLicenseEntitlementsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseEntitlementsError = + GetLicenseEntitlementsErrors[keyof GetLicenseEntitlementsErrors]; + +export type GetLicenseEntitlementsResponses = { + /** + * OK + */ + 200: PageLicenseEntitlement; +}; + +export type GetLicenseEntitlementsResponse = + GetLicenseEntitlementsResponses[keyof GetLicenseEntitlementsResponses]; + +export type AssociateEntitlementWithLicenseData = { + body: LicenseEntitlementWritable; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements"; +}; + +export type AssociateEntitlementWithLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AssociateEntitlementWithLicenseError = + AssociateEntitlementWithLicenseErrors[keyof AssociateEntitlementWithLicenseErrors]; + +export type AssociateEntitlementWithLicenseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type AssociateEntitlementWithLicenseResponse = + AssociateEntitlementWithLicenseResponses[keyof AssociateEntitlementWithLicenseResponses]; + +export type DeleteLicenseEntitlementData = { + body?: never; + path: { + licenseSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +}; + +export type DeleteLicenseEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteLicenseEntitlementError = + DeleteLicenseEntitlementErrors[keyof DeleteLicenseEntitlementErrors]; + +export type DeleteLicenseEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteLicenseEntitlementResponse = + DeleteLicenseEntitlementResponses[keyof DeleteLicenseEntitlementResponses]; + +export type GetLicenseEntitlementData = { + body?: never; + path: { + licenseSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +}; + +export type GetLicenseEntitlementErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseEntitlementError = + GetLicenseEntitlementErrors[keyof GetLicenseEntitlementErrors]; + +export type GetLicenseEntitlementResponses = { + /** + * OK + */ + 200: LicenseEntitlement; +}; + +export type GetLicenseEntitlementResponse = + GetLicenseEntitlementResponses[keyof GetLicenseEntitlementResponses]; + +export type UpdateLicenseEntitlementData = { + body: LicenseEntitlementWritable; + path: { + licenseSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +}; + +export type UpdateLicenseEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateLicenseEntitlementError = + UpdateLicenseEntitlementErrors[keyof UpdateLicenseEntitlementErrors]; + +export type UpdateLicenseEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateLicenseEntitlementResponse = + UpdateLicenseEntitlementResponses[keyof UpdateLicenseEntitlementResponses]; + +export type PreviewLicenseInvoiceData = { + body: InvoicePreviewScenario; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/invoice-preview"; +}; + +export type PreviewLicenseInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type PreviewLicenseInvoiceError = + PreviewLicenseInvoiceErrors[keyof PreviewLicenseInvoiceErrors]; + +export type PreviewLicenseInvoiceResponses = { + /** + * OK + */ + 200: InvoicePreview; +}; + +export type PreviewLicenseInvoiceResponse = + PreviewLicenseInvoiceResponses[keyof PreviewLicenseInvoiceResponses]; + +export type ListLicensePricesData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: { + /** + * Only prices in this status; both when omitted + */ + status?: "ACTIVE" | "DEPRECATED"; + /** + * Only prices of this billing model + */ + billingModel?: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; + }; + url: "/licenses/{licenseSlug}/prices"; +}; + +export type ListLicensePricesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListLicensePricesError = ListLicensePricesErrors[keyof ListLicensePricesErrors]; + +export type ListLicensePricesResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListLicensePricesResponse = + ListLicensePricesResponses[keyof ListLicensePricesResponses]; + +export type CreateLicensePriceData = { + body: NewLicensePrice; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices"; +}; + +export type CreateLicensePriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateLicensePriceError = CreateLicensePriceErrors[keyof CreateLicensePriceErrors]; + +export type CreateLicensePriceResponses = { + /** + * Created + */ + 201: Price; +}; + +export type CreateLicensePriceResponse = + CreateLicensePriceResponses[keyof CreateLicensePriceResponses]; + +export type GetLicensePriceData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + /** + * Price identifier + */ + priceId: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices/{priceId}"; +}; + +export type GetLicensePriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetLicensePriceError = GetLicensePriceErrors[keyof GetLicensePriceErrors]; + +export type GetLicensePriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type GetLicensePriceResponse = GetLicensePriceResponses[keyof GetLicensePriceResponses]; + +export type UpdateLicensePriceData = { + body: LicensePriceChanges; + path: { + /** + * License version slug + */ + licenseSlug: string; + /** + * Price identifier + */ + priceId: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices/{priceId}"; +}; + +export type UpdateLicensePriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateLicensePriceError = UpdateLicensePriceErrors[keyof UpdateLicensePriceErrors]; + +export type UpdateLicensePriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type UpdateLicensePriceResponse = + UpdateLicensePriceResponses[keyof UpdateLicensePriceResponses]; + +export type DeprecateLicensePriceData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + /** + * Price identifier + */ + priceId: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices/{priceId}/deprecate"; +}; + +export type DeprecateLicensePriceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DeprecateLicensePriceError = + DeprecateLicensePriceErrors[keyof DeprecateLicensePriceErrors]; + +export type DeprecateLicensePriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type DeprecateLicensePriceResponse = + DeprecateLicensePriceResponses[keyof DeprecateLicensePriceResponses]; + +export type PublishLicenseData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/publish"; +}; + +export type PublishLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type PublishLicenseError = PublishLicenseErrors[keyof PublishLicenseErrors]; + +export type PublishLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type PublishLicenseResponse = PublishLicenseResponses[keyof PublishLicenseResponses]; + +export type UnarchiveLicenseData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/unarchive"; +}; + +export type UnarchiveLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UnarchiveLicenseError = UnarchiveLicenseErrors[keyof UnarchiveLicenseErrors]; + +export type UnarchiveLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type UnarchiveLicenseResponse = UnarchiveLicenseResponses[keyof UnarchiveLicenseResponses]; + +export type ListMetadataFieldsData = { + body?: never; + path?: never; + query: { + resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/metadata-fields"; +}; + +export type ListMetadataFieldsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListMetadataFieldsError = ListMetadataFieldsErrors[keyof ListMetadataFieldsErrors]; + +export type ListMetadataFieldsResponses = { + /** + * OK + */ + 200: PageMetadataField; +}; + +export type ListMetadataFieldsResponse = + ListMetadataFieldsResponses[keyof ListMetadataFieldsResponses]; + +export type CreateMetadataFieldData = { + body: MetadataFieldWritable; + path?: never; + query?: never; + url: "/metadata-fields"; +}; + +export type CreateMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateMetadataFieldError = CreateMetadataFieldErrors[keyof CreateMetadataFieldErrors]; + +export type CreateMetadataFieldResponses = { + /** + * Created + */ + 201: MetadataField; +}; + +export type CreateMetadataFieldResponse = + CreateMetadataFieldResponses[keyof CreateMetadataFieldResponses]; + +export type ReorderMetadataFieldsData = { + body: ReorderMetadataFieldsInput; + path?: never; + query?: never; + url: "/metadata-fields/reorder"; +}; + +export type ReorderMetadataFieldsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ReorderMetadataFieldsError = + ReorderMetadataFieldsErrors[keyof ReorderMetadataFieldsErrors]; + +export type ReorderMetadataFieldsResponses = { + /** + * No Content + */ + 204: void; +}; + +export type ReorderMetadataFieldsResponse = + ReorderMetadataFieldsResponses[keyof ReorderMetadataFieldsResponses]; + +export type UpdateMetadataFieldData = { + body: MetadataFieldWritable; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}"; +}; + +export type UpdateMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateMetadataFieldError = UpdateMetadataFieldErrors[keyof UpdateMetadataFieldErrors]; + +export type UpdateMetadataFieldResponses = { + /** + * OK + */ + 200: MetadataField; +}; + +export type UpdateMetadataFieldResponse = + UpdateMetadataFieldResponses[keyof UpdateMetadataFieldResponses]; + +export type ArchiveMetadataFieldData = { + body?: never; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}/archive"; +}; + +export type ArchiveMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ArchiveMetadataFieldError = + ArchiveMetadataFieldErrors[keyof ArchiveMetadataFieldErrors]; + +export type ArchiveMetadataFieldResponses = { + /** + * OK + */ + 200: MetadataField; +}; + +export type ArchiveMetadataFieldResponse = + ArchiveMetadataFieldResponses[keyof ArchiveMetadataFieldResponses]; + +export type DryRunMetadataFieldData = { + body: MetadataFieldSchemaProposal; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}/dry-run"; +}; + +export type DryRunMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DryRunMetadataFieldError = DryRunMetadataFieldErrors[keyof DryRunMetadataFieldErrors]; + +export type DryRunMetadataFieldResponses = { + /** + * OK + */ + 200: Impact; +}; + +export type DryRunMetadataFieldResponse = + DryRunMetadataFieldResponses[keyof DryRunMetadataFieldResponses]; + +export type UnarchiveMetadataFieldData = { + body?: never; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}/unarchive"; +}; + +export type UnarchiveMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UnarchiveMetadataFieldError = + UnarchiveMetadataFieldErrors[keyof UnarchiveMetadataFieldErrors]; + +export type UnarchiveMetadataFieldResponses = { + /** + * OK + */ + 200: MetadataField; +}; + +export type UnarchiveMetadataFieldResponse = + UnarchiveMetadataFieldResponses[keyof UnarchiveMetadataFieldResponses]; + +export type EvaluateFlagsBulkData = { + /** + * EvaluateVariant multiple flags in one request + */ + body?: BulkEvaluationRequest; + headers?: { + /** + * The request will be processed only if ETag doesn't match any of the values listed. + */ + "If-None-Match"?: string; + }; + path?: never; + query?: never; + url: "/ofrep/v1/evaluate/flags"; +}; + +export type EvaluateFlagsBulkErrors = { + /** + * Bad evaluation request + */ + 400: BulkEvaluationFailure; + /** + * Unauthorized - You need credentials to access the API + */ + 401: unknown; + /** + * Forbidden - You are not authorized to access the API + */ + 403: unknown; + /** + * Rate limit reached on the Flag Management System + */ + 429: unknown; + /** + * Internal server error + */ + 500: BulkEvaluationFailure; +}; + +export type EvaluateFlagsBulkError = EvaluateFlagsBulkErrors[keyof EvaluateFlagsBulkErrors]; + +export type EvaluateFlagsBulkResponses = { + /** + * OFREP successful evaluation response + */ + 200: + | { + /** + * Array of evaluation results + */ + flags?: Array; + } + | BulkEvaluationFailure; +}; + +export type EvaluateFlagsBulkResponse = + EvaluateFlagsBulkResponses[keyof EvaluateFlagsBulkResponses]; + +export type EvaluateFlagData = { + /** + * Evaluation context + */ + body: EvaluationRequest; + path: { + key: string; + }; + query?: never; + url: "/ofrep/v1/evaluate/flags/{key}"; +}; + +export type EvaluateFlagErrors = { + /** + * Evaluation failed + */ + 400: EvaluationFailure; + /** + * Internal error + */ + 500: EvaluationFailure; +}; + +export type EvaluateFlagError = EvaluateFlagErrors[keyof EvaluateFlagErrors]; + +export type EvaluateFlagResponses = { + /** + * Flag evaluated successfully + */ + 200: EvaluationSuccess; +}; + +export type EvaluateFlagResponse = EvaluateFlagResponses[keyof EvaluateFlagResponses]; + +export type GetOpenfeatureManifestData = { + body?: never; + path?: never; + query?: never; + url: "/openfeature/v0/manifest"; +}; + +export type GetOpenfeatureManifestErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetOpenfeatureManifestError = + GetOpenfeatureManifestErrors[keyof GetOpenfeatureManifestErrors]; + +export type GetOpenfeatureManifestResponses = { + /** + * OK + */ + 200: ManifestEnvelope; +}; + +export type GetOpenfeatureManifestResponse = + GetOpenfeatureManifestResponses[keyof GetOpenfeatureManifestResponses]; + +export type GetPublicCatalogData = { + body?: never; + path?: never; + query?: { + /** + * Only this licence family + */ + familySlug?: string; + /** + * addons (the default) lists the public add-ons too; none leaves them out + */ + include?: Array<"addons" | "none"> | null; + }; + url: "/public/catalog"; +}; + +export type GetPublicCatalogErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetPublicCatalogError = GetPublicCatalogErrors[keyof GetPublicCatalogErrors]; + +export type GetPublicCatalogResponses = { + /** + * OK + */ + 200: PublicCatalog; +}; + +export type GetPublicCatalogResponse = GetPublicCatalogResponses[keyof GetPublicCatalogResponses]; + +export type CreateSessionCheckoutData = { + body: SessionCheckoutOrder; + path?: never; + query?: never; + url: "/public/session/checkout"; +}; + +export type CreateSessionCheckoutErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateSessionCheckoutError = + CreateSessionCheckoutErrors[keyof CreateSessionCheckoutErrors]; + +export type CreateSessionCheckoutResponses = { + /** + * Created + */ + 201: SessionCheckout; +}; + +export type CreateSessionCheckoutResponse = + CreateSessionCheckoutResponses[keyof CreateSessionCheckoutResponses]; + +export type ListSessionInvoicesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + }; + url: "/public/session/invoices"; +}; + +export type ListSessionInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListSessionInvoicesError = ListSessionInvoicesErrors[keyof ListSessionInvoicesErrors]; + +export type ListSessionInvoicesResponses = { + /** + * OK + */ + 200: PageSessionInvoice; +}; + +export type ListSessionInvoicesResponse = + ListSessionInvoicesResponses[keyof ListSessionInvoicesResponses]; + +export type ListPublishableKeysData = { + body?: never; + path?: never; + query?: { + /** + * Also list revoked keys + */ + includeRevoked?: boolean; + }; + url: "/publishable-keys"; +}; + +export type ListPublishableKeysErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListPublishableKeysError = ListPublishableKeysErrors[keyof ListPublishableKeysErrors]; + +export type ListPublishableKeysResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListPublishableKeysResponse = + ListPublishableKeysResponses[keyof ListPublishableKeysResponses]; + +export type CreatePublishableKeyData = { + body: PublishableKeyDraft; + path?: never; + query?: never; + url: "/publishable-keys"; +}; + +export type CreatePublishableKeyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreatePublishableKeyError = + CreatePublishableKeyErrors[keyof CreatePublishableKeyErrors]; + +export type CreatePublishableKeyResponses = { + /** + * Created + */ + 201: PublishableKeyCreated; +}; + +export type CreatePublishableKeyResponse = + CreatePublishableKeyResponses[keyof CreatePublishableKeyResponses]; + +export type UpdatePublishableKeyData = { + body: PublishableKeyPatch; + path: { + /** + * Publishable key id + */ + keyId: string; + }; + query?: never; + url: "/publishable-keys/{keyId}"; +}; + +export type UpdatePublishableKeyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdatePublishableKeyError = + UpdatePublishableKeyErrors[keyof UpdatePublishableKeyErrors]; + +export type UpdatePublishableKeyResponses = { + /** + * OK + */ + 200: PublishableKey; +}; + +export type UpdatePublishableKeyResponse = + UpdatePublishableKeyResponses[keyof UpdatePublishableKeyResponses]; + +export type RevokePublishableKeyData = { + body?: never; + path: { + /** + * Publishable key id + */ + keyId: string; + }; + query?: never; + url: "/publishable-keys/{keyId}/revoke"; +}; + +export type RevokePublishableKeyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type RevokePublishableKeyError = + RevokePublishableKeyErrors[keyof RevokePublishableKeyErrors]; + +export type RevokePublishableKeyResponses = { + /** + * OK + */ + 200: PublishableKey; +}; + +export type RevokePublishableKeyResponse = + RevokePublishableKeyResponses[keyof RevokePublishableKeyResponses]; + +export type ListReleasesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/releases"; +}; + +export type ListReleasesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListReleasesError = ListReleasesErrors[keyof ListReleasesErrors]; + +export type ListReleasesResponses = { + /** + * OK + */ + 200: PageRelease; +}; + +export type ListReleasesResponse = ListReleasesResponses[keyof ListReleasesResponses]; + +export type CreateReleaseData = { + body: ReleaseWritable; + path?: never; + query?: never; + url: "/releases"; +}; + +export type CreateReleaseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateReleaseError = CreateReleaseErrors[keyof CreateReleaseErrors]; + +export type CreateReleaseResponses = { + /** + * Created + */ + 201: Release; +}; + +export type CreateReleaseResponse = CreateReleaseResponses[keyof CreateReleaseResponses]; + +export type DeleteReleaseData = { + body?: never; + path: { + /** + * Release slug + */ + releaseSlug: string; + }; + query?: never; + url: "/releases/{releaseSlug}"; +}; + +export type DeleteReleaseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteReleaseError = DeleteReleaseErrors[keyof DeleteReleaseErrors]; + +export type DeleteReleaseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteReleaseResponse = DeleteReleaseResponses[keyof DeleteReleaseResponses]; + +export type GetReleaseBySlugData = { + body?: never; + path: { + /** + * Release slug + */ + releaseSlug: string; + }; + query?: never; + url: "/releases/{releaseSlug}"; +}; + +export type GetReleaseBySlugErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetReleaseBySlugError = GetReleaseBySlugErrors[keyof GetReleaseBySlugErrors]; + +export type GetReleaseBySlugResponses = { + /** + * OK + */ + 200: Release; +}; + +export type GetReleaseBySlugResponse = GetReleaseBySlugResponses[keyof GetReleaseBySlugResponses]; + +export type GetServiceAccountsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/service-accounts"; +}; + +export type GetServiceAccountsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetServiceAccountsError = GetServiceAccountsErrors[keyof GetServiceAccountsErrors]; + +export type GetServiceAccountsResponses = { + /** + * OK + */ + 200: PageServiceAccount; +}; + +export type GetServiceAccountsResponse = + GetServiceAccountsResponses[keyof GetServiceAccountsResponses]; + +export type CreateServiceAccountData = { + /** + * Service account details + */ + body: ServiceAccountWritable; + path?: never; + query?: never; + url: "/service-accounts"; +}; + +export type CreateServiceAccountErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateServiceAccountError = + CreateServiceAccountErrors[keyof CreateServiceAccountErrors]; + +export type CreateServiceAccountResponses = { + /** + * Created service account + */ + 201: ServiceAccount; +}; + +export type CreateServiceAccountResponse = + CreateServiceAccountResponses[keyof CreateServiceAccountResponses]; + +export type GetServiceAccountData = { + body?: never; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}"; +}; + +export type GetServiceAccountErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetServiceAccountError = GetServiceAccountErrors[keyof GetServiceAccountErrors]; + +export type GetServiceAccountResponses = { + /** + * Service account details + */ + 200: ServiceAccount; +}; + +export type GetServiceAccountResponse = + GetServiceAccountResponses[keyof GetServiceAccountResponses]; + +export type UpdateServiceAccountData = { + /** + * Service account update details + */ + body: ServiceAccountWritable; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}"; +}; + +export type UpdateServiceAccountErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateServiceAccountError = + UpdateServiceAccountErrors[keyof UpdateServiceAccountErrors]; + +export type UpdateServiceAccountResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateServiceAccountResponse = + UpdateServiceAccountResponses[keyof UpdateServiceAccountResponses]; + +export type GetServiceAccountTokensData = { + body?: never; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/service-accounts/{serviceAccountSlug}/tokens"; +}; + +export type GetServiceAccountTokensErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetServiceAccountTokensError = + GetServiceAccountTokensErrors[keyof GetServiceAccountTokensErrors]; + +export type GetServiceAccountTokensResponses = { + /** + * OK + */ + 200: PageToken; +}; + +export type GetServiceAccountTokensResponse = + GetServiceAccountTokensResponses[keyof GetServiceAccountTokensResponses]; + +export type CreateServiceAccountTokenData = { + /** + * Token creation details + */ + body: PlainTokenWritable; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}/tokens"; +}; + +export type CreateServiceAccountTokenErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateServiceAccountTokenError = + CreateServiceAccountTokenErrors[keyof CreateServiceAccountTokenErrors]; + +export type CreateServiceAccountTokenResponses = { + /** + * Created token with secret value (only shown once) + */ + 201: PlainToken; +}; + +export type CreateServiceAccountTokenResponse = + CreateServiceAccountTokenResponses[keyof CreateServiceAccountTokenResponses]; + +export type DeleteServiceAccountTokenData = { + body?: never; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + /** + * Token slug to revoke + */ + tokenSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}"; +}; + +export type DeleteServiceAccountTokenErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteServiceAccountTokenError = + DeleteServiceAccountTokenErrors[keyof DeleteServiceAccountTokenErrors]; + +export type DeleteServiceAccountTokenResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteServiceAccountTokenResponse = + DeleteServiceAccountTokenResponses[keyof DeleteServiceAccountTokenResponses]; + +export type ExportOrganizationUsageReportsData = { + body?: never; + path?: never; + query?: { + /** + * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + */ + from?: string; + /** + * End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. + */ + to?: string; + /** + * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat. + */ + format?: string; + /** + * Only this instance's reports + */ + instanceSlug?: string; + /** + * Only this instance's reports. Reaches a deleted instance, whose reports are kept. + */ + instanceId?: string; + /** + * Only this entitlement's reports + */ + entitlementSlug?: string; + /** + * Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. + */ + entitlementId?: string; + }; + url: "/usage/reports/export"; +}; + +export type ExportOrganizationUsageReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ExportOrganizationUsageReportsError = + ExportOrganizationUsageReportsErrors[keyof ExportOrganizationUsageReportsErrors]; + +export type ExportOrganizationUsageReportsResponses = { + /** + * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + */ + 200: string; +}; + +export type ExportOrganizationUsageReportsResponse = + ExportOrganizationUsageReportsResponses[keyof ExportOrganizationUsageReportsResponses]; + +export type GetNotificationPreferencesData = { + body?: never; + path?: never; + query?: never; + url: "/v1/notification-preferences"; +}; + +export type GetNotificationPreferencesErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetNotificationPreferencesError = + GetNotificationPreferencesErrors[keyof GetNotificationPreferencesErrors]; + +export type GetNotificationPreferencesResponses = { + /** + * OK + */ + 200: PreferenceMatrix; +}; + +export type GetNotificationPreferencesResponse = + GetNotificationPreferencesResponses[keyof GetNotificationPreferencesResponses]; + +export type PutNotificationPreferencesData = { + body: PreferenceChoices; + path?: never; + query?: never; + url: "/v1/notification-preferences"; +}; + +export type PutNotificationPreferencesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type PutNotificationPreferencesError = + PutNotificationPreferencesErrors[keyof PutNotificationPreferencesErrors]; + +export type PutNotificationPreferencesResponses = { + /** + * OK + */ + 200: PreferenceMatrix; +}; + +export type PutNotificationPreferencesResponse = + PutNotificationPreferencesResponses[keyof PutNotificationPreferencesResponses]; + +export type ListNotificationsData = { + body?: never; + path?: never; + query?: { + /** + * Which notifications to return (default all) + */ + status?: "all" | "unread"; + /** + * Only notifications about these kinds of object; repeat the parameter for several (default: all) + */ + objectType?: Array< + "instance" | "customer" | "release" | "deployment_zone" | "component" | "license" | "token" + > | null; + /** + * Opaque cursor from a previous response's next_cursor + */ + cursor?: string; + /** + * Page size (default 20, max 50) + */ + limit?: number; + }; + url: "/v1/notifications"; +}; + +export type ListNotificationsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListNotificationsError = ListNotificationsErrors[keyof ListNotificationsErrors]; + +export type ListNotificationsResponses = { + /** + * OK + */ + 200: List; +}; + +export type ListNotificationsResponse = + ListNotificationsResponses[keyof ListNotificationsResponses]; + +export type MarkNotificationsReadData = { + body: ReadSelection; + path?: never; + query?: never; + url: "/v1/notifications/mark-read"; +}; + +export type MarkNotificationsReadErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type MarkNotificationsReadError = + MarkNotificationsReadErrors[keyof MarkNotificationsReadErrors]; + +export type MarkNotificationsReadResponses = { + /** + * OK + */ + 200: MarkReadResult; +}; + +export type MarkNotificationsReadResponse = + MarkNotificationsReadResponses[keyof MarkNotificationsReadResponses]; + +export type ListVouchersData = { + body?: never; + path?: never; + query?: { + status?: "DRAFT" | "ACTIVE" | "EXPIRED" | "EXHAUSTED" | "ARCHIVED"; + voucherType?: "PRICE" | "ENTITLEMENT_BOOST"; + restrictedCustomerSlug?: string; + }; + url: "/vouchers"; +}; + +export type ListVouchersErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListVouchersError = ListVouchersErrors[keyof ListVouchersErrors]; + +export type ListVouchersResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListVouchersResponse = ListVouchersResponses[keyof ListVouchersResponses]; + +export type CreateVoucherData = { + body: VoucherDraft; + path?: never; + query?: never; + url: "/vouchers"; +}; + +export type CreateVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateVoucherError = CreateVoucherErrors[keyof CreateVoucherErrors]; + +export type CreateVoucherResponses = { + /** + * Created + */ + 201: Voucher; +}; + +export type CreateVoucherResponse = CreateVoucherResponses[keyof CreateVoucherResponses]; + +export type LookupVoucherData = { + body: VoucherCode; + path?: never; + query?: never; + url: "/vouchers/lookup"; +}; + +export type LookupVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type LookupVoucherError = LookupVoucherErrors[keyof LookupVoucherErrors]; + +export type LookupVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type LookupVoucherResponse = LookupVoucherResponses[keyof LookupVoucherResponses]; + +export type ValidateVoucherData = { + body: VoucherCheck; + path?: never; + query?: never; + url: "/vouchers/validate"; +}; + +export type ValidateVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ValidateVoucherError = ValidateVoucherErrors[keyof ValidateVoucherErrors]; + +export type ValidateVoucherResponses = { + /** + * OK + */ + 200: Validity; +}; + +export type ValidateVoucherResponse = ValidateVoucherResponses[keyof ValidateVoucherResponses]; + +export type GetVoucherData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}"; +}; + +export type GetVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetVoucherError = GetVoucherErrors[keyof GetVoucherErrors]; + +export type GetVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type GetVoucherResponse = GetVoucherResponses[keyof GetVoucherResponses]; + +export type UpdateVoucherData = { + body: VoucherDraft; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}"; +}; + +export type UpdateVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateVoucherError = UpdateVoucherErrors[keyof UpdateVoucherErrors]; + +export type UpdateVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type UpdateVoucherResponse = UpdateVoucherResponses[keyof UpdateVoucherResponses]; + +export type ArchiveVoucherData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}/archive"; +}; + +export type ArchiveVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ArchiveVoucherError = ArchiveVoucherErrors[keyof ArchiveVoucherErrors]; + +export type ArchiveVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type ArchiveVoucherResponse = ArchiveVoucherResponses[keyof ArchiveVoucherResponses]; + +export type PublishVoucherData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}/publish"; +}; + +export type PublishVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type PublishVoucherError = PublishVoucherErrors[keyof PublishVoucherErrors]; + +export type PublishVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type PublishVoucherResponse = PublishVoucherResponses[keyof PublishVoucherResponses]; + +export type ListVoucherRedemptionsData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}/redemptions"; +}; + +export type ListVoucherRedemptionsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListVoucherRedemptionsError = + ListVoucherRedemptionsErrors[keyof ListVoucherRedemptionsErrors]; + +export type ListVoucherRedemptionsResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListVoucherRedemptionsResponse = + ListVoucherRedemptionsResponses[keyof ListVoucherRedemptionsResponses]; + +export type OnAddonEntitlementAssignedWebhookPayload = { + data: AddonGrantUpdateWritable; + /** + * Event name + */ + name: "ADDON_ENTITLEMENT_ASSIGNED"; + /** + * Event type + */ + type: "com.kaiten.addon.entitlement.v1.assigned"; +}; + +export type OnAddonEntitlementAssignedWebhookRequest = { + body: OnAddonEntitlementAssignedWebhookPayload; + key: "com.kaiten.addon.entitlement.v1.assigned"; + path?: never; + query?: never; +}; + +export type OnAddonEntitlementUnassignedWebhookPayload = { + data: AddonGrantUpdateWritable; + /** + * Event name + */ + name: "ADDON_ENTITLEMENT_UNASSIGNED"; + /** + * Event type + */ + type: "com.kaiten.addon.entitlement.v1.unassigned"; +}; + +export type OnAddonEntitlementUnassignedWebhookRequest = { + body: OnAddonEntitlementUnassignedWebhookPayload; + key: "com.kaiten.addon.entitlement.v1.unassigned"; + path?: never; + query?: never; +}; + +export type OnAddonEntitlementUpdatedWebhookPayload = { + data: AddonGrantUpdateWritable; + /** + * Event name + */ + name: "ADDON_ENTITLEMENT_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.addon.entitlement.v1.updated"; +}; + +export type OnAddonEntitlementUpdatedWebhookRequest = { + body: OnAddonEntitlementUpdatedWebhookPayload; + key: "com.kaiten.addon.entitlement.v1.updated"; + path?: never; + query?: never; +}; + +export type OnAddonPriceCreatedWebhookPayload = { + data: AddonPriceUpdateWritable; + /** + * Event name + */ + name: "ADDON_PRICE_CREATED"; + /** + * Event type + */ + type: "com.kaiten.addon.price.v1.created"; +}; + +export type OnAddonPriceCreatedWebhookRequest = { + body: OnAddonPriceCreatedWebhookPayload; + key: "com.kaiten.addon.price.v1.created"; + path?: never; + query?: never; +}; + +export type OnAddonPriceDeprecatedWebhookPayload = { + data: AddonPriceUpdateWritable; + /** + * Event name + */ + name: "ADDON_PRICE_DEPRECATED"; + /** + * Event type + */ + type: "com.kaiten.addon.price.v1.deprecated"; +}; + +export type OnAddonPriceDeprecatedWebhookRequest = { + body: OnAddonPriceDeprecatedWebhookPayload; + key: "com.kaiten.addon.price.v1.deprecated"; + path?: never; + query?: never; +}; + +export type OnAddonArchivedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_ARCHIVED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.archived"; +}; + +export type OnAddonArchivedWebhookRequest = { + body: OnAddonArchivedWebhookPayload; + key: "com.kaiten.addon.v1.archived"; + path?: never; + query?: never; +}; + +export type OnAddonCreatedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_CREATED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.created"; +}; + +export type OnAddonCreatedWebhookRequest = { + body: OnAddonCreatedWebhookPayload; + key: "com.kaiten.addon.v1.created"; + path?: never; + query?: never; +}; + +export type OnAddonDeletedWebhookPayload = { + data: DeletedAddon; + /** + * Event name + */ + name: "ADDON_DELETED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.deleted"; +}; + +export type OnAddonDeletedWebhookRequest = { + body: OnAddonDeletedWebhookPayload; + key: "com.kaiten.addon.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnAddonPublishedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_PUBLISHED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.published"; +}; + +export type OnAddonPublishedWebhookRequest = { + body: OnAddonPublishedWebhookPayload; + key: "com.kaiten.addon.v1.published"; + path?: never; + query?: never; +}; + +export type OnAddonUnarchivedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_UNARCHIVED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.unarchived"; +}; + +export type OnAddonUnarchivedWebhookRequest = { + body: OnAddonUnarchivedWebhookPayload; + key: "com.kaiten.addon.v1.unarchived"; + path?: never; + query?: never; +}; + +export type OnAddonUpdatedWebhookPayload = { + data: AddonUpdateWritable; + /** + * Event name + */ + name: "ADDON_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.updated"; +}; + +export type OnAddonUpdatedWebhookRequest = { + body: OnAddonUpdatedWebhookPayload; + key: "com.kaiten.addon.v1.updated"; + path?: never; + query?: never; +}; + +export type OnBillingProviderConnectedWebhookPayload = { + data: Connection; + /** + * Event name + */ + name: "BILLING_PROVIDER_CONNECTED"; + /** + * Event type + */ + type: "com.kaiten.billing_provider.v1.connected"; +}; + +export type OnBillingProviderConnectedWebhookRequest = { + body: OnBillingProviderConnectedWebhookPayload; + key: "com.kaiten.billing_provider.v1.connected"; + path?: never; + query?: never; +}; + +export type OnBillingProviderDisconnectedWebhookPayload = { + data: Connection; + /** + * Event name + */ + name: "BILLING_PROVIDER_DISCONNECTED"; + /** + * Event type + */ + type: "com.kaiten.billing_provider.v1.disconnected"; +}; + +export type OnBillingProviderDisconnectedWebhookRequest = { + body: OnBillingProviderDisconnectedWebhookPayload; + key: "com.kaiten.billing_provider.v1.disconnected"; + path?: never; + query?: never; +}; + +export type OnBillingProviderSyncFailedWebhookPayload = { + data: SyncFailure; + /** + * Event name + */ + name: "BILLING_PROVIDER_SYNC_FAILED"; + /** + * Event type + */ + type: "com.kaiten.billing_provider.v1.sync_failed"; +}; + +export type OnBillingProviderSyncFailedWebhookRequest = { + body: OnBillingProviderSyncFailedWebhookPayload; + key: "com.kaiten.billing_provider.v1.sync_failed"; + path?: never; + query?: never; +}; + +export type OnComponentCreatedWebhookPayload = { + data: ComponentWritable; + /** + * Event name + */ + name: "COMPONENT_CREATED"; + /** + * Event type + */ + type: "com.kaiten.component.v1.created"; +}; + +export type OnComponentCreatedWebhookRequest = { + body: OnComponentCreatedWebhookPayload; + key: "com.kaiten.component.v1.created"; + path?: never; + query?: never; +}; + +export type OnComponentDeletedWebhookPayload = { + data: ComponentWritable; + /** + * Event name + */ + name: "COMPONENT_DELETED"; + /** + * Event type + */ + type: "com.kaiten.component.v1.deleted"; +}; + +export type OnComponentDeletedWebhookRequest = { + body: OnComponentDeletedWebhookPayload; + key: "com.kaiten.component.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnComponentUpdatedWebhookPayload = { + data: ComponentWritable; + /** + * Event name + */ + name: "COMPONENT_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.component.v1.updated"; +}; + +export type OnComponentUpdatedWebhookRequest = { + body: OnComponentUpdatedWebhookPayload; + key: "com.kaiten.component.v1.updated"; + path?: never; + query?: never; +}; + +export type OnCustomerPaymentMethodAttachedWebhookPayload = { + data: PaymentMethodAttached; + /** + * Event name + */ + name: "CUSTOMER_PAYMENT_METHOD_ATTACHED"; + /** + * Event type + */ + type: "com.kaiten.customer.payment_method.v1.attached"; +}; + +export type OnCustomerPaymentMethodAttachedWebhookRequest = { + body: OnCustomerPaymentMethodAttachedWebhookPayload; + key: "com.kaiten.customer.payment_method.v1.attached"; + path?: never; + query?: never; +}; + +export type OnCustomerPaymentMethodDetachedWebhookPayload = { + data: PaymentMethodDetached; + /** + * Event name + */ + name: "CUSTOMER_PAYMENT_METHOD_DETACHED"; + /** + * Event type + */ + type: "com.kaiten.customer.payment_method.v1.detached"; +}; + +export type OnCustomerPaymentMethodDetachedWebhookRequest = { + body: OnCustomerPaymentMethodDetachedWebhookPayload; + key: "com.kaiten.customer.payment_method.v1.detached"; + path?: never; + query?: never; +}; + +export type OnCustomerPaymentMethodExpiringWebhookPayload = { + data: PaymentMethodExpiring; + /** + * Event name + */ + name: "CUSTOMER_PAYMENT_METHOD_EXPIRING"; + /** + * Event type + */ + type: "com.kaiten.customer.payment_method.v1.expiring"; +}; + +export type OnCustomerPaymentMethodExpiringWebhookRequest = { + body: OnCustomerPaymentMethodExpiringWebhookPayload; + key: "com.kaiten.customer.payment_method.v1.expiring"; + path?: never; + query?: never; +}; + +export type OnCustomerCreatedWebhookPayload = { + data: CustomerWritable; + /** + * Event name + */ + name: "CUSTOMER_CREATED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.created"; +}; + +export type OnCustomerCreatedWebhookRequest = { + body: OnCustomerCreatedWebhookPayload; + key: "com.kaiten.customer.v1.created"; + path?: never; + query?: never; +}; + +export type OnCustomerCreationRejectedWebhookPayload = { + data: CustomerCreationRejected; + /** + * Event name + */ + name: "CUSTOMER_CREATION_REJECTED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.creation_rejected"; +}; + +export type OnCustomerCreationRejectedWebhookRequest = { + body: OnCustomerCreationRejectedWebhookPayload; + key: "com.kaiten.customer.v1.creation_rejected"; + path?: never; + query?: never; +}; + +export type OnCustomerDeletedWebhookPayload = { + data: CustomerWritable; + /** + * Event name + */ + name: "CUSTOMER_DELETED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.deleted"; +}; + +export type OnCustomerDeletedWebhookRequest = { + body: OnCustomerDeletedWebhookPayload; + key: "com.kaiten.customer.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnCustomerUpdatedWebhookPayload = { + data: CustomerWritable; + /** + * Event name + */ + name: "CUSTOMER_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.updated"; +}; + +export type OnCustomerUpdatedWebhookRequest = { + body: OnCustomerUpdatedWebhookPayload; + key: "com.kaiten.customer.v1.updated"; + path?: never; + query?: never; +}; + +export type OnDeploymentZoneCreatedWebhookPayload = { + data: DeploymentZoneWritable; + /** + * Event name + */ + name: "DEPLOYMENT_ZONE_CREATED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.created"; +}; + +export type OnDeploymentZoneCreatedWebhookRequest = { + body: OnDeploymentZoneCreatedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.created"; + path?: never; + query?: never; +}; + +export type OnDeploymentZoneDeletedWebhookPayload = { + data: DeploymentZoneWritable; + /** + * Event name + */ + name: "DEPLOYMENT_ZONE_DELETED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.deleted"; +}; + +export type OnDeploymentZoneDeletedWebhookRequest = { + body: OnDeploymentZoneDeletedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnReleaseDeployedWebhookPayload = { + data: Deployment; + /** + * Event name + */ + name: "RELEASE_DEPLOYED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.release_deployed"; +}; + +export type OnReleaseDeployedWebhookRequest = { + body: OnReleaseDeployedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.release_deployed"; + path?: never; + query?: never; +}; + +export type OnDeploymentZoneUpdatedWebhookPayload = { + data: DeploymentZoneWritable; + /** + * Event name + */ + name: "DEPLOYMENT_ZONE_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.updated"; +}; + +export type OnDeploymentZoneUpdatedWebhookRequest = { + body: OnDeploymentZoneUpdatedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.updated"; + path?: never; + query?: never; +}; + +export type OnEntitlementCreatedWebhookPayload = { + data: EntitlementWritable; + /** + * Event name + */ + name: "ENTITLEMENT_CREATED"; + /** + * Event type + */ + type: "com.kaiten.entitlement.v1.created"; +}; + +export type OnEntitlementCreatedWebhookRequest = { + body: OnEntitlementCreatedWebhookPayload; + key: "com.kaiten.entitlement.v1.created"; + path?: never; + query?: never; +}; + +export type OnEntitlementDeletedWebhookPayload = { + data: EntitlementWritable; + /** + * Event name + */ + name: "ENTITLEMENT_DELETED"; + /** + * Event type + */ + type: "com.kaiten.entitlement.v1.deleted"; +}; + +export type OnEntitlementDeletedWebhookRequest = { + body: OnEntitlementDeletedWebhookPayload; + key: "com.kaiten.entitlement.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnEntitlementUpdatedWebhookPayload = { + data: EntitlementWritable; + /** + * Event name + */ + name: "ENTITLEMENT_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.entitlement.v1.updated"; +}; + +export type OnEntitlementUpdatedWebhookRequest = { + body: OnEntitlementUpdatedWebhookPayload; + key: "com.kaiten.entitlement.v1.updated"; + path?: never; + query?: never; +}; + +export type OnEntitlementGroupCreatedWebhookPayload = { + data: EntitlementGroupWritable; + /** + * Event name + */ + name: "ENTITLEMENT_GROUP_CREATED"; + /** + * Event type + */ + type: "com.kaiten.entitlement_group.v1.created"; +}; + +export type OnEntitlementGroupCreatedWebhookRequest = { + body: OnEntitlementGroupCreatedWebhookPayload; + key: "com.kaiten.entitlement_group.v1.created"; + path?: never; + query?: never; +}; + +export type OnEntitlementGroupDeletedWebhookPayload = { + data: EntitlementGroupWritable; + /** + * Event name + */ + name: "ENTITLEMENT_GROUP_DELETED"; + /** + * Event type + */ + type: "com.kaiten.entitlement_group.v1.deleted"; +}; + +export type OnEntitlementGroupDeletedWebhookRequest = { + body: OnEntitlementGroupDeletedWebhookPayload; + key: "com.kaiten.entitlement_group.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnEntitlementGroupUpdatedWebhookPayload = { + data: EntitlementGroupWritable; + /** + * Event name */ - 401: Problem; + name: "ENTITLEMENT_GROUP_UPDATED"; /** - * Forbidden + * Event type */ - 403: Problem; + type: "com.kaiten.entitlement_group.v1.updated"; +}; + +export type OnEntitlementGroupUpdatedWebhookRequest = { + body: OnEntitlementGroupUpdatedWebhookPayload; + key: "com.kaiten.entitlement_group.v1.updated"; + path?: never; + query?: never; +}; + +export type OnFeatureFlagCreatedWebhookPayload = { + data: FeatureFlagWritable; /** - * Unprocessable Entity + * Event name */ - 422: Problem; + name: "FEATURE_FLAG_CREATED"; /** - * Internal Server Error + * Event type */ - 500: Problem; + type: "com.kaiten.feature_flag.v1.created"; }; -export type ListNotificationsError = ListNotificationsErrors[keyof ListNotificationsErrors]; +export type OnFeatureFlagCreatedWebhookRequest = { + body: OnFeatureFlagCreatedWebhookPayload; + key: "com.kaiten.feature_flag.v1.created"; + path?: never; + query?: never; +}; -export type ListNotificationsResponses = { +export type OnFeatureFlagDeletedWebhookPayload = { + data: FeatureFlagWritable; /** - * OK + * Event name */ - 200: List; + name: "FEATURE_FLAG_DELETED"; + /** + * Event type + */ + type: "com.kaiten.feature_flag.v1.deleted"; }; -export type ListNotificationsResponse = - ListNotificationsResponses[keyof ListNotificationsResponses]; - -export type MarkNotificationsReadData = { - body: ReadSelection; +export type OnFeatureFlagDeletedWebhookRequest = { + body: OnFeatureFlagDeletedWebhookPayload; + key: "com.kaiten.feature_flag.v1.deleted"; path?: never; query?: never; - url: "/v1/notifications/mark-read"; }; -export type MarkNotificationsReadErrors = { - /** - * Bad Request - */ - 400: Problem; +export type OnFeatureFlagEvaluatedWebhookPayload = { + data: FeatureFlagEvaluated; /** - * Unauthorized + * Event name */ - 401: Problem; + name: "FEATURE_FLAG_EVALUATED"; /** - * Forbidden + * Event type */ - 403: Problem; + type: "com.kaiten.feature_flag.v1.evaluated"; +}; + +export type OnFeatureFlagEvaluatedWebhookRequest = { + body: OnFeatureFlagEvaluatedWebhookPayload; + key: "com.kaiten.feature_flag.v1.evaluated"; + path?: never; + query?: never; +}; + +export type OnFeatureFlagUpdatedWebhookPayload = { + data: FeatureFlagWritable; /** - * Unprocessable Entity + * Event name */ - 422: Problem; + name: "FEATURE_FLAG_UPDATED"; /** - * Internal Server Error + * Event type */ - 500: Problem; + type: "com.kaiten.feature_flag.v1.updated"; }; -export type MarkNotificationsReadError = - MarkNotificationsReadErrors[keyof MarkNotificationsReadErrors]; +export type OnFeatureFlagUpdatedWebhookRequest = { + body: OnFeatureFlagUpdatedWebhookPayload; + key: "com.kaiten.feature_flag.v1.updated"; + path?: never; + query?: never; +}; -export type MarkNotificationsReadResponses = { +export type OnSystemOrganizationTokenIssuedWebhookPayload = { + data: SystemTokenIssuance; /** - * OK + * Event name */ - 200: MarkReadResult; + name: "SYSTEM_ORGANIZATION_TOKEN_ISSUED"; + /** + * Event type + */ + type: "com.kaiten.identity.v1.system_token_issued"; }; -export type MarkNotificationsReadResponse = - MarkNotificationsReadResponses[keyof MarkNotificationsReadResponses]; +export type OnSystemOrganizationTokenIssuedWebhookRequest = { + body: OnSystemOrganizationTokenIssuedWebhookPayload; + key: "com.kaiten.identity.v1.system_token_issued"; + path?: never; + query?: never; +}; -export type OnComponentCreatedWebhookPayload = { - data: ComponentWritable; +export type OnInstanceAddonAddedWebhookPayload = { + data: InstanceAddonUpdateWritable; /** * Event name */ - name: "COMPONENT_CREATED"; + name: "INSTANCE_ADDON_ADDED"; /** * Event type */ - type: "com.kaiten.component.v1.created"; + type: "com.kaiten.instance.addon.v1.added"; }; -export type OnComponentCreatedWebhookRequest = { - body: OnComponentCreatedWebhookPayload; - key: "com.kaiten.component.v1.created"; +export type OnInstanceAddonAddedWebhookRequest = { + body: OnInstanceAddonAddedWebhookPayload; + key: "com.kaiten.instance.addon.v1.added"; path?: never; query?: never; }; -export type OnComponentDeletedWebhookPayload = { - data: ComponentWritable; +export type OnInstanceAddonQuantityChangedWebhookPayload = { + data: InstanceAddonUpdateWritable; /** * Event name */ - name: "COMPONENT_DELETED"; + name: "INSTANCE_ADDON_QUANTITY_CHANGED"; /** * Event type */ - type: "com.kaiten.component.v1.deleted"; + type: "com.kaiten.instance.addon.v1.quantity_changed"; }; -export type OnComponentDeletedWebhookRequest = { - body: OnComponentDeletedWebhookPayload; - key: "com.kaiten.component.v1.deleted"; +export type OnInstanceAddonQuantityChangedWebhookRequest = { + body: OnInstanceAddonQuantityChangedWebhookPayload; + key: "com.kaiten.instance.addon.v1.quantity_changed"; path?: never; query?: never; }; -export type OnComponentUpdatedWebhookPayload = { - data: ComponentWritable; +export type OnInstanceAddonRemovedWebhookPayload = { + data: InstanceAddonUpdateWritable; /** * Event name */ - name: "COMPONENT_UPDATED"; + name: "INSTANCE_ADDON_REMOVED"; /** * Event type */ - type: "com.kaiten.component.v1.updated"; + type: "com.kaiten.instance.addon.v1.removed"; }; -export type OnComponentUpdatedWebhookRequest = { - body: OnComponentUpdatedWebhookPayload; - key: "com.kaiten.component.v1.updated"; +export type OnInstanceAddonRemovedWebhookRequest = { + body: OnInstanceAddonRemovedWebhookPayload; + key: "com.kaiten.instance.addon.v1.removed"; path?: never; query?: never; }; -export type OnCustomerCreatedWebhookPayload = { - data: CustomerWritable; +export type OnInstanceBillingCanceledWebhookPayload = { + data: CancellationWritable; /** * Event name */ - name: "CUSTOMER_CREATED"; + name: "INSTANCE_BILLING_CANCELED"; /** * Event type */ - type: "com.kaiten.customer.v1.created"; + type: "com.kaiten.instance.billing.v1.canceled"; }; -export type OnCustomerCreatedWebhookRequest = { - body: OnCustomerCreatedWebhookPayload; - key: "com.kaiten.customer.v1.created"; +export type OnInstanceBillingCanceledWebhookRequest = { + body: OnInstanceBillingCanceledWebhookPayload; + key: "com.kaiten.instance.billing.v1.canceled"; path?: never; query?: never; }; -export type OnCustomerCreationRejectedWebhookPayload = { - data: CustomerCreationRejected; +export type OnInstanceBillingCancellationRevertedWebhookPayload = { + data: CancellationChangeWritable; /** * Event name */ - name: "CUSTOMER_CREATION_REJECTED"; + name: "INSTANCE_BILLING_CANCELLATION_REVERTED"; /** * Event type */ - type: "com.kaiten.customer.v1.creation_rejected"; + type: "com.kaiten.instance.billing.v1.cancellation_reverted"; }; -export type OnCustomerCreationRejectedWebhookRequest = { - body: OnCustomerCreationRejectedWebhookPayload; - key: "com.kaiten.customer.v1.creation_rejected"; +export type OnInstanceBillingCancellationRevertedWebhookRequest = { + body: OnInstanceBillingCancellationRevertedWebhookPayload; + key: "com.kaiten.instance.billing.v1.cancellation_reverted"; path?: never; query?: never; }; -export type OnCustomerDeletedWebhookPayload = { - data: CustomerWritable; +export type OnInstanceBillingCancellationScheduledWebhookPayload = { + data: CancellationChangeWritable; /** * Event name */ - name: "CUSTOMER_DELETED"; + name: "INSTANCE_BILLING_CANCELLATION_SCHEDULED"; /** * Event type */ - type: "com.kaiten.customer.v1.deleted"; + type: "com.kaiten.instance.billing.v1.cancellation_scheduled"; }; -export type OnCustomerDeletedWebhookRequest = { - body: OnCustomerDeletedWebhookPayload; - key: "com.kaiten.customer.v1.deleted"; +export type OnInstanceBillingCancellationScheduledWebhookRequest = { + body: OnInstanceBillingCancellationScheduledWebhookPayload; + key: "com.kaiten.instance.billing.v1.cancellation_scheduled"; path?: never; query?: never; }; -export type OnCustomerUpdatedWebhookPayload = { - data: CustomerWritable; +export type OnInstanceBillingPlanChangeCancelledWebhookPayload = { + data: PlanChangeSchedule; /** * Event name */ - name: "CUSTOMER_UPDATED"; + name: "INSTANCE_BILLING_PLAN_CHANGE_CANCELLED"; /** * Event type */ - type: "com.kaiten.customer.v1.updated"; + type: "com.kaiten.instance.billing.v1.plan_change_cancelled"; }; -export type OnCustomerUpdatedWebhookRequest = { - body: OnCustomerUpdatedWebhookPayload; - key: "com.kaiten.customer.v1.updated"; +export type OnInstanceBillingPlanChangeCancelledWebhookRequest = { + body: OnInstanceBillingPlanChangeCancelledWebhookPayload; + key: "com.kaiten.instance.billing.v1.plan_change_cancelled"; path?: never; query?: never; }; -export type OnDeploymentZoneCreatedWebhookPayload = { - data: DeploymentZoneWritable; +export type OnInstanceBillingPlanChangeScheduledWebhookPayload = { + data: PlanChangeSchedule; /** * Event name */ - name: "DEPLOYMENT_ZONE_CREATED"; + name: "INSTANCE_BILLING_PLAN_CHANGE_SCHEDULED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.created"; + type: "com.kaiten.instance.billing.v1.plan_change_scheduled"; }; -export type OnDeploymentZoneCreatedWebhookRequest = { - body: OnDeploymentZoneCreatedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.created"; +export type OnInstanceBillingPlanChangeScheduledWebhookRequest = { + body: OnInstanceBillingPlanChangeScheduledWebhookPayload; + key: "com.kaiten.instance.billing.v1.plan_change_scheduled"; path?: never; query?: never; }; -export type OnDeploymentZoneDeletedWebhookPayload = { - data: DeploymentZoneWritable; +export type OnInstanceBillingPlanChangedWebhookPayload = { + data: PlanChange; /** * Event name */ - name: "DEPLOYMENT_ZONE_DELETED"; + name: "INSTANCE_BILLING_PLAN_CHANGED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.deleted"; + type: "com.kaiten.instance.billing.v1.plan_changed"; }; -export type OnDeploymentZoneDeletedWebhookRequest = { - body: OnDeploymentZoneDeletedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.deleted"; +export type OnInstanceBillingPlanChangedWebhookRequest = { + body: OnInstanceBillingPlanChangedWebhookPayload; + key: "com.kaiten.instance.billing.v1.plan_changed"; path?: never; query?: never; }; -export type OnReleaseDeployedWebhookPayload = { - data: Deployment; +export type OnInstanceBillingProviderChangedWebhookPayload = { + data: ProviderChange; /** * Event name */ - name: "RELEASE_DEPLOYED"; + name: "INSTANCE_BILLING_PROVIDER_CHANGED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.release_deployed"; + type: "com.kaiten.instance.billing.v1.provider_changed"; }; -export type OnReleaseDeployedWebhookRequest = { - body: OnReleaseDeployedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.release_deployed"; +export type OnInstanceBillingProviderChangedWebhookRequest = { + body: OnInstanceBillingProviderChangedWebhookPayload; + key: "com.kaiten.instance.billing.v1.provider_changed"; path?: never; query?: never; }; -export type OnDeploymentZoneUpdatedWebhookPayload = { - data: DeploymentZoneWritable; +export type OnInstanceBillingStartedWebhookPayload = { + data: BillingStartedWritable; /** * Event name */ - name: "DEPLOYMENT_ZONE_UPDATED"; + name: "INSTANCE_BILLING_STARTED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.updated"; + type: "com.kaiten.instance.billing.v1.started"; }; -export type OnDeploymentZoneUpdatedWebhookRequest = { - body: OnDeploymentZoneUpdatedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.updated"; +export type OnInstanceBillingStartedWebhookRequest = { + body: OnInstanceBillingStartedWebhookPayload; + key: "com.kaiten.instance.billing.v1.started"; path?: never; query?: never; }; -export type OnEntitlementCreatedWebhookPayload = { - data: EntitlementWritable; +export type OnInstanceBillingStatusChangedWebhookPayload = { + data: StatusChange; /** * Event name */ - name: "ENTITLEMENT_CREATED"; + name: "INSTANCE_BILLING_STATUS_CHANGED"; /** * Event type */ - type: "com.kaiten.entitlement.v1.created"; + type: "com.kaiten.instance.billing.v1.status_changed"; }; -export type OnEntitlementCreatedWebhookRequest = { - body: OnEntitlementCreatedWebhookPayload; - key: "com.kaiten.entitlement.v1.created"; +export type OnInstanceBillingStatusChangedWebhookRequest = { + body: OnInstanceBillingStatusChangedWebhookPayload; + key: "com.kaiten.instance.billing.v1.status_changed"; path?: never; query?: never; }; -export type OnEntitlementDeletedWebhookPayload = { - data: EntitlementWritable; +export type OnInstanceEntitlementCapExceededWebhookPayload = { + data: InstanceEntitlementCapExceeded; /** * Event name */ - name: "ENTITLEMENT_DELETED"; + name: "INSTANCE_ENTITLEMENT_CAP_EXCEEDED"; /** * Event type */ - type: "com.kaiten.entitlement.v1.deleted"; + type: "com.kaiten.instance.entitlement.v1.cap_exceeded"; }; -export type OnEntitlementDeletedWebhookRequest = { - body: OnEntitlementDeletedWebhookPayload; - key: "com.kaiten.entitlement.v1.deleted"; +export type OnInstanceEntitlementCapExceededWebhookRequest = { + body: OnInstanceEntitlementCapExceededWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.cap_exceeded"; path?: never; query?: never; }; -export type OnEntitlementUpdatedWebhookPayload = { - data: EntitlementWritable; +export type OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload = { + data: InstanceEntitlementUsagePeriodRolledOver; /** * Event name */ - name: "ENTITLEMENT_UPDATED"; + name: "INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER"; /** * Event type */ - type: "com.kaiten.entitlement.v1.updated"; + type: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; }; -export type OnEntitlementUpdatedWebhookRequest = { - body: OnEntitlementUpdatedWebhookPayload; - key: "com.kaiten.entitlement.v1.updated"; +export type OnInstanceEntitlementUsagePeriodRolledOverWebhookRequest = { + body: OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; path?: never; query?: never; }; -export type OnEntitlementGroupCreatedWebhookPayload = { - data: EntitlementGroupWritable; +export type OnInstanceEntitlementUsageReachedWebhookPayload = { + data: EntitlementUsageWritable; /** * Event name */ - name: "ENTITLEMENT_GROUP_CREATED"; + name: "INSTANCE_ENTITLEMENT_USAGE_REACHED"; /** * Event type */ - type: "com.kaiten.entitlement_group.v1.created"; + type: "com.kaiten.instance.entitlement.v1.usage_reached"; }; -export type OnEntitlementGroupCreatedWebhookRequest = { - body: OnEntitlementGroupCreatedWebhookPayload; - key: "com.kaiten.entitlement_group.v1.created"; +export type OnInstanceEntitlementUsageReachedWebhookRequest = { + body: OnInstanceEntitlementUsageReachedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_reached"; + path?: never; + query?: never; +}; + +export type OnInstanceEntitlementUsageReportAcceptedWebhookPayload = { + data: InstanceEntitlementUsageReportAccepted; + /** + * Event name + */ + name: "ENTITLEMENT_USAGE_REPORT_ACCEPTED"; + /** + * Event type + */ + type: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; +}; + +export type OnInstanceEntitlementUsageReportAcceptedWebhookRequest = { + body: OnInstanceEntitlementUsageReportAcceptedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; path?: never; query?: never; }; -export type OnEntitlementGroupDeletedWebhookPayload = { - data: EntitlementGroupWritable; +export type OnInstanceEntitlementUsageReportRejectedWebhookPayload = { + data: InstanceEntitlementUsageReportAccepted; /** * Event name */ - name: "ENTITLEMENT_GROUP_DELETED"; + name: "ENTITLEMENT_USAGE_REPORT_REJECTED"; /** * Event type */ - type: "com.kaiten.entitlement_group.v1.deleted"; + type: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; }; -export type OnEntitlementGroupDeletedWebhookRequest = { - body: OnEntitlementGroupDeletedWebhookPayload; - key: "com.kaiten.entitlement_group.v1.deleted"; +export type OnInstanceEntitlementUsageReportRejectedWebhookRequest = { + body: OnInstanceEntitlementUsageReportRejectedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; path?: never; query?: never; }; -export type OnEntitlementGroupUpdatedWebhookPayload = { - data: EntitlementGroupWritable; +export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload = { + data: InstanceEntitlementUsageWarningThresholdReached; /** * Event name */ - name: "ENTITLEMENT_GROUP_UPDATED"; + name: "INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED"; /** * Event type */ - type: "com.kaiten.entitlement_group.v1.updated"; + type: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; }; -export type OnEntitlementGroupUpdatedWebhookRequest = { - body: OnEntitlementGroupUpdatedWebhookPayload; - key: "com.kaiten.entitlement_group.v1.updated"; +export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest = { + body: OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; path?: never; query?: never; }; -export type OnFeatureFlagCreatedWebhookPayload = { - data: FeatureFlagWritable; +export type OnInstanceEntitlementValueGetWebhookPayload = { + data: InstanceEntitlementValueGetWritable; /** * Event name */ - name: "FEATURE_FLAG_CREATED"; + name: "ENTITLEMENT_VALUE_GET"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.created"; + type: "com.kaiten.instance.entitlement.v1.value_get"; }; -export type OnFeatureFlagCreatedWebhookRequest = { - body: OnFeatureFlagCreatedWebhookPayload; - key: "com.kaiten.feature_flag.v1.created"; +export type OnInstanceEntitlementValueGetWebhookRequest = { + body: OnInstanceEntitlementValueGetWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.value_get"; path?: never; query?: never; }; -export type OnFeatureFlagDeletedWebhookPayload = { - data: FeatureFlagWritable; +export type OnInstanceInvoiceHandoffAcknowledgedWebhookPayload = { + data: HandoffAcknowledgement; /** * Event name */ - name: "FEATURE_FLAG_DELETED"; + name: "INSTANCE_INVOICE_HANDOFF_ACKNOWLEDGED"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.deleted"; + type: "com.kaiten.instance.invoice.v1.handoff_acknowledged"; }; -export type OnFeatureFlagDeletedWebhookRequest = { - body: OnFeatureFlagDeletedWebhookPayload; - key: "com.kaiten.feature_flag.v1.deleted"; +export type OnInstanceInvoiceHandoffAcknowledgedWebhookRequest = { + body: OnInstanceInvoiceHandoffAcknowledgedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.handoff_acknowledged"; path?: never; query?: never; }; -export type OnFeatureFlagEvaluatedWebhookPayload = { - data: FeatureFlagEvaluated; +export type OnInstanceInvoiceHeldWebhookPayload = { + data: HeldInvoice; /** * Event name */ - name: "FEATURE_FLAG_EVALUATED"; + name: "INSTANCE_INVOICE_HELD"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.evaluated"; + type: "com.kaiten.instance.invoice.v1.held"; }; -export type OnFeatureFlagEvaluatedWebhookRequest = { - body: OnFeatureFlagEvaluatedWebhookPayload; - key: "com.kaiten.feature_flag.v1.evaluated"; +export type OnInstanceInvoiceHeldWebhookRequest = { + body: OnInstanceInvoiceHeldWebhookPayload; + key: "com.kaiten.instance.invoice.v1.held"; path?: never; query?: never; }; -export type OnFeatureFlagUpdatedWebhookPayload = { - data: FeatureFlagWritable; +export type OnInstanceInvoiceIssuedWebhookPayload = { + data: IssuedInvoice; /** * Event name */ - name: "FEATURE_FLAG_UPDATED"; + name: "INSTANCE_INVOICE_ISSUED"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.updated"; + type: "com.kaiten.instance.invoice.v1.issued"; }; -export type OnFeatureFlagUpdatedWebhookRequest = { - body: OnFeatureFlagUpdatedWebhookPayload; - key: "com.kaiten.feature_flag.v1.updated"; +export type OnInstanceInvoiceIssuedWebhookRequest = { + body: OnInstanceInvoiceIssuedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.issued"; path?: never; query?: never; }; -export type OnSystemOrganizationTokenIssuedWebhookPayload = { - data: SystemTokenIssuance; +export type OnInstanceInvoiceMarkedUncollectibleWebhookPayload = { + data: UncollectibleInvoice; /** * Event name */ - name: "SYSTEM_ORGANIZATION_TOKEN_ISSUED"; + name: "INSTANCE_INVOICE_MARKED_UNCOLLECTIBLE"; /** * Event type */ - type: "com.kaiten.identity.v1.system_token_issued"; + type: "com.kaiten.instance.invoice.v1.marked_uncollectible"; }; -export type OnSystemOrganizationTokenIssuedWebhookRequest = { - body: OnSystemOrganizationTokenIssuedWebhookPayload; - key: "com.kaiten.identity.v1.system_token_issued"; +export type OnInstanceInvoiceMarkedUncollectibleWebhookRequest = { + body: OnInstanceInvoiceMarkedUncollectibleWebhookPayload; + key: "com.kaiten.instance.invoice.v1.marked_uncollectible"; path?: never; query?: never; }; -export type OnInstanceEntitlementCapExceededWebhookPayload = { - data: InstanceEntitlementCapExceeded; +export type OnInstanceInvoicePaidWebhookPayload = { + data: PaidInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_CAP_EXCEEDED"; + name: "INSTANCE_INVOICE_PAID"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.cap_exceeded"; + type: "com.kaiten.instance.invoice.v1.paid"; }; -export type OnInstanceEntitlementCapExceededWebhookRequest = { - body: OnInstanceEntitlementCapExceededWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.cap_exceeded"; +export type OnInstanceInvoicePaidWebhookRequest = { + body: OnInstanceInvoicePaidWebhookPayload; + key: "com.kaiten.instance.invoice.v1.paid"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload = { - data: InstanceEntitlementUsagePeriodRolledOver; +export type OnInstanceInvoicePaymentFailedWebhookPayload = { + data: PaymentFailedInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER"; + name: "INSTANCE_INVOICE_PAYMENT_FAILED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; + type: "com.kaiten.instance.invoice.v1.payment_failed"; }; -export type OnInstanceEntitlementUsagePeriodRolledOverWebhookRequest = { - body: OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; +export type OnInstanceInvoicePaymentFailedWebhookRequest = { + body: OnInstanceInvoicePaymentFailedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.payment_failed"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageReachedWebhookPayload = { - data: EntitlementUsageWritable; +export type OnInstanceInvoicePushFailedWebhookPayload = { + data: PushFailedInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_USAGE_REACHED"; + name: "INSTANCE_INVOICE_PUSH_FAILED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_reached"; + type: "com.kaiten.instance.invoice.v1.push_failed"; }; -export type OnInstanceEntitlementUsageReachedWebhookRequest = { - body: OnInstanceEntitlementUsageReachedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_reached"; +export type OnInstanceInvoicePushFailedWebhookRequest = { + body: OnInstanceInvoicePushFailedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.push_failed"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageReportAcceptedWebhookPayload = { - data: InstanceEntitlementUsageReportAccepted; +export type OnInstanceInvoicePushedWebhookPayload = { + data: PushedInvoice; /** * Event name */ - name: "ENTITLEMENT_USAGE_REPORT_ACCEPTED"; + name: "INSTANCE_INVOICE_PUSHED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; + type: "com.kaiten.instance.invoice.v1.pushed"; }; -export type OnInstanceEntitlementUsageReportAcceptedWebhookRequest = { - body: OnInstanceEntitlementUsageReportAcceptedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; +export type OnInstanceInvoicePushedWebhookRequest = { + body: OnInstanceInvoicePushedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.pushed"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageReportRejectedWebhookPayload = { - data: InstanceEntitlementUsageReportAccepted; +export type OnInstanceInvoiceReconciliationMismatchWebhookPayload = { + data: MismatchedInvoice; /** * Event name */ - name: "ENTITLEMENT_USAGE_REPORT_REJECTED"; + name: "INSTANCE_INVOICE_RECONCILIATION_MISMATCH"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; + type: "com.kaiten.instance.invoice.v1.reconciliation_mismatch"; }; -export type OnInstanceEntitlementUsageReportRejectedWebhookRequest = { - body: OnInstanceEntitlementUsageReportRejectedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; +export type OnInstanceInvoiceReconciliationMismatchWebhookRequest = { + body: OnInstanceInvoiceReconciliationMismatchWebhookPayload; + key: "com.kaiten.instance.invoice.v1.reconciliation_mismatch"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload = { - data: InstanceEntitlementUsageWarningThresholdReached; +export type OnInstanceInvoiceReleasedWebhookPayload = { + data: ReleasedInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED"; + name: "INSTANCE_INVOICE_RELEASED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; + type: "com.kaiten.instance.invoice.v1.released"; }; -export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest = { - body: OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; +export type OnInstanceInvoiceReleasedWebhookRequest = { + body: OnInstanceInvoiceReleasedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.released"; path?: never; query?: never; }; -export type OnInstanceEntitlementValueGetWebhookPayload = { - data: InstanceEntitlementValueGetWritable; +export type OnInstanceInvoiceVoidedWebhookPayload = { + data: VoidedInvoice; /** * Event name */ - name: "ENTITLEMENT_VALUE_GET"; + name: "INSTANCE_INVOICE_VOIDED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.value_get"; + type: "com.kaiten.instance.invoice.v1.voided"; }; -export type OnInstanceEntitlementValueGetWebhookRequest = { - body: OnInstanceEntitlementValueGetWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.value_get"; +export type OnInstanceInvoiceVoidedWebhookRequest = { + body: OnInstanceInvoiceVoidedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.voided"; path?: never; query?: never; }; @@ -9405,6 +20172,63 @@ export type OnInstanceUpdatedWebhookRequest = { query?: never; }; +export type OnInstanceVoucherExpiredWebhookPayload = { + data: RedemptionWritable; + /** + * Event name + */ + name: "INSTANCE_VOUCHER_EXPIRED"; + /** + * Event type + */ + type: "com.kaiten.instance.voucher.v1.expired"; +}; + +export type OnInstanceVoucherExpiredWebhookRequest = { + body: OnInstanceVoucherExpiredWebhookPayload; + key: "com.kaiten.instance.voucher.v1.expired"; + path?: never; + query?: never; +}; + +export type OnInstanceVoucherRedeemedWebhookPayload = { + data: RedemptionWritable; + /** + * Event name + */ + name: "INSTANCE_VOUCHER_REDEEMED"; + /** + * Event type + */ + type: "com.kaiten.instance.voucher.v1.redeemed"; +}; + +export type OnInstanceVoucherRedeemedWebhookRequest = { + body: OnInstanceVoucherRedeemedWebhookPayload; + key: "com.kaiten.instance.voucher.v1.redeemed"; + path?: never; + query?: never; +}; + +export type OnInstanceVoucherRevokedWebhookPayload = { + data: RedemptionWritable; + /** + * Event name + */ + name: "INSTANCE_VOUCHER_REVOKED"; + /** + * Event type + */ + type: "com.kaiten.instance.voucher.v1.revoked"; +}; + +export type OnInstanceVoucherRevokedWebhookRequest = { + body: OnInstanceVoucherRevokedWebhookPayload; + key: "com.kaiten.instance.voucher.v1.revoked"; + path?: never; + query?: never; +}; + export type OnLicenseEntitlementAssignedWebhookPayload = { data: LicenseEntitlementWritable; /** @@ -9462,6 +20286,63 @@ export type OnLicenseEntitlementUpdatedWebhookRequest = { query?: never; }; +export type OnLicensePriceCreatedWebhookPayload = { + data: EventWritable; + /** + * Event name + */ + name: "LICENSE_PRICE_CREATED"; + /** + * Event type + */ + type: "com.kaiten.license.price.v1.created"; +}; + +export type OnLicensePriceCreatedWebhookRequest = { + body: OnLicensePriceCreatedWebhookPayload; + key: "com.kaiten.license.price.v1.created"; + path?: never; + query?: never; +}; + +export type OnLicensePriceDeprecatedWebhookPayload = { + data: EventWritable; + /** + * Event name + */ + name: "LICENSE_PRICE_DEPRECATED"; + /** + * Event type + */ + type: "com.kaiten.license.price.v1.deprecated"; +}; + +export type OnLicensePriceDeprecatedWebhookRequest = { + body: OnLicensePriceDeprecatedWebhookPayload; + key: "com.kaiten.license.price.v1.deprecated"; + path?: never; + query?: never; +}; + +export type OnLicensePriceUpdatedWebhookPayload = { + data: UpdatedEventWritable; + /** + * Event name + */ + name: "LICENSE_PRICE_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.license.price.v1.updated"; +}; + +export type OnLicensePriceUpdatedWebhookRequest = { + body: OnLicensePriceUpdatedWebhookPayload; + key: "com.kaiten.license.price.v1.updated"; + path?: never; + query?: never; +}; + export type OnLicenseArchivedWebhookPayload = { data: LicenseWritable; /** @@ -9765,3 +20646,98 @@ export type OnReleaseDeletedWebhookRequest = { path?: never; query?: never; }; + +export type OnVoucherArchivedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_ARCHIVED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.archived"; +}; + +export type OnVoucherArchivedWebhookRequest = { + body: OnVoucherArchivedWebhookPayload; + key: "com.kaiten.voucher.v1.archived"; + path?: never; + query?: never; +}; + +export type OnVoucherCreatedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_CREATED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.created"; +}; + +export type OnVoucherCreatedWebhookRequest = { + body: OnVoucherCreatedWebhookPayload; + key: "com.kaiten.voucher.v1.created"; + path?: never; + query?: never; +}; + +export type OnVoucherExhaustedWebhookPayload = { + data: ExhaustedEvent; + /** + * Event name + */ + name: "VOUCHER_EXHAUSTED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.exhausted"; +}; + +export type OnVoucherExhaustedWebhookRequest = { + body: OnVoucherExhaustedWebhookPayload; + key: "com.kaiten.voucher.v1.exhausted"; + path?: never; + query?: never; +}; + +export type OnVoucherPublishedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_PUBLISHED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.published"; +}; + +export type OnVoucherPublishedWebhookRequest = { + body: OnVoucherPublishedWebhookPayload; + key: "com.kaiten.voucher.v1.published"; + path?: never; + query?: never; +}; + +export type OnVoucherUpdatedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.updated"; +}; + +export type OnVoucherUpdatedWebhookRequest = { + body: OnVoucherUpdatedWebhookPayload; + key: "com.kaiten.voucher.v1.updated"; + path?: never; + query?: never; +}; diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index a9ecdf0..c42f5dd 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -42,6 +42,7 @@ export type { KaitenComponentsModule, KaitenCustomersModule, KaitenFlagsModule, + KaitenSessionModule, KaitenInstancesModule, KaitenLicensesModule, KaitenUsageModule, @@ -85,3 +86,14 @@ export type { // are the curated subset that stays top-level; the rest of the generated surface // is under `KaitenApi`. Some names intentionally override the generated ones. export type * from "./client/types.ts"; +// What a customer session does from the browser: checkout and invoices. +export type { + CheckoutDue, + CheckoutOrder, + CheckoutPayment, + CheckoutResult, + SessionInvoice, + SessionInvoiceLine, + SessionInvoicePage, + SessionSubscription, +} from "./client/session.ts"; diff --git a/packages/client/tests/client.test.ts b/packages/client/tests/client.test.ts index 3efa178..e005761 100644 --- a/packages/client/tests/client.test.ts +++ b/packages/client/tests/client.test.ts @@ -1359,3 +1359,182 @@ describe("public catalog (publishable key)", () => { expect(onDegraded).not.toHaveBeenCalled(); }); }); + +describe("customer session (kst_)", () => { + const subscribedWire = { + status: "subscribed", + subscription: { + status: "ACTIVE", + providerKind: "STRIPE", + collectionMethod: "CHARGE_AUTOMATICALLY", + currency: "EUR", + billingPeriod: "MONTHLY", + basePrice: { + id: "p-m", + billingModel: "FLAT_FEE", + billingTiming: "ADVANCE", + billingPeriod: "MONTHLY", + currency: "EUR", + unitAmount: 2900, + unitAmountDecimal: "2900", + displayOrder: 0, + isDefault: true, + }, + currentPeriodStart: "2026-10-08T10:00:00Z", + currentPeriodEnd: "2026-11-08T10:00:00Z", + trialEndsAt: null, + cancelAtPeriodEnd: false, + }, + activationInvoice: { + id: "inv-1", + kind: "ACTIVATION", + status: "PAID", + currency: "EUR", + subtotal: 2900, + discountTotal: 0, + total: 2900, + issuedAt: "2026-10-08T10:00:00Z", + dueAt: "2026-10-08T10:00:00Z", + paidAt: "2026-10-08T10:00:01Z", + serviceFrom: "2026-10-08T10:00:00Z", + serviceTo: "2026-11-08T10:00:00Z", + providerInvoiceNumber: "INV-0001", + externalReference: null, + hostedInvoiceUrl: "https://pay.example/inv-1", + invoicePdfUrl: null, + lines: [ + { + seq: 1, + type: "BASE", + label: "Pro", + description: "", + quantity: "1", + unitAmountDecimal: "2900", + amount: 2900, + serviceFrom: "2026-10-08T10:00:00Z", + serviceTo: "2026-11-08T10:00:00Z", + }, + ], + }, + payment: { status: "paid", hostedInvoiceUrl: "https://pay.example/inv-1" }, + }; + + function sessionClient(fetchMock: typeof fetch) { + return new KaitenClient({ + apiUrl: "https://api.test", + authScheme: "bearer", + tokenProvider: () => "kst_session", + fetch: fetchMock, + }); + } + + test("checks out with the session as a bearer token, and maps the answer", async () => { + const fetchMock = vi.fn(async () => json(subscribedWire, 201)); + vi.stubGlobal("fetch", fetchMock); + + const result = await sessionClient(fetchMock).session.checkout({ + licensePriceId: "p-m", + addOns: [{ addonSlug: "extra-seats-v1", quantity: 2 }], + }); + + const request = getFetchRequest(fetchMock); + expect(new URL(request.url).pathname).toBe("/public/session/checkout"); + expect(request.method).toBe("POST"); + expect(request.headers.get("Authorization")).toBe("Bearer kst_session"); + expect(await request.json()).toEqual({ + licensePriceId: "p-m", + addOns: [{ addonSlug: "extra-seats-v1", quantity: 2 }], + dryRun: false, + }); + + expect(result.status).toBe("subscribed"); + if (result.status !== "subscribed") return; + expect(result.payment).toEqual({ + status: "paid", + hostedInvoiceUrl: "https://pay.example/inv-1", + }); + expect(result.subscription).toMatchObject({ currencyCode: "EUR", status: "ACTIVE" }); + expect(result.subscription.basePrice).toMatchObject({ + amount: 2900, + interval: "month", + isDefault: true, + }); + expect(result.activationInvoice).toMatchObject({ + currencyCode: "EUR", + total: 2900, + status: "PAID", + }); + expect(result.activationInvoice?.lines[0]).toMatchObject({ type: "BASE", amount: 2900 }); + }); + + test("previews with dryRun, and passes a setup page through", async () => { + const fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => { + const request = new Request(input, init); + const body = (await request.json()) as { dryRun: boolean }; + return body.dryRun + ? json({ + status: "preview", + dueToday: { currency: "EUR", subtotal: 2900, discountTotal: 0, total: 2900, lines: [] }, + }) + : json({ + status: "requires_payment_method", + setupUrl: "https://checkout.stripe.test/setup", + setupSessionId: "cs_1", + expiresAt: "2026-10-09T10:00:00Z", + }); + }); + vi.stubGlobal("fetch", fetchMock); + const client = sessionClient(fetchMock as unknown as typeof fetch); + + const preview = await client.session.previewCheckout({ licensePriceId: "p-m" }); + expect(preview).toEqual({ + status: "preview", + dueToday: { currencyCode: "EUR", subtotal: 2900, discountTotal: 0, total: 2900, lines: [] }, + trialEndsAt: null, + }); + const setup = await client.session.checkout({ + licensePriceId: "p-m", + returnUrl: "https://app.test/billing", + }); + expect(setup).toEqual({ + status: "requires_payment_method", + setupUrl: "https://checkout.stripe.test/setup", + setupSessionId: "cs_1", + expiresAt: "2026-10-09T10:00:00Z", + }); + }); + + test("lists the customer's invoices", async () => { + const fetchMock = vi.fn(async () => + json({ items: [subscribedWire.activationInvoice], hasMore: false }), + ); + vi.stubGlobal("fetch", fetchMock); + + const page = await sessionClient(fetchMock).session.invoices({ limit: 10 }); + const request = getFetchRequest(fetchMock); + expect(new URL(request.url).pathname).toBe("/public/session/invoices"); + expect(new URL(request.url).searchParams.get("limit")).toBe("10"); + expect(page.items[0]).toMatchObject({ + id: "inv-1", + currencyCode: "EUR", + hostedInvoiceUrl: "https://pay.example/inv-1", + }); + expect(page.nextCursor).toBeNull(); + }); + + test("refuses the session routes with a publishable key, before any request", async () => { + const fetchMock = vi.fn(async () => json({})); + vi.stubGlobal("fetch", fetchMock); + const client = new KaitenClient({ + apiUrl: "https://api.test", + authScheme: "publishable", + tokenProvider: () => "pk_live", + fetch: fetchMock, + }); + await expect(client.session.checkout({ licensePriceId: "p-m" })).rejects.toBeInstanceOf( + TypeError, + ); + await expect(client.session.invoices()).rejects.toBeInstanceOf(TypeError); + expect(fetchMock).not.toHaveBeenCalled(); + }); +}); diff --git a/packages/server/src/generated/index.ts b/packages/server/src/generated/index.ts index 4c084a3..8ee6d23 100644 --- a/packages/server/src/generated/index.ts +++ b/packages/server/src/generated/index.ts @@ -1,9 +1,12 @@ // This file is auto-generated by @hey-api/openapi-ts export { + Addons, + Billing, Components, Connectors, Customers, + CustomerSessions, DeploymentZones, EntitlementGroups, Entitlements, @@ -17,10 +20,18 @@ export { OfrepCore, OpenFeature, type Options, + Public, + PublishableKeys, Releases, ServiceAccounts, + Vouchers, } from "./sdk.gen.js"; export type { + AckHandoffData, + AckHandoffError, + AckHandoffErrors, + AckHandoffResponse, + AckHandoffResponses, ActivateConnectorData, ActivateConnectorError, ActivateConnectorErrors, @@ -30,6 +41,27 @@ export type { AddEntitlementToGroupError, AddEntitlementToGroupErrors, AddEntitlementToGroupResponses, + Addon, + AddonChanges, + AddonEntitlement, + AddonEntitlementWritable, + AddonFamily, + AddonFamilyVisibility, + AddonFamilyWritable, + AddonGrant, + AddonGrantUpdate, + AddonGrantUpdateWritable, + AddonPriceUpdate, + AddonPriceUpdateWritable, + AddonQuantity, + AddonUpdate, + AddonUpdateWritable, + AddonWritable, + ArchiveAddonData, + ArchiveAddonError, + ArchiveAddonErrors, + ArchiveAddonResponse, + ArchiveAddonResponses, ArchiveLicenseData, ArchiveLicenseError, ArchiveLicenseErrors, @@ -40,28 +72,97 @@ export type { ArchiveMetadataFieldErrors, ArchiveMetadataFieldResponse, ArchiveMetadataFieldResponses, + ArchiveVoucherData, + ArchiveVoucherError, + ArchiveVoucherErrors, + ArchiveVoucherResponse, + ArchiveVoucherResponses, + AssignAddonEntitlementData, + AssignAddonEntitlementError, + AssignAddonEntitlementErrors, + AssignAddonEntitlementResponse, + AssignAddonEntitlementResponses, AssociateEntitlementWithLicenseData, AssociateEntitlementWithLicenseError, AssociateEntitlementWithLicenseErrors, AssociateEntitlementWithLicenseResponse, AssociateEntitlementWithLicenseResponses, + AttachInstanceAddonData, + AttachInstanceAddonError, + AttachInstanceAddonErrors, + AttachInstanceAddonResponse, + AttachInstanceAddonResponses, AuditTrail, Basic, BasicTargeting, + BillingCapabilities, + BillingFeatures, + BillingHealth, + BillingProvider, + BillingSettings, + BillingStarted, + BillingStartedWritable, BooleanEntitlementValue, BulkEvaluationFailure, BulkEvaluationRequest, + CanceledSubscription, + CanceledSubscriptionWritable, + Cancellation, + CancellationChange, + CancellationChangeWritable, + CancellationWritable, + CancelPlanChangeData, + CancelPlanChangeError, + CancelPlanChangeErrors, + CancelPlanChangeResponse, + CancelPlanChangeResponses, + CancelSubscriptionData, + CancelSubscriptionError, + CancelSubscriptionErrors, + CancelSubscriptionResponse, + CancelSubscriptionResponses, + ClaimHandoffData, + ClaimHandoffError, + ClaimHandoffErrors, + ClaimHandoffResponse, + ClaimHandoffResponses, ClientOptions, + CloseBacklog, + CloseBillingPeriodsData, + CloseBillingPeriodsError, + CloseBillingPeriodsErrors, + CloseBillingPeriodsResponse, + CloseBillingPeriodsResponses, + ClosedInvoice, + ClosePeriodsScope, Command, + CompatibleLicenseFamilies, + CompletedPaymentMethodSession, + CompletePaymentMethodSessionData, + CompletePaymentMethodSessionError, + CompletePaymentMethodSessionErrors, + CompletePaymentMethodSessionResponse, + CompletePaymentMethodSessionResponses, Component, ComponentWritable, ConfigEntitlementValue, + Connection, Connector, ConnectorActivation, ConnectorSettings, ConnectorSettingsSchema, ConnectorSettingsWritable, ConnectorState, + CreateAddonData, + CreateAddonError, + CreateAddonErrors, + CreateAddonPriceData, + CreateAddonPriceError, + CreateAddonPriceErrors, + CreateAddonPriceResponse, + CreateAddonPriceResponses, + CreateAddonResponse, + CreateAddonResponses, CreateComponentData, CreateComponentError, CreateComponentErrors, @@ -77,6 +178,12 @@ export type { CreateCustomerIntegrationResponses, CreateCustomerResponse, CreateCustomerResponses, + CreateCustomerSessionData, + CreateCustomerSessionError, + CreateCustomerSessionErrors, + CreateCustomerSessionResponse, + CreateCustomerSessionResponses, + CreatedCustomerSession, CreateDeploymentZoneData, CreateDeploymentZoneError, CreateDeploymentZoneErrors, @@ -110,6 +217,11 @@ export type { CreateLicenseData, CreateLicenseError, CreateLicenseErrors, + CreateLicensePriceData, + CreateLicensePriceError, + CreateLicensePriceErrors, + CreateLicensePriceResponse, + CreateLicensePriceResponses, CreateLicenseResponse, CreateLicenseResponses, CreateMetadataFieldData, @@ -117,6 +229,21 @@ export type { CreateMetadataFieldErrors, CreateMetadataFieldResponse, CreateMetadataFieldResponses, + CreatePaymentMethodSessionData, + CreatePaymentMethodSessionError, + CreatePaymentMethodSessionErrors, + CreatePaymentMethodSessionResponse, + CreatePaymentMethodSessionResponses, + CreatePortalSessionData, + CreatePortalSessionError, + CreatePortalSessionErrors, + CreatePortalSessionResponse, + CreatePortalSessionResponses, + CreatePublishableKeyData, + CreatePublishableKeyError, + CreatePublishableKeyErrors, + CreatePublishableKeyResponse, + CreatePublishableKeyResponses, CreateReleaseData, CreateReleaseError, CreateReleaseErrors, @@ -132,12 +259,25 @@ export type { CreateServiceAccountTokenErrors, CreateServiceAccountTokenResponse, CreateServiceAccountTokenResponses, + CreateSessionCheckoutData, + CreateSessionCheckoutError, + CreateSessionCheckoutErrors, + CreateSessionCheckoutResponse, + CreateSessionCheckoutResponses, + CreateVoucherData, + CreateVoucherError, + CreateVoucherErrors, + CreateVoucherResponse, + CreateVoucherResponses, Customer, + CustomerBilling, CustomerBody, CustomerCreationRejected, + CustomerInProvider, CustomerIntegration, CustomerIntegrationResource, CustomerIntegrationWritable, + CustomerSessionDraft, CustomerWritable, DeactivateConnectorData, DeactivateConnectorError, @@ -145,6 +285,11 @@ export type { DeactivateConnectorResponse, DeactivateConnectorResponses, DefaultVariant, + DeleteAddonData, + DeleteAddonError, + DeleteAddonErrors, + DeleteAddonResponse, + DeleteAddonResponses, DeleteComponentData, DeleteComponentError, DeleteComponentErrors, @@ -165,6 +310,7 @@ export type { DeleteCustomerIntegrationResponses, DeleteCustomerResponse, DeleteCustomerResponses, + DeletedAddon, DeleteDeploymentZoneData, DeleteDeploymentZoneError, DeleteDeploymentZoneErrors, @@ -218,11 +364,32 @@ export type { Deployment, DeploymentZone, DeploymentZoneWritable, + DeprecateAddonPriceData, + DeprecateAddonPriceError, + DeprecateAddonPriceErrors, + DeprecateAddonPriceResponse, + DeprecateAddonPriceResponses, + DeprecateLicensePriceData, + DeprecateLicensePriceError, + DeprecateLicensePriceErrors, + DeprecateLicensePriceResponse, + DeprecateLicensePriceResponses, + DetachInstanceAddonData, + DetachInstanceAddonError, + DetachInstanceAddonErrors, + DetachInstanceAddonResponse, + DetachInstanceAddonResponses, + DetachPaymentMethodData, + DetachPaymentMethodError, + DetachPaymentMethodErrors, + DetachPaymentMethodResponse, + DetachPaymentMethodResponses, DryRunMetadataFieldData, DryRunMetadataFieldError, DryRunMetadataFieldErrors, DryRunMetadataFieldResponse, DryRunMetadataFieldResponses, + DueToday, Entitlement, EntitlementGroup, EntitlementGroupSummary, @@ -246,6 +413,14 @@ export type { EvaluationFailure, EvaluationRequest, EvaluationSuccess, + Event, + EventWritable, + ExhaustedEvent, + ExportInvoicesData, + ExportInvoicesError, + ExportInvoicesErrors, + ExportInvoicesResponse, + ExportInvoicesResponses, ExportOrganizationUsageReportsData, ExportOrganizationUsageReportsError, ExportOrganizationUsageReportsErrors, @@ -259,11 +434,41 @@ export type { FeatureFlag, FeatureFlagEvaluated, FeatureFlagWritable, + GetAddonData, + GetAddonEntitlementData, + GetAddonEntitlementError, + GetAddonEntitlementErrors, + GetAddonEntitlementResponse, + GetAddonEntitlementResponses, + GetAddonError, + GetAddonErrors, + GetAddonFamilyData, + GetAddonFamilyError, + GetAddonFamilyErrors, + GetAddonFamilyResponse, + GetAddonFamilyResponses, + GetAddonResponse, + GetAddonResponses, GetAuditTrailsData, GetAuditTrailsError, GetAuditTrailsErrors, GetAuditTrailsResponse, GetAuditTrailsResponses, + GetBillingCapabilitiesData, + GetBillingCapabilitiesError, + GetBillingCapabilitiesErrors, + GetBillingCapabilitiesResponse, + GetBillingCapabilitiesResponses, + GetBillingHealthData, + GetBillingHealthError, + GetBillingHealthErrors, + GetBillingHealthResponse, + GetBillingHealthResponses, + GetBillingSettingsData, + GetBillingSettingsError, + GetBillingSettingsErrors, + GetBillingSettingsResponse, + GetBillingSettingsResponses, GetComponentData, GetComponentError, GetComponentErrors, @@ -289,6 +494,11 @@ export type { GetConnectorStateErrors, GetConnectorStateResponse, GetConnectorStateResponses, + GetCustomerBillingData, + GetCustomerBillingError, + GetCustomerBillingErrors, + GetCustomerBillingResponse, + GetCustomerBillingResponses, GetCustomerData, GetCustomerError, GetCustomerErrors, @@ -344,6 +554,11 @@ export type { GetFeatureFlagsErrors, GetFeatureFlagsResponse, GetFeatureFlagsResponses, + GetInstanceBillingData, + GetInstanceBillingError, + GetInstanceBillingErrors, + GetInstanceBillingResponse, + GetInstanceBillingResponses, GetInstanceData, GetInstanceError, GetInstanceErrors, @@ -364,6 +579,11 @@ export type { GetInstancesErrors, GetInstancesResponse, GetInstancesResponses, + GetInvoiceData, + GetInvoiceError, + GetInvoiceErrors, + GetInvoiceResponse, + GetInvoiceResponses, GetLicenseData, GetLicenseEntitlementData, GetLicenseEntitlementError, @@ -382,6 +602,11 @@ export type { GetLicenseFamilyErrors, GetLicenseFamilyResponse, GetLicenseFamilyResponses, + GetLicensePriceData, + GetLicensePriceError, + GetLicensePriceErrors, + GetLicensePriceResponse, + GetLicensePriceResponses, GetLicenseResponse, GetLicenseResponses, GetLicensesData, @@ -399,6 +624,11 @@ export type { GetOpenfeatureManifestErrors, GetOpenfeatureManifestResponse, GetOpenfeatureManifestResponses, + GetPublicCatalogData, + GetPublicCatalogError, + GetPublicCatalogErrors, + GetPublicCatalogResponse, + GetPublicCatalogResponses, GetReleaseBySlugData, GetReleaseBySlugError, GetReleaseBySlugErrors, @@ -424,9 +654,38 @@ export type { GetTargetingContextErrors, GetTargetingContextResponse, GetTargetingContextResponses, + GetUpcomingInvoiceData, + GetUpcomingInvoiceError, + GetUpcomingInvoiceErrors, + GetUpcomingInvoiceResponse, + GetUpcomingInvoiceResponses, + GetVoucherData, + GetVoucherError, + GetVoucherErrors, + GetVoucherResponse, + GetVoucherResponses, + Grant, + Handoff, + HandoffAcknowledgement, + HandoffBacklog, + HandoffBooking, + HandoffClaim, + HandoffClaimSize, + HeldInvoice, + HeldInvoices, + HeldPair, + HoldDetail, + HoldRecord, + HoldRelease, Impact, ImpactSample, Instance, + InstanceAddon, + InstanceAddonUpdate, + InstanceAddonUpdateWritable, + InstanceAddonWritable, + InstanceBilling, + InstanceBillingWritable, InstanceBody, InstanceEntitlementCapExceeded, InstanceEntitlementUsagePeriodRolledOver, @@ -440,18 +699,62 @@ export type { InstanceLifecycleStageChanged, InstanceStatusChanged, InstanceWritable, + Invoice, + InvoiceHold, + InvoiceLine, + InvoiceLineDiscount, + InvoiceLineLedger, + InvoiceLineMetering, + InvoiceLineOverage, + InvoiceLineProvider, + InvoicePayment, + InvoicePreview, + InvoicePreviewScenario, + InvoiceSummary, + InvoiceVoid, + InvoiceWriteOff, + IssuedInvoice, License, LicenseEntitlement, LicenseEntitlementWritable, LicenseFamilyView, LicenseFamilyViewWritable, + LicenseFamilyVisibility, + LicensePriceChanges, LicenseWritable, + LineDifference, + LineReportPage, LintTargetingRuleData, LintTargetingRuleError, LintTargetingRuleErrors, LintTargetingRuleResponse, LintTargetingRuleResponses, List, + ListAddonCompatibilityData, + ListAddonCompatibilityError, + ListAddonCompatibilityErrors, + ListAddonCompatibilityResponse, + ListAddonCompatibilityResponses, + ListAddonEntitlementsData, + ListAddonEntitlementsError, + ListAddonEntitlementsErrors, + ListAddonEntitlementsResponse, + ListAddonEntitlementsResponses, + ListAddonFamiliesData, + ListAddonFamiliesError, + ListAddonFamiliesErrors, + ListAddonFamiliesResponse, + ListAddonFamiliesResponses, + ListAddonPricesData, + ListAddonPricesError, + ListAddonPricesErrors, + ListAddonPricesResponse, + ListAddonPricesResponses, + ListAddonsData, + ListAddonsError, + ListAddonsErrors, + ListAddonsResponse, + ListAddonsResponses, ListComponentsData, ListComponentsError, ListComponentsErrors, @@ -482,11 +785,46 @@ export type { ListEntitlementsErrors, ListEntitlementsResponse, ListEntitlementsResponses, + ListHandoffData, + ListHandoffError, + ListHandoffErrors, + ListHandoffResponse, + ListHandoffResponses, + ListInstanceAddonsData, + ListInstanceAddonsError, + ListInstanceAddonsErrors, + ListInstanceAddonsResponse, + ListInstanceAddonsResponses, + ListInstanceInvoicesData, + ListInstanceInvoicesError, + ListInstanceInvoicesErrors, + ListInstanceInvoicesResponse, + ListInstanceInvoicesResponses, + ListInstanceVouchersData, + ListInstanceVouchersError, + ListInstanceVouchersErrors, + ListInstanceVouchersResponse, + ListInstanceVouchersResponses, + ListInvoiceLineReportsData, + ListInvoiceLineReportsError, + ListInvoiceLineReportsErrors, + ListInvoiceLineReportsResponse, + ListInvoiceLineReportsResponses, + ListInvoicesData, + ListInvoicesError, + ListInvoicesErrors, + ListInvoicesResponse, + ListInvoicesResponses, ListLicenseFamiliesData, ListLicenseFamiliesError, ListLicenseFamiliesErrors, ListLicenseFamiliesResponse, ListLicenseFamiliesResponses, + ListLicensePricesData, + ListLicensePricesError, + ListLicensePricesErrors, + ListLicensePricesResponse, + ListLicensePricesResponses, ListMetadataFieldsData, ListMetadataFieldsError, ListMetadataFieldsErrors, @@ -497,18 +835,48 @@ export type { ListNotificationsErrors, ListNotificationsResponse, ListNotificationsResponses, + ListPublishableKeysData, + ListPublishableKeysError, + ListPublishableKeysErrors, + ListPublishableKeysResponse, + ListPublishableKeysResponses, ListReleasesData, ListReleasesError, ListReleasesErrors, ListReleasesResponse, ListReleasesResponses, + ListSessionInvoicesData, + ListSessionInvoicesError, + ListSessionInvoicesErrors, + ListSessionInvoicesResponse, + ListSessionInvoicesResponses, ListUsageReportsData, ListUsageReportsError, ListUsageReportsErrors, ListUsageReportsResponse, ListUsageReportsResponses, + ListVoucherRedemptionsData, + ListVoucherRedemptionsError, + ListVoucherRedemptionsErrors, + ListVoucherRedemptionsResponse, + ListVoucherRedemptionsResponses, + ListVouchersData, + ListVouchersError, + ListVouchersErrors, + ListVouchersResponse, + ListVouchersResponses, + LookupVoucherData, + LookupVoucherError, + LookupVoucherErrors, + LookupVoucherResponse, + LookupVoucherResponses, ManifestEnvelope, ManifestFlag, + MarkInvoicePaidData, + MarkInvoicePaidError, + MarkInvoicePaidErrors, + MarkInvoicePaidResponse, + MarkInvoicePaidResponses, MarkNotificationsReadData, MarkNotificationsReadError, MarkNotificationsReadErrors, @@ -519,9 +887,48 @@ export type { MetadataFieldReordered, MetadataFieldSchemaProposal, MetadataFieldWritable, + Meter, + MinimumAmount, + MismatchedInvoice, + NewAddon, + NewAddonGrant, + NewAddonPrice, + NewInstanceAddon, + NewLicensePrice, + NewPaymentMethodSession, + NewPortalSession, + NewSubscription, Notification, NumberEntitlementValue, NumberEntitlementValueWritable, + OnAddonArchivedWebhookPayload, + OnAddonArchivedWebhookRequest, + OnAddonCreatedWebhookPayload, + OnAddonCreatedWebhookRequest, + OnAddonDeletedWebhookPayload, + OnAddonDeletedWebhookRequest, + OnAddonEntitlementAssignedWebhookPayload, + OnAddonEntitlementAssignedWebhookRequest, + OnAddonEntitlementUnassignedWebhookPayload, + OnAddonEntitlementUnassignedWebhookRequest, + OnAddonEntitlementUpdatedWebhookPayload, + OnAddonEntitlementUpdatedWebhookRequest, + OnAddonPriceCreatedWebhookPayload, + OnAddonPriceCreatedWebhookRequest, + OnAddonPriceDeprecatedWebhookPayload, + OnAddonPriceDeprecatedWebhookRequest, + OnAddonPublishedWebhookPayload, + OnAddonPublishedWebhookRequest, + OnAddonUnarchivedWebhookPayload, + OnAddonUnarchivedWebhookRequest, + OnAddonUpdatedWebhookPayload, + OnAddonUpdatedWebhookRequest, + OnBillingProviderConnectedWebhookPayload, + OnBillingProviderConnectedWebhookRequest, + OnBillingProviderDisconnectedWebhookPayload, + OnBillingProviderDisconnectedWebhookRequest, + OnBillingProviderSyncFailedWebhookPayload, + OnBillingProviderSyncFailedWebhookRequest, OnComponentCreatedWebhookPayload, OnComponentCreatedWebhookRequest, OnComponentDeletedWebhookPayload, @@ -534,6 +941,12 @@ export type { OnCustomerCreationRejectedWebhookRequest, OnCustomerDeletedWebhookPayload, OnCustomerDeletedWebhookRequest, + OnCustomerPaymentMethodAttachedWebhookPayload, + OnCustomerPaymentMethodAttachedWebhookRequest, + OnCustomerPaymentMethodDetachedWebhookPayload, + OnCustomerPaymentMethodDetachedWebhookRequest, + OnCustomerPaymentMethodExpiringWebhookPayload, + OnCustomerPaymentMethodExpiringWebhookRequest, OnCustomerUpdatedWebhookPayload, OnCustomerUpdatedWebhookRequest, OnDeploymentZoneCreatedWebhookPayload, @@ -562,6 +975,30 @@ export type { OnFeatureFlagEvaluatedWebhookRequest, OnFeatureFlagUpdatedWebhookPayload, OnFeatureFlagUpdatedWebhookRequest, + OnInstanceAddonAddedWebhookPayload, + OnInstanceAddonAddedWebhookRequest, + OnInstanceAddonQuantityChangedWebhookPayload, + OnInstanceAddonQuantityChangedWebhookRequest, + OnInstanceAddonRemovedWebhookPayload, + OnInstanceAddonRemovedWebhookRequest, + OnInstanceBillingCanceledWebhookPayload, + OnInstanceBillingCanceledWebhookRequest, + OnInstanceBillingCancellationRevertedWebhookPayload, + OnInstanceBillingCancellationRevertedWebhookRequest, + OnInstanceBillingCancellationScheduledWebhookPayload, + OnInstanceBillingCancellationScheduledWebhookRequest, + OnInstanceBillingPlanChangeCancelledWebhookPayload, + OnInstanceBillingPlanChangeCancelledWebhookRequest, + OnInstanceBillingPlanChangedWebhookPayload, + OnInstanceBillingPlanChangedWebhookRequest, + OnInstanceBillingPlanChangeScheduledWebhookPayload, + OnInstanceBillingPlanChangeScheduledWebhookRequest, + OnInstanceBillingProviderChangedWebhookPayload, + OnInstanceBillingProviderChangedWebhookRequest, + OnInstanceBillingStartedWebhookPayload, + OnInstanceBillingStartedWebhookRequest, + OnInstanceBillingStatusChangedWebhookPayload, + OnInstanceBillingStatusChangedWebhookRequest, OnInstanceCreatedWebhookPayload, OnInstanceCreatedWebhookRequest, OnInstanceDeletedWebhookPayload, @@ -582,6 +1019,28 @@ export type { OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest, OnInstanceEntitlementValueGetWebhookPayload, OnInstanceEntitlementValueGetWebhookRequest, + OnInstanceInvoiceHandoffAcknowledgedWebhookPayload, + OnInstanceInvoiceHandoffAcknowledgedWebhookRequest, + OnInstanceInvoiceHeldWebhookPayload, + OnInstanceInvoiceHeldWebhookRequest, + OnInstanceInvoiceIssuedWebhookPayload, + OnInstanceInvoiceIssuedWebhookRequest, + OnInstanceInvoiceMarkedUncollectibleWebhookPayload, + OnInstanceInvoiceMarkedUncollectibleWebhookRequest, + OnInstanceInvoicePaidWebhookPayload, + OnInstanceInvoicePaidWebhookRequest, + OnInstanceInvoicePaymentFailedWebhookPayload, + OnInstanceInvoicePaymentFailedWebhookRequest, + OnInstanceInvoicePushedWebhookPayload, + OnInstanceInvoicePushedWebhookRequest, + OnInstanceInvoicePushFailedWebhookPayload, + OnInstanceInvoicePushFailedWebhookRequest, + OnInstanceInvoiceReconciliationMismatchWebhookPayload, + OnInstanceInvoiceReconciliationMismatchWebhookRequest, + OnInstanceInvoiceReleasedWebhookPayload, + OnInstanceInvoiceReleasedWebhookRequest, + OnInstanceInvoiceVoidedWebhookPayload, + OnInstanceInvoiceVoidedWebhookRequest, OnInstanceLifecycleStageChangedWebhookPayload, OnInstanceLifecycleStageChangedWebhookRequest, OnInstanceMigratedWebhookPayload, @@ -590,6 +1049,12 @@ export type { OnInstanceStatusChangedWebhookRequest, OnInstanceUpdatedWebhookPayload, OnInstanceUpdatedWebhookRequest, + OnInstanceVoucherExpiredWebhookPayload, + OnInstanceVoucherExpiredWebhookRequest, + OnInstanceVoucherRedeemedWebhookPayload, + OnInstanceVoucherRedeemedWebhookRequest, + OnInstanceVoucherRevokedWebhookPayload, + OnInstanceVoucherRevokedWebhookRequest, OnLicenseArchivedWebhookPayload, OnLicenseArchivedWebhookRequest, OnLicenseCreatedWebhookPayload, @@ -608,6 +1073,12 @@ export type { OnLicenseFamilyDeletedWebhookRequest, OnLicenseFamilyUpdatedWebhookPayload, OnLicenseFamilyUpdatedWebhookRequest, + OnLicensePriceCreatedWebhookPayload, + OnLicensePriceCreatedWebhookRequest, + OnLicensePriceDeprecatedWebhookPayload, + OnLicensePriceDeprecatedWebhookRequest, + OnLicensePriceUpdatedWebhookPayload, + OnLicensePriceUpdatedWebhookRequest, OnLicensePublishedWebhookPayload, OnLicensePublishedWebhookRequest, OnLicenseUnarchivedWebhookPayload, @@ -632,6 +1103,18 @@ export type { OnReleaseDeployedWebhookRequest, OnSystemOrganizationTokenIssuedWebhookPayload, OnSystemOrganizationTokenIssuedWebhookRequest, + OnVoucherArchivedWebhookPayload, + OnVoucherArchivedWebhookRequest, + OnVoucherCreatedWebhookPayload, + OnVoucherCreatedWebhookRequest, + OnVoucherExhaustedWebhookPayload, + OnVoucherExhaustedWebhookRequest, + OnVoucherPublishedWebhookPayload, + OnVoucherPublishedWebhookRequest, + OnVoucherUpdatedWebhookPayload, + OnVoucherUpdatedWebhookRequest, + Outcome, + OverageLimit, PageAuditTrail, PageComponent, PageComponentWritable, @@ -647,6 +1130,7 @@ export type { PageFeatureFlagWritable, PageInstance, PageInstanceWritable, + PageInvoiceSummary, PageLicense, PageLicenseEntitlement, PageLicenseEntitlementWritable, @@ -655,38 +1139,123 @@ export type { PageLicenseWritable, PageMetadataField, PageMetadataFieldWritable, + PageQueuedInvoice, PageRelease, PageReleaseWritable, PageServiceAccount, PageServiceAccountWritable, + PageSessionInvoice, PageToken, PageTokenWritable, + PaidInvoice, PatchInstanceBody, PatchInstanceData, PatchInstanceError, PatchInstanceErrors, PatchInstanceResponse, PatchInstanceResponses, + Payment, + PaymentFailedInvoice, + PaymentMethodAttached, + PaymentMethodDetached, + PaymentMethodExpiring, + PaymentMethodLabels, + PaymentMethodSession, PlainToken, PlainTokenWritable, + PlanChange, + PlanChangeSchedule, + PlanChangeTarget, + PortalSession, PreferenceChoices, PreferenceEvent, PreferenceMatrix, PreferenceUpdate, + PreviewLicenseInvoiceData, + PreviewLicenseInvoiceError, + PreviewLicenseInvoiceErrors, + PreviewLicenseInvoiceResponse, + PreviewLicenseInvoiceResponses, + Price, + PriceWritable, Problem, + ProviderCapabilities, + ProviderChange, + ProviderRecord, + ProviderSync, + PublicAddOn, + PublicAddOnEntitlement, + PublicCatalog, + PublicCatalogCapabilities, + PublicMeter, + PublicPlan, + PublicPlanEntitlement, + PublicPrice, + PublicSurface, + PublishableKey, + PublishableKeyCreated, + PublishableKeyCreatedWritable, + PublishableKeyDraft, + PublishableKeyPatch, + PublishableKeyWritable, + PublishAddonData, + PublishAddonError, + PublishAddonErrors, + PublishAddonResponse, + PublishAddonResponses, PublishLicenseData, PublishLicenseError, PublishLicenseErrors, PublishLicenseResponse, PublishLicenseResponses, + PublishVoucherData, + PublishVoucherError, + PublishVoucherErrors, + PublishVoucherResponse, + PublishVoucherResponses, + PushedInvoice, + PushFailedInvoice, + PushFailures, PutNotificationPreferencesData, PutNotificationPreferencesError, PutNotificationPreferencesErrors, PutNotificationPreferencesResponse, PutNotificationPreferencesResponses, + QueuedInvoice, + ReactivateSubscriptionData, + ReactivateSubscriptionError, + ReactivateSubscriptionErrors, + ReactivateSubscriptionResponse, + ReactivateSubscriptionResponses, ReadSelection, + RecomposeInvoiceData, + RecomposeInvoiceError, + RecomposeInvoiceErrors, + RecomposeInvoiceResponse, + RecomposeInvoiceResponses, + Reconciliation, + RedeemableCode, + RedeemVoucherData, + RedeemVoucherError, + RedeemVoucherErrors, + RedeemVoucherResponse, + RedeemVoucherResponses, + Redemption, + RedemptionRules, + RedemptionWritable, Release, + ReleasedInvoice, + ReleaseInvoiceHoldData, + ReleaseInvoiceHoldError, + ReleaseInvoiceHoldErrors, + ReleaseInvoiceHoldResponse, + ReleaseInvoiceHoldResponses, ReleaseWritable, + RemoveAddonCompatibilityData, + RemoveAddonCompatibilityError, + RemoveAddonCompatibilityErrors, + RemoveAddonCompatibilityResponse, + RemoveAddonCompatibilityResponses, RemoveEntitlementFromGroupData, RemoveEntitlementFromGroupError, RemoveEntitlementFromGroupErrors, @@ -698,6 +1267,7 @@ export type { ReorderMetadataFieldsInput, ReorderMetadataFieldsResponse, ReorderMetadataFieldsResponses, + Report, ReportEntitlementUsageBody, ReportEntitlementUsageBodyWritable, ReportEntitlementUsageMetricData, @@ -705,13 +1275,80 @@ export type { ReportEntitlementUsageMetricErrors, ReportEntitlementUsageMetricResponse, ReportEntitlementUsageMetricResponses, + RetryInvoicePushData, + RetryInvoicePushError, + RetryInvoicePushErrors, + RetryInvoicePushResponse, + RetryInvoicePushResponses, + RevocationReason, + RevokeCustomerSessionData, + RevokeCustomerSessionError, + RevokeCustomerSessionErrors, + RevokeCustomerSessionResponse, + RevokeCustomerSessionResponses, + RevokeInstanceVoucherData, + RevokeInstanceVoucherError, + RevokeInstanceVoucherErrors, + RevokeInstanceVoucherResponse, + RevokeInstanceVoucherResponses, + RevokePublishableKeyData, + RevokePublishableKeyError, + RevokePublishableKeyErrors, + RevokePublishableKeyResponse, + RevokePublishableKeyResponses, RolloutDate, RolloutDateTargeting, RolloutPercentage, RolloutPercentageTargeting, RolloutStep, + SampleUsageAmount, + ScheduledChange, + ScheduledChangeWritable, + SchedulePlanChangeData, + SchedulePlanChangeError, + SchedulePlanChangeErrors, + SchedulePlanChangeResponse, + SchedulePlanChangeResponses, ServiceAccount, ServiceAccountWritable, + SessionCheckout, + SessionCheckoutOrder, + SessionInvoice, + SessionLine, + SessionSubscription, + SetAddonCompatibilityData, + SetAddonCompatibilityError, + SetAddonCompatibilityErrors, + SetAddonCompatibilityResponse, + SetAddonCompatibilityResponses, + SetInstanceAddonQuantityData, + SetInstanceAddonQuantityError, + SetInstanceAddonQuantityErrors, + SetInstanceAddonQuantityResponse, + SetInstanceAddonQuantityResponses, + StartedSubscription, + StartedSubscriptionWritable, + StatusChange, + SubscribeInstanceData, + SubscribeInstanceError, + SubscribeInstanceErrors, + SubscribeInstanceResponse, + SubscribeInstanceResponses, + SubscriptionAddon, + SubscriptionCancellation, + SubscriptionTerms, + SyncBillingProviderData, + SyncBillingProviderError, + SyncBillingProviderErrors, + SyncBillingProviderResponse, + SyncBillingProviderResponses, + SyncFailure, + SyncInvoiceData, + SyncInvoiceError, + SyncInvoiceErrors, + SyncInvoiceResponse, + SyncInvoiceResponses, + SyncReport, SystemTokenIssuance, TargetingContext, TargetingContextNode, @@ -728,6 +1365,12 @@ export type { TestTargetingRuleResponses, Token, TokenWritable, + TotalsDifference, + UnarchiveAddonData, + UnarchiveAddonError, + UnarchiveAddonErrors, + UnarchiveAddonResponse, + UnarchiveAddonResponses, UnarchiveLicenseData, UnarchiveLicenseError, UnarchiveLicenseErrors, @@ -738,6 +1381,32 @@ export type { UnarchiveMetadataFieldErrors, UnarchiveMetadataFieldResponse, UnarchiveMetadataFieldResponses, + UnassignAddonEntitlementData, + UnassignAddonEntitlementError, + UnassignAddonEntitlementErrors, + UnassignAddonEntitlementResponse, + UnassignAddonEntitlementResponses, + UncollectibleInvoice, + UpdateAddonData, + UpdateAddonEntitlementData, + UpdateAddonEntitlementError, + UpdateAddonEntitlementErrors, + UpdateAddonEntitlementResponse, + UpdateAddonEntitlementResponses, + UpdateAddonError, + UpdateAddonErrors, + UpdateAddonFamilyData, + UpdateAddonFamilyError, + UpdateAddonFamilyErrors, + UpdateAddonFamilyResponse, + UpdateAddonFamilyResponses, + UpdateAddonResponse, + UpdateAddonResponses, + UpdateBillingSettingsData, + UpdateBillingSettingsError, + UpdateBillingSettingsErrors, + UpdateBillingSettingsResponse, + UpdateBillingSettingsResponses, UpdateComponentData, UpdateComponentError, UpdateComponentErrors, @@ -763,6 +1432,8 @@ export type { UpdateDeploymentZoneErrors, UpdateDeploymentZoneResponse, UpdateDeploymentZoneResponses, + UpdatedEvent, + UpdatedEventWritable, UpdateEntitlementData, UpdateEntitlementError, UpdateEntitlementErrors, @@ -778,6 +1449,11 @@ export type { UpdateFeatureFlagErrors, UpdateFeatureFlagResponse, UpdateFeatureFlagResponses, + UpdateInstanceBillingData, + UpdateInstanceBillingError, + UpdateInstanceBillingErrors, + UpdateInstanceBillingResponse, + UpdateInstanceBillingResponses, UpdateInstanceData, UpdateInstanceError, UpdateInstanceErrors, @@ -796,6 +1472,16 @@ export type { UpdateLicenseEntitlementResponses, UpdateLicenseError, UpdateLicenseErrors, + UpdateLicenseFamilyData, + UpdateLicenseFamilyError, + UpdateLicenseFamilyErrors, + UpdateLicenseFamilyResponse, + UpdateLicenseFamilyResponses, + UpdateLicensePriceData, + UpdateLicensePriceError, + UpdateLicensePriceErrors, + UpdateLicensePriceResponse, + UpdateLicensePriceResponses, UpdateLicenseResponse, UpdateLicenseResponses, UpdateMetadataFieldData, @@ -803,11 +1489,21 @@ export type { UpdateMetadataFieldErrors, UpdateMetadataFieldResponse, UpdateMetadataFieldResponses, + UpdatePublishableKeyData, + UpdatePublishableKeyError, + UpdatePublishableKeyErrors, + UpdatePublishableKeyResponse, + UpdatePublishableKeyResponses, UpdateServiceAccountData, UpdateServiceAccountError, UpdateServiceAccountErrors, UpdateServiceAccountResponse, UpdateServiceAccountResponses, + UpdateVoucherData, + UpdateVoucherError, + UpdateVoucherErrors, + UpdateVoucherResponse, + UpdateVoucherResponses, UpsertCustomerIntegrationByExternalIdData, UpsertCustomerIntegrationByExternalIdError, UpsertCustomerIntegrationByExternalIdErrors, @@ -821,6 +1517,29 @@ export type { UsageReport, UsageReportPage, User, + ValidateVoucherData, + ValidateVoucherError, + ValidateVoucherErrors, + ValidateVoucherResponse, + ValidateVoucherResponses, + Validity, + ValidityWritable, Variant, + VoidedInvoice, + VoidInvoiceData, + VoidInvoiceError, + VoidInvoiceErrors, + VoidInvoiceResponse, + VoidInvoiceResponses, + Voucher, + VoucherCheck, + VoucherCode, + VoucherDraft, + VoucherWritable, Webhooks, + WriteOffInvoiceData, + WriteOffInvoiceError, + WriteOffInvoiceErrors, + WriteOffInvoiceResponse, + WriteOffInvoiceResponses, } from "./types.gen.js"; diff --git a/packages/server/src/generated/sdk.gen.ts b/packages/server/src/generated/sdk.gen.ts index d56557b..d457061 100644 --- a/packages/server/src/generated/sdk.gen.ts +++ b/packages/server/src/generated/sdk.gen.ts @@ -9,21 +9,57 @@ import type { TDataShape, } from "./client/index.js"; import type { + AckHandoffData, + AckHandoffErrors, + AckHandoffResponses, ActivateConnectorData, ActivateConnectorErrors, ActivateConnectorResponses, AddEntitlementToGroupData, AddEntitlementToGroupErrors, AddEntitlementToGroupResponses, + ArchiveAddonData, + ArchiveAddonErrors, + ArchiveAddonResponses, ArchiveLicenseData, ArchiveLicenseErrors, ArchiveLicenseResponses, ArchiveMetadataFieldData, ArchiveMetadataFieldErrors, ArchiveMetadataFieldResponses, + ArchiveVoucherData, + ArchiveVoucherErrors, + ArchiveVoucherResponses, + AssignAddonEntitlementData, + AssignAddonEntitlementErrors, + AssignAddonEntitlementResponses, AssociateEntitlementWithLicenseData, AssociateEntitlementWithLicenseErrors, AssociateEntitlementWithLicenseResponses, + AttachInstanceAddonData, + AttachInstanceAddonErrors, + AttachInstanceAddonResponses, + CancelPlanChangeData, + CancelPlanChangeErrors, + CancelPlanChangeResponses, + CancelSubscriptionData, + CancelSubscriptionErrors, + CancelSubscriptionResponses, + ClaimHandoffData, + ClaimHandoffErrors, + ClaimHandoffResponses, + CloseBillingPeriodsData, + CloseBillingPeriodsErrors, + CloseBillingPeriodsResponses, + CompletePaymentMethodSessionData, + CompletePaymentMethodSessionErrors, + CompletePaymentMethodSessionResponses, + CreateAddonData, + CreateAddonErrors, + CreateAddonPriceData, + CreateAddonPriceErrors, + CreateAddonPriceResponses, + CreateAddonResponses, CreateComponentData, CreateComponentErrors, CreateComponentResponses, @@ -33,6 +69,9 @@ import type { CreateCustomerIntegrationErrors, CreateCustomerIntegrationResponses, CreateCustomerResponses, + CreateCustomerSessionData, + CreateCustomerSessionErrors, + CreateCustomerSessionResponses, CreateDeploymentZoneData, CreateDeploymentZoneErrors, CreateDeploymentZoneResponses, @@ -53,10 +92,22 @@ import type { CreateInstanceResponses, CreateLicenseData, CreateLicenseErrors, + CreateLicensePriceData, + CreateLicensePriceErrors, + CreateLicensePriceResponses, CreateLicenseResponses, CreateMetadataFieldData, CreateMetadataFieldErrors, CreateMetadataFieldResponses, + CreatePaymentMethodSessionData, + CreatePaymentMethodSessionErrors, + CreatePaymentMethodSessionResponses, + CreatePortalSessionData, + CreatePortalSessionErrors, + CreatePortalSessionResponses, + CreatePublishableKeyData, + CreatePublishableKeyErrors, + CreatePublishableKeyResponses, CreateReleaseData, CreateReleaseErrors, CreateReleaseResponses, @@ -66,9 +117,18 @@ import type { CreateServiceAccountTokenData, CreateServiceAccountTokenErrors, CreateServiceAccountTokenResponses, + CreateSessionCheckoutData, + CreateSessionCheckoutErrors, + CreateSessionCheckoutResponses, + CreateVoucherData, + CreateVoucherErrors, + CreateVoucherResponses, DeactivateConnectorData, DeactivateConnectorErrors, DeactivateConnectorResponses, + DeleteAddonData, + DeleteAddonErrors, + DeleteAddonResponses, DeleteComponentData, DeleteComponentErrors, DeleteComponentResponses, @@ -111,6 +171,18 @@ import type { DeleteServiceAccountTokenData, DeleteServiceAccountTokenErrors, DeleteServiceAccountTokenResponses, + DeprecateAddonPriceData, + DeprecateAddonPriceErrors, + DeprecateAddonPriceResponses, + DeprecateLicensePriceData, + DeprecateLicensePriceErrors, + DeprecateLicensePriceResponses, + DetachInstanceAddonData, + DetachInstanceAddonErrors, + DetachInstanceAddonResponses, + DetachPaymentMethodData, + DetachPaymentMethodErrors, + DetachPaymentMethodResponses, DryRunMetadataFieldData, DryRunMetadataFieldErrors, DryRunMetadataFieldResponses, @@ -120,15 +192,36 @@ import type { EvaluateFlagsBulkData, EvaluateFlagsBulkErrors, EvaluateFlagsBulkResponses, + ExportInvoicesData, + ExportInvoicesErrors, + ExportInvoicesResponses, ExportOrganizationUsageReportsData, ExportOrganizationUsageReportsErrors, ExportOrganizationUsageReportsResponses, ExportUsageReportsData, ExportUsageReportsErrors, ExportUsageReportsResponses, + GetAddonData, + GetAddonEntitlementData, + GetAddonEntitlementErrors, + GetAddonEntitlementResponses, + GetAddonErrors, + GetAddonFamilyData, + GetAddonFamilyErrors, + GetAddonFamilyResponses, + GetAddonResponses, GetAuditTrailsData, GetAuditTrailsErrors, GetAuditTrailsResponses, + GetBillingCapabilitiesData, + GetBillingCapabilitiesErrors, + GetBillingCapabilitiesResponses, + GetBillingHealthData, + GetBillingHealthErrors, + GetBillingHealthResponses, + GetBillingSettingsData, + GetBillingSettingsErrors, + GetBillingSettingsResponses, GetComponentData, GetComponentErrors, GetComponentResponses, @@ -144,6 +237,9 @@ import type { GetConnectorStateData, GetConnectorStateErrors, GetConnectorStateResponses, + GetCustomerBillingData, + GetCustomerBillingErrors, + GetCustomerBillingResponses, GetCustomerData, GetCustomerErrors, GetCustomerIntegrationByExternalIdData, @@ -177,6 +273,9 @@ import type { GetFeatureFlagsData, GetFeatureFlagsErrors, GetFeatureFlagsResponses, + GetInstanceBillingData, + GetInstanceBillingErrors, + GetInstanceBillingResponses, GetInstanceData, GetInstanceErrors, GetInstanceIntegrationByExternalIdData, @@ -189,6 +288,9 @@ import type { GetInstancesData, GetInstancesErrors, GetInstancesResponses, + GetInvoiceData, + GetInvoiceErrors, + GetInvoiceResponses, GetLicenseData, GetLicenseEntitlementData, GetLicenseEntitlementErrors, @@ -200,6 +302,9 @@ import type { GetLicenseFamilyData, GetLicenseFamilyErrors, GetLicenseFamilyResponses, + GetLicensePriceData, + GetLicensePriceErrors, + GetLicensePriceResponses, GetLicenseResponses, GetLicensesData, GetLicensesErrors, @@ -210,6 +315,9 @@ import type { GetOpenfeatureManifestData, GetOpenfeatureManifestErrors, GetOpenfeatureManifestResponses, + GetPublicCatalogData, + GetPublicCatalogErrors, + GetPublicCatalogResponses, GetReleaseBySlugData, GetReleaseBySlugErrors, GetReleaseBySlugResponses, @@ -225,9 +333,30 @@ import type { GetTargetingContextData, GetTargetingContextErrors, GetTargetingContextResponses, + GetUpcomingInvoiceData, + GetUpcomingInvoiceErrors, + GetUpcomingInvoiceResponses, + GetVoucherData, + GetVoucherErrors, + GetVoucherResponses, LintTargetingRuleData, LintTargetingRuleErrors, LintTargetingRuleResponses, + ListAddonCompatibilityData, + ListAddonCompatibilityErrors, + ListAddonCompatibilityResponses, + ListAddonEntitlementsData, + ListAddonEntitlementsErrors, + ListAddonEntitlementsResponses, + ListAddonFamiliesData, + ListAddonFamiliesErrors, + ListAddonFamiliesResponses, + ListAddonPricesData, + ListAddonPricesErrors, + ListAddonPricesResponses, + ListAddonsData, + ListAddonsErrors, + ListAddonsResponses, ListComponentsData, ListComponentsErrors, ListComponentsResponses, @@ -246,33 +375,96 @@ import type { ListEntitlementsData, ListEntitlementsErrors, ListEntitlementsResponses, + ListHandoffData, + ListHandoffErrors, + ListHandoffResponses, + ListInstanceAddonsData, + ListInstanceAddonsErrors, + ListInstanceAddonsResponses, + ListInstanceInvoicesData, + ListInstanceInvoicesErrors, + ListInstanceInvoicesResponses, + ListInstanceVouchersData, + ListInstanceVouchersErrors, + ListInstanceVouchersResponses, + ListInvoiceLineReportsData, + ListInvoiceLineReportsErrors, + ListInvoiceLineReportsResponses, + ListInvoicesData, + ListInvoicesErrors, + ListInvoicesResponses, ListLicenseFamiliesData, ListLicenseFamiliesErrors, ListLicenseFamiliesResponses, + ListLicensePricesData, + ListLicensePricesErrors, + ListLicensePricesResponses, ListMetadataFieldsData, ListMetadataFieldsErrors, ListMetadataFieldsResponses, ListNotificationsData, ListNotificationsErrors, ListNotificationsResponses, + ListPublishableKeysData, + ListPublishableKeysErrors, + ListPublishableKeysResponses, ListReleasesData, ListReleasesErrors, ListReleasesResponses, + ListSessionInvoicesData, + ListSessionInvoicesErrors, + ListSessionInvoicesResponses, ListUsageReportsData, ListUsageReportsErrors, ListUsageReportsResponses, + ListVoucherRedemptionsData, + ListVoucherRedemptionsErrors, + ListVoucherRedemptionsResponses, + ListVouchersData, + ListVouchersErrors, + ListVouchersResponses, + LookupVoucherData, + LookupVoucherErrors, + LookupVoucherResponses, + MarkInvoicePaidData, + MarkInvoicePaidErrors, + MarkInvoicePaidResponses, MarkNotificationsReadData, MarkNotificationsReadErrors, MarkNotificationsReadResponses, PatchInstanceData, PatchInstanceErrors, PatchInstanceResponses, + PreviewLicenseInvoiceData, + PreviewLicenseInvoiceErrors, + PreviewLicenseInvoiceResponses, + PublishAddonData, + PublishAddonErrors, + PublishAddonResponses, PublishLicenseData, PublishLicenseErrors, PublishLicenseResponses, + PublishVoucherData, + PublishVoucherErrors, + PublishVoucherResponses, PutNotificationPreferencesData, PutNotificationPreferencesErrors, PutNotificationPreferencesResponses, + ReactivateSubscriptionData, + ReactivateSubscriptionErrors, + ReactivateSubscriptionResponses, + RecomposeInvoiceData, + RecomposeInvoiceErrors, + RecomposeInvoiceResponses, + RedeemVoucherData, + RedeemVoucherErrors, + RedeemVoucherResponses, + ReleaseInvoiceHoldData, + ReleaseInvoiceHoldErrors, + ReleaseInvoiceHoldResponses, + RemoveAddonCompatibilityData, + RemoveAddonCompatibilityErrors, + RemoveAddonCompatibilityResponses, RemoveEntitlementFromGroupData, RemoveEntitlementFromGroupErrors, RemoveEntitlementFromGroupResponses, @@ -282,15 +474,63 @@ import type { ReportEntitlementUsageMetricData, ReportEntitlementUsageMetricErrors, ReportEntitlementUsageMetricResponses, + RetryInvoicePushData, + RetryInvoicePushErrors, + RetryInvoicePushResponses, + RevokeCustomerSessionData, + RevokeCustomerSessionErrors, + RevokeCustomerSessionResponses, + RevokeInstanceVoucherData, + RevokeInstanceVoucherErrors, + RevokeInstanceVoucherResponses, + RevokePublishableKeyData, + RevokePublishableKeyErrors, + RevokePublishableKeyResponses, + SchedulePlanChangeData, + SchedulePlanChangeErrors, + SchedulePlanChangeResponses, + SetAddonCompatibilityData, + SetAddonCompatibilityErrors, + SetAddonCompatibilityResponses, + SetInstanceAddonQuantityData, + SetInstanceAddonQuantityErrors, + SetInstanceAddonQuantityResponses, + SubscribeInstanceData, + SubscribeInstanceErrors, + SubscribeInstanceResponses, + SyncBillingProviderData, + SyncBillingProviderErrors, + SyncBillingProviderResponses, + SyncInvoiceData, + SyncInvoiceErrors, + SyncInvoiceResponses, TestTargetingRuleData, TestTargetingRuleErrors, TestTargetingRuleResponses, + UnarchiveAddonData, + UnarchiveAddonErrors, + UnarchiveAddonResponses, UnarchiveLicenseData, UnarchiveLicenseErrors, UnarchiveLicenseResponses, UnarchiveMetadataFieldData, UnarchiveMetadataFieldErrors, UnarchiveMetadataFieldResponses, + UnassignAddonEntitlementData, + UnassignAddonEntitlementErrors, + UnassignAddonEntitlementResponses, + UpdateAddonData, + UpdateAddonEntitlementData, + UpdateAddonEntitlementErrors, + UpdateAddonEntitlementResponses, + UpdateAddonErrors, + UpdateAddonFamilyData, + UpdateAddonFamilyErrors, + UpdateAddonFamilyResponses, + UpdateAddonResponses, + UpdateBillingSettingsData, + UpdateBillingSettingsErrors, + UpdateBillingSettingsResponses, UpdateComponentData, UpdateComponentErrors, UpdateComponentResponses, @@ -315,6 +555,9 @@ import type { UpdateFeatureFlagData, UpdateFeatureFlagErrors, UpdateFeatureFlagResponses, + UpdateInstanceBillingData, + UpdateInstanceBillingErrors, + UpdateInstanceBillingResponses, UpdateInstanceData, UpdateInstanceErrors, UpdateInstanceIntegrationData, @@ -326,19 +569,40 @@ import type { UpdateLicenseEntitlementErrors, UpdateLicenseEntitlementResponses, UpdateLicenseErrors, + UpdateLicenseFamilyData, + UpdateLicenseFamilyErrors, + UpdateLicenseFamilyResponses, + UpdateLicensePriceData, + UpdateLicensePriceErrors, + UpdateLicensePriceResponses, UpdateLicenseResponses, UpdateMetadataFieldData, UpdateMetadataFieldErrors, UpdateMetadataFieldResponses, + UpdatePublishableKeyData, + UpdatePublishableKeyErrors, + UpdatePublishableKeyResponses, UpdateServiceAccountData, UpdateServiceAccountErrors, UpdateServiceAccountResponses, + UpdateVoucherData, + UpdateVoucherErrors, + UpdateVoucherResponses, UpsertCustomerIntegrationByExternalIdData, UpsertCustomerIntegrationByExternalIdErrors, UpsertCustomerIntegrationByExternalIdResponses, UpsertInstanceIntegrationByExternalIdData, UpsertInstanceIntegrationByExternalIdErrors, UpsertInstanceIntegrationByExternalIdResponses, + ValidateVoucherData, + ValidateVoucherErrors, + ValidateVoucherResponses, + VoidInvoiceData, + VoidInvoiceErrors, + VoidInvoiceResponses, + WriteOffInvoiceData, + WriteOffInvoiceErrors, + WriteOffInvoiceResponses, } from "./types.gen.js"; export type Options< @@ -359,6 +623,1460 @@ export type Options< meta?: keyof ClientMeta extends never ? Record : ClientMeta; }; +export class Addons { + /** + * List add-on families + * + * Every add-on family of the organization with its versions, newest family first. Requires billing to be enabled for the organization. + */ + public static listAddonFamilies( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + ListAddonFamiliesResponses, + ListAddonFamiliesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addon-families", + ...options, + }); + } + + /** + * Get an add-on family + * + * One add-on family with its versions and its current version. Requires billing to be enabled for the organization. + */ + public static getAddonFamily( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + GetAddonFamilyResponses, + GetAddonFamilyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addon-families/{familySlug}", + ...options, + }); + } + + /** + * Update an add-on family + * + * Lists the family in the public catalogue, or takes it out. Families are private until made public. Emits ADDON_UPDATED on each of its versions. Requires billing to be enabled for the organization. + */ + public static updateAddonFamily( + options: Options, + ): RequestResult { + return (options.client ?? client).patch< + UpdateAddonFamilyResponses, + UpdateAddonFamilyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addon-families/{familySlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * List add-on versions + * + * The organization's add-on versions, newest first. Requires billing to be enabled for the organization. + */ + public static listAddons( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons", + ...options, + }); + } + + /** + * Create an add-on version + * + * Creates an add-on version: the first of a new family, or the next version of the family familySlug (or familyId) names. Emits ADDON_CREATED. Requires billing to be enabled for the organization. + */ + public static createAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Delete an add-on version + * + * Deletes a version that was never attached and grants nothing (409 DeleteAddon.InUseConflict otherwise); its family goes with its last version. Emits ADDON_DELETED. Requires billing to be enabled for the organization. + */ + public static deleteAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).delete( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}", + ...options, + }, + ); + } + + /** + * Get an add-on version + * + * One add-on version. Requires billing to be enabled for the organization. + */ + public static getAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}", + ...options, + }); + } + + /** + * Update an add-on version + * + * Replaces a version's name, description, version name, default flag and maximum quantity. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + */ + public static updateAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).put({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Archive an add-on version + * + * Withdraws a PUBLISHED version from sale: instances holding it keep it, none can attach it again (409 ArchiveAddon.NotPublished otherwise). Emits ADDON_ARCHIVED. Requires billing to be enabled for the organization. + */ + public static archiveAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).post( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/archive", + ...options, + }, + ); + } + + /** + * List the licence families an add-on fits + * + * The licence families an instance must be on to attach this add-on version. None: it cannot be attached. Requires billing to be enabled for the organization. + */ + public static listAddonCompatibility( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListAddonCompatibilityResponses, + ListAddonCompatibilityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/compatible-license-families", + ...options, + }); + } + + /** + * Stop an add-on fitting a licence family + * + * Instances already holding the add-on keep it; no new attachment from the family. Idempotent. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + */ + public static removeAddonCompatibility( + options: Options, + ): RequestResult< + RemoveAddonCompatibilityResponses, + RemoveAddonCompatibilityErrors, + ThrowOnError + > { + return (options.client ?? client).delete< + RemoveAddonCompatibilityResponses, + RemoveAddonCompatibilityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}", + ...options, + }); + } + + /** + * Make an add-on fit a licence family + * + * Lets instances on any version of the licence family attach this add-on version. Idempotent. Emits ADDON_UPDATED. Requires billing to be enabled for the organization. + */ + public static setAddonCompatibility( + options: Options, + ): RequestResult { + return (options.client ?? client).put< + SetAddonCompatibilityResponses, + SetAddonCompatibilityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}", + ...options, + }); + } + + /** + * List an add-on version's grants + * + * What one add-on version grants per unit of quantity. Requires billing to be enabled for the organization. + */ + public static listAddonEntitlements( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListAddonEntitlementsResponses, + ListAddonEntitlementsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements", + ...options, + }); + } + + /** + * Grant an entitlement through an add-on + * + * Grants an entitlement per unit of an add-on version. Refused while an instance with a live subscription holds the version (409 AssignAddonEntitlement.BillingActive). Emits ADDON_ENTITLEMENT_ASSIGNED. Requires billing to be enabled for the organization. + */ + public static assignAddonEntitlement( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + AssignAddonEntitlementResponses, + AssignAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Remove an add-on grant + * + * Removes a grant. Refused while an instance with a live subscription holds the version (409 UnassignAddonEntitlement.BillingActive) and while an ACTIVE price of the version meters it (409 UnassignAddonEntitlement.MeteredByPrice). Emits ADDON_ENTITLEMENT_UNASSIGNED. Requires billing to be enabled for the organization. + */ + public static unassignAddonEntitlement( + options: Options, + ): RequestResult< + UnassignAddonEntitlementResponses, + UnassignAddonEntitlementErrors, + ThrowOnError + > { + return (options.client ?? client).delete< + UnassignAddonEntitlementResponses, + UnassignAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}", + ...options, + }); + } + + /** + * Get an add-on grant + * + * One grant of an add-on version. Requires billing to be enabled for the organization. + */ + public static getAddonEntitlement( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + GetAddonEntitlementResponses, + GetAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}", + ...options, + }); + } + + /** + * Update an add-on grant + * + * Replaces a grant's value, override behaviour and overage. Refused while an instance with a live subscription holds the version (409 UpdateAddonEntitlement.BillingActive). Emits ADDON_ENTITLEMENT_UPDATED. Requires billing to be enabled for the organization. + */ + public static updateAddonEntitlement( + options: Options, + ): RequestResult { + return (options.client ?? client).put< + UpdateAddonEntitlementResponses, + UpdateAddonEntitlementErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * List an add-on version's prices + * + * The prices of one add-on version, in display order. Requires billing to be enabled for the organization. + */ + public static listAddonPrices( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListAddonPricesResponses, + ListAddonPricesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/prices", + ...options, + }); + } + + /** + * Create an add-on price + * + * Adds a price to an add-on version, under the rules of a licence price. A price cannot change once created: create another and deprecate this one. Refused while an instance with a live subscription holds the version (409 CreateAddonPrice.BillingActive). Emits ADDON_PRICE_CREATED. Requires billing to be enabled for the organization. + */ + public static createAddonPrice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreateAddonPriceResponses, + CreateAddonPriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/prices", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Deprecate an add-on price + * + * Stops offering a price. A default price cannot be deprecated (409 DeprecateAddonPrice.IsDefault): it is what bills every instance holding the version; retire it through a new version. Emits ADDON_PRICE_DEPRECATED. Requires billing to be enabled for the organization. + */ + public static deprecateAddonPrice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + DeprecateAddonPriceResponses, + DeprecateAddonPriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/prices/{priceId}/deprecate", + ...options, + }); + } + + /** + * Publish an add-on version + * + * Puts a DRAFT version on sale (409 PublishAddon.NotADraft otherwise). Emits ADDON_PUBLISHED. Requires billing to be enabled for the organization. + */ + public static publishAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).post( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/publish", + ...options, + }, + ); + } + + /** + * Unarchive an add-on version + * + * Puts an ARCHIVED version back on sale (409 UnarchiveAddon.NotArchived otherwise). Emits ADDON_UNARCHIVED. Requires billing to be enabled for the organization. + */ + public static unarchiveAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + UnarchiveAddonResponses, + UnarchiveAddonErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/addons/{addonSlug}/unarchive", + ...options, + }); + } +} + +export class Billing { + /** + * Get billing capabilities + * + * Whether billing is enabled for the organization, and if not why; who can collect its invoices; and which parts of billing this release ships, so a client shows only what works. Answers even when billing is disabled. + */ + public static getBillingCapabilities( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + GetBillingCapabilitiesResponses, + GetBillingCapabilitiesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/capabilities", + ...options, + }); + } + + /** + * Close due billing periods + * + * Closes the subscriptions whose period has ended now, rather than at the period-close job's next pass: each one's RENEWAL invoice is composed and issued (or held, when its usage journal fails a check) and its period advances. A subscription several periods behind closes one period at a time until it is current. Only what is due closes, at most the configured batch size per call. Requires billing to be enabled for the organization. + */ + public static closeBillingPeriods( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CloseBillingPeriodsResponses, + CloseBillingPeriodsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/close-periods", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * List the handoff queue + * + * The invoices waiting for the organization's accounting system (PENDING), or already acknowledged by it, oldest issue first. Reading never leases: claim to take invoices. Requires billing to be enabled for the organization. + */ + public static listHandoff( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/handoff", + ...options, + }); + } + + /** + * Claim invoices from the handoff queue + * + * Leases the oldest invoices waiting for the organization's accounting system, under one lease. Two consumers claiming at once get different invoices. An invoice not acknowledged before its lease expires is claimed again: the queue delivers at least once, so a consumer deduplicates on the invoice id. A claim is not idempotent: a lost response leaves its invoices leased until leasedUntil. Requires billing to be enabled for the organization. + */ + public static claimHandoff( + options: Options, + ): RequestResult { + return (options.client ?? client).post( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/handoff/claim", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }, + ); + } + + /** + * Acknowledge a handed-off invoice + * + * Records that the organization's accounting system booked an invoice from the handoff queue. Safe to repeat: the same acknowledgement again, or one that adds a reference the invoice did not have, answers 200. Another reference than the one it was acknowledged under is refused (AckHandoff.ReferenceMismatch), which a consumer can take as already handed off. Requires billing to be enabled for the organization. + */ + public static ackHandoff( + options: Options, + ): RequestResult { + return (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/handoff/{invoiceId}/ack", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Get the billing health + * + * What the organization's billing needs attention for, computed when read: periods waiting for their close, held invoices, invoices a payment provider keeps refusing, reconciliation mismatches, each provider's sync, overdue invoices and the handoff backlog. Requires billing to be enabled for the organization. + */ + public static getBillingHealth( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + GetBillingHealthResponses, + GetBillingHealthErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/health", + ...options, + }); + } + + /** + * Get billing settings + * + * The organization's billing defaults: the collection method and payment terms a subscription gets when it names none of its own. An organization that never wrote them has the defaults (SEND_INVOICE, 30 days). + */ + public static getBillingSettings( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + GetBillingSettingsResponses, + GetBillingSettingsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/settings", + ...options, + }); + } + + /** + * Update billing settings + * + * Replaces the organization's billing defaults. A subscription that names its own terms keeps them; the others take these at their next invoice. + */ + public static updateBillingSettings( + options: Options, + ): RequestResult { + return (options.client ?? client).put< + UpdateBillingSettingsResponses, + UpdateBillingSettingsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/settings", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Sync with the payment providers now + * + * Runs one sync pass now for each payment provider the organization has connected: payments, voids and finalizations done in the provider are mirrored, as the periodic pass does. Refused when none is connected (409 SyncProvider.NotConnected). Requires billing to be enabled for the organization. + */ + public static syncBillingProvider( + options?: Options, + ): RequestResult { + return (options?.client ?? client).post< + SyncBillingProviderResponses, + SyncBillingProviderErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/billing/sync", + ...options, + }); + } + + /** + * Get a customer's billing + * + * The customer's billing e-mail and its side in each payment provider: its id there and the labels of its default payment method (never card data). 404 GetCustomerBilling.CustomerNotFound. Requires billing to be enabled for the organization. + */ + public static getCustomerBilling( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + GetCustomerBillingResponses, + GetCustomerBillingErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing", + ...options, + }); + } + + /** + * Detach a customer's payment method + * + * Removes the customer's payment method from the payment provider. 409 .InUseByAutomaticCollection while a live subscription of the customer is charged automatically, .NoPaymentMethod; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + */ + public static detachPaymentMethod( + options: Options, + ): RequestResult { + return (options.client ?? client).delete< + DetachPaymentMethodResponses, + DetachPaymentMethodErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/payment-method", + ...options, + }); + } + + /** + * Open a page saving a customer's payment method + * + * Ensures the customer in the payment provider, then opens the provider's hosted page where the customer saves a payment method; Kaiten never sees card data. When the customer comes back to returnUrl, complete the session server-side. 404 .CustomerNotFound; 422 .ProviderNotConnected, .InvalidReturnUrl, .CurrencyRequired; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + */ + public static createPaymentMethodSession( + options: Options, + ): RequestResult< + CreatePaymentMethodSessionResponses, + CreatePaymentMethodSessionErrors, + ThrowOnError + > { + return (options.client ?? client).post< + CreatePaymentMethodSessionResponses, + CreatePaymentMethodSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/payment-method-session", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Complete a payment-method session + * + * Checks the setup session with the payment provider (the redirect is never trusted) and makes the payment method saved there the one the customer's invoices are charged to. Idempotent. 404 .SessionNotFound (unknown, or another customer's); 409 .SessionNotComplete; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + */ + public static completePaymentMethodSession( + options: Options, + ): RequestResult< + CompletePaymentMethodSessionResponses, + CompletePaymentMethodSessionErrors, + ThrowOnError + > { + return (options.client ?? client).post< + CompletePaymentMethodSessionResponses, + CompletePaymentMethodSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/payment-method-session/{sessionId}/complete", + ...options, + }); + } + + /** + * Open a customer's billing portal + * + * Opens the payment provider's hosted portal for the customer, where it manages payment methods and invoices; changes reach Kaiten through sync. 422 .ProviderNotConnected, .CustomerNotOnProvider, .InvalidReturnUrl; 503 .ProviderUnavailable. Requires billing to be enabled for the organization. + */ + public static createPortalSession( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreatePortalSessionResponses, + CreatePortalSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customers/{customerSlug}/billing/portal-session", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Get an instance's subscription + * + * The instance's subscription, live or CANCELED; 404 when it was never subscribed. Requires billing to be enabled for the organization. + */ + public static getInstanceBilling( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + GetInstanceBillingResponses, + GetInstanceBillingErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing", + ...options, + }); + } + + /** + * Change a subscription's terms or provider + * + * Changes the subscription's payment provider, collection method and payment terms from its next invoice on; null restores the organization's default. Invoices already composed keep their own, and keep routing to the provider that issued them. Moving to a provider that pushes invoices registers the customer with it first (503 UpdateInstanceBilling.ProviderUnavailable when it cannot be reached). A provider change emits INSTANCE_BILLING_PROVIDER_CHANGED. Requires billing to be enabled for the organization. + */ + public static updateInstanceBilling( + options: Options, + ): RequestResult { + return (options.client ?? client).patch< + UpdateInstanceBillingResponses, + UpdateInstanceBillingErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Subscribe an instance + * + * Starts billing an instance on a FLAT_FEE price of its licence version. A base price that bills in advance issues the first period's invoice (ACTIVATION) at once; charged automatically, it is pushed and charged before the answer when the provider answers within 20 seconds. Each period then closes into a RENEWAL. Add-ons and a voucher can be started with it, in the same transaction. A CANCELED subscription is subscribed again. While the subscription is live the instance's customer and licence cannot change. Requires billing to be enabled for the organization. + */ + public static subscribeInstance( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + SubscribeInstanceResponses, + SubscribeInstanceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Cancel a subscription + * + * Cancels an instance's subscription: a trial at once with no invoice; otherwise at the period's end (repeating it changes nothing), or immediately with a FINAL invoice. Cancellation changes billing only: entitlements and licence dates stay the vendor's to change. Requires billing to be enabled for the organization. + */ + public static cancelSubscription( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CancelSubscriptionResponses, + CancelSubscriptionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/cancel", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Reactivate a subscription + * + * Reverts a cancellation scheduled for the period end, before it. A canceled subscription is subscribed again instead. Requires billing to be enabled for the organization. + */ + public static reactivateSubscription( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + ReactivateSubscriptionResponses, + ReactivateSubscriptionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/reactivate", + ...options, + }); + } + + /** + * Cancel a scheduled plan change + * + * Drops the plan change scheduled for the next boundary. Requires billing to be enabled for the organization. + */ + public static cancelPlanChange( + options: Options, + ): RequestResult { + return (options.client ?? client).delete< + CancelPlanChangeResponses, + CancelPlanChangeErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/scheduled-change", + ...options, + }); + } + + /** + * Schedule a plan change + * + * Schedules a move to another FLAT_FEE price, of any PUBLISHED licence version in the subscription's currency, for the next boundary. That boundary's RENEWAL bills the old plan's arrears and the new plan's advance, and moves the instance to the new version; there is no proration. Scheduling another target replaces the change, the same one changes nothing. A scheduled target's price cannot be deprecated, nor its version archived. Requires billing to be enabled for the organization. + */ + public static schedulePlanChange( + options: Options, + ): RequestResult { + return (options.client ?? client).put< + SchedulePlanChangeResponses, + SchedulePlanChangeErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/scheduled-change", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Preview an instance's upcoming invoice + * + * The invoice the subscription's next boundary will issue, composed from its usage so far, without writing anything: lines carry the period they will bill, quantities what was measured until now. wouldHold lists the meters whose usage journal fails a check and would hold the invoice. Requires billing to be enabled for the organization. + */ + public static getUpcomingInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + GetUpcomingInvoiceResponses, + GetUpcomingInvoiceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/billing/upcoming-invoice", + ...options, + }); + } + + /** + * List an instance's invoices + * + * The invoices of one instance's subscription, across every time it was subscribed, with the filters of listInvoices. Requires billing to be enabled for the organization. + */ + public static listInstanceInvoices( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListInstanceInvoicesResponses, + ListInstanceInvoicesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/invoices", + ...options, + }); + } + + /** + * List invoices + * + * The organization's invoices, newest first; with updatedSince, the ones changed since an instant, oldest change first, for incremental sync. Invoices outlive their instance and customer. Requires billing to be enabled for the organization. + */ + public static listInvoices( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices", + ...options, + }, + ); + } + + /** + * Export invoices + * + * Streams the invoices the filters of listInvoices select, as CSV or NDJSON. Amounts are integer minor units with the currency's exponent beside them, so a spreadsheet never sees a float. The export carries billing e-mails: it is an authenticated read for the organization's accounting. Requires billing to be enabled for the organization. + */ + public static exportInvoices( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + ExportInvoicesResponses, + ExportInvoicesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/export", + ...options, + }); + } + + /** + * Get an invoice + * + * One invoice with its lines, the customer and instance as they were when it was composed, its hold and its handoff. Addressed by id at organization level: an invoice outlives its instance and customer. Requires billing to be enabled for the organization. + */ + public static getInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}", + ...options, + }); + } + + /** + * List the usage reports behind an invoice line + * + * The usage reports a USAGE or OVERAGE line was measured from: its pair's reports dated in its service period, in reportSeq order. Summed by reset window and floored at 0, they give the line's measured quantity. Addressed by invoice, it answers after the instance was deleted. Requires billing to be enabled for the organization. + */ + public static listInvoiceLineReports( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListInvoiceLineReportsResponses, + ListInvoiceLineReportsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/lines/{lineId}/reports", + ...options, + }); + } + + /** + * Mark an invoice paid + * + * Records that a MANUAL invoice was paid. An invoice still waiting in the handoff queue is acknowledged by the same write. Marking it paid again with the same external reference answers it unchanged. An invoice a payment provider collects is settled there. Requires billing to be enabled for the organization. + */ + public static markInvoicePaid( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + MarkInvoicePaidResponses, + MarkInvoicePaidErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/mark-paid", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Recompose an invoice + * + * Composes an invoice again from the usage journal as it is now, keeping its BASE lines as they were sold. A held DRAFT is rewritten in place (200): issued when its journal is now sound, held again otherwise. A VOID invoice gets a replacement for the same boundary (201), under the subscription's current terms and billing e-mail. Any other invoice must be voided first. Requires billing to be enabled for the organization. + */ + public static recomposeInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + RecomposeInvoiceResponses, + RecomposeInvoiceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/recompose", + ...options, + }); + } + + /** + * Release a held invoice + * + * Accepts a held invoice as composed and issues it: MANUAL and pending in the handoff queue, or PAID when nothing is owed. The release keeps who released it and why. Requires billing to be enabled for the organization. + */ + public static releaseInvoiceHold( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + ReleaseInvoiceHoldResponses, + ReleaseInvoiceHoldErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/release-hold", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Retry pushing an invoice to its provider + * + * Puts a DRAFT or PUSH_FAILED invoice of a payment provider back in the push queue now, which resumes the push where its last attempt stopped. A draft waiting for finalization in its provider is finalized at once. Refused for a held invoice (409 RetryInvoicePush.Held) and for any other (409 RetryInvoicePush.InvalidStatus). Requires billing to be enabled for the organization. + */ + public static retryInvoicePush( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + RetryInvoicePushResponses, + RetryInvoicePushErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/retry-push", + ...options, + }); + } + + /** + * Sync an invoice with its provider + * + * Reads an invoice from its payment provider now and applies what the provider says: its finalization, payment, write-off or void. Refused for an invoice not in a provider (409 SyncInvoice.NotPushed). Requires billing to be enabled for the organization. + */ + public static syncInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/sync", + ...options, + }); + } + + /** + * Void an invoice + * + * Voids an invoice not yet settled -- a DRAFT, held or not, a MANUAL one, or one a payment provider issued -- which frees its boundary for a recompose. A provider's invoice is voided there first, and here only once the provider confirms (503 VoidInvoice.ProviderUnavailable leaves it unchanged); one the provider reports paid is refused. A paid or written-off invoice cannot be voided. A handoff still pending stays so, and its consumer sees the VOID. Voiding a VOID invoice again answers it unchanged. Requires billing to be enabled for the organization. + */ + public static voidInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).post({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/void", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Write off an invoice + * + * Records that the organization gave up collecting a MANUAL invoice: it becomes UNCOLLECTIBLE. A handoff still pending stays so, and its consumer sees the new status. Writing off an UNCOLLECTIBLE invoice again answers it unchanged. Requires billing to be enabled for the organization. + */ + public static writeOffInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + WriteOffInvoiceResponses, + WriteOffInvoiceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/invoices/{invoiceId}/write-off", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } +} + export class Components { /** * List components @@ -373,7 +2091,13 @@ export class Components { ListComponentsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components", ...options, }); @@ -392,7 +2116,13 @@ export class Components { CreateComponentErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components", ...options, headers: { @@ -415,7 +2145,13 @@ export class Components { DeleteComponentErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components/{componentSlug}", ...options, }); @@ -430,7 +2166,13 @@ export class Components { options: Options, ): RequestResult { return (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components/{componentSlug}", ...options, }); @@ -449,7 +2191,13 @@ export class Components { UpdateComponentErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/components/{componentSlug}", ...options, headers: { @@ -474,7 +2222,13 @@ export class Connectors { ListConnectorsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors", ...options, }); @@ -489,7 +2243,13 @@ export class Connectors { options: Options, ): RequestResult { return (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}", ...options, }); @@ -508,7 +2268,13 @@ export class Connectors { DeactivateConnectorErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/activation", ...options, }); @@ -527,7 +2293,13 @@ export class Connectors { ActivateConnectorErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/activation", ...options, }); @@ -546,7 +2318,13 @@ export class Connectors { DeleteConnectorSettingsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings", ...options, }); @@ -565,7 +2343,13 @@ export class Connectors { GetConnectorSettingsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings", ...options, }); @@ -584,7 +2368,13 @@ export class Connectors { UpdateConnectorSettingsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings", ...options, headers: { @@ -611,7 +2401,13 @@ export class Connectors { GetConnectorSettingsSchemaErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/settings/schema", ...options, }); @@ -630,13 +2426,75 @@ export class Connectors { GetConnectorStateErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/connectors/{connectorName}/state", ...options, }); } } +export class CustomerSessions { + /** + * Create a customer session + * + * Mints a kst_ session for one of the organization's customers, optionally bound to one of its instances, for that customer's browser to call the /api/public/session routes: checkout, invoices. Call it from your backend, where the customer is signed in, and hand the token to the page; mint a new one before it expires. What the session writes is attributed to the caller. Limited to 50 sessions a second per organization. + */ + public static createCustomerSession( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreateCustomerSessionResponses, + CreateCustomerSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customer-sessions", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Revoke a customer session + * + * The session stops authenticating on the next request: on sign-out, or when the customer's access changes. Idempotent. + */ + public static revokeCustomerSession( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + RevokeCustomerSessionResponses, + RevokeCustomerSessionErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/customer-sessions/{sessionId}/revoke", + ...options, + }); + } +} + export class Customers { /** * List customers @@ -651,7 +2509,13 @@ export class Customers { ListCustomersErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers", ...options, }); @@ -670,7 +2534,13 @@ export class Customers { CreateCustomerErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers", ...options, headers: { @@ -693,7 +2563,13 @@ export class Customers { DeleteCustomerErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}", ...options, }); @@ -708,7 +2584,13 @@ export class Customers { options: Options, ): RequestResult { return (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}", ...options, }); @@ -727,7 +2609,13 @@ export class Customers { UpdateCustomerErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}", ...options, headers: { @@ -754,7 +2642,13 @@ export class Customers { DeleteCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, }); @@ -773,7 +2667,13 @@ export class Customers { GetCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, }); @@ -796,7 +2696,13 @@ export class Customers { CreateCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, headers: { @@ -823,7 +2729,13 @@ export class Customers { UpdateCustomerIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/customers/{customerSlug}/integrations/{integrationName}", ...options, headers: { @@ -850,7 +2762,13 @@ export class Customers { GetCustomerIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/customer/{externalId}", ...options, }); @@ -873,7 +2791,13 @@ export class Customers { UpsertCustomerIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/customer/{externalId}", ...options, headers: { @@ -898,7 +2822,13 @@ export class DeploymentZones { ListDeploymentZonesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones", ...options, }); @@ -917,7 +2847,13 @@ export class DeploymentZones { CreateDeploymentZoneErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones", ...options, headers: { @@ -940,7 +2876,13 @@ export class DeploymentZones { DeleteDeploymentZoneErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones/{deploymentZoneSlug}", ...options, }); @@ -959,7 +2901,13 @@ export class DeploymentZones { GetDeploymentZoneBySlugErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones/{deploymentZoneSlug}", ...options, }); @@ -978,7 +2926,13 @@ export class DeploymentZones { UpdateDeploymentZoneErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/deployment-zones/{deploymentZoneSlug}", ...options, headers: { @@ -1001,7 +2955,13 @@ export class DeploymentZones { GetReleaseBySlugErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases/{releaseSlug}", ...options, }); @@ -1022,7 +2982,13 @@ export class EntitlementGroups { ListEntitlementGroupsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups", ...options, }); @@ -1041,7 +3007,13 @@ export class EntitlementGroups { CreateEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups", ...options, headers: { @@ -1064,7 +3036,13 @@ export class EntitlementGroups { DeleteEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}", ...options, }); @@ -1083,7 +3061,13 @@ export class EntitlementGroups { GetEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}", ...options, }); @@ -1102,7 +3086,13 @@ export class EntitlementGroups { UpdateEntitlementGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}", ...options, headers: { @@ -1125,7 +3115,13 @@ export class EntitlementGroups { AddEntitlementToGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}/entitlements", ...options, headers: { @@ -1152,7 +3148,13 @@ export class EntitlementGroups { RemoveEntitlementFromGroupErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}", ...options, }); @@ -1175,7 +3177,13 @@ export class EntitlementGroups { GetEntitlementGroupUsageErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlement-groups/{entitlementGroupSlug}/usage", ...options, }); @@ -1196,7 +3204,13 @@ export class Entitlements { ListEntitlementsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements", ...options, }); @@ -1215,7 +3229,13 @@ export class Entitlements { CreateEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements", ...options, headers: { @@ -1238,7 +3258,13 @@ export class Entitlements { DeleteEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements/{entitlementSlug}", ...options, }); @@ -1257,7 +3283,13 @@ export class Entitlements { GetEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements/{entitlementSlug}", ...options, }); @@ -1276,7 +3308,13 @@ export class Entitlements { UpdateEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/entitlements/{entitlementSlug}", ...options, headers: { @@ -1301,7 +3339,13 @@ export class Featureflags { GetFeatureFlagsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags", ...options, }); @@ -1320,7 +3364,13 @@ export class Featureflags { CreateFeatureFlagErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags", ...options, headers: { @@ -1343,7 +3393,13 @@ export class Featureflags { GetTargetingContextErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/targeting/context", ...options, }); @@ -1362,7 +3418,13 @@ export class Featureflags { LintTargetingRuleErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/targeting/lint", ...options, headers: { @@ -1385,7 +3447,13 @@ export class Featureflags { TestTargetingRuleErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/targeting/test", ...options, headers: { @@ -1408,7 +3476,13 @@ export class Featureflags { DeleteFeatureFlagErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/{featureFlagSlug}", ...options, }); @@ -1427,7 +3501,13 @@ export class Featureflags { GetFeatureFlagErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/{featureFlagSlug}", ...options, }); @@ -1446,7 +3526,13 @@ export class Featureflags { UpdateFeatureFlagErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/feature-flags/{featureFlagSlug}", ...options, headers: { @@ -1468,7 +3554,13 @@ export class Instances { ): RequestResult { return (options?.client ?? client).get( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances", ...options, }, @@ -1488,7 +3580,13 @@ export class Instances { CreateInstanceErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances", ...options, headers: { @@ -1511,7 +3609,13 @@ export class Instances { DeleteInstanceErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}", ...options, }); @@ -1526,7 +3630,13 @@ export class Instances { options: Options, ): RequestResult { return (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}", ...options, }); @@ -1545,7 +3655,13 @@ export class Instances { PatchInstanceErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}", ...options, headers: { @@ -1568,7 +3684,13 @@ export class Instances { UpdateInstanceErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}", ...options, headers: { @@ -1578,6 +3700,118 @@ export class Instances { }); } + /** + * List an instance's add-ons + * + * The add-ons an instance holds, in attachment order, each with the prices its subscription bills. Requires billing to be enabled for the organization. + */ + public static listInstanceAddons( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListInstanceAddonsResponses, + ListInstanceAddonsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons", + ...options, + }); + } + + /** + * Attach an add-on to an instance + * + * Gives an instance an add-on version and a quantity. The entitlements apply at once; a subscription bills the quantity held at each boundary, without proration. One version per family: moving to another version is detach then attach. Emits INSTANCE_ADDON_ADDED. Requires billing to be enabled for the organization. + */ + public static attachInstanceAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + AttachInstanceAddonResponses, + AttachInstanceAddonErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Remove an add-on from an instance + * + * Removes an add-on from an instance. The entitlements drop at once; nothing is refunded. The attachment stays readable with includeRemoved. Emits INSTANCE_ADDON_REMOVED. Requires billing to be enabled for the organization. + */ + public static detachInstanceAddon( + options: Options, + ): RequestResult { + return (options.client ?? client).delete< + DetachInstanceAddonResponses, + DetachInstanceAddonErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons/{addonSlug}", + ...options, + }); + } + + /** + * Change an instance add-on's quantity + * + * Changes how many units of an add-on an instance holds. The entitlements follow at once; the next invoice bills the new quantity. Emits INSTANCE_ADDON_QUANTITY_CHANGED. Requires billing to be enabled for the organization. + */ + public static setInstanceAddonQuantity( + options: Options, + ): RequestResult< + SetInstanceAddonQuantityResponses, + SetInstanceAddonQuantityErrors, + ThrowOnError + > { + return (options.client ?? client).patch< + SetInstanceAddonQuantityResponses, + SetInstanceAddonQuantityErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/addons/{addonSlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + /** * List audit trail entries for an instance * @@ -1591,7 +3825,13 @@ export class Instances { GetAuditTrailsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/audit-trails", ...options, }); @@ -1614,7 +3854,13 @@ export class Instances { GetEntitlementsUsageMetricsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/usage", ...options, }); @@ -1637,7 +3883,13 @@ export class Instances { GetEntitlementUsageMetricsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage", ...options, }); @@ -1660,7 +3912,13 @@ export class Instances { ReportEntitlementUsageMetricErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage", ...options, headers: { @@ -1683,7 +3941,13 @@ export class Instances { ListUsageReportsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports", ...options, }); @@ -1702,7 +3966,13 @@ export class Instances { ExportUsageReportsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export", ...options, }); @@ -1725,7 +3995,13 @@ export class Instances { DeleteInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, }); @@ -1744,7 +4020,13 @@ export class Instances { GetInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, }); @@ -1767,7 +4049,13 @@ export class Instances { CreateInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, headers: { @@ -1794,7 +4082,13 @@ export class Instances { UpdateInstanceIntegrationErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/instances/{instanceSlug}/integrations/{integrationName}", ...options, headers: { @@ -1821,7 +4115,13 @@ export class Instances { GetInstanceIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/instance/{externalId}", ...options, }); @@ -1844,35 +4144,367 @@ export class Instances { UpsertInstanceIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], - url: "/integration/{adapter}/instance/{externalId}", + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/integration/{adapter}/instance/{externalId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Export the organization's usage reports + * + * Streams every usage report of the organization in the range, across instances and entitlements, as CSV or NDJSON, ordered by reportedAt. Filters narrow it to one instance or one entitlement, including deleted ones by ID. Use it to keep the usage history before deleting the organization. + */ + public static exportOrganizationUsageReports( + options?: Options, + ): RequestResult< + ExportOrganizationUsageReportsResponses, + ExportOrganizationUsageReportsErrors, + ThrowOnError + > { + return (options?.client ?? client).get< + ExportOrganizationUsageReportsResponses, + ExportOrganizationUsageReportsErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/usage/reports/export", + ...options, + }); + } +} + +export class Vouchers { + /** + * List an instance's vouchers + * + * The vouchers an instance redeemed, newest first. Requires billing to be enabled for the organization. + */ + public static listInstanceVouchers( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListInstanceVouchersResponses, + ListInstanceVouchersErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/vouchers", + ...options, + }); + } + + /** + * Redeem a voucher + * + * Redeems a voucher for an instance. A boost applies from the next read or report, for its duration; a PRICE voucher discounts the subscription's next invoices. Emits INSTANCE_VOUCHER_REDEEMED, and VOUCHER_EXHAUSTED with the last redemption. Requires billing to be enabled for the organization. + */ + public static redeemVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + RedeemVoucherResponses, + RedeemVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/vouchers/redeem", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Revoke a redemption + * + * Stops a redemption from applying: a boost ends at once, a discount applies to no further invoice. Invoices already issued are untouched. Emits INSTANCE_VOUCHER_REVOKED. Requires billing to be enabled for the organization. + */ + public static revokeInstanceVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + RevokeInstanceVoucherResponses, + RevokeInstanceVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/instances/{instanceSlug}/vouchers/{instanceVoucherId}/revoke", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * List vouchers + * + * The organization's vouchers, newest first, with their codes. Requires billing to be enabled for the organization. + */ + public static listVouchers( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get( + { + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers", + ...options, + }, + ); + } + + /** + * Create a voucher + * + * Creates a DRAFT voucher: a PRICE discount or an ENTITLEMENT_BOOST. The code is generated when none is given, and returned. Emits VOUCHER_CREATED, without the code. Requires billing to be enabled for the organization. + */ + public static createVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreateVoucherResponses, + CreateVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Find a voucher by code + * + * Finds the voucher a code names, matched without case or separators. The code travels in the body, never in a URL. Requires billing to be enabled for the organization. + */ + public static lookupVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + LookupVoucherResponses, + LookupVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/lookup", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Validate a voucher code + * + * Runs the redemption checks without redeeming: the voucher's own, and, with instanceSlug, the instance's. Answers 200 with valid, and the first failing reason (and eligibility rule) otherwise. Requires billing to be enabled for the organization. + */ + public static validateVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + ValidateVoucherResponses, + ValidateVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/validate", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Get a voucher + * + * One voucher, with its code. Requires billing to be enabled for the organization. + */ + public static getVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).get({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}", + ...options, + }); + } + + /** + * Update a voucher + * + * Replaces a DRAFT voucher, but its type. An ACTIVE voucher takes a new name, description, expiresAt and maxRedemptions (at least redemptionsCount); its other members must stay as they are (409 UpdateVoucher.NotEditable). Emits VOUCHER_UPDATED. Requires billing to be enabled for the organization. + */ + public static updateVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).put< + UpdateVoucherResponses, + UpdateVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Archive a voucher + * + * Stops a voucher from being redeemed. Redemptions already made keep applying until revoked. Emits VOUCHER_ARCHIVED. Requires billing to be enabled for the organization. + */ + public static archiveVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + ArchiveVoucherResponses, + ArchiveVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}/archive", + ...options, + }); + } + + /** + * Publish a voucher + * + * Makes a DRAFT voucher redeemable (409 PublishVoucher.NotADraft otherwise). Emits VOUCHER_PUBLISHED. Requires billing to be enabled for the organization. + */ + public static publishVoucher( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + PublishVoucherResponses, + PublishVoucherErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}/publish", ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, }); } /** - * Export the organization's usage reports + * List a voucher's redemptions * - * Streams every usage report of the organization in the range, across instances and entitlements, as CSV or NDJSON, ordered by reportedAt. Filters narrow it to one instance or one entitlement, including deleted ones by ID. Use it to keep the usage history before deleting the organization. + * Every redemption of a voucher, newest first. Requires billing to be enabled for the organization. */ - public static exportOrganizationUsageReports( - options?: Options, - ): RequestResult< - ExportOrganizationUsageReportsResponses, - ExportOrganizationUsageReportsErrors, - ThrowOnError - > { - return (options?.client ?? client).get< - ExportOrganizationUsageReportsResponses, - ExportOrganizationUsageReportsErrors, + public static listVoucherRedemptions( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListVoucherRedemptionsResponses, + ListVoucherRedemptionsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], - url: "/usage/reports/export", + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/vouchers/{voucherId}/redemptions", ...options, }); } @@ -1896,7 +4528,13 @@ export class Integrations { GetCustomerIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/customer/{externalId}", ...options, }); @@ -1919,7 +4557,13 @@ export class Integrations { UpsertCustomerIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/customer/{externalId}", ...options, headers: { @@ -1946,7 +4590,13 @@ export class Integrations { GetInstanceIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/instance/{externalId}", ...options, }); @@ -1969,7 +4619,13 @@ export class Integrations { UpsertInstanceIntegrationByExternalIdErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/integration/{adapter}/instance/{externalId}", ...options, headers: { @@ -1994,7 +4650,13 @@ export class LicenseFamilies { ListLicenseFamiliesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/license-families", ...options, }); @@ -2018,7 +4680,13 @@ export class LicenseFamilies { ThrowOnError >({ querySerializer: { parameters: { include: { array: { explode: false } } } }, - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/license-families/{familySlug}", ...options, }); @@ -2026,6 +4694,35 @@ export class LicenseFamilies { } export class Licenses { + /** + * Update a license family + * + * Lists the family in the public catalogue, or takes it out. Families are private until made public. + */ + public static updateLicenseFamily( + options: Options, + ): RequestResult { + return (options.client ?? client).patch< + UpdateLicenseFamilyResponses, + UpdateLicenseFamilyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/license-families/{familySlug}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + /** * GetUser all licenses * @@ -2035,7 +4732,13 @@ export class Licenses { options?: Options, ): RequestResult { return (options?.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses", ...options, }); @@ -2056,7 +4759,13 @@ export class Licenses { CreateLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses", ...options, headers: { @@ -2079,7 +4788,13 @@ export class Licenses { DeleteLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}", ...options, }); @@ -2094,7 +4809,13 @@ export class Licenses { options: Options, ): RequestResult { return (options.client ?? client).get({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}", ...options, }); @@ -2113,7 +4834,13 @@ export class Licenses { UpdateLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}", ...options, headers: { @@ -2136,7 +4863,13 @@ export class Licenses { ArchiveLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/archive", ...options, }); @@ -2155,7 +4888,13 @@ export class Licenses { GetLicenseEntitlementsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements", ...options, }); @@ -2178,7 +4917,13 @@ export class Licenses { AssociateEntitlementWithLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements", ...options, headers: { @@ -2205,7 +4950,13 @@ export class Licenses { DeleteLicenseEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}", ...options, }); @@ -2224,7 +4975,13 @@ export class Licenses { GetLicenseEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}", ...options, }); @@ -2247,7 +5004,13 @@ export class Licenses { UpdateLicenseEntitlementErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}", ...options, headers: { @@ -2257,6 +5020,168 @@ export class Licenses { }); } + /** + * Preview a license invoice + * + * Composes the RENEWAL invoice a subscription to this licence version would be billed at a boundary now, without writing anything: the sample usage rated in arrears over the billing period that ends, and the base price for the period that starts (or the one that ends, for an ARREARS base). Works on DRAFT versions, to check prices before publishing. Requires billing to be enabled for the organization. + */ + public static previewLicenseInvoice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + PreviewLicenseInvoiceResponses, + PreviewLicenseInvoiceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/invoice-preview", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * List a license version's prices + * + * The prices of one licence version, in display order. Requires billing to be enabled for the organization. + */ + public static listLicensePrices( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + ListLicensePricesResponses, + ListLicensePricesErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices", + ...options, + }); + } + + /** + * Create a license price + * + * Adds a price to a licence version. A metered price's sale-unit factor is captured from its entitlement now and never changes. Requires billing to be enabled for the organization. + */ + public static createLicensePrice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreateLicensePriceResponses, + CreateLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Get a license price + * + * One price of a licence version. Requires billing to be enabled for the organization. + */ + public static getLicensePrice( + options: Options, + ): RequestResult { + return (options.client ?? client).get< + GetLicensePriceResponses, + GetLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices/{priceId}", + ...options, + }); + } + + /** + * Update a license price + * + * Edits a price of a DRAFT licence version; the prices of a published version are immutable (UpdateLicensePrice.VersionNotDraft). Currency and billing model cannot change. Requires billing to be enabled for the organization. + */ + public static updateLicensePrice( + options: Options, + ): RequestResult { + return (options.client ?? client).patch< + UpdateLicensePriceResponses, + UpdateLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices/{priceId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Deprecate a license price + * + * Retires a price from the catalogue: it keeps billing what is already pinned to it, is no longer offered, and stops being a default. Deprecation cannot be undone. Requires billing to be enabled for the organization. + */ + public static deprecateLicensePrice( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + DeprecateLicensePriceResponses, + DeprecateLicensePriceErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/licenses/{licenseSlug}/prices/{priceId}/deprecate", + ...options, + }); + } + /** * Publish a license version * @@ -2270,7 +5195,13 @@ export class Licenses { PublishLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/publish", ...options, }); @@ -2289,7 +5220,13 @@ export class Licenses { UnarchiveLicenseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/licenses/{licenseSlug}/unarchive", ...options, }); @@ -2310,7 +5247,13 @@ export class MetadataFields { ListMetadataFieldsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields", ...options, }); @@ -2329,7 +5272,13 @@ export class MetadataFields { CreateMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields", ...options, headers: { @@ -2352,7 +5301,13 @@ export class MetadataFields { ReorderMetadataFieldsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/reorder", ...options, headers: { @@ -2375,7 +5330,13 @@ export class MetadataFields { UpdateMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}", ...options, headers: { @@ -2398,7 +5359,13 @@ export class MetadataFields { ArchiveMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}/archive", ...options, }); @@ -2417,7 +5384,13 @@ export class MetadataFields { DryRunMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}/dry-run", ...options, headers: { @@ -2440,7 +5413,13 @@ export class MetadataFields { UnarchiveMetadataFieldErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/metadata-fields/{id}/unarchive", ...options, }); @@ -2462,7 +5441,13 @@ export class OfrepCore { EvaluateFlagsBulkErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/ofrep/v1/evaluate/flags", ...options, headers: { @@ -2482,7 +5467,13 @@ export class OfrepCore { ): RequestResult { return (options.client ?? client).post( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/ofrep/v1/evaluate/flags/{key}", ...options, headers: { @@ -2508,13 +5499,204 @@ export class OpenFeature { GetOpenfeatureManifestErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/openfeature/v0/manifest", ...options, }); } } +export class Public { + /** + * Get the public catalogue + * + * What a pricing page shows: for each licence family the organization made public, its default version with its ACTIVE prices and user-facing entitlements, and the same for public add-on families. Read with a publishable key (X-Kaiten-Publishable-Key); the organization is the key's. Amounts are in minor units; never sum metered prices into a headline. Cacheable for 60 seconds. + */ + public static getPublicCatalog( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + GetPublicCatalogResponses, + GetPublicCatalogErrors, + ThrowOnError + >({ + security: [{ name: "X-Kaiten-Publishable-Key", type: "apiKey" }], + url: "/public/catalog", + ...options, + }); + } + + /** + * Check out + * + * Subscribes the session's instance to a price of the public catalogue, with add-ons and a voucher, in one call. With dryRun, answers 200 status=preview and what would be billed today, changing nothing. When a payment method has to be saved first, answers 200 status=requires_payment_method with a setup page: send the customer there, then call again with its setupSessionId. Otherwise answers 201 status=subscribed: the invoice of the first period has been pushed and charged, and payment.status says how that went -- poll GET /public/session/invoices on processing or requires_action. Needs a session bound to an instance. + */ + public static createSessionCheckout( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreateSessionCheckoutResponses, + CreateSessionCheckoutErrors, + ThrowOnError + >({ + security: [ + { + key: "customerSession", + scheme: "bearer", + type: "http", + }, + ], + url: "/public/session/checkout", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * List the customer's invoices + * + * The session's customer's issued invoices -- its instance's, for a session bound to one -- newest first, with how to pay each. An invoice still awaiting the outcome of its payment is read from the payment provider first, at most every 30 seconds: poll this after a checkout answered processing or requires_action. + */ + public static listSessionInvoices( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + ListSessionInvoicesResponses, + ListSessionInvoicesErrors, + ThrowOnError + >({ + security: [ + { + key: "customerSession", + scheme: "bearer", + type: "http", + }, + ], + url: "/public/session/invoices", + ...options, + }); + } +} + +export class PublishableKeys { + /** + * List publishable keys + * + * The organization's publishable keys, newest first. The keys themselves are never returned, only their last four characters. + */ + public static listPublishableKeys( + options?: Options, + ): RequestResult { + return (options?.client ?? client).get< + ListPublishableKeysResponses, + ListPublishableKeysErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys", + ...options, + }); + } + + /** + * Create a publishable key + * + * Issues a pk_ key for a web page to read the organization's public catalogue (GET /api/public/catalog) and nothing else. The key is returned once; only its digest is stored. + */ + public static createPublishableKey( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + CreatePublishableKeyResponses, + CreatePublishableKeyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Update a publishable key + * + * Changes a live key's label or allowed origins. A revoked key answers 409. + */ + public static updatePublishableKey( + options: Options, + ): RequestResult { + return (options.client ?? client).patch< + UpdatePublishableKeyResponses, + UpdatePublishableKeyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys/{keyId}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); + } + + /** + * Revoke a publishable key + * + * The key stops authenticating on the next request. Idempotent; revocation is final. + */ + public static revokePublishableKey( + options: Options, + ): RequestResult { + return (options.client ?? client).post< + RevokePublishableKeyResponses, + RevokePublishableKeyErrors, + ThrowOnError + >({ + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], + url: "/publishable-keys/{keyId}/revoke", + ...options, + }); + } +} + export class Releases { /** * List releases @@ -2526,7 +5708,13 @@ export class Releases { ): RequestResult { return (options?.client ?? client).get( { - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases", ...options, }, @@ -2546,7 +5734,13 @@ export class Releases { CreateReleaseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases", ...options, headers: { @@ -2569,7 +5763,13 @@ export class Releases { DeleteReleaseErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/releases/{releaseSlug}", ...options, }); @@ -2590,7 +5790,13 @@ export class ServiceAccounts { GetServiceAccountsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts", ...options, }); @@ -2609,7 +5815,13 @@ export class ServiceAccounts { CreateServiceAccountErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts", ...options, headers: { @@ -2632,7 +5844,13 @@ export class ServiceAccounts { GetServiceAccountErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}", ...options, }); @@ -2651,7 +5869,13 @@ export class ServiceAccounts { UpdateServiceAccountErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}", ...options, headers: { @@ -2674,7 +5898,13 @@ export class ServiceAccounts { GetServiceAccountTokensErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}/tokens", ...options, }); @@ -2697,7 +5927,13 @@ export class ServiceAccounts { CreateServiceAccountTokenErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}/tokens", ...options, headers: { @@ -2724,7 +5960,13 @@ export class ServiceAccounts { DeleteServiceAccountTokenErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}", ...options, }); @@ -2749,7 +5991,13 @@ export class Notifications { GetNotificationPreferencesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notification-preferences", ...options, }); @@ -2772,7 +6020,13 @@ export class Notifications { PutNotificationPreferencesErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notification-preferences", ...options, headers: { @@ -2795,7 +6049,13 @@ export class Notifications { ListNotificationsErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notifications", ...options, }); @@ -2814,7 +6074,13 @@ export class Notifications { MarkNotificationsReadErrors, ThrowOnError >({ - security: [{ scheme: "bearer", type: "http" }], + security: [ + { + key: "bearerAuth", + scheme: "bearer", + type: "http", + }, + ], url: "/v1/notifications/mark-read", ...options, headers: { diff --git a/packages/server/src/generated/types.gen.ts b/packages/server/src/generated/types.gen.ts index 1e85cf1..ca068c9 100644 --- a/packages/server/src/generated/types.gen.ts +++ b/packages/server/src/generated/types.gen.ts @@ -5,9 +5,26 @@ export type ClientOptions = { }; export type Webhooks = + | OnAddonEntitlementAssignedWebhookRequest + | OnAddonEntitlementUnassignedWebhookRequest + | OnAddonEntitlementUpdatedWebhookRequest + | OnAddonPriceCreatedWebhookRequest + | OnAddonPriceDeprecatedWebhookRequest + | OnAddonArchivedWebhookRequest + | OnAddonCreatedWebhookRequest + | OnAddonDeletedWebhookRequest + | OnAddonPublishedWebhookRequest + | OnAddonUnarchivedWebhookRequest + | OnAddonUpdatedWebhookRequest + | OnBillingProviderConnectedWebhookRequest + | OnBillingProviderDisconnectedWebhookRequest + | OnBillingProviderSyncFailedWebhookRequest | OnComponentCreatedWebhookRequest | OnComponentDeletedWebhookRequest | OnComponentUpdatedWebhookRequest + | OnCustomerPaymentMethodAttachedWebhookRequest + | OnCustomerPaymentMethodDetachedWebhookRequest + | OnCustomerPaymentMethodExpiringWebhookRequest | OnCustomerCreatedWebhookRequest | OnCustomerCreationRejectedWebhookRequest | OnCustomerDeletedWebhookRequest @@ -27,6 +44,18 @@ export type Webhooks = | OnFeatureFlagEvaluatedWebhookRequest | OnFeatureFlagUpdatedWebhookRequest | OnSystemOrganizationTokenIssuedWebhookRequest + | OnInstanceAddonAddedWebhookRequest + | OnInstanceAddonQuantityChangedWebhookRequest + | OnInstanceAddonRemovedWebhookRequest + | OnInstanceBillingCanceledWebhookRequest + | OnInstanceBillingCancellationRevertedWebhookRequest + | OnInstanceBillingCancellationScheduledWebhookRequest + | OnInstanceBillingPlanChangeCancelledWebhookRequest + | OnInstanceBillingPlanChangeScheduledWebhookRequest + | OnInstanceBillingPlanChangedWebhookRequest + | OnInstanceBillingProviderChangedWebhookRequest + | OnInstanceBillingStartedWebhookRequest + | OnInstanceBillingStatusChangedWebhookRequest | OnInstanceEntitlementCapExceededWebhookRequest | OnInstanceEntitlementUsagePeriodRolledOverWebhookRequest | OnInstanceEntitlementUsageReachedWebhookRequest @@ -34,6 +63,17 @@ export type Webhooks = | OnInstanceEntitlementUsageReportRejectedWebhookRequest | OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest | OnInstanceEntitlementValueGetWebhookRequest + | OnInstanceInvoiceHandoffAcknowledgedWebhookRequest + | OnInstanceInvoiceHeldWebhookRequest + | OnInstanceInvoiceIssuedWebhookRequest + | OnInstanceInvoiceMarkedUncollectibleWebhookRequest + | OnInstanceInvoicePaidWebhookRequest + | OnInstanceInvoicePaymentFailedWebhookRequest + | OnInstanceInvoicePushFailedWebhookRequest + | OnInstanceInvoicePushedWebhookRequest + | OnInstanceInvoiceReconciliationMismatchWebhookRequest + | OnInstanceInvoiceReleasedWebhookRequest + | OnInstanceInvoiceVoidedWebhookRequest | OnInstanceCreatedWebhookRequest | OnInstanceDeletedWebhookRequest | OnInstanceDeployedWebhookRequest @@ -41,9 +81,15 @@ export type Webhooks = | OnInstanceMigratedWebhookRequest | OnInstanceStatusChangedWebhookRequest | OnInstanceUpdatedWebhookRequest + | OnInstanceVoucherExpiredWebhookRequest + | OnInstanceVoucherRedeemedWebhookRequest + | OnInstanceVoucherRevokedWebhookRequest | OnLicenseEntitlementAssignedWebhookRequest | OnLicenseEntitlementUnassignedWebhookRequest | OnLicenseEntitlementUpdatedWebhookRequest + | OnLicensePriceCreatedWebhookRequest + | OnLicensePriceDeprecatedWebhookRequest + | OnLicensePriceUpdatedWebhookRequest | OnLicenseArchivedWebhookRequest | OnLicenseCreatedWebhookRequest | OnLicenseDeletedWebhookRequest @@ -59,870 +105,957 @@ export type Webhooks = | OnMetadataFieldUnarchivedWebhookRequest | OnMetadataFieldUpdatedWebhookRequest | OnReleaseCreatedWebhookRequest - | OnReleaseDeletedWebhookRequest; - -export type AuditTrail = { - /** - * Event name (e.g. ENTITLEMENT_VALUE_GET) - */ - eventName: string; + | OnReleaseDeletedWebhookRequest + | OnVoucherArchivedWebhookRequest + | OnVoucherCreatedWebhookRequest + | OnVoucherExhaustedWebhookRequest + | OnVoucherPublishedWebhookRequest + | OnVoucherUpdatedWebhookRequest; + +export type Addon = { + readonly createdAt: string; + description: string; /** - * Event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get) + * The family the version belongs to */ - eventType: string; + familySlug: string; + readonly id: string; /** - * Unique audit trail entry ID + * The version the family resolves to. Only a PUBLISHED version. */ - id: string; + isDefault: boolean; /** - * Instance UUID (present for instance-scoped events) + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. */ - instanceId?: string; + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Instance slug + * The largest quantity an instance can hold; unbounded when absent */ - instanceSlug: string; + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * Event payload (JSON) + * The version's slug, unique in the organization */ - payload?: unknown; + slug: string; + readonly updatedAt: string; /** - * When the event occurred + * The version number in its family, assigned on create */ - timestamp: string; -}; - -export type Basic = { - type: "basic"; - value: string; + readonly version: number; + versionName: string; }; -export type BasicTargeting = { +export type AddonChanges = { + description: string; + isDefault: boolean; + maxQuantity?: number; name: string; - /** - * CEL expression for basicTargeting evaluation - */ - rule: string; - type: "basic"; - variant: string; + versionName?: string; }; -export type BooleanEntitlementValue = { - /** - * Value type discriminator - */ - type: "boolean"; +export type AddonEntitlement = { + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + readonly id: string; /** - * Boolean value + * The overage the add-on allows; absent inherits the licence grant's */ - value: boolean; -}; - -export type BulkEvaluationFailure = { + limitCapExceededOveragePercent?: number; /** - * Error code specific to the bulk evaluation error + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. */ - errorCode: string; + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; /** - * Optional error details description + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. */ - errorDetails?: string; -}; - -export type BulkEvaluationRequest = { - context?: { + value: { [key: string]: unknown; }; }; -export type Command = { - entitlementSlug: string; -}; - -export type Component = { +export type AddonFamily = { /** - * Timestamp when the component was created + * The default version, else the highest PUBLISHED one; absent when none is published */ - readonly createdAt: string; + currentVersion?: Addon; + readonly id: string; /** - * User who created this component + * Whether the family is listed in the public catalogue */ - readonly createdBy: User; + isPublic: boolean; /** - * Description of the component + * The highest version number the family has assigned */ - description?: string; + lastVersion: number; + slug: string; /** - * Unique identifier for the component + * Every version, newest first */ - readonly id: string; + versions: Array | null; +}; + +export type AddonFamilyVisibility = { /** - * Name of the component + * List the family's default PUBLISHED version, with its ACTIVE prices, in the public catalogue */ - name: string; + isPublic: boolean; +}; + +export type AddonGrant = { /** - * Reference to the previous version of this component + * The overage the add-on allows: -1 with an unlimited value, 0 or more otherwise. Absent inherits the licence grant's. */ - previousComponentId?: string; + limitCapExceededOveragePercent?: number; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * How a number grant combines with the licence's */ - slug?: string; + overrideBehavior?: "ADD" | "OVERRIDE" | "MAX"; /** - * Version of the component + * {type, value}, shaped like a licence grant: a number counts once per unit of quantity */ - version: string; + value: { + [key: string]: unknown; + }; }; -export type ConfigEntitlementValue = { +export type AddonGrantUpdate = { /** - * Value type discriminator + * The add-on version the grant belongs to */ - type: "object"; + addonSlug: string; + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + readonly id: string; /** - * Object configuration value + * The overage the add-on allows; absent inherits the licence grant's + */ + limitCapExceededOveragePercent?: number; + /** + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. + */ + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; + /** + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. */ value: { [key: string]: unknown; }; }; -export type Connector = { +export type AddonPriceUpdate = { /** - * Timestamp when connector was first registered + * The add-on version the price belongs to */ - created_at: string; + addonSlug: string; /** - * Slug of the BOOLEAN entitlement a license must grant for an organization to activate this connector. Absent means the connector is ungated. + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - entitlement_slug?: string; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Stable connector identifier + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - name: string; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * JSON schema used to validate connector settings payloads + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - settings_schema: { - [key: string]: unknown; - }; + billingTiming: "ADVANCE" | "ARREARS"; + readonly createdAt: string; /** - * Timestamp when connector registration was last updated + * ISO 4217 code, upper case. One currency per licence version. */ - updated_at: string; + currency: string; /** - * Registered connector version + * When the price was deprecated */ - version: string; -}; - -export type ConnectorActivation = { + deprecatedAt?: string; /** - * When this organization first activated the connector + * The invoice line's label; a default is derived when absent. */ - activatedAt: string; + displayLabel?: string; /** - * Stable connector identifier + * Order among the version's prices */ - connectorName: string; -}; - -export type ConnectorSettings = { + displayOrder: number; /** - * Stable connector identifier + * Unique identifier of the price */ - readonly connector_name: string; + readonly id: string; /** - * Connector settings payload + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - settings: { - [key: string]: unknown; - }; -}; - -export type ConnectorSettingsSchema = { + isDefault: boolean; /** - * Stable connector identifier + * What a metered price measures. Absent on FLAT_FEE prices. */ - connector_name: string; + metered?: Meter; /** - * JSON schema describing supported connector settings payload + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - schema: { - [key: string]: unknown; - }; + status: "ACTIVE" | "DEPRECATED"; /** - * Registered connector version + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - version: string; + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; + readonly updatedAt: string; }; -export type ConnectorState = { +export type AddonQuantity = { + quantity: number; +}; + +export type AddonUpdate = { /** - * Whether this organization has turned the connector on + * The members the change touched, as the API names them */ - activated: boolean; + changedFields: Array | null; /** - * When this organization activated the connector. Absent when it has not. + * The licence families the version fits after the change */ - activatedAt?: string; + compatibleLicenseFamilies: Array | null; + readonly createdAt: string; + description: string; /** - * Whether this deployment has the connector registered + * The family the version belongs to */ - available: boolean; + familySlug: string; + readonly id: string; /** - * Stable connector identifier + * The version the family resolves to. Only a PUBLISHED version. */ - connectorName: string; + isDefault: boolean; /** - * Whether this organization's licence includes the connector. True for an ungated connector. + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. */ - entitled: boolean; + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Registered connector version. Absent when the connector is not available. + * The largest quantity an instance can hold; unbounded when absent */ - version?: string; -}; - -export type Customer = { + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * Timestamp when the customer was created + * The version's slug, unique in the organization */ - readonly createdAt: string; + slug: string; + readonly updatedAt: string; /** - * User who created this customer + * The version number in its family, assigned on create */ - readonly createdBy: User; + readonly version: number; + versionName: string; +}; + +export type AuditTrail = { /** - * Optional customer domain name + * Event name (e.g. ENTITLEMENT_VALUE_GET) */ - domain?: string; + eventName: string; /** - * Optional identifier for the customer in an external system + * Event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get) */ - externalCustomerId?: string | null; + eventType: string; /** - * Unique identifier for the customer + * Unique audit trail entry ID */ - readonly id: string; + id: string; /** - * Integrations grouped by adapter name + * Instance UUID (present for instance-scoped events) */ - integrations?: { - [key: string]: CustomerIntegration; - }; + instanceId?: string; /** - * Name of the customer + * Instance slug */ - name: string; + instanceSlug: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Event payload (JSON) */ - slug?: string; + payload?: unknown; /** - * Timestamp when the customer was last updated + * When the event occurred */ - readonly updatedAt: string; + timestamp: string; +}; + +export type Basic = { + type: "basic"; + value: string; +}; + +export type BasicTargeting = { + name: string; /** - * User who last updated this customer + * CEL expression for basicTargeting evaluation */ - readonly updatedBy: User; + rule: string; + type: "basic"; + variant: string; }; -export type CustomerBody = { +export type BillingCapabilities = { /** - * Optional customer domain name + * Why they do not: billing is off on this deployment, or the organization's plan does not include it */ - domain?: string; + disabledReason?: "DEPLOYMENT_DISABLED" | "NOT_ENTITLED"; /** - * Optional integration error message + * Whether the billing routes answer for this organization */ - error?: string; + enabled: boolean; /** - * Adapter-specific integration metadata + * Which parts of billing this release ships */ - integrationMetadata?: { - [key: string]: unknown; - }; + features: BillingFeatures; /** - * Customer name + * Who can collect invoices */ - name?: string; + providers: Array; + publicSurface: PublicSurface; /** - * Customer slug + * How long usage reports are kept, in months; absent when they are kept forever or it cannot be told */ - slug?: string; + usageHistoryRetentionMonths?: number; /** - * Absolute http(s) link to the record in the third-party system + * How long a usage report's transactionId is remembered, in days */ - webUrl?: string; + usageIdempotencyWindowDays: number; }; -export type CustomerCreationRejected = { - name: string; - reason: string; - slug: string; +export type BillingFeatures = { + addons: boolean; + chargeAutomatically: boolean; + /** + * Cancellation, reactivation, plan changes and overdue tracking + */ + lifecycle: boolean; + publicSurface: boolean; + stripe: boolean; + trials: boolean; + vouchers: boolean; }; -export type CustomerIntegration = { +export type BillingHealth = { /** - * External identifier in the third-party adapter + * Subscriptions whose period ended and has not closed yet */ - external_id: string; + closeBacklog: CloseBacklog; + handoff: HandoffBacklog; + heldInvoices: HeldInvoices; + overdueInvoices: number; + pastDueSubscriptions: number; + providerSync: Array; /** - * Last synchronization error message, if any + * Invoices whose push failed at least as many times as the alert threshold */ - last_error?: string; + pushFailures: PushFailures; /** - * Adapter-specific integration metadata + * Invoices whose provider's amounts differed from Kaiten's, in the last 30 days */ - metadata?: { - [key: string]: unknown; - }; + reconciliationMismatches30d: number; +}; + +export type BillingProvider = { /** - * Timestamp of the last synchronization with the adapter + * Whether the organization may connect it on this deployment */ - readonly synced_at: string; + available: boolean; + capabilities: ProviderCapabilities; /** - * Absolute http(s) link to the record in the third-party system + * Whether it is set up for the organization; NOOP always is */ - web_url?: string; + connected: boolean; + kind: "NOOP" | "STRIPE"; + /** + * Whether the connection reaches the provider's live account rather than a test one; absent when not connected, and for NOOP + */ + livemode?: boolean; + /** + * Why it is not available; absent when it is + */ + unavailableReason?: "NOT_ENTITLED" | "VAULT_NOT_CONFIGURED"; }; -export type CustomerIntegrationResource = { +export type BillingSettings = { /** - * Optional customer domain name + * How an invoice is collected when its subscription does not say: SEND_INVOICE sends it for payment. CHARGE_AUTOMATICALLY needs a payment provider and is refused until one is available. */ - domain?: string; + defaultCollectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Last synchronization error for this integration, if any + * Days an invoice is due after it is issued, when its subscription does not say; 0 to 365. */ - error?: string; + defaultDaysUntilDue: number; /** - * Adapter-specific customer integration metadata + * Whether invoices a payment provider issues also enter the handoff queue, for an accounting system that wants every invoice. Invoices without a provider always do. */ - integrationMetadata: { - [key: string]: unknown; - }; + handoffStripeInvoices: boolean; +}; + +export type BillingStarted = { /** - * Customer name + * The instant its periods are counted from */ - name: string; + anchorAt: string; /** - * Customer slug + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - slug: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Absolute http(s) link to the record in the third-party system + * Effective: the subscription's own, else the organization's default */ - webUrl?: string; -}; - -export type DefaultVariant = - | ({ - type: "basic"; - } & Basic) - | ({ - type: "rollout_date"; - } & RolloutDate) - | ({ - type: "rollout_percentage"; - } & RolloutPercentage); - -export type Deployment = { + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Timestamp when the deployment was recorded + * The subscription's own collection method; absent when it takes the organization's */ + collectionMethodOverride?: string; createdAt: string; + currency: string; /** - * User who recorded this deployment + * The next boundary: the period closes, and its invoice is composed, after it */ - createdBy: User; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Deployment zone the release was deployed to + * Effective: the subscription's own, else the organization's default */ - deploymentZoneId: string; + daysUntilDue: number; /** - * Unique identifier for this deployment event + * The subscription's own payment terms; absent when it takes the organization's */ + daysUntilDueOverride?: number; id: string; + instanceName: string; /** - * Release that was deployed + * As it was at the subscription's last write */ - releaseId: string; -}; - -export type DeploymentZone = { + instanceSlug: string; + pastDueSince?: string; /** - * Timestamp when the deployment zone was created + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - readonly createdAt: string; + providerKind: "NOOP" | "STRIPE"; /** - * User who created this deployment zone + * Set when a CANCELED subscription was subscribed again */ - readonly createdBy: User; + resubscribed: boolean; /** - * Description of the deployment zone + * A plan change waiting for the next boundary */ - description: string; + scheduledChange?: ScheduledChange; /** - * Unique identifier for the deployment zone + * When billing started: usage before it is never billed */ - readonly id: string; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema + * When the trial ends, or ended: usage before it is never billed */ - metadata?: { - [key: string]: unknown; - }; + trialEndsAt?: string; + updatedAt: string; +}; + +export type BooleanEntitlementValue = { /** - * Name of the deployment zone + * Value type discriminator */ - name: string; + type: "boolean"; /** - * Currently deployed release ID + * Boolean value */ - releaseId?: string; + value: boolean; +}; + +export type BulkEvaluationFailure = { /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Error code specific to the bulk evaluation error */ - slug?: string; + errorCode: string; /** - * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. + * Optional error details description */ - type: string; + errorDetails?: string; +}; + +export type BulkEvaluationRequest = { + context?: { + [key: string]: unknown; + }; +}; + +export type CanceledSubscription = { /** - * Timestamp when the deployment zone was last updated + * The instant its periods are counted from */ - readonly updatedAt: string; + anchorAt: string; /** - * User who last updated the deployment zone + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - readonly updatedBy: User; -}; - -export type Entitlement = { + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. + * Effective: the subscription's own, else the organization's default */ - aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Timestamp when this entitlement was created + * The subscription's own collection method; absent when it takes the organization's */ - readonly createdAt: string; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Description of the entitlement + * The next boundary: the period closes, and its invoice is composed, after it */ - description: string | null; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. + * Effective: the subscription's own, else the organization's default */ - displayOrder?: number; + daysUntilDue: number; /** - * Groups associated with this entitlement + * The subscription's own payment terms; absent when it takes the organization's */ - readonly entitlementGroups?: Array | null; + daysUntilDueOverride?: number; /** - * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. + * The FINAL invoice of an immediate cancellation */ - icon?: string; + finalInvoice?: InvoiceSummary; + id: string; + instanceName: string; /** - * Unique identifier for the entitlement + * As it was at the subscription's last write */ - readonly id: string; + instanceSlug: string; + pastDueSince?: string; /** - * Name of the entitlement + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - name: string; + providerKind: "NOOP" | "STRIPE"; /** - * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. + * A plan change waiting for the next boundary */ - resetAnchor?: "CALENDAR" | "LICENSE_START"; + scheduledChange?: ScheduledChange; /** - * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. + * When billing started: usage before it is never billed */ - resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Number of base units one sale unit represents (1 sale unit = N base units). + * When the trial ends, or ended: usage before it is never billed */ - saleUnitFactor?: number; + trialEndsAt?: string; + updatedAt: string; +}; + +export type Cancellation = { /** - * Plural label of the unit this entitlement is sold in, when it differs from the base unit. + * The instant its periods are counted from */ - saleUnitPlural?: string; + anchorAt: string; /** - * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - saleUnitSingular?: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Effective: the subscription's own, else the organization's default */ - slug?: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Type of the entitlement + * The subscription's own collection method; absent when it takes the organization's */ - type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. + * The next boundary: the period closes, and its invoice is composed, after it */ - unitPlural?: string; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. + * Effective: the subscription's own, else the organization's default */ - unitSingular?: string; + daysUntilDue: number; /** - * Timestamp when this entitlement was last updated + * The subscription's own payment terms; absent when it takes the organization's */ - readonly updatedAt: string; + daysUntilDueOverride?: number; /** - * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. + * The FINAL invoice, when the cancellation issued one */ - userFacing?: boolean; + finalInvoiceId?: string; + id: string; + instanceName: string; /** - * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + * As it was at the subscription's last write */ - warningThresholdPercent?: number; -}; - -export type EntitlementGroup = { + instanceSlug: string; /** - * Description of the entitlement group + * How it was canceled; a trial is canceled at once in either mode */ - description: string | null; + mode: "AT_PERIOD_END" | "IMMEDIATE"; + pastDueSince?: string; /** - * Unique identifier for the entitlement group + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - readonly id: string; + providerKind: "NOOP" | "STRIPE"; /** - * Name of the entitlement group + * A plan change waiting for the next boundary */ - name: string; + scheduledChange?: ScheduledChange; /** - * URL-friendly identifier, unique per organization. Auto-generated if not provided. + * When billing started: usage before it is never billed */ - slug?: string; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type EntitlementGroupSummary = { +export type CancellationChange = { /** - * Unique identifier for the entitlement group + * The instant its periods are counted from */ - id: string; + anchorAt: string; /** - * Name of the entitlement group + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - name: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * URL-friendly identifier for the entitlement group + * Effective: the subscription's own, else the organization's default */ - slug: string; -}; - -export type EntitlementGroupUsage = { + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement. + * The subscription's own collection method; absent when it takes the organization's */ - currentPeriodEnd?: string; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement. + * The next boundary: the period closes, and its invoice is composed, after it */ - currentPeriodStart?: string; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Entitlement ID + * Effective: the subscription's own, else the organization's default */ - entitlementId: string; + daysUntilDue: number; /** - * Entitlement name + * The subscription's own payment terms; absent when it takes the organization's */ - entitlementName: string; + daysUntilDueOverride?: number; /** - * Entitlement slug + * The boundary the cancellation takes effect at */ - entitlementSlug: string; + effectiveAt: string; + id: string; + instanceName: string; /** - * Entitlement type + * As it was at the subscription's last write */ - entitlementType: string; + instanceSlug: string; + pastDueSince?: string; /** - * License limit value, discriminated by the 'type' field. Null when the license grants no value. + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - licenseValue?: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + providerKind: "NOOP" | "STRIPE"; /** - * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. + * A plan change waiting for the next boundary */ - usageValue?: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type EntitlementUsage = { + scheduledChange?: ScheduledChange; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). + * When billing started: usage before it is never billed */ - currentPeriodEnd?: string; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). + * When the trial ends, or ended: usage before it is never billed */ - currentPeriodStart?: string; + trialEndsAt?: string; + updatedAt: string; +}; + +export type CloseBacklog = { + count: number; + oldestDueAt?: string; +}; + +export type ClosePeriodsScope = { /** - * Unique identifier for the entitlement + * Close only this instance's subscription */ - entitlementId: string; + instanceSlug?: string; +}; + +export type ClosedInvoice = { + boundaryAt: string; /** - * URL-friendly identifier of the entitlement + * Set when the invoice is a held DRAFT */ + held: boolean; + id: string; + instanceSlug: string; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; +}; + +export type Command = { entitlementSlug: string; +}; + +export type CompatibleLicenseFamilies = { + familySlugs: Array; +}; + +export type CompletedPaymentMethodSession = { + paymentMethod: PaymentMethodLabels; +}; + +export type Component = { /** - * Unique identifier for the license to which this entitlement usage belongs + * Timestamp when the component was created */ - licenseId: string; + readonly createdAt: string; /** - * URL-friendly identifier of the license + * User who created this component */ - licenseSlug: string; + readonly createdBy: User; /** - * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + * Description of the component */ - limit?: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); - /** - * Resolved entitlement value, discriminated by the 'type' field - */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type ErrorDetail = { - /** - * Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' - */ - location?: string; - /** - * Error message text - */ - message?: string; + description?: string; /** - * The value at the given location + * Unique identifier for the component */ - value?: unknown; -}; - -export type EvaluationFailure = { + readonly id: string; /** - * OpenFeature compatible error code + * Name of the component */ - errorCode: string; + name: string; /** - * Error description + * Reference to the previous version of this component */ - errorDetails?: string; + previousComponentId?: string; /** - * Feature flag key + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - key: string; + slug?: string; /** - * Arbitrary metadata for the flag + * Version of the component */ - metadata?: { - [key: string]: unknown; - }; -}; - -export type EvaluationRequest = { - context?: { - [key: string]: unknown; - }; + version: string; }; -export type EvaluationSuccess = { +export type ConfigEntitlementValue = { /** - * Feature flag key + * Value type discriminator */ - key: string; + type: "object"; /** - * Arbitrary metadata for the flag + * Object configuration value */ - metadata?: { + value: { [key: string]: unknown; }; +}; + +export type Connection = { /** - * OpenFeature reason for the evaluation + * The connector that configures it */ - reason?: string; + connectorName: string; /** - * Flag evaluation result + * Whether the connection reaches the provider's live account rather than a test one */ - value?: unknown; + livemode: boolean; /** - * string of the evaluated flag value + * The payment provider */ - variant?: string; -}; - -export type FeatureFlag = { - default_variant: DefaultVariant; - description: string | null; - enabled: boolean; - event_name: string; - readonly id: string; - metadata: { - [key: string]: unknown; - }; - name: string; - slug?: string; - targetings: Targetings; - type: "boolean" | "string" | "number" | "object"; - variants: Array | null; + providerKind: "STRIPE"; }; -export type FeatureFlagEvaluated = { +export type Connector = { /** - * Set when the evaluation failed and the default was returned + * Timestamp when connector was first registered */ - error_code?: string; + created_at: string; /** - * Human-readable detail accompanying error_code + * Slug of the BOOLEAN entitlement a license must grant for an organization to activate this connector. Absent means the connector is ungated. */ - error_message?: string; + entitlement_slug?: string; /** - * Unique identifier of the evaluated flag + * Stable connector identifier */ - flag_id: string; + name: string; /** - * URL-friendly identifier of the evaluated flag + * JSON schema used to validate connector settings payloads */ - flag_slug: string; + settings_schema: { + [key: string]: unknown; + }; /** - * Name of the targeting rule that matched, when the reason is TARGETING_MATCH + * Timestamp when connector registration was last updated */ - matched_rule_name?: string; + updated_at: string; /** - * Why the value resolved as it did + * Registered connector version */ - reason: string; + version: string; +}; + +export type ConnectorActivation = { /** - * Name of the resolved variant, when the flag has one + * When this organization first activated the connector */ - variant?: string; + activatedAt: string; + /** + * Stable connector identifier + */ + connectorName: string; }; -export type Impact = { +export type ConnectorSettings = { /** - * Number of resources whose stored value for this field would no longer satisfy the candidate schema + * Stable connector identifier */ - count: number; + readonly connector_name: string; /** - * Up to 5 impacted resources, for display + * Connector settings payload */ - samples: Array | null; + settings: { + [key: string]: unknown; + }; }; -export type ImpactSample = { +export type ConnectorSettingsSchema = { /** - * Resource display name + * Stable connector identifier */ - name: string; + connector_name: string; /** - * Resource slug + * JSON schema describing supported connector settings payload */ - slug: string; + schema: { + [key: string]: unknown; + }; + /** + * Registered connector version + */ + version: string; }; -export type Instance = { +export type ConnectorState = { /** - * Timestamp when the instance was created + * Whether this organization has turned the connector on */ - readonly createdAt: string; + activated: boolean; /** - * User who created this instance + * When this organization activated the connector. Absent when it has not. */ - readonly createdBy: User; + activatedAt?: string; /** - * ID of the customer associated with this instance + * Whether this deployment has the connector registered */ - customerId: string; + available: boolean; /** - * Slug of the customer associated with this instance + * Stable connector identifier */ - readonly customerSlug: string; + connectorName: string; /** - * ID of the deployment zone associated with this instance (optional) + * Whether this organization's licence includes the connector. True for an ungated connector. */ - deploymentZoneId?: string; + entitled: boolean; /** - * Slug of the deployment zone associated with this instance (optional) + * Registered connector version. Absent when the connector is not available. */ - readonly deploymentZoneSlug?: string; + version?: string; +}; + +export type CreatedCustomerSession = { + customerSlug: string; + expiresAt: string; /** - * Brief description of the instance + * Revoke it with POST /customer-sessions/{id}/revoke */ - description: string; + id: string; + instanceSlug?: string; /** - * End date of the license for this instance + * The kst_ token: hand it to the customer's browser, which sends it as Authorization: Bearer on /api/public/session routes. Shown once; only its digest is stored. */ - endLicenseDate: string; + token: string; +}; + +export type Customer = { /** - * Unique identifier for the instance + * Where invoices sent to this customer are delivered, at most 254 characters (CreateCustomer.InvalidBillingEmail). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. Personal data: never included in event payloads. */ - readonly id: string; + billingEmail?: string; /** - * Integrations grouped by adapter name + * Timestamp when the customer was created */ - integrations?: { - [key: string]: InstanceIntegration; - }; + readonly createdAt: string; /** - * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. + * User who created this customer */ - licenseId: string; + readonly createdBy: User; /** - * Slug of the license associated with this instance + * Optional customer domain name */ - readonly licenseSlug: string; + domain?: string; /** - * Commercial lifecycle stage of the instance (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED) + * Optional identifier for the customer in an external system */ - readonly lifecycleStage?: string; + externalCustomerId?: string | null; /** - * Metadata for the instance + * Unique identifier for the customer */ - metadata?: { - [key: string]: unknown; + readonly id: string; + /** + * Integrations grouped by adapter name + */ + integrations?: { + [key: string]: CustomerIntegration; }; /** - * Name of the instance + * Name of the customer */ name: string; /** @@ -930,40 +1063,31 @@ export type Instance = { */ slug?: string; /** - * Start date of the license for this instance - */ - startLicenseDate: string; - /** - * Operational status of the instance - */ - readonly status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; - /** - * Timestamp when the instance was last updated + * Timestamp when the customer was last updated */ readonly updatedAt: string; /** - * User who last updated this instance + * User who last updated this customer */ readonly updatedBy: User; }; -export type InstanceBody = { +export type CustomerBilling = { /** - * External identifier of the related customer in the same adapter + * Where the customer's invoices are sent. Personal data */ - customerExternalId?: string; + billingEmail?: string; /** - * Deployment zone ID + * The customer in each payment provider; none for NOOP */ - deploymentZoneId?: string; + providers: Array; +}; + +export type CustomerBody = { /** - * Instance description + * Optional customer domain name */ - description?: string; - /** - * License end date - */ - endLicenseDate?: string; + domain?: string; /** * Optional integration error message */ @@ -975,2009 +1099,1985 @@ export type InstanceBody = { [key: string]: unknown; }; /** - * License ID - */ - licenseId?: string; - /** - * Instance metadata - */ - metadata?: { - [key: string]: unknown; - }; - /** - * Instance name + * Customer name */ name?: string; /** - * Instance slug + * Customer slug */ slug?: string; - /** - * License start date - */ - startLicenseDate?: string; /** * Absolute http(s) link to the record in the third-party system */ webUrl?: string; }; -export type InstanceEntitlementCapExceeded = { - /** - * URL-friendly identifier of the entitlement - */ - entitlement_slug: string; +export type CustomerCreationRejected = { + name: string; + reason: string; + slug: string; +}; + +export type CustomerInProvider = { /** - * Amount by which usage exceeds the cap + * The customer's id in the provider */ - overage: number; + externalCustomerId: string; /** - * The entitlement cap + * Its default payment method; null when there is none */ - threshold: number; + paymentMethod: PaymentMethodLabels; + providerKind: "STRIPE"; + syncedAt?: string; /** - * Current usage value, including overage + * The customer's page in the provider's dashboard */ - value: number; -}; - -export type InstanceEntitlementUsagePeriodRolledOver = { - closed_period_end: string | null; - closed_period_start: string | null; - entitlement_id: string; - entitlement_slug: string; - event_count: number; - instance_id: string; - is_synthetic: boolean; - new_period_start: string; - value: number; + webUrl?: string; }; -export type InstanceEntitlementUsageReportAccepted = { +export type CustomerIntegration = { /** - * Report behavior: append folds the value into the stored total, set overwrites it + * External identifier in the third-party adapter */ - behavior: "append" | "set"; + external_id: string; /** - * URL-friendly identifier of the entitlement the usage was reported against + * Last synchronization error message, if any */ - entitlement_slug: string; + last_error?: string; /** - * Number of reports folded into the current usage window, including this one + * Adapter-specific integration metadata */ - event_count: number; + metadata?: { + [key: string]: unknown; + }; /** - * Whether the report was persisted + * Timestamp of the last synchronization with the adapter */ - status: "ACCEPTED" | "REJECTED"; + readonly synced_at: string; /** - * Value carried by the report + * Absolute http(s) link to the record in the third-party system */ - value: number; + web_url?: string; }; -export type InstanceEntitlementUsageWarningThresholdReached = { - /** - * Usage value at which the warning fires (cap * warningThresholdPercent / 100) - */ - boundary: number; - /** - * URL-friendly identifier of the entitlement - */ - entitlement_slug: string; - /** - * The entitlement cap - */ - threshold: number; +export type CustomerIntegrationResource = { /** - * Current usage value + * Optional customer domain name */ - value: number; -}; - -export type InstanceEntitlementValueGet = { + domain?: string; /** - * Unique identifier for the entitlement + * Last synchronization error for this integration, if any */ - entitlement_id: string; + error?: string; /** - * URL-friendly identifier of the entitlement + * Adapter-specific customer integration metadata */ - entitlement_slug: string; + integrationMetadata: { + [key: string]: unknown; + }; /** - * Unique identifier for the instance the value was read for + * Customer name */ - instance_id: string; + name: string; /** - * Unique identifier for the license carrying the entitlement + * Customer slug */ - license_id: string; + slug: string; /** - * Unique identifier for the owning organization + * Absolute http(s) link to the record in the third-party system */ - organization_id: string; + webUrl?: string; +}; + +export type CustomerSessionDraft = { /** - * When the value was read + * The customer the session acts for */ - timestamp: string; + customerSlug: string; /** - * Discriminator of the resolved entitlement value + * Binds the session to one of the customer's instances; checkout, cancel and the other subscription routes need it. Omitted: the session reads the whole customer. */ - type: string; + instanceSlug?: string; /** - * Resolved entitlement value at read time + * How long the session lives, in seconds: 300 to 3600 (CreateCustomerSession.InvalidTtl otherwise). Default 30 minutes; mint a new one before it ends. */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + ttlSeconds?: number; }; -export type InstanceIntegration = { +export type DefaultVariant = + | ({ + type: "basic"; + } & Basic) + | ({ + type: "rollout_date"; + } & RolloutDate) + | ({ + type: "rollout_percentage"; + } & RolloutPercentage); + +export type DeletedAddon = { + familySlug: string; + id: string; + slug: string; +}; + +export type Deployment = { /** - * External identifier in the third-party adapter + * Timestamp when the deployment was recorded */ - external_id: string; + createdAt: string; /** - * Last synchronization error message, if any + * User who recorded this deployment */ - last_error?: string; + createdBy: User; /** - * Adapter-specific integration metadata + * Deployment zone the release was deployed to */ - metadata?: { - [key: string]: unknown; - }; + deploymentZoneId: string; /** - * Timestamp of the last synchronization with the adapter + * Unique identifier for this deployment event */ - readonly synced_at: string; + id: string; /** - * Absolute http(s) link to the record in the third-party system + * Release that was deployed */ - web_url?: string; + releaseId: string; }; -export type InstanceIntegrationResource = { +export type DeploymentZone = { /** - * External identifier of the related customer in the same adapter + * Timestamp when the deployment zone was created */ - customerExternalId?: string; + readonly createdAt: string; /** - * Deployment zone ID + * User who created this deployment zone */ - deploymentZoneId?: string; + readonly createdBy: User; /** - * Instance description + * Description of the deployment zone */ description: string; /** - * License end date - */ - endLicenseDate: string; - /** - * Last synchronization error for this integration, if any + * Unique identifier for the deployment zone */ - error?: string; + readonly id: string; /** - * Adapter-specific instance integration metadata + * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema */ - integrationMetadata: { + metadata?: { [key: string]: unknown; }; /** - * License ID + * Name of the deployment zone */ - licenseId: string; + name: string; /** - * Instance name + * Currently deployed release ID */ - name: string; + releaseId?: string; /** - * Instance slug + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - slug: string; + slug?: string; /** - * License start date + * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. */ - startLicenseDate: string; + type: string; /** - * Absolute http(s) link to the record in the third-party system + * Timestamp when the deployment zone was last updated */ - webUrl?: string; -}; - -export type InstanceLifecycleStageChanged = { - changed_by: string; - instance_id: string; - new_lifecycle_stage: string | null; - previous_lifecycle_stage: string | null; -}; - -export type InstanceStatusChanged = { - changed_by: string; - instance_id: string; - new_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; - previous_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; + readonly updatedAt: string; + /** + * User who last updated the deployment zone + */ + readonly updatedBy: User; }; -export type License = { +export type DueToday = { + currency: string; /** - * Timestamp when this license was created + * Minor units */ - readonly createdAt: string; + discountTotal: number; + lines: Array; /** - * Detailed description of the license capabilities and restrictions + * Minor units */ - description: string; + subtotal: number; /** - * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). + * Minor units */ - familyId?: string; + total: number; +}; + +export type Entitlement = { /** - * Unique identifier for the license + * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. */ - readonly id: string; + aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; /** - * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). + * Timestamp when this entitlement was created */ - isDefault: boolean; - /** - * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. - */ - lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; + readonly createdAt: string; /** - * Display name of the license + * Description of the entitlement */ - name: string; + description: string | null; /** - * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. + * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. */ - slug?: string; + displayOrder?: number; /** - * Type of the license determining its capabilities and restrictions + * Groups associated with this entitlement */ - type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; + readonly entitlementGroups?: Array | null; /** - * Timestamp when this license was last updated + * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. */ - readonly updatedAt: string; + icon?: string; /** - * Version of the license within its family, assigned by the server when the version is created and never changed afterwards: the version's derived slug ({familySlug}-v{version}, see slug) is built from it. A number is never reused within a family, even after its version is deleted. Create refuses any value (CreateLicense.VersionNotSettable); update accepts only the stored one, so a representation can be written back as it was read (UpdateLicense.VersionNotSettable). + * Unique identifier for the entitlement */ - readonly version: string; + readonly id: string; /** - * Optional human-readable name for the license version. Defaults to "Version - ". + * Name of the entitlement */ - versionName?: string; -}; - -export type LicenseEntitlement = { + name: string; /** - * Timestamp when this entitlement was created + * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. */ - readonly createdAt: string; + resetAnchor?: "CALENDAR" | "LICENSE_START"; /** - * User who created this entitlement + * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. */ - readonly createdBy: User; + resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; /** - * Groups associated with this entitlement + * Number of base units one sale unit represents (1 sale unit = N base units). */ - readonly entitlementGroups?: Array | null; + saleUnitFactor?: number; /** - * Name of the entitlement feature or service + * Plural label of the unit this entitlement is sold in, when it differs from the base unit. */ - readonly entitlementName: string; + saleUnitPlural?: string; /** - * URL-friendly identifier for the entitlement + * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). */ - entitlementSlug?: string; + saleUnitSingular?: string; /** - * Type of entitlement (BOOLEAN, NUMBER, or CONFIG) + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - readonly entitlementType?: "BOOLEAN" | "NUMBER" | "CONFIG"; + slug?: string; /** - * Unique identifier for the license this entitlement belongs to + * Type of the entitlement */ - readonly licenseId: string; + type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * URL-friendly identifier for the license this entitlement belongs to + * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. */ - readonly licenseSlug: string; + unitPlural?: string; /** - * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. + * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. */ - limitCapExceededOveragePercent?: number; + unitSingular?: string; /** * Timestamp when this entitlement was last updated */ readonly updatedAt: string; /** - * User who last updated this entitlement + * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. */ - readonly updatedBy: User; + userFacing?: boolean; /** - * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} + * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + warningThresholdPercent?: number; }; -export type LicenseFamilyView = { +export type EntitlementGroup = { /** - * Timestamp when this family was created + * Description of the entitlement group */ - readonly createdAt: string; + description: string | null; /** - * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. + * Unique identifier for the entitlement group */ - currentVersion?: License; + readonly id: string; /** - * Unique identifier for the license family + * Name of the entitlement group */ - readonly id: string; + name: string; /** - * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. + * URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - slug: string; + slug?: string; +}; + +export type EntitlementGroupSummary = { /** - * Timestamp when a version was last added to this family, or when the family was created. Renames, lifecycle moves and default changes update the versions' own updatedAt, not this one. + * Unique identifier for the entitlement group */ - readonly updatedAt: string; + id: string; /** - * Number of versions in this family, whatever their lifecycle state + * Name of the entitlement group */ - versionCount: number; + name: string; /** - * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. + * URL-friendly identifier for the entitlement group */ - versions?: Array; + slug: string; }; -export type List = { +export type EntitlementGroupUsage = { /** - * The page, newest first + * End of the current usage window (exclusive). Null for a lifetime entitlement. */ - data: Array; + currentPeriodEnd?: string; /** - * Opaque cursor for the next page; null on the last page + * Start of the current usage window (inclusive). Null for a lifetime entitlement. */ - nextCursor: string | null; + currentPeriodStart?: string; /** - * Unread notifications, capped (see MaxUnreadCount) + * Entitlement ID */ - unreadCount: number; -}; - -export type ManifestEnvelope = { - flags: Array | null; -}; - -export type ManifestFlag = { - defaultValue: unknown; - description?: string; - key: string; - name?: string; - type: string; -}; - -export type MarkReadResult = { + entitlementId: string; /** - * Unread notifications after the change + * Entitlement name */ - unreadCount: number; + entitlementName: string; /** - * Notifications newly marked read + * Entitlement slug */ - updated: number; -}; - -export type MetadataField = { + entitlementSlug: string; /** - * Timestamp when the field was archived (soft delete). Absent if active. + * Entitlement type */ - readonly archivedAt?: string; + entitlementType: string; /** - * Timestamp when the field was created + * License limit value, discriminated by the 'type' field. Null when the license grants no value. */ - readonly createdAt: string; + licenseValue?: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); /** - * User who created this field + * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. */ - readonly createdBy: User; + usageValue?: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); +}; + +export type EntitlementUsage = { /** - * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. + * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). */ - displayOrder?: number; + currentPeriodEnd?: string; /** - * Unique identifier + * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). */ - readonly id: string; + currentPeriodStart?: string; /** - * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} + * Unique identifier for the entitlement */ - jsonSchema: { - [key: string]: unknown; - }; + entitlementId: string; /** - * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. + * URL-friendly identifier of the entitlement */ - key: string; + entitlementSlug: string; /** - * Human-readable label shown in the admin UI + * Unique identifier for the license to which this entitlement usage belongs */ - label: string; + licenseId: string; /** - * Resource type this field applies to. Immutable after creation; update must echo back the stored value. + * URL-friendly identifier of the license */ - resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; + licenseSlug: string; /** - * Timestamp when the field was last updated + * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. */ - readonly updatedAt: string; + limit?: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); /** - * User who last updated this field + * Resolved entitlement value, discriminated by the 'type' field */ - readonly updatedBy: User; + value: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type MetadataFieldReordered = { +export type ErrorDetail = { /** - * Metadata field ids in their new display order + * Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' */ - ids: Array | null; -}; - -export type MetadataFieldSchemaProposal = { + location?: string; /** - * Candidate JSON Schema 2020-12 document to evaluate existing values against. + * Error message text */ - jsonSchema: { - [key: string]: unknown; - }; + message?: string; + /** + * The value at the given location + */ + value?: unknown; }; -export type Notification = { +export type EvaluationFailure = { /** - * Where clicking the notification goes + * OpenFeature compatible error code */ - actionUrl?: string; + errorCode: string; /** - * Rendered detail line, when the event has one + * Error description */ - body?: string; + errorDetails?: string; /** - * When the event occurred + * Feature flag key */ - createdAt: string; + key: string; /** - * Event this notification reports + * Arbitrary metadata for the flag */ - eventName: string; + metadata?: { + [key: string]: unknown; + }; +}; + +export type EvaluationRequest = { + context?: { + [key: string]: unknown; + }; +}; + +export type EvaluationSuccess = { /** - * CloudEvents type of the same event -- the key it is published under in this document's webhooks section, so a client can line a notification up with the payload schema and the description already published there + * Feature flag key */ - eventType: string; + key: string; /** - * Identifier of the underlying audit trail entry + * Arbitrary metadata for the flag */ - id: string; + metadata?: { + [key: string]: unknown; + }; /** - * What the notification is about -- the kind of page actionUrl opens, and what the list's objectType filter matches + * OpenFeature reason for the evaluation */ - objectType: string; + reason?: string; /** - * When this user read it; absent means unread + * Flag evaluation result */ - readAt?: string; + value?: unknown; /** - * Rendered headline + * string of the evaluated flag value */ - title: string; + variant?: string; }; -export type NumberEntitlementValue = { +export type Event = { /** - * Number of events accumulated (server-computed) + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - readonly event_count?: number; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Value type discriminator + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - type: "number"; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Numeric value + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - value: number; -}; - -export type PageAuditTrail = { + billingTiming: "ADVANCE" | "ARREARS"; + readonly createdAt: string; /** - * Whether more rows exist beyond this page. + * ISO 4217 code, upper case. One currency per licence version. */ - hasMore: boolean; - items: Array; + currency: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * When the price was deprecated */ - nextCursor?: string; -}; - -export type PageComponent = { + deprecatedAt?: string; /** - * Whether more rows exist beyond this page. + * The invoice line's label; a default is derived when absent. */ - hasMore: boolean; - items: Array; + displayLabel?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Order among the version's prices */ - nextCursor?: string; -}; - -export type PageCustomer = { + displayOrder: number; /** - * Whether more rows exist beyond this page. + * The family of that version */ - hasMore: boolean; - items: Array; + familySlug: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Unique identifier of the price */ - nextCursor?: string; -}; - -export type PageDeploymentZone = { + readonly id: string; /** - * Whether more rows exist beyond this page. + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - hasMore: boolean; - items: Array; + isDefault: boolean; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The licence version the price belongs to */ - nextCursor?: string; -}; - -export type PageEntitlement = { + licenseSlug: string; /** - * Whether more rows exist beyond this page. + * What a metered price measures. Absent on FLAT_FEE prices. */ - hasMore: boolean; - items: Array; + metered?: Meter; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - nextCursor?: string; -}; - -export type PageEntitlementGroup = { + status: "ACTIVE" | "DEPRECATED"; /** - * Whether more rows exist beyond this page. + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - hasMore: boolean; - items: Array; + unitAmount?: number; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - nextCursor?: string; + unitAmountDecimal: string; + readonly updatedAt: string; }; -export type PageFeatureFlag = { +export type ExhaustedEvent = { + id: string; + maxRedemptions?: number; + name: string; +}; + +export type FeatureFlag = { + default_variant: DefaultVariant; + description: string | null; + enabled: boolean; + event_name: string; + readonly id: string; + metadata: { + [key: string]: unknown; + }; + name: string; + slug?: string; + targetings: Targetings; + type: "boolean" | "string" | "number" | "object"; + variants: Array | null; +}; + +export type FeatureFlagEvaluated = { /** - * Whether more rows exist beyond this page. + * Set when the evaluation failed and the default was returned */ - hasMore: boolean; - items: Array; + error_code?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Human-readable detail accompanying error_code */ - nextCursor?: string; -}; - -export type PageInstance = { + error_message?: string; /** - * Whether more rows exist beyond this page. + * Unique identifier of the evaluated flag */ - hasMore: boolean; - items: Array; + flag_id: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * URL-friendly identifier of the evaluated flag */ - nextCursor?: string; -}; - -export type PageLicense = { + flag_slug: string; /** - * Whether more rows exist beyond this page. + * Name of the targeting rule that matched, when the reason is TARGETING_MATCH */ - hasMore: boolean; - items: Array; + matched_rule_name?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Why the value resolved as it did */ - nextCursor?: string; + reason: string; + /** + * Name of the resolved variant, when the flag has one + */ + variant?: string; }; -export type PageLicenseEntitlement = { +export type Grant = { + entitlementSlug: string; /** - * Whether more rows exist beyond this page. + * SET replaces the value, ADD adds to it, MULTIPLY multiplies it, UNLIMITED lifts the limit */ - hasMore: boolean; - items: Array; + modifierType: "SET" | "ADD" | "MULTIPLY" | "UNLIMITED"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * A decimal: >= 0 for SET, > 0 for ADD and MULTIPLY, absent for UNLIMITED */ - nextCursor?: string; + modifierValue?: string; }; -export type PageLicenseFamilyView = { +export type Handoff = { + acknowledgedAt?: string; + claimCount: number; /** - * Whether more rows exist beyond this page. + * The invoice's number in the organization's accounting system */ - hasMore: boolean; - items: Array; + externalReference?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The claim currently holding it */ - nextCursor?: string; + leaseId?: string; + leasedUntil?: string; + status: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; }; -export type PageMetadataField = { - /** - * Whether more rows exist beyond this page. - */ - hasMore: boolean; - items: Array; +export type HandoffAcknowledgement = { + acknowledgedBy: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The invoice's number in the organization's accounting system */ - nextCursor?: string; + externalReference?: string; + invoiceId: string; }; -export type PageRelease = { +export type HandoffBacklog = { + oldestPendingIssuedAt?: string; + pending: number; +}; + +export type HandoffBooking = { /** - * Whether more rows exist beyond this page. + * The invoice's number in the accounting system, 1 to 255 characters */ - hasMore: boolean; - items: Array; + externalReference?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * The claim's lease. When given, an invoice another claim took since is refused (AckHandoff.LeaseMismatch) */ - nextCursor?: string; + leaseId?: string; }; -export type PageServiceAccount = { +export type HandoffClaim = { /** - * Whether more rows exist beyond this page. + * The leased invoices, oldest issue first, with their billing e-mail: what the accounting system needs to book them */ - hasMore: boolean; - items: Array; + invoices: Array; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Pass it back when acknowledging an invoice of this claim */ - nextCursor?: string; + leaseId: string; + /** + * When the lease expires and the invoices are claimable again + */ + leasedUntil: string; }; -export type PageToken = { +export type HandoffClaimSize = { /** - * Whether more rows exist beyond this page. + * Lease length, 60 to 3600 seconds; 900 when omitted */ - hasMore: boolean; - items: Array; + leaseSeconds?: number; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Invoices to lease, 1 to 100; 25 when omitted */ - nextCursor?: string; + limit?: number; }; -export type PatchInstanceBody = { +export type HeldInvoice = { /** - * Commercial lifecycle stage (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED). When omitted, the current stage is preserved; clearing it back to unset is not supported. + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - lifecycleStage?: string; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Operational status of the instance + * As it was when the invoice was composed */ - status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; -}; - -export type PlainToken = { - readonly createdAt: string; - readonly createdBy: User; - expiresAt?: string; - readonly id?: string; - name: string; - readonly revokedAt?: string; - readonly revokedBy?: User; - scopes: Array | null; - readonly serviceAccountId?: string; + customerSlug: string; + daysUntilDue?: number; /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * Sum of the discounts, in minor units */ - slug?: string; - readonly token?: string; -}; - -export type PreferenceChoices = { + discountTotal: number; /** - * Events to set; events left out keep their current value + * issuedAt + daysUntilDue */ - events: Array | null; -}; - -export type PreferenceEvent = { + dueAt?: string; /** - * Effective value per channel + * PENDING: waiting in the handoff queue for the organization's accounting system */ - channels: { - [key: string]: boolean; - }; - eventName: string; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + holdDetail: HoldDetail; /** - * CloudEvents type of the same event; see Notification.eventType + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - eventType: string; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Catalogue group the client renders this under + * The invoice's identifier: the key an accounting system deduplicates on */ - group: string; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Human-readable event name + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - label: string; -}; - -export type PreferenceMatrix = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Channels this deployment serves, in display order + * Who collects it. NOOP: the organization itself, through the handoff queue */ - channels: Array; + providerKind: "NOOP" | "STRIPE"; /** - * Every notifiable event + * Earliest start of its lines' service periods */ - events: Array; -}; - -export type PreferenceUpdate = { - channels: { - [key: string]: boolean; - }; - eventName: string; -}; - -export type Problem = { + serviceFrom: string; /** - * Stable, machine-readable error code. + * Latest end of its lines' service periods */ - code?: string; + serviceTo: string; /** - * A human-readable explanation specific to this occurrence of the problem. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - detail?: string; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Correlation id for the server-side log entry describing the withheld cause. + * Sum of the lines, in minor units */ - errorId?: string; + subtotal: number; /** - * Optional list of individual error details + * subtotal − discountTotal, in minor units */ - errors?: Array | null; + total: number; + updatedAt: string; +}; + +export type HeldInvoices = { + byReason: { + [key: string]: number; + }; + count: number; +}; + +export type HeldPair = { + counterReportSeq: number | null; + entitlementId: string; + expected: string; + firstSeq: number | null; + found: string; + instanceId: string; + invariant: string; + lastSeq: number | null; +}; + +export type HoldDetail = { + pairs: Array; +}; + +export type HoldRecord = { + heldAt?: string; + releaseReason?: string; + releasedAt?: string; /** - * A URI reference that identifies the specific occurrence of the problem. + * The user who released it; absent when it was released by a later check */ - instance?: string; + releasedBy?: string; +}; + +export type HoldRelease = { /** - * HTTP status code + * 1 to 500 characters */ - status?: number; + reason: string; +}; + +export type Impact = { /** - * A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + * Number of resources whose stored value for this field would no longer satisfy the candidate schema */ - title?: string; + count: number; /** - * A URI reference to human-readable documentation for the error. + * Up to 5 impacted resources, for display */ - type?: string; + samples: Array | null; }; -export type ReadSelection = { +export type ImpactSample = { /** - * Mark every notification read, up to now + * Resource display name */ - all?: boolean; + name: string; /** - * Notifications to mark read + * Resource slug */ - ids?: Array | null; + slug: string; }; -export type Release = { - /** - * List of components included in this release, fixed at creation - */ - readonly components?: Array | null; +export type Instance = { /** - * Timestamp when the release was created + * Timestamp when the instance was created */ readonly createdAt: string; /** - * User who created this release + * User who created this instance */ readonly createdBy: User; /** - * Description of the release + * ID of the customer associated with this instance */ - description?: string; + customerId: string; /** - * Unique identifier for the release + * Slug of the customer associated with this instance */ - readonly id: string; + readonly customerSlug: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * ID of the deployment zone associated with this instance (optional) */ - slug?: string; + deploymentZoneId?: string; /** - * Version of the release + * Slug of the deployment zone associated with this instance (optional) */ - version: string; -}; - -export type ReorderMetadataFieldsInput = { - ids: Array | null; -}; - -export type ReportEntitlementUsageBody = { + readonly deploymentZoneSlug?: string; /** - * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it + * Brief description of the instance */ - behavior?: "append" | "set"; + description: string; /** - * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. + * End date of the license for this instance */ - metadata?: { - [key: string]: unknown; + endLicenseDate: string; + /** + * Unique identifier for the instance + */ + readonly id: string; + /** + * Integrations grouped by adapter name + */ + integrations?: { + [key: string]: InstanceIntegration; }; /** - * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. + * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. */ - transactionId?: string; + licenseId: string; /** - * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + * Slug of the license associated with this instance */ - value: - | ({ - type: "number"; - } & NumberEntitlementValue) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type RolloutDate = { - end: RolloutStep; - start: RolloutStep; - type: "rollout_date"; -}; - -export type RolloutDateTargeting = { - end: RolloutStep; - name: string; + readonly licenseSlug: string; /** - * CEL expression for basicTargeting evaluation + * Commercial lifecycle stage of the instance (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED) */ - rule: string; - start: RolloutStep; - type: "rollout_date"; -}; - -export type RolloutPercentage = { - distribution: { - [key: string]: number; - }; - type: "rollout_percentage"; -}; - -export type RolloutPercentageTargeting = { - distribution: { - [key: string]: number; + readonly lifecycleStage?: string; + /** + * Metadata for the instance + */ + metadata?: { + [key: string]: unknown; }; - name: string; /** - * CEL expression for basicTargeting evaluation + * Name of the instance */ - rule: string; - type: "rollout_percentage"; -}; - -export type RolloutStep = { - date: string; - percentage: number; - variant: string; -}; - -export type ServiceAccount = { - readonly createdAt?: string; - readonly createdBy?: User; - readonly externalId?: string; - readonly id?: string; name: string; /** * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ slug?: string; - readonly tokens: Array | null; -}; - -export type SystemTokenIssuance = { - /** - * Credential class that performed the mint; "platform" is the system:kaiten identity - */ - credentialKind: string; /** - * Absent when the minted credential does not expire + * Start date of the license for this instance */ - expiresAt?: string; + startLicenseDate: string; /** - * When the credential was minted + * Operational status of the instance */ - issuedAt: string; + readonly status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; /** - * The credential that was minted + * Timestamp when the instance was last updated */ - issuedTokenId: string; + readonly updatedAt: string; /** - * Human-readable label the caller gave the minted credential + * User who last updated this instance */ - name: string; + readonly updatedBy: User; +}; + +export type InstanceAddon = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + readonly id: string; + maxQuantity?: number; /** - * Platform credential that performed the mint; revoking it revokes everything it issued + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - platformTokenId: string; + prices: Array; + quantity: number; + removedAt?: string; +}; + +export type InstanceAddonUpdate = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + readonly id: string; + instanceSlug: string; + maxQuantity?: number; /** - * Scopes granted to the minted credential + * The quantity before a quantity change */ - scopes: Array | null; + previousQuantity?: number; /** - * Server-assigned identifier of the minted credential + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - slug: string; + prices: Array; + quantity: number; + removedAt?: string; }; -export type TargetingContext = { +export type InstanceBilling = { /** - * Identifiers the server guarantees, and what is reachable below each. Not a closed set: a host may target on its own attributes too + * The instant its periods are counted from */ - roots: Array; -}; - -export type TargetingContextNode = { + anchorAt: string; /** - * What this value means, shown by the editor + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - description?: string; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Named children, for an object + * Effective: the subscription's own, else the organization's default */ - fields?: Array; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Keys this map currently has, for completion. Not a closed set + * The subscription's own collection method; absent when it takes the organization's */ - knownKeys?: Array; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Name as it is written in a rule + * The next boundary: the period closes, and its invoice is composed, after it */ - name: string; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Whether this value may be absent, in which case has() is worth using + * Effective: the subscription's own, else the organization's default */ - optional?: boolean; + daysUntilDue: number; /** - * Shape of this node's value + * The subscription's own payment terms; absent when it takes the organization's */ - type: "string" | "number" | "boolean" | "object" | "map" | "dyn"; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Shape shared by every entry, for a map + * As it was at the subscription's last write */ - values?: TargetingContextNode; -}; - -export type TargetingRuleDraft = { + instanceSlug: string; + pastDueSince?: string; /** - * The CEL targeting rule to check. May be blank, which is itself a mistake this reports + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - rule: string; -}; - -export type TargetingRuleIssue = { + providerKind: "NOOP" | "STRIPE"; /** - * 1-based column the problem starts on, or 0 when it has no position + * A plan change waiting for the next boundary */ - column: number; + scheduledChange?: ScheduledChange; /** - * 1-based column just past the problem, or 0 when only a point is known + * When billing started: usage before it is never billed */ - endColumn?: number; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * 1-based line the problem ends on, or 0 when only a point is known + * When the trial ends, or ended: usage before it is never billed */ - endLine?: number; + trialEndsAt?: string; + updatedAt: string; +}; + +export type InstanceBody = { /** - * 1-based line the problem starts on, or 0 when it has no position + * External identifier of the related customer in the same adapter */ - line: number; + customerExternalId?: string; /** - * What is wrong, in the same words the write path refuses it with + * Deployment zone ID */ - message: string; -}; - -export type TargetingRuleRehearsal = { + deploymentZoneId?: string; /** - * Why the engine could not answer, when it could not — e.g. the rule reads a host attribute this context does not carry. At a real evaluation the rule would simply not match + * Instance description */ - evaluationError?: string; + description?: string; /** - * The __kaiten namespace as enriched for this context — what a rule actually reads. Empty sub-roots mean the context resolved nothing for them + * License end date */ - facts: { - [key: string]: unknown; - }; + endLicenseDate?: string; /** - * Problems the lint found. The rule is only run when there are none + * Optional integration error message */ - issues: Array; + error?: string; /** - * Whether the rule matched this context. Meaningful only when valid and evaluationError is empty + * Adapter-specific integration metadata */ - matched: boolean; + integrationMetadata?: { + [key: string]: unknown; + }; /** - * Whether the rule lints clean + * License ID */ - valid: boolean; -}; - -export type TargetingRuleTrial = { + licenseId?: string; /** - * The evaluation context to rehearse against, as a client would send it. Anything under __kaiten is discarded, exactly as at a real evaluation + * Instance metadata */ - context?: { + metadata?: { [key: string]: unknown; }; /** - * The CEL targeting rule to rehearse + * Instance name */ - rule: string; + name?: string; /** - * The key the evaluation would be bucketed on. Resolves license and entitlement facts when it names a customer slug + * Instance slug */ - targetingKey?: string; -}; - -export type TargetingRuleVerdict = { + slug?: string; /** - * Every problem found, positioned where it is written. Empty when the rule is accepted + * License start date */ - issues: Array; + startLicenseDate?: string; /** - * Whether the write path would accept this rule + * Absolute http(s) link to the record in the third-party system */ - valid: boolean; + webUrl?: string; }; -/** - * Polymorphic list of targeting rules (Basic, RolloutDate, RolloutPercentage) - */ -export type Targetings = Array< - BasicTargeting | RolloutDateTargeting | RolloutPercentageTargeting -> | null; - -export type Token = { - readonly createdAt: string; - readonly createdBy: User; - expiresAt?: string; - readonly id?: string; - name: string; - readonly revokedAt?: string; - readonly revokedBy?: User; - scopes: Array | null; - readonly serviceAccountId?: string; +export type InstanceEntitlementCapExceeded = { /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * URL-friendly identifier of the entitlement */ - slug?: string; -}; - -export type UsageReport = { + entitlement_slug: string; /** - * The entitlement's aggregation method when the report was accepted + * Amount by which usage exceeds the cap */ - aggregationMethod: string; + overage: number; /** - * append adds the value through the aggregation method; set overwrites the counter + * The entitlement cap */ - behavior: "append" | "set"; + threshold: number; /** - * valueAfter minus valueBefore; negative for a set that lowered the counter + * Current usage value, including overage */ - delta: string; + value: number; +}; + +export type InstanceEntitlementUsagePeriodRolledOver = { + closed_period_end: string | null; + closed_period_start: string | null; + entitlement_id: string; + entitlement_slug: string; + event_count: number; + instance_id: string; + is_synthetic: boolean; + new_period_start: string; + value: number; +}; + +export type InstanceEntitlementUsageReportAccepted = { /** - * The entitlement the report was made for. It may since have been deleted. + * Report behavior: append folds the value into the stored total, set overwrites it */ - entitlementId: string; + behavior: "append" | "set"; /** - * Reports counted in the window after this one + * URL-friendly identifier of the entitlement the usage was reported against */ - eventCountAfter: number; + entitlement_slug: string; /** - * The instance the report was made for. It may since have been deleted. + * Number of reports folded into the current usage window, including this one */ - instanceId: string; + event_count: number; /** - * The instance's licence when the report was accepted + * Whether the report was persisted */ - licenseId: string; + status: "ACCEPTED" | "REJECTED"; /** - * The limit in force when the report was accepted. Null when unlimited. + * Value carried by the report */ - limitValue?: string; + value: number; +}; + +export type InstanceEntitlementUsageWarningThresholdReached = { /** - * How much the usage above limitValue moved: max(0, valueAfter - limitValue) - max(0, valueBefore - limitValue). 0 when unlimited. + * Usage value at which the warning fires (cap * warningThresholdPercent / 100) */ - overageDelta: string; + boundary: number; /** - * The overage allowed above limitValue, in percent, when the report was accepted. Null when unlimited. + * URL-friendly identifier of the entitlement */ - overagePercent?: number; + entitlement_slug: string; /** - * The report's metadata, when it was stored + * The entitlement cap */ - properties?: { - [key: string]: unknown; - }; + threshold: number; /** - * Position of the report among the pair's accepted reports, from 1, without gaps + * Current usage value */ - reportSeq: number; + value: number; +}; + +export type InstanceEntitlementValueGet = { /** - * When the server accepted the report (UTC, millisecond precision) + * Unique identifier for the entitlement */ - reportedAt: string; + entitlement_id: string; /** - * The value as sent: a delta for append, an absolute value for set + * URL-friendly identifier of the entitlement */ - reportedValue: string; + entitlement_slug: string; /** - * The report's idempotency key, when it was sent with one + * Unique identifier for the instance the value was read for */ - transactionId?: string; + instance_id: string; /** - * The counter after the report + * Unique identifier for the license carrying the entitlement */ - valueAfter: string; + license_id: string; /** - * The counter before the report, after any window reset + * Unique identifier for the owning organization */ - valueBefore: string; + organization_id: string; /** - * End of the usage window the report counted in (exclusive). Null for a lifetime entitlement. + * When the value was read */ - windowEnd?: string; + timestamp: string; /** - * Start of the usage window the report counted in (inclusive). Null for a lifetime entitlement. + * Discriminator of the resolved entitlement value */ - windowStart?: string; + type: string; + /** + * Resolved entitlement value at read time + */ + value: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type UsageReportPage = { +export type InstanceIntegration = { /** - * The reports, in reportSeq order + * External identifier in the third-party adapter */ - items: Array; + external_id: string; /** - * Pass as afterSeq to read the next page. Absent on the last page. + * Last synchronization error message, if any */ - nextAfterSeq?: number; -}; - -export type User = { + last_error?: string; /** - * ID of the user + * Adapter-specific integration metadata */ - id: string; + metadata?: { + [key: string]: unknown; + }; /** - * Name of the user + * Timestamp of the last synchronization with the adapter */ - name?: string; -}; - -export type Variant = { - description: string; - name: string; - value: unknown; + readonly synced_at: string; + /** + * Absolute http(s) link to the record in the third-party system + */ + web_url?: string; }; -export type ComponentWritable = { +export type InstanceIntegrationResource = { /** - * Description of the component + * External identifier of the related customer in the same adapter */ - description?: string; + customerExternalId?: string; /** - * Name of the component + * Deployment zone ID */ - name: string; + deploymentZoneId?: string; /** - * Reference to the previous version of this component + * Instance description */ - previousComponentId?: string; + description: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * License end date */ - slug?: string; + endLicenseDate: string; /** - * Version of the component + * Last synchronization error for this integration, if any */ - version: string; -}; - -export type ConnectorSettingsWritable = { + error?: string; /** - * Connector settings payload + * Adapter-specific instance integration metadata */ - settings: { + integrationMetadata: { [key: string]: unknown; }; -}; - -export type CustomerWritable = { /** - * Optional customer domain name + * License ID */ - domain?: string; + licenseId: string; /** - * Optional identifier for the customer in an external system + * Instance name */ - externalCustomerId?: string | null; + name: string; /** - * Integrations grouped by adapter name + * Instance slug */ - integrations?: { - [key: string]: CustomerIntegrationWritable; - }; + slug: string; /** - * Name of the customer + * License start date */ - name: string; + startLicenseDate: string; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Absolute http(s) link to the record in the third-party system */ - slug?: string; + webUrl?: string; }; -export type CustomerIntegrationWritable = { +export type InstanceLifecycleStageChanged = { + changed_by: string; + instance_id: string; + new_lifecycle_stage: string | null; + previous_lifecycle_stage: string | null; +}; + +export type InstanceStatusChanged = { + changed_by: string; + instance_id: string; + new_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; + previous_status: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; +}; + +export type Invoice = { /** - * External identifier in the third-party adapter + * The address the invoice is for, as it was when composed. Personal data: it appears in no event */ - external_id: string; + billingEmail?: string; /** - * Last synchronization error message, if any + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - last_error?: string; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Adapter-specific integration metadata + * As it was when the invoice was composed */ - metadata?: { - [key: string]: unknown; - }; + customerSlug: string; + daysUntilDue?: number; /** - * Absolute http(s) link to the record in the third-party system + * Sum of the discounts, in minor units */ - web_url?: string; -}; - -export type DeploymentZoneWritable = { + discountTotal: number; /** - * Description of the deployment zone + * issuedAt + daysUntilDue */ - description: string; + dueAt?: string; + handoff: Handoff; /** - * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema + * PENDING: waiting in the handoff queue for the organization's accounting system */ - metadata?: { - [key: string]: unknown; - }; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Name of the deployment zone + * When the invoice was held and released */ - name: string; + hold?: HoldRecord; /** - * Currently deployed release ID + * Every meter whose journal failed a check */ - releaseId?: string; + holdDetail?: HoldDetail; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - slug?: string; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. + * The invoice's identifier: the key an accounting system deduplicates on */ - type: string; -}; - -export type EntitlementWritable = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseId: string; + licenseSlug: string; + lines: Array; + paidAt?: string; /** - * Description of the entitlement + * The invoice in its payment provider; absent for NOOP */ - description: string | null; + provider?: ProviderRecord; /** - * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. + * Who collects it. NOOP: the organization itself, through the handoff queue */ - displayOrder?: number; + providerKind: "NOOP" | "STRIPE"; /** - * Groups associated with this entitlement, identified by slug + * The invoice recomposed from this VOID one */ - groupSlugs?: Array | null; + replacedByInvoiceId?: string; /** - * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. + * The VOID invoice this one was recomposed from */ - icon?: string; + replacesInvoiceId?: string; /** - * Name of the entitlement + * Earliest start of its lines' service periods */ - name: string; + serviceFrom: string; /** - * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. + * Latest end of its lines' service periods */ - resetAnchor?: "CALENDAR" | "LICENSE_START"; + serviceTo: string; /** - * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Number of base units one sale unit represents (1 sale unit = N base units). + * Sum of the lines, in minor units */ - saleUnitFactor?: number; + subtotal: number; /** - * Plural label of the unit this entitlement is sold in, when it differs from the base unit. + * subtotal − discountTotal, in minor units */ - saleUnitPlural?: string; + total: number; + uncollectibleAt?: string; + updatedAt: string; + voidReason?: string; + voidedAt?: string; +}; + +export type InvoiceHold = { + entitlementId: string; /** - * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). + * The check that failed */ - saleUnitSingular?: string; + invariant: string; +}; + +export type InvoiceLine = { /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * The add-on version an ADDON line bills */ - slug?: string; + addonId?: string; /** - * Type of the entitlement + * The add-on price an ADDON line bills */ - type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; + addonPriceId?: string; /** - * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. + * round_half_up(quantity × unitAmountDecimal), in minor units; negative on a DISCOUNT line */ - unitPlural?: string; + amount: number; /** - * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. + * The price's billing model; absent on a DISCOUNT line */ - unitSingular?: string; + billingModel?: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. + * ADVANCE lines bill the period that starts at the boundary, ARREARS lines the one that ends there; absent on a DISCOUNT line */ - userFacing?: boolean; + billingTiming?: "ADVANCE" | "ARREARS"; /** - * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + * Set on a preview line whose sample exceeded what the licence accepts: reports above that are rejected, so the excess is not billed */ - warningThresholdPercent?: number; -}; - -export type EntitlementGroupWritable = { + capped?: boolean; /** - * Description of the entitlement group + * The arithmetic of the line */ - description: string | null; + description: string; /** - * Name of the entitlement group + * How a DISCOUNT line was computed */ - name: string; + discount?: InvoiceLineDiscount; /** - * URL-friendly identifier, unique per organization. Auto-generated if not provided. + * The metered entitlement, on USAGE and OVERAGE lines */ - slug?: string; -}; - -export type EntitlementGroupUsageWritable = { + entitlementId?: string; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement. + * Its slug, as it was when the line was composed */ - currentPeriodEnd?: string; + entitlementSlug?: string; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement. + * The line's identifier, stable for the invoice's life; absent on a preview */ - currentPeriodStart?: string; + id?: string; /** - * Entitlement ID + * The instance's attachment an ADDON line bills */ - entitlementId: string; + instanceAddonId?: string; /** - * Entitlement name + * The redemption a DISCOUNT line applies */ - entitlementName: string; + instanceVoucherId?: string; /** - * Entitlement slug + * The price's display label, else a derived one */ - entitlementSlug: string; + label: string; /** - * Entitlement type + * The licence price the line bills; absent on an ADDON line */ - entitlementType: string; + licensePriceId?: string; /** - * License limit value, discriminated by the 'type' field. Null when the license grants no value. + * How a USAGE or OVERAGE line's quantity was measured */ - licenseValue?: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + metering?: InvoiceLineMetering; /** - * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. + * The arithmetic of an OVERAGE line */ - usageValue?: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type EntitlementUsageWritable = { + overage?: InvoiceLineOverage; /** - * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). + * The line in the payment provider, once pushed */ - currentPeriodEnd?: string; + provider?: InvoiceLineProvider; /** - * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). + * In sale units, a decimal string: 1 on a BASE line, the quantity held on an ADDON line */ - currentPeriodStart?: string; + quantity: string; /** - * Unique identifier for the entitlement + * Position on the invoice, from 1 */ - entitlementId: string; + seq: number; /** - * URL-friendly identifier of the entitlement + * Start of the period the line bills (inclusive) */ - entitlementSlug: string; + serviceFrom: string; /** - * Unique identifier for the license to which this entitlement usage belongs + * End of the period the line bills (exclusive) */ - licenseId: string; + serviceTo: string; /** - * URL-friendly identifier of the license + * BASE: the subscription's FLAT_FEE price. ADDON: an add-on's FLAT_FEE price times the quantity held at the boundary. USAGE: a USAGE_BASED price's metered usage. OVERAGE: an OVERAGE price's usage above the licence's limit. DISCOUNT: a PRICE voucher's discount, negative. */ - licenseSlug: string; + type: "BASE" | "ADDON" | "USAGE" | "OVERAGE" | "DISCOUNT"; /** - * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + * The price's unit amount in minor units; absent on a DISCOUNT line */ - limit?: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + unitAmountDecimal?: string; /** - * Resolved entitlement value, discriminated by the 'type' field + * The voucher a DISCOUNT line applies */ - value: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); -}; - -export type FeatureFlagWritable = { - default_variant: DefaultVariant; - description: string | null; - enabled: boolean; - event_name: string; - metadata: { - [key: string]: unknown; - }; - name: string; - slug?: string; - targetings: Targetings; - type: "boolean" | "string" | "number" | "object"; - variants: Array | null; + voucherId?: string; }; -export type InstanceWritable = { +export type InvoiceLineDiscount = { /** - * ID of the customer associated with this instance + * Which invoice of the redemption this is, from 1 */ - customerId: string; + application: number; /** - * ID of the deployment zone associated with this instance (optional) + * How many invoices the redemption discounts; absent for FOREVER */ - deploymentZoneId?: string; + applicationsMax?: number; + appliesTo: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; /** - * Brief description of the instance + * What its targets still amounted to before it, exact, in minor units */ - description: string; + base: string; + currency?: string; + discountType: "PERCENTAGE" | "FIXED_AMOUNT"; /** - * End date of the license for this instance + * The percentage, or the amount in minor units */ - endLicenseDate: string; + discountValue: string; /** - * Integrations grouped by adapter name + * The lines it discounts */ - integrations?: { - [key: string]: InstanceIntegrationWritable; - }; + targetSeqs: Array | null; +}; + +export type InvoiceLineLedger = { /** - * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. + * First report of the period, null when it has none */ - licenseId: string; + firstSeq: number | null; /** - * Metadata for the instance + * The instance whose reports these are: with the line's entitlement, the pair the journal is kept by. It outlives the instance */ - metadata?: { - [key: string]: unknown; - }; + instanceId?: string; /** - * Name of the instance + * Last report of the period, null when it has none */ - name: string; + lastSeq: number | null; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Reports in the period */ - slug?: string; + rows: number; /** - * Start date of the license for this instance + * Sum of the reports' movements, before any floor */ - startLicenseDate: string; + sumDelta: string; + /** + * Sum of their movements above the limit, before any floor + */ + sumOverage: string | null; }; -export type InstanceEntitlementValueGetWritable = { +export type InvoiceLineMetering = { /** - * Unique identifier for the entitlement + * The usage journal rows the line was measured from */ - entitlement_id: string; + ledger?: InvoiceLineLedger; /** - * URL-friendly identifier of the entitlement + * In measured units: the usage for a USAGE line, the overage for an OVERAGE line */ - entitlement_slug: string; + measuredQuantity: string; /** - * Unique identifier for the instance the value was read for + * Windows whose net movement was negative and counted as 0 */ - instance_id: string; + negativeSegmentsFloored: number; /** - * Unique identifier for the license carrying the entitlement + * Measured units in one sale unit */ - license_id: string; + saleUnitFactor: string; /** - * Unique identifier for the owning organization + * Reset windows the period spans */ - organization_id: string; + windows: number; +}; + +export type InvoiceLineOverage = { /** - * When the value was read + * The limits applied, in the order they first applied */ - timestamp: string; + limits: Array; /** - * Discriminator of the resolved entitlement value + * Usage above the applied limit */ - type: string; + overageMeasured: string; /** - * Resolved entitlement value at read time + * Usage in measured units */ - value: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + usageMeasured: string; }; -export type InstanceIntegrationWritable = { +export type InvoiceLineProvider = { /** - * External identifier in the third-party adapter + * The provider's amount, read back for reconciliation */ - external_id: string; + amount?: number; /** - * Last synchronization error message, if any + * The provider's id of the line */ - last_error?: string; + externalLineId: string; +}; + +export type InvoicePayment = { /** - * Adapter-specific integration metadata + * The invoice's number in the organization's accounting system, 1 to 255 characters. It also acknowledges an invoice still waiting in the handoff queue */ - metadata?: { - [key: string]: unknown; - }; + externalReference?: string; /** - * Absolute http(s) link to the record in the third-party system + * A note, such as the transfer's reference, kept only in the paid event */ - web_url?: string; + note?: string; + /** + * When it was paid, now or earlier; now when omitted + */ + paidAt?: string; }; -export type LicenseWritable = { +export type InvoicePreview = { /** - * Detailed description of the license capabilities and restrictions + * When the preview was composed */ - description: string; + asOf: string; /** - * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). + * The boundary the invoice bills */ - familyId?: string; + boundaryAt: string; /** - * Write-only on create: slug of the family this license is a new version of. familyId names the same family by identifier; sent together they must agree. Omit both to create a new family, of which this license becomes version 1. Never returned -- see familyId. Refused on update: a version cannot move between families. + * ISO 4217 code */ - familySlug?: string; + currency: string; /** - * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). + * Sum of the discounts, in minor units */ - isDefault: boolean; + discountTotal: number; /** - * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. + * The boundary previewed */ - lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; /** - * Display name of the license + * The licence version previewed */ - name: string; + licenseSlug: string; + lines: Array; /** - * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. + * Earliest start of the lines' service periods; absent without lines */ - slug?: string; + serviceFrom?: string; /** - * Type of the license determining its capabilities and restrictions + * Latest end of the lines' service periods; absent without lines */ - type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; + serviceTo?: string; /** - * Optional human-readable name for the license version. Defaults to "Version - ". + * Always PREVIEW */ - versionName?: string; -}; - -export type LicenseEntitlementWritable = { + status: "PREVIEW"; /** - * URL-friendly identifier for the entitlement + * Sum of the lines, in minor units */ - entitlementSlug?: string; + subtotal: number; /** - * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. + * subtotal − discountTotal, in minor units */ - limitCapExceededOveragePercent?: number; + total: number; /** - * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} + * Meters whose usage journal fails a consistency check, which would hold the invoice. Always empty for a sample. */ - value: - | ({ - type: "number"; - } & NumberEntitlementValueWritable) - | ({ - type: "boolean"; - } & BooleanEntitlementValue) - | ({ - type: "object"; - } & ConfigEntitlementValue); + wouldHold: Array; }; -export type LicenseFamilyViewWritable = { +export type InvoicePreviewScenario = { /** - * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. + * The FLAT_FEE price billed as the base (PreviewLicenseInvoice.PriceNotFound). Defaults to the version's default FLAT_FEE price (PreviewLicenseInvoice.NoBasePrice when it has none). */ - currentVersion?: LicenseWritable; + basePriceId?: string; /** - * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. + * Usage of the metered entitlements over the period that ends, one entry per entitlement. An entitlement left out used nothing. */ - slug: string; + sampleUsage?: Array | null; +}; + +export type InvoiceSummary = { /** - * Number of versions in this family, whatever their lifecycle state + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - versionCount: number; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. + * As it was when the invoice was composed */ - versions?: Array; -}; - -export type MetadataFieldWritable = { + customerSlug: string; + daysUntilDue?: number; /** - * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. + * Sum of the discounts, in minor units */ - displayOrder?: number; + discountTotal: number; /** - * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} + * issuedAt + daysUntilDue */ - jsonSchema: { - [key: string]: unknown; - }; + dueAt?: string; /** - * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. + * PENDING: waiting in the handoff queue for the organization's accounting system */ - key: string; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Human-readable label shown in the admin UI + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - label: string; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Resource type this field applies to. Immutable after creation; update must echo back the stored value. + * The invoice's identifier: the key an accounting system deduplicates on */ - resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; -}; - -export type NumberEntitlementValueWritable = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Value type discriminator + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - type: "number"; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Numeric value + * Who collects it. NOOP: the organization itself, through the handoff queue */ - value: number; -}; - -export type PageComponentWritable = { + providerKind: "NOOP" | "STRIPE"; /** - * Whether more rows exist beyond this page. + * Earliest start of its lines' service periods */ - hasMore: boolean; - items: Array; + serviceFrom: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Latest end of its lines' service periods */ - nextCursor?: string; -}; - -export type PageCustomerWritable = { + serviceTo: string; /** - * Whether more rows exist beyond this page. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - hasMore: boolean; - items: Array; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Sum of the lines, in minor units */ - nextCursor?: string; + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type PageDeploymentZoneWritable = { +export type InvoiceVoid = { /** - * Whether more rows exist beyond this page. + * 1 to 500 characters */ - hasMore: boolean; - items: Array; + reason: string; +}; + +export type InvoiceWriteOff = { /** - * Opaque cursor for the next page. Absent when hasMore is false. + * 1 to 500 characters */ - nextCursor?: string; + reason: string; }; -export type PageEntitlementWritable = { +export type IssuedInvoice = { /** - * Whether more rows exist beyond this page. + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - hasMore: boolean; - items: Array; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * As it was when the invoice was composed */ - nextCursor?: string; -}; - -export type PageEntitlementGroupWritable = { + customerSlug: string; + daysUntilDue?: number; /** - * Whether more rows exist beyond this page. + * Sum of the discounts, in minor units */ - hasMore: boolean; - items: Array; + discountTotal: number; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * issuedAt + daysUntilDue */ - nextCursor?: string; -}; - -export type PageFeatureFlagWritable = { + dueAt?: string; /** - * Whether more rows exist beyond this page. + * PENDING: waiting in the handoff queue for the organization's accounting system */ - hasMore: boolean; - items: Array; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - nextCursor?: string; -}; - -export type PageInstanceWritable = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Whether more rows exist beyond this page. + * The invoice's identifier: the key an accounting system deduplicates on */ - hasMore: boolean; - items: Array; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - nextCursor?: string; -}; - -export type PageLicenseWritable = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseId: string; + licenseSlug: string; + lines: Array; /** - * Whether more rows exist beyond this page. + * Set when the lines did not fit the event: read the invoice for all of them */ - hasMore: boolean; - items: Array; + linesTruncated?: boolean; + paidAt?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Who collects it. NOOP: the organization itself, through the handoff queue */ - nextCursor?: string; -}; - -export type PageLicenseEntitlementWritable = { + providerKind: "NOOP" | "STRIPE"; /** - * Whether more rows exist beyond this page. + * Earliest start of its lines' service periods */ - hasMore: boolean; - items: Array; + serviceFrom: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Latest end of its lines' service periods */ - nextCursor?: string; -}; - -export type PageLicenseFamilyViewWritable = { + serviceTo: string; /** - * Whether more rows exist beyond this page. + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - hasMore: boolean; - items: Array; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Sum of the lines, in minor units */ - nextCursor?: string; + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type PageMetadataFieldWritable = { +export type License = { /** - * Whether more rows exist beyond this page. + * Timestamp when this license was created */ - hasMore: boolean; - items: Array; + readonly createdAt: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Detailed description of the license capabilities and restrictions */ - nextCursor?: string; -}; - -export type PageReleaseWritable = { + description: string; /** - * Whether more rows exist beyond this page. + * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). */ - hasMore: boolean; - items: Array; + familyId?: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Unique identifier for the license */ - nextCursor?: string; -}; - -export type PageServiceAccountWritable = { + readonly id: string; /** - * Whether more rows exist beyond this page. + * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). */ - hasMore: boolean; - items: Array; + isDefault: boolean; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. */ - nextCursor?: string; -}; - -export type PageTokenWritable = { + lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Whether more rows exist beyond this page. + * Display name of the license */ - hasMore: boolean; - items: Array; + name: string; /** - * Opaque cursor for the next page. Absent when hasMore is false. + * How this version is sold. FREE and PAID can be bought self-serve; CUSTOM sends a buyer to selfServeCtaUrl or a conversation. Always present in responses. On create it defaults to CUSTOM; on update, omit it to keep the stored value. */ - nextCursor?: string; -}; - -export type PlainTokenWritable = { - expiresAt?: string; - name: string; - scopes: Array | null; + pricingType?: "FREE" | "PAID" | "CUSTOM"; /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * Whether self-serve signup captures a payment method before activation. Always present in responses; false when omitted on create. On update, omit it to keep the stored value. + */ + requiresPaymentMethod?: boolean; + /** + * Where a buyer is sent when this version cannot be bought self-serve: an http(s) URL of at most 2048 characters (CreateLicense.InvalidSelfServeCtaUrl). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. + */ + selfServeCtaUrl?: string; + /** + * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. */ slug?: string; -}; - -export type ReleaseWritable = { /** - * List of component IDs to link to this release + * Trial length, in days, a subscription to this version starts with by default. Absent when there is none. Must be at least 1 on create (CreateLicense.InvalidTrialPeriodDays). On update, omit it to keep the stored value, or send 0 to remove the trial. */ - componentIds?: Array | null; + trialPeriodDays?: number; /** - * Description of the release + * Type of the license determining its capabilities and restrictions */ - description?: string; + type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Timestamp when this license was last updated */ - slug?: string; + readonly updatedAt: string; /** - * Version of the release + * Version of the license within its family, assigned by the server when the version is created and never changed afterwards: the version's derived slug ({familySlug}-v{version}, see slug) is built from it. A number is never reused within a family, even after its version is deleted. Create refuses any value (CreateLicense.VersionNotSettable); update accepts only the stored one, so a representation can be written back as it was read (UpdateLicense.VersionNotSettable). */ - version: string; + readonly version: string; + /** + * Optional human-readable name for the license version. Defaults to "Version - ". + */ + versionName?: string; }; -export type ReportEntitlementUsageBodyWritable = { +export type LicenseEntitlement = { /** - * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it + * Timestamp when this entitlement was created */ - behavior?: "append" | "set"; + readonly createdAt: string; /** - * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. + * User who created this entitlement */ - metadata?: { - [key: string]: unknown; - }; + readonly createdBy: User; /** - * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. + * Groups associated with this entitlement */ - transactionId?: string; + readonly entitlementGroups?: Array | null; /** - * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + * Name of the entitlement feature or service + */ + readonly entitlementName: string; + /** + * URL-friendly identifier for the entitlement + */ + entitlementSlug?: string; + /** + * Type of entitlement (BOOLEAN, NUMBER, or CONFIG) + */ + readonly entitlementType?: "BOOLEAN" | "NUMBER" | "CONFIG"; + /** + * Unique identifier for the license this entitlement belongs to + */ + readonly licenseId: string; + /** + * URL-friendly identifier for the license this entitlement belongs to + */ + readonly licenseSlug: string; + /** + * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. + */ + limitCapExceededOveragePercent?: number; + /** + * Timestamp when this entitlement was last updated + */ + readonly updatedAt: string; + /** + * User who last updated this entitlement + */ + readonly updatedBy: User; + /** + * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} */ value: | ({ type: "number"; - } & NumberEntitlementValueWritable) + } & NumberEntitlementValue) | ({ type: "boolean"; } & BooleanEntitlementValue) @@ -2986,5150 +3086,4809 @@ export type ReportEntitlementUsageBodyWritable = { } & ConfigEntitlementValue); }; -export type ServiceAccountWritable = { - name: string; +export type LicenseFamilyView = { /** - * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + * Timestamp when this family was created */ - slug?: string; -}; - -export type TokenWritable = { - expiresAt?: string; - name: string; - scopes: Array | null; + readonly createdAt: string; /** - * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. */ - slug?: string; -}; - -export type ListComponentsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/components"; -}; - -export type ListComponentsErrors = { + currentVersion?: License; /** - * Bad Request + * Unique identifier for the license family */ - 400: Problem; + readonly id: string; /** - * Unauthorized + * Whether the family's default PUBLISHED version is listed in the public catalogue. Private by default. */ - 401: Problem; + isPublic: boolean; /** - * Forbidden + * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. */ - 403: Problem; + slug: string; /** - * Unprocessable Entity + * Timestamp when a version was last added to this family, or when the family was created. Renames, lifecycle moves and default changes update the versions' own updatedAt, not this one. */ - 422: Problem; + readonly updatedAt: string; /** - * Internal Server Error + * Number of versions in this family, whatever their lifecycle state */ - 500: Problem; -}; - -export type ListComponentsError = ListComponentsErrors[keyof ListComponentsErrors]; - -export type ListComponentsResponses = { + versionCount: number; /** - * OK + * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. */ - 200: PageComponent; + versions?: Array; }; -export type ListComponentsResponse = ListComponentsResponses[keyof ListComponentsResponses]; - -export type CreateComponentData = { - body: ComponentWritable; - path?: never; - query?: never; - url: "/components"; +export type LicenseFamilyVisibility = { + /** + * List the family's default PUBLISHED version, with its ACTIVE prices, in the public catalogue + */ + isPublic: boolean; }; -export type CreateComponentErrors = { +export type LicensePriceChanges = { /** - * Bad Request + * See createLicensePrice. */ - 400: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Unauthorized + * See createLicensePrice. */ - 401: Problem; + billingTiming?: "ADVANCE" | "ARREARS"; + displayLabel?: string; + displayOrder?: number; + isDefault?: boolean; /** - * Forbidden + * See createLicensePrice. */ - 403: Problem; + meteredEntitlementSlug?: string; /** - * Not Found + * See createLicensePrice. */ - 404: Problem; + unitAmountDecimal?: string; +}; + +export type LineDifference = { + externalLineId: string; + kaitenAmount: number; + lineId: string; + providerAmount: number; + seq: number; +}; + +export type LineReportPage = { /** - * Conflict + * The reports, in reportSeq order */ - 409: Problem; + items: Array; /** - * Unprocessable Entity + * Pass as afterSeq to read the next page. Absent on the last page. */ - 422: Problem; + nextAfterSeq?: number; +}; + +export type List = { /** - * Internal Server Error + * The page, newest first */ - 500: Problem; + data: Array; /** - * Service Unavailable + * Opaque cursor for the next page; null on the last page */ - 503: Problem; -}; - -export type CreateComponentError = CreateComponentErrors[keyof CreateComponentErrors]; - -export type CreateComponentResponses = { + nextCursor: string | null; /** - * Created + * Unread notifications, capped (see MaxUnreadCount) */ - 201: Component; + unreadCount: number; }; -export type CreateComponentResponse = CreateComponentResponses[keyof CreateComponentResponses]; +export type ManifestEnvelope = { + flags: Array | null; +}; -export type DeleteComponentData = { - body?: never; - path: { - /** - * Component slug - */ - componentSlug: string; - }; - query?: never; - url: "/components/{componentSlug}"; +export type ManifestFlag = { + defaultValue: unknown; + description?: string; + key: string; + name?: string; + type: string; }; -export type DeleteComponentErrors = { +export type MarkReadResult = { /** - * Bad Request + * Unread notifications after the change */ - 400: Problem; + unreadCount: number; /** - * Unauthorized + * Notifications newly marked read */ - 401: Problem; + updated: number; +}; + +export type MetadataField = { /** - * Forbidden + * Timestamp when the field was archived (soft delete). Absent if active. */ - 403: Problem; + readonly archivedAt?: string; /** - * Not Found + * Timestamp when the field was created */ - 404: Problem; + readonly createdAt: string; /** - * Conflict + * User who created this field */ - 409: Problem; + readonly createdBy: User; /** - * Unprocessable Entity + * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. */ - 422: Problem; + displayOrder?: number; /** - * Internal Server Error + * Unique identifier */ - 500: Problem; -}; - -export type DeleteComponentError = DeleteComponentErrors[keyof DeleteComponentErrors]; - -export type DeleteComponentResponses = { + readonly id: string; /** - * No Content + * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} */ - 204: void; -}; - -export type DeleteComponentResponse = DeleteComponentResponses[keyof DeleteComponentResponses]; - -export type GetComponentData = { - body?: never; - path: { - /** - * Component slug - */ - componentSlug: string; + jsonSchema: { + [key: string]: unknown; }; - query?: never; - url: "/components/{componentSlug}"; -}; - -export type GetComponentErrors = { /** - * Unauthorized + * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. */ - 401: Problem; + key: string; /** - * Forbidden + * Human-readable label shown in the admin UI */ - 403: Problem; + label: string; /** - * Not Found + * Resource type this field applies to. Immutable after creation; update must echo back the stored value. */ - 404: Problem; + resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; /** - * Unprocessable Entity + * Timestamp when the field was last updated */ - 422: Problem; + readonly updatedAt: string; /** - * Internal Server Error + * User who last updated this field */ - 500: Problem; + readonly updatedBy: User; }; -export type GetComponentError = GetComponentErrors[keyof GetComponentErrors]; +export type MetadataFieldReordered = { + /** + * Metadata field ids in their new display order + */ + ids: Array | null; +}; -export type GetComponentResponses = { +export type MetadataFieldSchemaProposal = { /** - * OK + * Candidate JSON Schema 2020-12 document to evaluate existing values against. */ - 200: Component; + jsonSchema: { + [key: string]: unknown; + }; }; -export type GetComponentResponse = GetComponentResponses[keyof GetComponentResponses]; +export type Meter = { + /** + * The metered entitlement + */ + entitlementSlug: string; + /** + * Measured units in one sale unit, captured when the price was created (1 when the entitlement has no sale unit): 10000 bills per 10,000 tokens. + */ + saleUnitFactor: string; + saleUnitPlural?: string; + saleUnitSingular?: string; +}; -export type UpdateComponentData = { - body: ComponentWritable; - path: { - /** - * Component slug - */ - componentSlug: string; - }; - query?: never; - url: "/components/{componentSlug}"; +export type MinimumAmount = { + currency: string; + /** + * In minor units + */ + unitAmountDecimal: string; }; -export type UpdateComponentErrors = { +export type MismatchedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Conflict + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 409: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Unprocessable Entity + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 422: Problem; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Internal Server Error + * The invoice's identifier: the key an accounting system deduplicates on */ - 500: Problem; -}; - -export type UpdateComponentError = UpdateComponentErrors[keyof UpdateComponentErrors]; - -export type UpdateComponentResponses = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * OK + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 200: Component; -}; - -export type UpdateComponentResponse = UpdateComponentResponses[keyof UpdateComponentResponses]; - -export type ListConnectorsData = { - body?: never; - path?: never; - query?: never; - url: "/connectors"; -}; - -export type ListConnectorsErrors = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Unauthorized + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 401: Problem; + providerKind: "NOOP" | "STRIPE"; + reconciliationDetail: Reconciliation; /** - * Forbidden + * Earliest start of its lines' service periods */ - 403: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; -}; - -export type ListConnectorsError = ListConnectorsErrors[keyof ListConnectorsErrors]; - -export type ListConnectorsResponses = { + serviceTo: string; /** - * OK + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 200: Array | null; -}; - -export type ListConnectorsResponse = ListConnectorsResponses[keyof ListConnectorsResponses]; - -export type GetConnectorData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}"; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type GetConnectorErrors = { +export type NewAddon = { + description: string; /** - * Bad Request + * Make this a new version of this family */ - 400: Problem; + familyId?: string; /** - * Unauthorized + * Make this a new version of this family */ - 401: Problem; + familySlug?: string; /** - * Forbidden + * Make this version its family's default; the previous default loses it */ - 403: Problem; + isDefault?: boolean; + lifecycleState?: "DRAFT" | "PUBLISHED"; /** - * Not Found + * The largest quantity an instance can hold */ - 404: Problem; + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * Unprocessable Entity + * The version's slug. Default: {familySlug}-v{n} for a new version of a family, a slug generated from the name for a new family. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Default: Version - {n} */ - 500: Problem; + versionName?: string; }; -export type GetConnectorError = GetConnectorErrors[keyof GetConnectorErrors]; - -export type GetConnectorResponses = { +export type NewAddonGrant = { + entitlementSlug: string; /** - * OK + * The overage the add-on allows: -1 with an unlimited value, 0 or more otherwise. Absent inherits the licence grant's. */ - 200: Connector; -}; - -export type GetConnectorResponse = GetConnectorResponses[keyof GetConnectorResponses]; - -export type DeactivateConnectorData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; + limitCapExceededOveragePercent?: number; + /** + * How a number grant combines with the licence's + */ + overrideBehavior?: "ADD" | "OVERRIDE" | "MAX"; + /** + * {type, value}, shaped like a licence grant: a number counts once per unit of quantity + */ + value: { + [key: string]: unknown; }; - query?: never; - url: "/connectors/{connectorName}/activation"; }; -export type DeactivateConnectorErrors = { +export type NewAddonPrice = { + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Bad Request + * Required on a FLAT_FEE price: it bills subscriptions of that period. Refused on a metered one. */ - 400: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Unauthorized + * Defaults to ADVANCE for a FLAT_FEE price and ARREARS for a metered one, which must be ARREARS. */ - 401: Problem; + billingTiming?: "ADVANCE" | "ARREARS"; /** - * Forbidden + * ISO 4217 code, upper case. One currency per add-on version. */ - 403: Problem; + currency: string; + displayLabel?: string; + displayOrder?: number; /** - * Unprocessable Entity + * Makes this FLAT_FEE price the one that bills its period; the previous default of the period loses it. */ - 422: Problem; + isDefault?: boolean; /** - * Internal Server Error + * The entitlement a metered price measures: granted by the add-on version, with a reset period, SUM or COUNT, NUMBER or NUMBER_AI_CREDIT. */ - 500: Problem; -}; - -export type DeactivateConnectorError = DeactivateConnectorErrors[keyof DeactivateConnectorErrors]; - -export type DeactivateConnectorResponses = { + meteredEntitlementSlug?: string; /** - * No Content + * Amount in minor units: per unit and period for FLAT_FEE, per sale unit for metered prices. */ - 204: void; + unitAmountDecimal: string; }; -export type DeactivateConnectorResponse = - DeactivateConnectorResponses[keyof DeactivateConnectorResponses]; - -export type ActivateConnectorData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/activation"; +export type NewInstanceAddon = { + /** + * The add-on version to attach + */ + addonSlug: string; + quantity?: number; }; -export type ActivateConnectorErrors = { +export type NewLicensePrice = { /** - * Bad Request + * FLAT_FEE: an amount per billing period. USAGE_BASED: per sale unit of usage. OVERAGE: per sale unit of usage above the licence's limit. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * Required on a FLAT_FEE price, refused on a metered one (CreateLicensePrice.InvalidPeriod). */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Forbidden + * Defaults to ADVANCE for a FLAT_FEE price and ARREARS for a metered one, which must be ARREARS (CreateLicensePrice.InvalidTiming). */ - 403: Problem; + billingTiming?: "ADVANCE" | "ARREARS"; /** - * Not Found + * ISO 4217 code, upper case (CreateLicensePrice.InvalidCurrency). One currency per licence version (CreateLicensePrice.CurrencyMismatch). */ - 404: Problem; + currency: string; /** - * Unprocessable Entity + * The invoice line's label. */ - 422: Problem; + displayLabel?: string; /** - * Internal Server Error + * Order among the version's prices. */ - 500: Problem; + displayOrder?: number; /** - * Service Unavailable + * Makes this FLAT_FEE price the default of its billing period (CreateLicensePrice.DefaultConflict when another is). */ - 503: Problem; + isDefault?: boolean; + /** + * The entitlement a metered price measures: granted by the version, with a reset period, SUM or COUNT, NUMBER or NUMBER_AI_CREDIT, and metered by no other active price of the version. + */ + meteredEntitlementSlug?: string; + /** + * Amount in minor units: per period for FLAT_FEE, per sale unit for metered prices. A non-negative decimal of at most 12 integer digits and 12 decimal places (CreateLicensePrice.InvalidAmount). + */ + unitAmountDecimal: string; }; -export type ActivateConnectorError = ActivateConnectorErrors[keyof ActivateConnectorErrors]; - -export type ActivateConnectorResponses = { +export type NewPaymentMethodSession = { /** - * OK + * The currency the payment method is set up in; required when the customer has no live subscription, whose currency is used otherwise */ - 200: ConnectorActivation; + currency?: string; + /** + * Where the customer comes back to: https, or http on localhost. The session id is appended as kaiten_setup_session + */ + returnUrl: string; }; -export type ActivateConnectorResponse = - ActivateConnectorResponses[keyof ActivateConnectorResponses]; - -export type DeleteConnectorSettingsData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings"; +export type NewPortalSession = { + /** + * https, or http on localhost + */ + returnUrl: string; }; -export type DeleteConnectorSettingsErrors = { +export type NewSubscription = { /** - * Bad Request + * Add-ons to attach with the subscription, under the rules of POST /instances/{instanceSlug}/addons; the ACTIVATION invoice bills them. One refused refuses the subscribe: 422 SubscribeInstance.AddonInvalid, the add-on's own code in errors[0].value.code. */ - 400: Problem; + addOns?: Array | null; /** - * Unauthorized + * An ACTIVE FLAT_FEE price of the instance's licence version, which must be PUBLISHED. The subscription stays pinned to it, even once deprecated. */ - 401: Problem; + basePriceId: string; /** - * Forbidden + * Omitted: the organization's default, read at each invoice. CHARGE_AUTOMATICALLY needs a provider that charges automatically (SubscribeInstance.CollectionMethodUnsupported). */ - 403: Problem; + collectionMethod?: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * Payment terms in days, 0 to 365. Omitted: the organization's default, read at each invoice. */ - 422: Problem; + daysUntilDue?: number; /** - * Internal Server Error + * Who issues and collects the invoices. NOOP (the default): the organization itself, through the handoff queue. A provider must be connected (SubscribeInstance.ProviderNotConnected); one that pushes invoices needs the customer's billing e-mail for SEND_INVOICE (.BillingEmailMissing) and the price's currency (.UnsupportedCurrency), and registers the customer first. */ - 500: Problem; -}; - -export type DeleteConnectorSettingsError = - DeleteConnectorSettingsErrors[keyof DeleteConnectorSettingsErrors]; - -export type DeleteConnectorSettingsResponses = { + providerKind?: "NOOP" | "STRIPE"; /** - * No Content + * The anchor periods are counted from, truncated to the second: now when omitted, else at most one billing period ago. A period that has already ended closes on the next pass. */ - 204: void; -}; - -export type DeleteConnectorSettingsResponse = - DeleteConnectorSettingsResponses[keyof DeleteConnectorSettingsResponses]; - -export type GetConnectorSettingsData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings"; -}; - -export type GetConnectorSettingsErrors = { + startAt?: string; /** - * Bad Request + * Days of trial from the anchor: nothing is billed, and no usage counts, until it ends; the period close then issues the first invoice. 0 is no trial. Omitted: the licence's trialPeriodDays, else no trial. */ - 400: Problem; + trialDays?: number; /** - * Unauthorized + * A voucher to redeem with the subscription, once its add-ons are attached; a PRICE voucher applies from the ACTIVATION invoice. Refused: 422 SubscribeInstance.VoucherInvalid, the redemption's own code in errors[0].value.code. */ - 401: Problem; + voucherCode?: string; +}; + +export type Notification = { /** - * Forbidden + * Where clicking the notification goes */ - 403: Problem; + actionUrl?: string; /** - * Not Found + * Rendered detail line, when the event has one */ - 404: Problem; + body?: string; /** - * Unprocessable Entity + * When the event occurred */ - 422: Problem; + createdAt: string; /** - * Internal Server Error + * Event this notification reports */ - 500: Problem; -}; - -export type GetConnectorSettingsError = - GetConnectorSettingsErrors[keyof GetConnectorSettingsErrors]; - -export type GetConnectorSettingsResponses = { + eventName: string; /** - * OK + * CloudEvents type of the same event -- the key it is published under in this document's webhooks section, so a client can line a notification up with the payload schema and the description already published there */ - 200: ConnectorSettings; -}; - -export type GetConnectorSettingsResponse = - GetConnectorSettingsResponses[keyof GetConnectorSettingsResponses]; - -export type UpdateConnectorSettingsData = { + eventType: string; /** - * Connector settings payload to upsert + * Identifier of the underlying audit trail entry */ - body: ConnectorSettingsWritable; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings"; -}; - -export type UpdateConnectorSettingsErrors = { + id: string; /** - * Bad Request + * What the notification is about -- the kind of page actionUrl opens, and what the list's objectType filter matches */ - 400: Problem; + objectType: string; /** - * Unauthorized + * When this user read it; absent means unread */ - 401: Problem; + readAt?: string; /** - * Forbidden + * Rendered headline */ - 403: Problem; + title: string; +}; + +export type NumberEntitlementValue = { /** - * Not Found + * Number of events accumulated (server-computed) */ - 404: Problem; + readonly event_count?: number; /** - * Unprocessable Entity + * Value type discriminator */ - 422: Problem; + type: "number"; /** - * Internal Server Error + * Numeric value */ - 500: Problem; + value: number; }; -export type UpdateConnectorSettingsError = - UpdateConnectorSettingsErrors[keyof UpdateConnectorSettingsErrors]; - -export type UpdateConnectorSettingsResponses = { +export type Outcome = { /** - * OK + * Invoices read and applied */ - 200: ConnectorSettings; -}; - -export type UpdateConnectorSettingsResponse = - UpdateConnectorSettingsResponses[keyof UpdateConnectorSettingsResponses]; - -export type GetConnectorSettingsSchemaData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/settings/schema"; -}; - -export type GetConnectorSettingsSchemaErrors = { + applied: number; + error?: string; /** - * Bad Request + * Invoices that could not be read or applied */ - 400: Problem; + failed: number; + providerKind: "NOOP" | "STRIPE"; + status: "SUCCESS" | "PARTIAL" | "FAILED"; + syncedAt: string; +}; + +export type OverageLimit = { /** - * Unauthorized + * The limit, null when unlimited */ - 401: Problem; + limitValue: string | null; /** - * Forbidden + * Usage accepted above the limit, as a percent of it */ - 403: Problem; + overagePercent: number; /** - * Not Found + * Usage reports measured against it; 0 for a sample */ - 404: Problem; + rows: number; +}; + +export type PageAuditTrail = { /** - * Unprocessable Entity + * Whether more rows exist beyond this page. */ - 422: Problem; + hasMore: boolean; + items: Array; /** - * Internal Server Error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: Problem; + nextCursor?: string; }; -export type GetConnectorSettingsSchemaError = - GetConnectorSettingsSchemaErrors[keyof GetConnectorSettingsSchemaErrors]; - -export type GetConnectorSettingsSchemaResponses = { +export type PageComponent = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: ConnectorSettingsSchema; -}; - -export type GetConnectorSettingsSchemaResponse = - GetConnectorSettingsSchemaResponses[keyof GetConnectorSettingsSchemaResponses]; - -export type GetConnectorStateData = { - body?: never; - path: { - /** - * Stable connector name - */ - connectorName: string; - }; - query?: never; - url: "/connectors/{connectorName}/state"; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type GetConnectorStateErrors = { +export type PageCustomer = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageDeploymentZone = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageEntitlement = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; /** - * Service Unavailable + * Opaque cursor for the next page. Absent when hasMore is false. */ - 503: Problem; + nextCursor?: string; }; -export type GetConnectorStateError = GetConnectorStateErrors[keyof GetConnectorStateErrors]; - -export type GetConnectorStateResponses = { +export type PageEntitlementGroup = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: ConnectorState; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type GetConnectorStateResponse = - GetConnectorStateResponses[keyof GetConnectorStateResponses]; - -export type ListCustomersData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/customers"; +export type PageFeatureFlag = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListCustomersErrors = { +export type PageInstance = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageInvoiceSummary = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageLicense = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListCustomersError = ListCustomersErrors[keyof ListCustomersErrors]; - -export type ListCustomersResponses = { +export type PageLicenseEntitlement = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: PageCustomer; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListCustomersResponse = ListCustomersResponses[keyof ListCustomersResponses]; - -export type CreateCustomerData = { - body: CustomerWritable; - path?: never; - query?: never; - url: "/customers"; +export type PageLicenseFamilyView = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateCustomerErrors = { +export type PageMetadataField = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageQueuedInvoice = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Not Found + * Opaque cursor for the next page. Absent when hasMore is false. */ - 404: Problem; + nextCursor?: string; +}; + +export type PageRelease = { /** - * Conflict + * Whether more rows exist beyond this page. */ - 409: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageServiceAccount = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; /** - * Service Unavailable + * Opaque cursor for the next page. Absent when hasMore is false. */ - 503: Problem; + nextCursor?: string; }; -export type CreateCustomerError = CreateCustomerErrors[keyof CreateCustomerErrors]; - -export type CreateCustomerResponses = { +export type PageSessionInvoice = { /** - * Created + * Whether more rows exist beyond this page. */ - 201: Customer; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateCustomerResponse = CreateCustomerResponses[keyof CreateCustomerResponses]; - -export type DeleteCustomerData = { - body?: never; - path: { - customerSlug: string; - }; - query?: never; - url: "/customers/{customerSlug}"; +export type PageToken = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type DeleteCustomerErrors = { +export type PaidInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; + externalReference?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type DeleteCustomerError = DeleteCustomerErrors[keyof DeleteCustomerErrors]; - -export type DeleteCustomerResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * No Content + * The invoice's identifier: the key an accounting system deduplicates on */ - 204: void; -}; - -export type DeleteCustomerResponse = DeleteCustomerResponses[keyof DeleteCustomerResponses]; - -export type GetCustomerData = { - body?: never; - path: { - customerSlug: string; - }; - query?: never; - url: "/customers/{customerSlug}"; -}; - -export type GetCustomerErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; /** - * Forbidden + * The note given when it was marked paid, kept only here */ - 403: Problem; + note?: string; + paidAt?: string; /** - * Not Found + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 404: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unprocessable Entity + * Earliest start of its lines' service periods */ - 422: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; + serviceTo: string; + /** + * MARK_PAID: recorded by the organization. ZERO_TOTAL: nothing was owed + */ + source: "MARK_PAID" | "PROVIDER" | "ZERO_TOTAL"; + /** + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose + */ + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors]; - -export type GetCustomerResponses = { +export type PatchInstanceBody = { /** - * OK + * Commercial lifecycle stage (free-form; suggested: TRIAL, ACTIVE, AT_RISK, CHURNED). When omitted, the current stage is preserved; clearing it back to unset is not supported. */ - 200: Customer; + lifecycleStage?: string; + /** + * Operational status of the instance + */ + status?: "HEALTHY" | "DEGRADED" | "INCIDENT" | "MAINTENANCE"; }; -export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses]; - -export type UpdateCustomerData = { - body: CustomerWritable; - path: { - customerSlug: string; - }; - query?: never; - url: "/customers/{customerSlug}"; +export type Payment = { + hostedInvoiceUrl?: string; + /** + * paid. requires_action: the customer must confirm the payment on hostedInvoiceUrl. failed: the charge was refused; save another payment method, or pay on hostedInvoiceUrl. processing: the outcome is not known yet; poll GET /public/session/invoices. not_required: nothing is due today. + */ + status: "paid" | "requires_action" | "failed" | "processing" | "not_required"; }; -export type UpdateCustomerErrors = { +export type PaymentFailedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * The provider's decline or failure code, such as card_declined, expired_card, authentication_required or no_payment_method */ - 422: Problem; + failureCode: string; /** - * Internal Server Error + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 500: Problem; -}; - -export type UpdateCustomerError = UpdateCustomerErrors[keyof UpdateCustomerErrors]; - -export type UpdateCustomerResponses = { + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * No Content + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 204: void; -}; - -export type UpdateCustomerResponse = UpdateCustomerResponses[keyof UpdateCustomerResponses]; - -export type DeleteCustomerIntegrationData = { - body?: never; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; -}; - -export type DeleteCustomerIntegrationErrors = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Bad Request + * The invoice's identifier: the key an accounting system deduplicates on */ - 400: Problem; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Forbidden + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Not Found + * The customer must authenticate the payment on the invoice's hosted page */ - 404: Problem; + requiresAction: boolean; /** - * Unprocessable Entity + * Earliest start of its lines' service periods */ - 422: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; -}; - -export type DeleteCustomerIntegrationError = - DeleteCustomerIntegrationErrors[keyof DeleteCustomerIntegrationErrors]; - -export type DeleteCustomerIntegrationResponses = { + serviceTo: string; /** - * No Content + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 204: void; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type DeleteCustomerIntegrationResponse = - DeleteCustomerIntegrationResponses[keyof DeleteCustomerIntegrationResponses]; +export type PaymentMethodAttached = { + attachedAt: string; + customerSlug: string; + providerKind: "STRIPE"; + status: "ACTIVE"; +}; -export type GetCustomerIntegrationData = { - body?: never; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; +export type PaymentMethodDetached = { + customerSlug: string; + providerKind: "STRIPE"; }; -export type GetCustomerIntegrationErrors = { +export type PaymentMethodExpiring = { + customerSlug: string; /** - * Unauthorized + * The last instant of the payment method's expiry month */ - 401: Problem; + expiresAt: string; + providerKind: "STRIPE"; +}; + +export type PaymentMethodLabels = { + attachedAt?: string; + brand?: string; + expMonth?: number; + expYear?: number; + last4?: string; /** - * Forbidden + * ACTIVE: charged automatically. EXPIRED, FAILED: a charge said it is no longer usable; save another one */ - 403: Problem; + status: "ACTIVE" | "EXPIRED" | "FAILED"; +}; + +export type PaymentMethodSession = { + expiresAt: string; /** - * Not Found + * Complete it with POST …/payment-method-session/{sessionId}/complete once the customer is back */ - 404: Problem; + sessionId: string; /** - * Unprocessable Entity + * The provider's page; send the customer there */ - 422: Problem; + url: string; +}; + +export type PlainToken = { + readonly createdAt: string; + readonly createdBy: User; + expiresAt?: string; + readonly id?: string; + name: string; + readonly revokedAt?: string; + readonly revokedBy?: User; + scopes: Array | null; + readonly serviceAccountId?: string; /** - * Internal Server Error + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. */ - 500: Problem; + slug?: string; + readonly token?: string; }; -export type GetCustomerIntegrationError = - GetCustomerIntegrationErrors[keyof GetCustomerIntegrationErrors]; - -export type GetCustomerIntegrationResponses = { +export type PlanChange = { + fromLicenseSlug: string; + fromPriceId: string; + instanceSlug: string; /** - * OK + * The RENEWAL that billed the old plan's arrears and the new plan's advance */ - 200: CustomerIntegration; + invoiceId: string; + toLicenseSlug: string; + toPriceId: string; }; -export type GetCustomerIntegrationResponse = - GetCustomerIntegrationResponses[keyof GetCustomerIntegrationResponses]; +export type PlanChangeSchedule = { + effectiveAt: string; + fromPriceId: string; + instanceSlug: string; + toPriceId: string; +}; -export type CreateCustomerIntegrationData = { +export type PlanChangeTarget = { /** - * Integration payload + * An ACTIVE FLAT_FEE price of a PUBLISHED licence version, in the subscription's currency */ - body: CustomerIntegrationWritable; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; + licensePriceId: string; }; -export type CreateCustomerIntegrationErrors = { +export type PortalSession = { + url: string; +}; + +export type PreferenceChoices = { /** - * Bad Request + * Events to set; events left out keep their current value */ - 400: Problem; + events: Array | null; +}; + +export type PreferenceEvent = { /** - * Unauthorized + * Effective value per channel */ - 401: Problem; + channels: { + [key: string]: boolean; + }; + eventName: string; /** - * Forbidden + * CloudEvents type of the same event; see Notification.eventType */ - 403: Problem; + eventType: string; /** - * Not Found + * Catalogue group the client renders this under */ - 404: Problem; + group: string; /** - * Conflict + * Human-readable event name */ - 409: Problem; + label: string; +}; + +export type PreferenceMatrix = { /** - * Unprocessable Entity + * Channels this deployment serves, in display order */ - 422: Problem; + channels: Array; /** - * Internal Server Error + * Every notifiable event */ - 500: Problem; + events: Array; }; -export type CreateCustomerIntegrationError = - CreateCustomerIntegrationErrors[keyof CreateCustomerIntegrationErrors]; +export type PreferenceUpdate = { + channels: { + [key: string]: boolean; + }; + eventName: string; +}; -export type CreateCustomerIntegrationResponses = { +export type Price = { /** - * Created + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 201: CustomerIntegration; -}; - -export type CreateCustomerIntegrationResponse = - CreateCustomerIntegrationResponses[keyof CreateCustomerIntegrationResponses]; - -export type UpdateCustomerIntegrationData = { + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Integration payload + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - body: CustomerIntegrationWritable; - path: { - /** - * Customer slug - */ - customerSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/customers/{customerSlug}/integrations/{integrationName}"; -}; - -export type UpdateCustomerIntegrationErrors = { + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Bad Request + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 400: Problem; + billingTiming: "ADVANCE" | "ARREARS"; + readonly createdAt: string; /** - * Unauthorized + * ISO 4217 code, upper case. One currency per licence version. */ - 401: Problem; + currency: string; /** - * Forbidden + * When the price was deprecated */ - 403: Problem; + deprecatedAt?: string; /** - * Not Found + * The invoice line's label; a default is derived when absent. */ - 404: Problem; + displayLabel?: string; /** - * Conflict + * Order among the version's prices */ - 409: Problem; + displayOrder: number; /** - * Unprocessable Entity + * Unique identifier of the price */ - 422: Problem; + readonly id: string; /** - * Internal Server Error + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 500: Problem; -}; - -export type UpdateCustomerIntegrationError = - UpdateCustomerIntegrationErrors[keyof UpdateCustomerIntegrationErrors]; - -export type UpdateCustomerIntegrationResponses = { + isDefault: boolean; /** - * OK + * What a metered price measures. Absent on FLAT_FEE prices. */ - 200: CustomerIntegration; -}; - -export type UpdateCustomerIntegrationResponse = - UpdateCustomerIntegrationResponses[keyof UpdateCustomerIntegrationResponses]; - -export type ListDeploymentZonesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/deployment-zones"; -}; - -export type ListDeploymentZonesErrors = { + metered?: Meter; /** - * Bad Request + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 400: Problem; + status: "ACTIVE" | "DEPRECATED"; /** - * Unauthorized + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 401: Problem; + unitAmount?: number; /** - * Forbidden + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - 403: Problem; + unitAmountDecimal: string; + readonly updatedAt: string; +}; + +export type Problem = { /** - * Unprocessable Entity + * Stable, machine-readable error code. */ - 422: Problem; + code?: string; /** - * Internal Server Error + * A human-readable explanation specific to this occurrence of the problem. */ - 500: Problem; -}; - -export type ListDeploymentZonesError = ListDeploymentZonesErrors[keyof ListDeploymentZonesErrors]; - -export type ListDeploymentZonesResponses = { + detail?: string; /** - * OK + * Correlation id for the server-side log entry describing the withheld cause. */ - 200: PageDeploymentZone; + errorId?: string; + /** + * Optional list of individual error details + */ + errors?: Array | null; + /** + * A URI reference that identifies the specific occurrence of the problem. + */ + instance?: string; + /** + * HTTP status code + */ + status?: number; + /** + * A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + */ + title?: string; + /** + * A URI reference to human-readable documentation for the error. + */ + type?: string; }; -export type ListDeploymentZonesResponse = - ListDeploymentZonesResponses[keyof ListDeploymentZonesResponses]; +export type ProviderCapabilities = { + automaticCollection: boolean; + billingPortal: boolean; + paymentMethodCapture: boolean; +}; -export type CreateDeploymentZoneData = { - body: DeploymentZoneWritable; - path?: never; - query?: never; - url: "/deployment-zones"; +export type ProviderChange = { + /** + * Invoices already composed keep their provider + */ + effectiveFrom: "next_composition"; + from: "NOOP" | "STRIPE"; + instanceSlug: string; + to: "NOOP" | "STRIPE"; }; -export type CreateDeploymentZoneErrors = { +export type ProviderRecord = { + externalCustomerId?: string; + externalInvoiceId?: string; + hostedInvoiceUrl?: string; /** - * Bad Request + * The provider's invoice number */ - 400: Problem; + invoiceNumber?: string; + invoicePdfUrl?: string; /** - * Unauthorized + * Why the last automatic charge failed, as the provider coded it: authentication_required (the customer must confirm the payment on the hosted invoice page), card_declined, expired_card, no_payment_method... */ - 401: Problem; + lastPaymentError?: string; /** - * Forbidden + * The provider's code and message of the last failed push step */ - 403: Problem; + lastPushError?: string; /** - * Conflict + * When the push queue tries it next; absent when it waits for a human (finalization in the provider) or is pushed */ - 409: Problem; + nextPushAt?: string; + pushAttempts: number; + pushedAt?: string; + reconciledAt?: string; /** - * Unprocessable Entity + * What differs, on a MISMATCH */ - 422: Problem; + reconciliationDetail?: Reconciliation; + reconciliationStatus?: "MATCHED" | "MISMATCH"; /** - * Internal Server Error + * The provider's status, mirrored verbatim */ - 500: Problem; + status?: "draft" | "open" | "paid" | "uncollectible" | "void"; + syncedAt?: string; /** - * Service Unavailable + * The provider's total excluding tax, read back */ - 503: Problem; + totalExcludingTax?: number; }; -export type CreateDeploymentZoneError = - CreateDeploymentZoneErrors[keyof CreateDeploymentZoneErrors]; - -export type CreateDeploymentZoneResponses = { +export type ProviderSync = { + consecutiveFailures: number; /** - * Created + * Seconds since the last pass */ - 201: DeploymentZone; -}; - -export type CreateDeploymentZoneResponse = - CreateDeploymentZoneResponses[keyof CreateDeploymentZoneResponses]; - -export type DeleteDeploymentZoneData = { - body?: never; - path: { - deploymentZoneSlug: string; - }; - query?: never; - url: "/deployment-zones/{deploymentZoneSlug}"; + lagSeconds?: number; + lastFullSweepAt?: string; + lastSyncError?: string; + lastSyncStatus?: "SUCCESS" | "PARTIAL" | "FAILED"; + lastSyncedAt?: string; + providerKind: "NOOP" | "STRIPE"; }; -export type DeleteDeploymentZoneErrors = { +export type PublicAddOn = { + addonId: string; + addonSlug: string; /** - * Bad Request + * Public licence families this add-on fits */ - 400: Problem; + compatibleLicenseFamilies: Array; + description: string; /** - * Unauthorized + * User-facing entitlements one unit grants */ - 401: Problem; + entitlements: Array; + familySlug: string; /** - * Forbidden + * Most units one instance may attach; null when unbounded */ - 403: Problem; + maxQuantity: number | null; + name: string; + prices: Array; + pricingType: "FREE" | "PAID" | "CUSTOM"; +}; + +export type PublicAddOnEntitlement = { + limitCapExceededOveragePercent?: number; + name: string; /** - * Not Found + * How the grant combines with the plan's: added to it, replacing it, or the larger of the two */ - 404: Problem; + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; + slug: string; + type: "BOOLEAN" | "NUMBER" | "CONFIG"; + value: unknown; +}; + +export type PublicCatalog = { /** - * Unprocessable Entity + * The default version of each public add-on family; empty when include omits addons */ - 422: Problem; + addOns: Array; + capabilities: PublicCatalogCapabilities; /** - * Internal Server Error + * The default version of each public licence family, by family slug */ - 500: Problem; + plans: Array; }; -export type DeleteDeploymentZoneError = - DeleteDeploymentZoneErrors[keyof DeleteDeploymentZoneErrors]; - -export type DeleteDeploymentZoneResponses = { +export type PublicCatalogCapabilities = { /** - * No Content + * Whether self-serve checkout is available through the public surface. False in this release: checkout ships with customer sessions. */ - 204: void; + checkout: boolean; + /** + * Whether the organization's billing provider captures payment methods + */ + paymentMethods: boolean; }; -export type DeleteDeploymentZoneResponse = - DeleteDeploymentZoneResponses[keyof DeleteDeploymentZoneResponses]; - -export type GetDeploymentZoneBySlugData = { - body?: never; - path: { - deploymentZoneSlug: string; - }; - query?: never; - url: "/deployment-zones/{deploymentZoneSlug}"; +export type PublicMeter = { + entitlementSlug: string; + /** + * Measured units in one sale unit + */ + saleUnitFactor: string; + saleUnitPlural?: string; + saleUnitSingular?: string; }; -export type GetDeploymentZoneBySlugErrors = { +export type PublicPlan = { /** - * Unauthorized + * Public add-on families whose listed version fits this plan */ - 401: Problem; + compatibleAddonFamilies: Array; /** - * Forbidden + * ISO 4217 code of the plan's prices; null when it has none */ - 403: Problem; + currency: string | null; + description: string; /** - * Not Found + * User-facing entitlements the plan grants, in display order */ - 404: Problem; + entitlements: Array; + familySlug: string; + licenseId: string; /** - * Unprocessable Entity + * The version's own slug */ - 422: Problem; + licenseSlug: string; /** - * Internal Server Error + * Always PUBLISHED: only the default version is listed, and a default version is published */ - 500: Problem; -}; - -export type GetDeploymentZoneBySlugError = - GetDeploymentZoneBySlugErrors[keyof GetDeploymentZoneBySlugErrors]; - -export type GetDeploymentZoneBySlugResponses = { + lifecycleState: "PUBLISHED"; + name: string; /** - * OK + * ACTIVE prices, in display order */ - 200: DeploymentZone; + prices: Array; + /** + * CUSTOM: priced on request; render selfServeCtaUrl + */ + pricingType: "FREE" | "PAID" | "CUSTOM"; + /** + * A card is captured before subscribing, even when nothing is due + */ + requiresPaymentMethod: boolean; + /** + * Whether a customer can subscribe to this plan alone: not CUSTOM, with a default ACTIVE flat-fee price, and either FREE or sold through a provider that captures payment methods. Otherwise render selfServeCtaUrl. + */ + selfServe: boolean; + /** + * Where to send a customer who cannot subscribe alone ("Contact us") + */ + selfServeCtaUrl: string | null; + /** + * Length of the free trial; null when the plan has none + */ + trialPeriodDays: number | null; }; -export type GetDeploymentZoneBySlugResponse = - GetDeploymentZoneBySlugResponses[keyof GetDeploymentZoneBySlugResponses]; - -export type UpdateDeploymentZoneData = { - body: DeploymentZoneWritable; - path: { - deploymentZoneSlug: string; - }; - query?: never; - url: "/deployment-zones/{deploymentZoneSlug}"; +export type PublicPlanEntitlement = { + description?: string; + displayOrder: number; + icon?: string; + /** + * How far usage may exceed a NUMBER grant before it is refused: 0 is a hard limit, -1 is unlimited; absent for other types + */ + limitCapExceededOveragePercent?: number; + name: string; + saleUnitFactor?: string; + saleUnitPlural?: string; + saleUnitSingular?: string; + slug: string; + type: "BOOLEAN" | "NUMBER" | "CONFIG"; + unitPlural?: string; + unitSingular?: string; + /** + * A NUMBER grant with no limit + */ + unlimited: boolean; + /** + * The granted value: a boolean, a number, or a configuration object + */ + value: unknown; }; -export type UpdateDeploymentZoneErrors = { +export type PublicPrice = { /** - * Bad Request + * FLAT_FEE: per billing period. USAGE_BASED: per sale unit of usage. OVERAGE: per sale unit of usage above the limit. Never sum metered prices into a headline. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * The period a FLAT_FEE price is charged for; absent on metered prices */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + billingTiming: "ADVANCE" | "ARREARS"; + currency: string; + displayLabel?: string; + displayOrder: number; + id: string; /** - * Forbidden + * The FLAT_FEE price shown for its billing period */ - 403: Problem; + isDefault: boolean; /** - * Not Found + * What a metered price measures; absent on FLAT_FEE prices */ - 404: Problem; + metered?: PublicMeter; /** - * Unprocessable Entity + * The amount in minor units, when it is a whole number of them; absent otherwise (render unitAmountDecimal) */ - 422: Problem; + unitAmount?: number; /** - * Internal Server Error + * The amount in minor units, up to 12 decimal places */ - 500: Problem; + unitAmountDecimal: string; }; -export type UpdateDeploymentZoneError = - UpdateDeploymentZoneErrors[keyof UpdateDeploymentZoneErrors]; +export type PublicSurface = { + enabled: boolean; +}; -export type UpdateDeploymentZoneResponses = { +export type PublishableKey = { /** - * No Content + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. */ - 204: void; -}; - -export type UpdateDeploymentZoneResponse = - UpdateDeploymentZoneResponses[keyof UpdateDeploymentZoneResponses]; - -export type ListEntitlementGroupsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/entitlement-groups"; -}; - -export type ListEntitlementGroupsErrors = { + allowedOrigins: Array; + readonly createdAt: string; /** - * Bad Request + * Unique identifier of the key */ - 400: Problem; + readonly id: string; /** - * Unauthorized + * The last four characters of the key */ - 401: Problem; + readonly keyHint: string; /** - * Forbidden + * What the key is for, to tell keys apart */ - 403: Problem; + label: string; /** - * Unprocessable Entity + * When the key last authenticated a request, to the minute */ - 422: Problem; + readonly lastUsedAt?: string; /** - * Internal Server Error + * When the key was revoked; absent while it is live */ - 500: Problem; + readonly revokedAt?: string; + readonly updatedAt: string; }; -export type ListEntitlementGroupsError = - ListEntitlementGroupsErrors[keyof ListEntitlementGroupsErrors]; - -export type ListEntitlementGroupsResponses = { +export type PublishableKeyCreated = { /** - * OK + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. */ - 200: PageEntitlementGroup; -}; - -export type ListEntitlementGroupsResponse = - ListEntitlementGroupsResponses[keyof ListEntitlementGroupsResponses]; - -export type CreateEntitlementGroupData = { - body: EntitlementGroupWritable; - path?: never; - query?: never; - url: "/entitlement-groups"; -}; - -export type CreateEntitlementGroupErrors = { - /** - * Bad Request - */ - 400: Problem; + allowedOrigins: Array; + readonly createdAt: string; /** - * Unauthorized + * Unique identifier of the key */ - 401: Problem; + readonly id: string; /** - * Forbidden + * The key itself. Shown once: only its digest is stored. */ - 403: Problem; + readonly key: string; /** - * Conflict + * The last four characters of the key */ - 409: Problem; + readonly keyHint: string; /** - * Unprocessable Entity + * What the key is for, to tell keys apart */ - 422: Problem; + label: string; /** - * Internal Server Error + * When the key last authenticated a request, to the minute */ - 500: Problem; + readonly lastUsedAt?: string; /** - * Service Unavailable + * When the key was revoked; absent while it is live */ - 503: Problem; + readonly revokedAt?: string; + readonly updatedAt: string; }; -export type CreateEntitlementGroupError = - CreateEntitlementGroupErrors[keyof CreateEntitlementGroupErrors]; - -export type CreateEntitlementGroupResponses = { +export type PublishableKeyDraft = { /** - * Created + * Browser origins allowed to send the key, as scheme://host[:port]: https, or http for localhost. Empty: no browser origin may. */ - 201: EntitlementGroup; + allowedOrigins: Array; + /** + * What the key is for + */ + label: string; }; -export type CreateEntitlementGroupResponse = - CreateEntitlementGroupResponses[keyof CreateEntitlementGroupResponses]; - -export type DeleteEntitlementGroupData = { - body?: never; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}"; +export type PublishableKeyPatch = { + /** + * Replaces the allowed browser origins. Takes effect on the next request. + */ + allowedOrigins?: Array; + /** + * What the key is for + */ + label?: string; }; -export type DeleteEntitlementGroupErrors = { +export type PushFailedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type DeleteEntitlementGroupError = - DeleteEntitlementGroupErrors[keyof DeleteEntitlementGroupErrors]; - -export type DeleteEntitlementGroupResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * No Content + * The invoice's identifier: the key an accounting system deduplicates on */ - 204: void; -}; - -export type DeleteEntitlementGroupResponse = - DeleteEntitlementGroupResponses[keyof DeleteEntitlementGroupResponses]; - -export type GetEntitlementGroupData = { - body?: never; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}"; -}; - -export type GetEntitlementGroupErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; /** - * Forbidden + * The provider's code and message, never a request body */ - 403: Problem; + lastPushError: string; + licenseSlug: string; + paidAt?: string; /** - * Not Found + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 404: Problem; + providerKind: "NOOP" | "STRIPE"; + pushAttempts: number; /** - * Unprocessable Entity + * Earliest start of its lines' service periods */ - 422: Problem; + serviceFrom: string; /** - * Internal Server Error + * Latest end of its lines' service periods */ - 500: Problem; -}; - -export type GetEntitlementGroupError = GetEntitlementGroupErrors[keyof GetEntitlementGroupErrors]; - -export type GetEntitlementGroupResponses = { + serviceTo: string; /** - * OK + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 200: EntitlementGroup; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; + /** + * Sum of the lines, in minor units + */ + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type GetEntitlementGroupResponse = - GetEntitlementGroupResponses[keyof GetEntitlementGroupResponses]; - -export type UpdateEntitlementGroupData = { - body: EntitlementGroupWritable; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}"; +export type PushFailures = { + count: number; + oldestFailedAt?: string; }; -export type UpdateEntitlementGroupErrors = { +export type PushedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; + externalInvoiceId: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type UpdateEntitlementGroupError = - UpdateEntitlementGroupErrors[keyof UpdateEntitlementGroupErrors]; - -export type UpdateEntitlementGroupResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * No Content + * The invoice's identifier: the key an accounting system deduplicates on */ - 204: void; -}; - -export type UpdateEntitlementGroupResponse = - UpdateEntitlementGroupResponses[keyof UpdateEntitlementGroupResponses]; - -export type AddEntitlementToGroupData = { - body: Command; - path: { - entitlementGroupSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}/entitlements"; -}; - -export type AddEntitlementToGroupErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Bad Request + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 400: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; + providerInvoiceNumber?: string; /** - * Unauthorized + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 401: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Forbidden + * Earliest start of its lines' service periods */ - 403: Problem; + serviceFrom: string; /** - * Not Found + * Latest end of its lines' service periods */ - 404: Problem; + serviceTo: string; /** - * Conflict + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 409: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Unprocessable Entity + * Sum of the lines, in minor units */ - 422: Problem; + subtotal: number; /** - * Internal Server Error + * subtotal − discountTotal, in minor units */ - 500: Problem; + total: number; + updatedAt: string; }; -export type AddEntitlementToGroupError = - AddEntitlementToGroupErrors[keyof AddEntitlementToGroupErrors]; - -export type AddEntitlementToGroupResponses = { +export type QueuedInvoice = { /** - * Created + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 201: unknown; -}; - -export type RemoveEntitlementFromGroupData = { - body?: never; - path: { - entitlementGroupSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}"; -}; - -export type RemoveEntitlementFromGroupErrors = { + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Bad Request + * As it was when the invoice was composed */ - 400: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Unauthorized + * Sum of the discounts, in minor units */ - 401: Problem; + discountTotal: number; /** - * Forbidden + * issuedAt + daysUntilDue */ - 403: Problem; + dueAt?: string; + handoff: Handoff; /** - * Not Found + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 404: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Unprocessable Entity + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 422: Problem; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Internal Server Error + * The invoice's identifier: the key an accounting system deduplicates on */ - 500: Problem; -}; - -export type RemoveEntitlementFromGroupError = - RemoveEntitlementFromGroupErrors[keyof RemoveEntitlementFromGroupErrors]; - -export type RemoveEntitlementFromGroupResponses = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * No Content + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 204: void; -}; - -export type RemoveEntitlementFromGroupResponse = - RemoveEntitlementFromGroupResponses[keyof RemoveEntitlementFromGroupResponses]; - -export type GetEntitlementGroupUsageData = { - body?: never; - path: { - entitlementGroupSlug: string; - }; - query: { - /** - * Instance slug to get usage for - */ - instance: string; - }; - url: "/entitlement-groups/{entitlementGroupSlug}/usage"; -}; - -export type GetEntitlementGroupUsageErrors = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Bad Request + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 400: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unauthorized + * Earliest start of its lines' service periods */ - 401: Problem; + serviceFrom: string; /** - * Forbidden + * Latest end of its lines' service periods */ - 403: Problem; + serviceTo: string; /** - * Not Found + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 404: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Unprocessable Entity + * Sum of the lines, in minor units */ - 422: Problem; - /** - * Internal Server Error - */ - 500: Problem; -}; - -export type GetEntitlementGroupUsageError = - GetEntitlementGroupUsageErrors[keyof GetEntitlementGroupUsageErrors]; - -export type GetEntitlementGroupUsageResponses = { + subtotal: number; /** - * OK + * subtotal − discountTotal, in minor units */ - 200: Array | null; -}; - -export type GetEntitlementGroupUsageResponse = - GetEntitlementGroupUsageResponses[keyof GetEntitlementGroupUsageResponses]; - -export type ListEntitlementsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/entitlements"; + total: number; + updatedAt: string; }; -export type ListEntitlementsErrors = { - /** - * Bad Request - */ - 400: Problem; +export type ReadSelection = { /** - * Unauthorized + * Mark every notification read, up to now */ - 401: Problem; + all?: boolean; /** - * Forbidden + * Notifications to mark read */ - 403: Problem; + ids?: Array | null; +}; + +export type Reconciliation = { /** - * Unprocessable Entity + * Provider lines Kaiten does not have */ - 422: Problem; + extraInProvider: Array; /** - * Internal Server Error + * Whether the provider's subtotal was compared, its tax being included in the amounts */ - 500: Problem; -}; - -export type ListEntitlementsError = ListEntitlementsErrors[keyof ListEntitlementsErrors]; - -export type ListEntitlementsResponses = { + inclusiveTax: boolean; + lines: Array; /** - * OK + * Kaiten lines the provider does not have */ - 200: PageEntitlement; + missingInProvider: Array; + totals: TotalsDifference; }; -export type ListEntitlementsResponse = ListEntitlementsResponses[keyof ListEntitlementsResponses]; - -export type CreateEntitlementData = { - body: EntitlementWritable; - path?: never; - query?: never; - url: "/entitlements"; +export type RedeemableCode = { + code: string; }; -export type CreateEntitlementErrors = { - /** - * Bad Request - */ - 400: Problem; - /** - * Unauthorized - */ - 401: Problem; +export type Redemption = { /** - * Forbidden + * Invoices a PRICE voucher discounted */ - 403: Problem; + applicationsCount: number; /** - * Not Found + * 1 for ONE_TIME, durationInPeriods for REPEATING; absent for FOREVER */ - 404: Problem; + applicationsMax?: number; + codeHint: string; /** - * Conflict + * When a boost stops applying; absent for a PRICE voucher, counted in invoices, and for FOREVER */ - 409: Problem; + effectiveExpiresAt?: string; + effectiveStartsAt: string; + expiredAt?: string; + readonly id: string; + instanceSlug: string; + redeemedAt: string; + revokedAt?: string; + revokedReason?: string; + status: "ACTIVE" | "EXPIRED" | "REVOKED"; + voucherId: string; + voucherName: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; +}; + +export type RedemptionRules = { /** - * Unprocessable Entity + * Only for an instance with a live ANNUAL subscription */ - 422: Problem; + annualOnly?: boolean; /** - * Internal Server Error + * Only for a customer none of whose instances has paid an invoice */ - 500: Problem; + firstTimeOnly?: boolean; /** - * Service Unavailable + * Only for a live subscription whose base price is at least this */ - 503: Problem; + minimumSubscriptionAmount?: MinimumAmount; }; -export type CreateEntitlementError = CreateEntitlementErrors[keyof CreateEntitlementErrors]; - -export type CreateEntitlementResponses = { +export type Release = { /** - * Created + * List of components included in this release, fixed at creation */ - 201: Entitlement; -}; - -export type CreateEntitlementResponse = - CreateEntitlementResponses[keyof CreateEntitlementResponses]; - -export type DeleteEntitlementData = { - body?: never; - path: { - entitlementSlug: string; - }; - query?: never; - url: "/entitlements/{entitlementSlug}"; -}; - -export type DeleteEntitlementErrors = { + readonly components?: Array | null; /** - * Bad Request + * Timestamp when the release was created */ - 400: Problem; + readonly createdAt: string; /** - * Unauthorized + * User who created this release */ - 401: Problem; + readonly createdBy: User; /** - * Forbidden + * Description of the release */ - 403: Problem; + description?: string; /** - * Not Found + * Unique identifier for the release */ - 404: Problem; + readonly id: string; /** - * Unprocessable Entity + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Version of the release */ - 500: Problem; + version: string; }; -export type DeleteEntitlementError = DeleteEntitlementErrors[keyof DeleteEntitlementErrors]; - -export type DeleteEntitlementResponses = { +export type ReleasedInvoice = { /** - * No Content + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 204: void; -}; - -export type DeleteEntitlementResponse = - DeleteEntitlementResponses[keyof DeleteEntitlementResponses]; - -export type GetEntitlementData = { - body?: never; - path: { - entitlementSlug: string; - }; - query?: never; - url: "/entitlements/{entitlementSlug}"; -}; - -export type GetEntitlementErrors = { + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * The hold it left, which the invoice no longer shows */ - 500: Problem; -}; - -export type GetEntitlementError = GetEntitlementErrors[keyof GetEntitlementErrors]; - -export type GetEntitlementResponses = { + holdDetail: HoldDetail; /** - * OK + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 200: Entitlement; -}; - -export type GetEntitlementResponse = GetEntitlementResponses[keyof GetEntitlementResponses]; - -export type UpdateEntitlementData = { - body: EntitlementWritable; - path: { - entitlementSlug: string; - }; - query?: never; - url: "/entitlements/{entitlementSlug}"; -}; - -export type UpdateEntitlementErrors = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Bad Request + * The invoice's identifier: the key an accounting system deduplicates on */ - 400: Problem; + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Unauthorized + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 401: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Forbidden + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; + releaseReason: string; /** - * Not Found + * The user who released it, or system when a later check found the journal sound */ - 404: Problem; + releasedBy: string; /** - * Conflict + * Earliest start of its lines' service periods */ - 409: Problem; + serviceFrom: string; /** - * Unprocessable Entity + * Latest end of its lines' service periods */ - 422: Problem; + serviceTo: string; /** - * Internal Server Error + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 500: Problem; -}; - -export type UpdateEntitlementError = UpdateEntitlementErrors[keyof UpdateEntitlementErrors]; - -export type UpdateEntitlementResponses = { + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * No Content + * Sum of the lines, in minor units */ - 204: void; + subtotal: number; + /** + * subtotal − discountTotal, in minor units + */ + total: number; + updatedAt: string; }; -export type UpdateEntitlementResponse = - UpdateEntitlementResponses[keyof UpdateEntitlementResponses]; - -export type GetFeatureFlagsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/feature-flags"; +export type ReorderMetadataFieldsInput = { + ids: Array | null; }; -export type GetFeatureFlagsErrors = { - /** - * Bad Request - */ - 400: Problem; +export type Report = { /** - * Unauthorized + * Periods closed into an invoice */ - 401: Problem; + closed: number; /** - * Forbidden + * Subscriptions the batch looked at */ - 403: Problem; + examined: number; /** - * Not Found + * Set when due subscriptions are left beyond the batch */ - 404: Problem; + hasMore: boolean; /** - * Unprocessable Entity + * Of those, invoices held as DRAFTs for their usage journal */ - 422: Problem; + held: number; + invoices: Array; /** - * Internal Server Error + * Subscriptions left for later: held by another transaction, their meters' clock not at the boundary, or failed (logged) */ - 500: Problem; + skipped: number; }; -export type GetFeatureFlagsError = GetFeatureFlagsErrors[keyof GetFeatureFlagsErrors]; - -export type GetFeatureFlagsResponses = { +export type ReportEntitlementUsageBody = { /** - * OK - */ - 200: PageFeatureFlag; -}; - -export type GetFeatureFlagsResponse = GetFeatureFlagsResponses[keyof GetFeatureFlagsResponses]; - -export type CreateFeatureFlagData = { - /** - * Feature flag details - */ - body: FeatureFlagWritable; - path?: never; - query?: never; - url: "/feature-flags"; -}; - -export type CreateFeatureFlagErrors = { - /** - * Bad Request - */ - 400: Problem; - /** - * Unauthorized - */ - 401: Problem; - /** - * Forbidden - */ - 403: Problem; - /** - * Conflict + * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it */ - 409: Problem; + behavior?: "append" | "set"; /** - * Unprocessable Entity + * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. */ - 422: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Internal Server Error + * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. */ - 500: Problem; + transactionId?: string; /** - * Service Unavailable + * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. */ - 503: Problem; + value: + | ({ + type: "number"; + } & NumberEntitlementValue) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type CreateFeatureFlagError = CreateFeatureFlagErrors[keyof CreateFeatureFlagErrors]; +export type RevocationReason = { + reason: string; +}; -export type CreateFeatureFlagResponses = { +export type RolloutDate = { + end: RolloutStep; + start: RolloutStep; + type: "rollout_date"; +}; + +export type RolloutDateTargeting = { + end: RolloutStep; + name: string; /** - * Created feature flag + * CEL expression for basicTargeting evaluation */ - 201: FeatureFlag; + rule: string; + start: RolloutStep; + type: "rollout_date"; }; -export type CreateFeatureFlagResponse = - CreateFeatureFlagResponses[keyof CreateFeatureFlagResponses]; - -export type GetTargetingContextData = { - body?: never; - path?: never; - query?: never; - url: "/feature-flags/targeting/context"; +export type RolloutPercentage = { + distribution: { + [key: string]: number; + }; + type: "rollout_percentage"; }; -export type GetTargetingContextErrors = { +export type RolloutPercentageTargeting = { + distribution: { + [key: string]: number; + }; + name: string; /** - * Unauthorized + * CEL expression for basicTargeting evaluation */ - 401: Problem; + rule: string; + type: "rollout_percentage"; +}; + +export type RolloutStep = { + date: string; + percentage: number; + variant: string; +}; + +export type SampleUsageAmount = { /** - * Forbidden + * An entitlement an ACTIVE price of the version meters */ - 403: Problem; + entitlementSlug: string; /** - * Internal Server Error + * Usage in the entitlement's measured units, a non-negative decimal string. Rated as one reset window against the version's grant: usage above limit × (1 + overage percent / 100) would be rejected, so it is capped, and the line says capped. */ - 500: Problem; + quantity: string; }; -export type GetTargetingContextError = GetTargetingContextErrors[keyof GetTargetingContextErrors]; - -export type GetTargetingContextResponses = { +export type ScheduledChange = { /** - * OK + * The boundary it applies at: the current period's end */ - 200: TargetingContext; + effectiveAt: string; + /** + * The FLAT_FEE price the subscription moves to + */ + price: Price; + scheduledAt: string; }; -export type GetTargetingContextResponse = - GetTargetingContextResponses[keyof GetTargetingContextResponses]; - -export type LintTargetingRuleData = { - body: TargetingRuleDraft; - path?: never; - query?: never; - url: "/feature-flags/targeting/lint"; +export type ServiceAccount = { + readonly createdAt?: string; + readonly createdBy?: User; + readonly externalId?: string; + readonly id?: string; + name: string; + /** + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; + readonly tokens: Array | null; }; -export type LintTargetingRuleErrors = { +export type SessionCheckout = { /** - * Bad Request + * subscribed: the invoice of the first period; absent during a trial */ - 400: Problem; + activationInvoice?: SessionInvoice; /** - * Unauthorized + * preview: what the checkout bills today; zero, with no lines, during a trial */ - 401: Problem; + dueToday?: DueToday; /** - * Forbidden + * requires_payment_method: when the setup page expires */ - 403: Problem; + expiresAt?: string; /** - * Unprocessable Entity + * subscribed: how paying the activation invoice went */ - 422: Problem; + payment?: Payment; /** - * Internal Server Error + * requires_payment_method: send it back as setupSessionId once the customer returns */ - 500: Problem; -}; - -export type LintTargetingRuleError = LintTargetingRuleErrors[keyof LintTargetingRuleErrors]; - -export type LintTargetingRuleResponses = { + setupSessionId?: string; /** - * OK + * requires_payment_method: the provider's page where the customer saves a payment method */ - 200: TargetingRuleVerdict; -}; - -export type LintTargetingRuleResponse = - LintTargetingRuleResponses[keyof LintTargetingRuleResponses]; - -export type TestTargetingRuleData = { - body: TargetingRuleTrial; - path?: never; - query?: never; - url: "/feature-flags/targeting/test"; + setupUrl?: string; + status: "preview" | "requires_payment_method" | "subscribed"; + /** + * subscribed: the subscription started + */ + subscription?: SessionSubscription; + /** + * preview: when the trial would end, if there is one + */ + trialEndsAt?: string; }; -export type TestTargetingRuleErrors = { +export type SessionCheckoutOrder = { /** - * Bad Request + * Public add-ons that fit the plan */ - 400: Problem; + addOns?: Array | null; /** - * Unauthorized + * Where invoices go. Required when the customer has none; stored on the customer when given. */ - 401: Problem; + billingEmail?: string; /** - * Forbidden + * Answer what the checkout would bill today, and change nothing */ - 403: Problem; + dryRun?: boolean; /** - * Unprocessable Entity + * An ACTIVE flat-fee price of a plan in the public catalogue. The instance is moved to that price's version when it is on another one. */ - 422: Problem; + licensePriceId: string; /** - * Internal Server Error + * Where the setup page sends the customer back, with kaiten_setup_session appended. Required when a payment method has to be captured. Its origin must be one the organization's publishable keys allow. */ - 500: Problem; -}; - -export type TestTargetingRuleError = TestTargetingRuleErrors[keyof TestTargetingRuleErrors]; - -export type TestTargetingRuleResponses = { + returnUrl?: string; /** - * OK + * The setupSessionId a requires_payment_method answer gave, once the customer is back from the setup page: the payment method saved there is checked with the provider and used. */ - 200: TargetingRuleRehearsal; -}; - -export type TestTargetingRuleResponse = - TestTargetingRuleResponses[keyof TestTargetingRuleResponses]; - -export type DeleteFeatureFlagData = { - body?: never; - path: { - featureFlagSlug: string; - }; - query?: never; - url: "/feature-flags/{featureFlagSlug}"; + setupSessionId?: string; + /** + * false skips the plan's trial. Omitted: the plan's trial, if it has one. + */ + trial?: boolean; + /** + * Validated and redeemed in the checkout; any refusal answers .VoucherInvalid + */ + voucherCode?: string; }; -export type DeleteFeatureFlagErrors = { +export type SessionInvoice = { + currency: string; /** - * Unauthorized + * Minor units */ - 401: Problem; + discountTotal: number; + dueAt: string | null; /** - * Forbidden + * The vendor's own number for an invoice it collects itself */ - 403: Problem; + externalReference: string | null; /** - * Not Found + * Where the customer pays the invoice, or confirms a payment that needs authenticating */ - 404: Problem; + hostedInvoiceUrl: string | null; + id: string; + invoicePdfUrl: string | null; + issuedAt: string | null; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + lines: Array; + paidAt: string | null; + providerInvoiceNumber: string | null; + serviceFrom: string; + serviceTo: string; /** - * Unprocessable Entity + * PUSHED: issued and awaiting payment. PAYMENT_FAILED: a charge failed; pay on hostedInvoiceUrl. MANUAL: issued, the vendor collects it. */ - 422: Problem; + status: "MANUAL" | "PUSHED" | "PAID" | "PAYMENT_FAILED" | "UNCOLLECTIBLE" | "VOID"; /** - * Internal Server Error + * Minor units */ - 500: Problem; + subtotal: number; + /** + * Minor units + */ + total: number; }; -export type DeleteFeatureFlagError = DeleteFeatureFlagErrors[keyof DeleteFeatureFlagErrors]; - -export type DeleteFeatureFlagResponses = { +export type SessionLine = { /** - * No Content + * Minor units; negative on a DISCOUNT line */ - 204: void; + amount: number; + description: string; + label: string; + /** + * In sale units, a decimal string + */ + quantity: string; + seq: number; + serviceFrom: string; + serviceTo: string; + type: "BASE" | "ADDON" | "USAGE" | "OVERAGE" | "DISCOUNT"; + /** + * Minor units; empty on a DISCOUNT line + */ + unitAmountDecimal: string; }; -export type DeleteFeatureFlagResponse = - DeleteFeatureFlagResponses[keyof DeleteFeatureFlagResponses]; - -export type GetFeatureFlagData = { - body?: never; - path: { - featureFlagSlug: string; - }; - query?: never; - url: "/feature-flags/{featureFlagSlug}"; +export type SessionSubscription = { + basePrice: PublicPrice; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + currency: string; + /** + * When the current period ends: the renewal date, or the trial's end + */ + currentPeriodEnd: string; + currentPeriodStart: string; + providerKind: "NOOP" | "STRIPE"; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + trialEndsAt: string | null; }; -export type GetFeatureFlagErrors = { +export type StartedSubscription = { /** - * Unauthorized + * The invoice of the first period, when the base price bills in advance; absent otherwise. Charged automatically, it is pushed and charged before this answer when the provider answers within 20 seconds: its status says how it went. */ - 401: Problem; + activationInvoice?: InvoiceSummary; /** - * Forbidden + * The instant its periods are counted from */ - 403: Problem; + anchorAt: string; /** - * Not Found + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 404: Problem; + basePrice: Price; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Unprocessable Entity + * Effective: the subscription's own, else the organization's default */ - 422: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Internal Server Error + * The subscription's own collection method; absent when it takes the organization's */ - 500: Problem; -}; - -export type GetFeatureFlagError = GetFeatureFlagErrors[keyof GetFeatureFlagErrors]; - -export type GetFeatureFlagResponses = { + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * OK + * The next boundary: the period closes, and its invoice is composed, after it */ - 200: FeatureFlag; -}; - -export type GetFeatureFlagResponse = GetFeatureFlagResponses[keyof GetFeatureFlagResponses]; - -export type UpdateFeatureFlagData = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Feature flag details + * Effective: the subscription's own, else the organization's default */ - body: FeatureFlagWritable; - path: { - featureFlagSlug: string; - }; - query?: never; - url: "/feature-flags/{featureFlagSlug}"; -}; - -export type UpdateFeatureFlagErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Unauthorized + * As it was at the subscription's last write */ - 401: Problem; + instanceSlug: string; + pastDueSince?: string; /** - * Forbidden + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Not Found + * A plan change waiting for the next boundary */ - 404: Problem; + scheduledChange?: ScheduledChange; /** - * Unprocessable Entity + * When billing started: usage before it is never billed */ - 422: Problem; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Internal Server Error + * When the trial ends, or ended: usage before it is never billed */ - 500: Problem; + trialEndsAt?: string; + updatedAt: string; }; -export type UpdateFeatureFlagError = UpdateFeatureFlagErrors[keyof UpdateFeatureFlagErrors]; +export type StatusChange = { + from: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + instanceBillingId: string; + instanceSlug: string; + reason: "TRIAL_ENDED" | "INVOICE_OVERDUE" | "PAYMENT_FAILED" | "SETTLED"; + to: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; +}; -export type UpdateFeatureFlagResponses = { +export type SubscriptionAddon = { /** - * No Content + * The add-on version to attach */ - 204: void; -}; - -export type UpdateFeatureFlagResponse = - UpdateFeatureFlagResponses[keyof UpdateFeatureFlagResponses]; - -export type GetInstancesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/instances"; + addonSlug: string; + quantity?: number; }; -export type GetInstancesErrors = { +export type SubscriptionCancellation = { /** - * Bad Request + * AT_PERIOD_END (the default): the period paid for runs out, then the FINAL invoice is issued. IMMEDIATE: the FINAL invoice is issued now, flat fees billed in full and nothing refunded. */ - 400: Problem; + mode?: "AT_PERIOD_END" | "IMMEDIATE"; /** - * Unauthorized + * Up to 500 characters */ - 401: Problem; + reason?: string; +}; + +export type SubscriptionTerms = { /** - * Forbidden + * null: the organization's default. CHARGE_AUTOMATICALLY needs a provider that charges automatically (UpdateInstanceBilling.CollectionMethodUnsupported). */ - 403: Problem; + collectionMethod?: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * 0 to 365; null: the organization's default */ - 422: Problem; + daysUntilDue?: number | null; /** - * Internal Server Error + * Who issues and collects the invoices, from the next one on. NOOP: the organization itself, through the handoff queue. A provider must be connected (UpdateInstanceBilling.ProviderNotConnected); one that pushes invoices needs the customer's billing e-mail for SEND_INVOICE (.BillingEmailMissing) and the subscription's currency (.UnsupportedCurrency). */ - 500: Problem; + providerKind?: "NOOP" | "STRIPE"; }; -export type GetInstancesError = GetInstancesErrors[keyof GetInstancesErrors]; - -export type GetInstancesResponses = { - /** - * OK - */ - 200: PageInstance; +export type SyncFailure = { + consecutiveFailures: number; + lastSyncError: string; + lastSyncedAt: string; + providerKind: string; }; -export type GetInstancesResponse = GetInstancesResponses[keyof GetInstancesResponses]; - -export type CreateInstanceData = { - body: InstanceWritable; - path?: never; - query?: never; - url: "/instances"; +export type SyncReport = { + providers: Array; }; -export type CreateInstanceErrors = { +export type SystemTokenIssuance = { /** - * Bad Request + * Credential class that performed the mint; "platform" is the system:kaiten identity */ - 400: Problem; + credentialKind: string; /** - * Unauthorized + * Absent when the minted credential does not expire */ - 401: Problem; + expiresAt?: string; /** - * Forbidden + * When the credential was minted */ - 403: Problem; + issuedAt: string; /** - * Not Found + * The credential that was minted */ - 404: Problem; + issuedTokenId: string; /** - * Conflict + * Human-readable label the caller gave the minted credential */ - 409: Problem; + name: string; /** - * Unprocessable Entity + * Platform credential that performed the mint; revoking it revokes everything it issued */ - 422: Problem; + platformTokenId: string; /** - * Internal Server Error + * Scopes granted to the minted credential */ - 500: Problem; + scopes: Array | null; /** - * Service Unavailable + * Server-assigned identifier of the minted credential */ - 503: Problem; + slug: string; }; -export type CreateInstanceError = CreateInstanceErrors[keyof CreateInstanceErrors]; - -export type CreateInstanceResponses = { +export type TargetingContext = { /** - * Created + * Identifiers the server guarantees, and what is reachable below each. Not a closed set: a host may target on its own attributes too */ - 201: Instance; -}; - -export type CreateInstanceResponse = CreateInstanceResponses[keyof CreateInstanceResponses]; - -export type DeleteInstanceData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; + roots: Array; }; -export type DeleteInstanceErrors = { +export type TargetingContextNode = { /** - * Bad Request + * What this value means, shown by the editor */ - 400: Problem; + description?: string; /** - * Unauthorized + * Named children, for an object */ - 401: Problem; + fields?: Array; /** - * Forbidden + * Keys this map currently has, for completion. Not a closed set */ - 403: Problem; + knownKeys?: Array; /** - * Not Found + * Name as it is written in a rule */ - 404: Problem; + name: string; /** - * Unprocessable Entity + * Whether this value may be absent, in which case has() is worth using */ - 422: Problem; + optional?: boolean; /** - * Internal Server Error + * Shape of this node's value */ - 500: Problem; -}; - -export type DeleteInstanceError = DeleteInstanceErrors[keyof DeleteInstanceErrors]; - -export type DeleteInstanceResponses = { + type: "string" | "number" | "boolean" | "object" | "map" | "dyn"; /** - * No Content + * Shape shared by every entry, for a map */ - 204: void; + values?: TargetingContextNode; }; -export type DeleteInstanceResponse = DeleteInstanceResponses[keyof DeleteInstanceResponses]; - -export type GetInstanceData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; +export type TargetingRuleDraft = { + /** + * The CEL targeting rule to check. May be blank, which is itself a mistake this reports + */ + rule: string; }; -export type GetInstanceErrors = { +export type TargetingRuleIssue = { /** - * Unauthorized + * 1-based column the problem starts on, or 0 when it has no position */ - 401: Problem; + column: number; /** - * Forbidden + * 1-based column just past the problem, or 0 when only a point is known */ - 403: Problem; + endColumn?: number; /** - * Not Found + * 1-based line the problem ends on, or 0 when only a point is known */ - 404: Problem; + endLine?: number; /** - * Unprocessable Entity + * 1-based line the problem starts on, or 0 when it has no position */ - 422: Problem; + line: number; /** - * Internal Server Error + * What is wrong, in the same words the write path refuses it with */ - 500: Problem; + message: string; }; -export type GetInstanceError = GetInstanceErrors[keyof GetInstanceErrors]; - -export type GetInstanceResponses = { +export type TargetingRuleRehearsal = { /** - * OK + * Why the engine could not answer, when it could not — e.g. the rule reads a host attribute this context does not carry. At a real evaluation the rule would simply not match */ - 200: Instance; -}; - -export type GetInstanceResponse = GetInstanceResponses[keyof GetInstanceResponses]; - -export type PatchInstanceData = { - body: PatchInstanceBody; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; -}; - -export type PatchInstanceErrors = { + evaluationError?: string; /** - * Bad Request + * The __kaiten namespace as enriched for this context — what a rule actually reads. Empty sub-roots mean the context resolved nothing for them */ - 400: Problem; + facts: { + [key: string]: unknown; + }; /** - * Unauthorized + * Problems the lint found. The rule is only run when there are none */ - 401: Problem; + issues: Array; /** - * Forbidden + * Whether the rule matched this context. Meaningful only when valid and evaluationError is empty */ - 403: Problem; + matched: boolean; /** - * Not Found + * Whether the rule lints clean */ - 404: Problem; + valid: boolean; +}; + +export type TargetingRuleTrial = { /** - * Unprocessable Entity + * The evaluation context to rehearse against, as a client would send it. Anything under __kaiten is discarded, exactly as at a real evaluation */ - 422: Problem; + context?: { + [key: string]: unknown; + }; /** - * Internal Server Error + * The CEL targeting rule to rehearse */ - 500: Problem; + rule: string; + /** + * The key the evaluation would be bucketed on. Resolves license and entitlement facts when it names a customer slug + */ + targetingKey?: string; }; -export type PatchInstanceError = PatchInstanceErrors[keyof PatchInstanceErrors]; - -export type PatchInstanceResponses = { +export type TargetingRuleVerdict = { /** - * No Content + * Every problem found, positioned where it is written. Empty when the rule is accepted */ - 204: void; + issues: Array; + /** + * Whether the write path would accept this rule + */ + valid: boolean; }; -export type PatchInstanceResponse = PatchInstanceResponses[keyof PatchInstanceResponses]; +/** + * Polymorphic list of targeting rules (Basic, RolloutDate, RolloutPercentage) + */ +export type Targetings = Array< + BasicTargeting | RolloutDateTargeting | RolloutPercentageTargeting +> | null; -export type UpdateInstanceData = { - body: InstanceWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}"; +export type Token = { + readonly createdAt: string; + readonly createdBy: User; + expiresAt?: string; + readonly id?: string; + name: string; + readonly revokedAt?: string; + readonly revokedBy?: User; + scopes: Array | null; + readonly serviceAccountId?: string; + /** + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + */ + slug?: string; }; -export type UpdateInstanceErrors = { +export type TotalsDifference = { + kaitenTotal: number; + providerSubtotal?: number; + providerTotalExcludingTax: number; +}; + +export type UncollectibleInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Conflict + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 409: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Unprocessable Entity + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 422: Problem; + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * Internal Server Error + * The invoice's identifier: the key an accounting system deduplicates on */ - 500: Problem; -}; - -export type UpdateInstanceError = UpdateInstanceErrors[keyof UpdateInstanceErrors]; - -export type UpdateInstanceResponses = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * No Content + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 204: void; -}; - -export type UpdateInstanceResponse = UpdateInstanceResponses[keyof UpdateInstanceResponses]; - -export type GetAuditTrailsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: { - /** - * Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) - */ - event_name?: string; - /** - * RFC3339 timestamp — include entries with timestamp ≥ this value - */ - after?: string; - /** - * RFC3339 timestamp — include entries with timestamp ≤ this value - */ - before?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - }; - url: "/instances/{instanceSlug}/audit-trails"; -}; - -export type GetAuditTrailsErrors = { + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Bad Request + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 400: Problem; + providerKind: "NOOP" | "STRIPE"; + reason: string; /** - * Unauthorized + * Earliest start of its lines' service periods */ - 401: Problem; + serviceFrom: string; /** - * Forbidden + * Latest end of its lines' service periods */ - 403: Problem; + serviceTo: string; /** - * Not Found + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 404: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Unprocessable Entity + * Sum of the lines, in minor units */ - 422: Problem; + subtotal: number; /** - * Internal Server Error + * subtotal − discountTotal, in minor units */ - 500: Problem; + total: number; + updatedAt: string; }; -export type GetAuditTrailsError = GetAuditTrailsErrors[keyof GetAuditTrailsErrors]; - -export type GetAuditTrailsResponses = { +export type UpdatedEvent = { /** - * OK + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 200: PageAuditTrail; -}; - -export type GetAuditTrailsResponse = GetAuditTrailsResponses[keyof GetAuditTrailsResponses]; - -export type GetEntitlementsUsageMetricsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}/entitlements/usage"; -}; - -export type GetEntitlementsUsageMetricsErrors = { + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Bad Request + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 400: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Unauthorized + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 401: Problem; + billingTiming: "ADVANCE" | "ARREARS"; /** - * Forbidden + * The members the update changed, as the API names them */ - 403: Problem; + changedFields: Array | null; + readonly createdAt: string; /** - * Not Found + * ISO 4217 code, upper case. One currency per licence version. */ - 404: Problem; + currency: string; /** - * Unprocessable Entity + * When the price was deprecated */ - 422: Problem; + deprecatedAt?: string; /** - * Internal Server Error + * The invoice line's label; a default is derived when absent. */ - 500: Problem; -}; - -export type GetEntitlementsUsageMetricsError = - GetEntitlementsUsageMetricsErrors[keyof GetEntitlementsUsageMetricsErrors]; - -export type GetEntitlementsUsageMetricsResponses = { + displayLabel?: string; /** - * OK + * Order among the version's prices */ - 200: Array | null; -}; - -export type GetEntitlementsUsageMetricsResponse = - GetEntitlementsUsageMetricsResponses[keyof GetEntitlementsUsageMetricsResponses]; - -export type GetEntitlementUsageMetricsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; -}; - -export type GetEntitlementUsageMetricsErrors = { + displayOrder: number; /** - * Bad Request + * The family of that version */ - 400: Problem; + familySlug: string; /** - * Unauthorized + * Unique identifier of the price */ - 401: Problem; + readonly id: string; /** - * Forbidden + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 403: Problem; + isDefault: boolean; /** - * Not Found + * The licence version the price belongs to */ - 404: Problem; + licenseSlug: string; /** - * Unprocessable Entity + * What a metered price measures. Absent on FLAT_FEE prices. */ - 422: Problem; + metered?: Meter; /** - * Internal Server Error + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 500: Problem; -}; - -export type GetEntitlementUsageMetricsError = - GetEntitlementUsageMetricsErrors[keyof GetEntitlementUsageMetricsErrors]; - -export type GetEntitlementUsageMetricsResponses = { + status: "ACTIVE" | "DEPRECATED"; /** - * OK + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 200: EntitlementUsage; -}; - -export type GetEntitlementUsageMetricsResponse = - GetEntitlementUsageMetricsResponses[keyof GetEntitlementUsageMetricsResponses]; - -export type ReportEntitlementUsageMetricData = { - body: ReportEntitlementUsageBodyWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: never; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; + readonly updatedAt: string; }; -export type ReportEntitlementUsageMetricErrors = { +export type UsageReport = { /** - * Bad Request + * The entitlement's aggregation method when the report was accepted */ - 400: Problem; + aggregationMethod: string; /** - * Unauthorized + * append adds the value through the aggregation method; set overwrites the counter */ - 401: Problem; + behavior: "append" | "set"; /** - * Forbidden + * valueAfter minus valueBefore; negative for a set that lowered the counter */ - 403: Problem; + delta: string; /** - * Not Found + * The entitlement the report was made for. It may since have been deleted. */ - 404: Problem; + entitlementId: string; /** - * Conflict + * Reports counted in the window after this one */ - 409: Problem; + eventCountAfter: number; /** - * Unprocessable Entity + * The instance the report was made for. It may since have been deleted. */ - 422: Problem; + instanceId: string; /** - * Internal Server Error + * The instance's licence when the report was accepted */ - 500: Problem; + licenseId: string; /** - * Service Unavailable + * The limit in force when the report was accepted. Null when unlimited. */ - 503: Problem; -}; - -export type ReportEntitlementUsageMetricError = - ReportEntitlementUsageMetricErrors[keyof ReportEntitlementUsageMetricErrors]; - -export type ReportEntitlementUsageMetricResponses = { + limitValue?: string; /** - * OK + * How much the usage above limitValue moved: max(0, valueAfter - limitValue) - max(0, valueBefore - limitValue). 0 when unlimited. */ - 200: EntitlementUsage; -}; - -export type ReportEntitlementUsageMetricResponse = - ReportEntitlementUsageMetricResponses[keyof ReportEntitlementUsageMetricResponses]; - -export type ListUsageReportsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: { - /** - * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. - */ - from?: string; - /** - * End of the range, exclusive (RFC 3339). Defaults to now. - */ - to?: string; - /** - * Return the reports after this reportSeq: the nextAfterSeq of the previous page - */ - afterSeq?: number; - /** - * Maximum number of reports to return (default 100, max 500) - */ - limit?: number; - /** - * Only the report sent with this idempotency key - */ - transactionId?: string; + overageDelta: string; + /** + * The overage allowed above limitValue, in percent, when the report was accepted. Null when unlimited. + */ + overagePercent?: number; + /** + * The report's metadata, when it was stored + */ + properties?: { + [key: string]: unknown; }; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports"; -}; - -export type ListUsageReportsErrors = { /** - * Bad Request + * Position of the report among the pair's accepted reports, from 1, without gaps */ - 400: Problem; + reportSeq: number; /** - * Unauthorized + * When the server accepted the report (UTC, millisecond precision) */ - 401: Problem; + reportedAt: string; /** - * Forbidden + * The value as sent: a delta for append, an absolute value for set */ - 403: Problem; + reportedValue: string; /** - * Not Found + * The report's idempotency key, when it was sent with one */ - 404: Problem; + transactionId?: string; /** - * Unprocessable Entity + * The counter after the report */ - 422: Problem; + valueAfter: string; /** - * Internal Server Error + * The counter before the report, after any window reset */ - 500: Problem; + valueBefore: string; + /** + * End of the usage window the report counted in (exclusive). Null for a lifetime entitlement. + */ + windowEnd?: string; + /** + * Start of the usage window the report counted in (inclusive). Null for a lifetime entitlement. + */ + windowStart?: string; }; -export type ListUsageReportsError = ListUsageReportsErrors[keyof ListUsageReportsErrors]; +export type UsageReportPage = { + /** + * The reports, in reportSeq order + */ + items: Array; + /** + * Pass as afterSeq to read the next page. Absent on the last page. + */ + nextAfterSeq?: number; +}; -export type ListUsageReportsResponses = { +export type User = { /** - * OK + * ID of the user */ - 200: UsageReportPage; + id: string; + /** + * Name of the user + */ + name?: string; }; -export type ListUsageReportsResponse = ListUsageReportsResponses[keyof ListUsageReportsResponses]; +export type Validity = { + /** + * The first failing check + */ + reason?: + | "NOT_FOUND" + | "NOT_ACTIVE" + | "NOT_YET_VALID" + | "EXPIRED" + | "EXHAUSTED" + | "ALREADY_REDEEMED" + | "NOT_ELIGIBLE" + | "CURRENCY_MISMATCH"; + /** + * With NOT_ELIGIBLE: the eligibility rule + */ + rule?: + | "RESTRICTED_CUSTOMER" + | "LICENSE_NOT_APPLICABLE" + | "ADDON_NOT_APPLICABLE" + | "FIRST_TIME_ONLY" + | "ANNUAL_ONLY" + | "MINIMUM_SUBSCRIPTION_AMOUNT" + | "NOTHING_TO_BOOST"; + valid: boolean; + /** + * The voucher, without its code, when the code names one + */ + voucher?: Voucher; +}; -export type ExportUsageReportsData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Entitlement slug - */ - entitlementSlug: string; - }; - query?: { - /** - * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - */ - from?: string; - /** - * End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. - */ - to?: string; - /** - * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat. - */ - format?: string; - }; - url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export"; +export type Variant = { + description: string; + name: string; + value: unknown; }; -export type ExportUsageReportsErrors = { +export type VoidedInvoice = { /** - * Bad Request + * The boundary the invoice bills. With the kind, it identifies the invoice within its subscription */ - 400: Problem; + boundaryAt: string; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; + createdAt: string; + currency: string; + customerName: string; /** - * Unauthorized + * As it was when the invoice was composed */ - 401: Problem; + customerSlug: string; + daysUntilDue?: number; /** - * Forbidden + * Sum of the discounts, in minor units */ - 403: Problem; + discountTotal: number; /** - * Not Found + * issuedAt + daysUntilDue */ - 404: Problem; + dueAt?: string; /** - * Unprocessable Entity + * PENDING: waiting in the handoff queue for the organization's accounting system */ - 422: Problem; + handoffStatus: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; /** - * Internal Server Error + * Why a DRAFT is held: the usage journal it was measured from failed a consistency check */ - 500: Problem; -}; - -export type ExportUsageReportsError = ExportUsageReportsErrors[keyof ExportUsageReportsErrors]; - -export type ExportUsageReportsResponses = { + holdReason?: "LEDGER_SEQUENCE_GAP" | "LEDGER_CHAIN_BREAK" | "LEDGER_COUNTER_MISMATCH"; /** - * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + * The invoice's identifier: the key an accounting system deduplicates on */ - 200: string; -}; - -export type ExportUsageReportsResponse = - ExportUsageReportsResponses[keyof ExportUsageReportsResponses]; - -export type DeleteInstanceIntegrationData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; -}; - -export type DeleteInstanceIntegrationErrors = { + id: string; + instanceName: string; + instanceSlug: string; + issuedAt?: string; /** - * Bad Request + * ACTIVATION bills a subscription's first period, RENEWAL the period that ended and the one that starts, FINAL what is left when a subscription ends */ - 400: Problem; + kind: "ACTIVATION" | "RENEWAL" | "FINAL"; + licenseSlug: string; + paidAt?: string; /** - * Unauthorized + * Who collects it. NOOP: the organization itself, through the handoff queue */ - 401: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Forbidden + * Earliest start of its lines' service periods */ - 403: Problem; + serviceFrom: string; /** - * Not Found + * Latest end of its lines' service periods */ - 404: Problem; + serviceTo: string; /** - * Unprocessable Entity + * MANUAL: issued, for the organization to collect. PAID, UNCOLLECTIBLE and VOID are final. DRAFT: held, waiting for a release or a recompose */ - 422: Problem; + status: + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID"; /** - * Internal Server Error + * Sum of the lines, in minor units */ - 500: Problem; -}; - -export type DeleteInstanceIntegrationError = - DeleteInstanceIntegrationErrors[keyof DeleteInstanceIntegrationErrors]; - -export type DeleteInstanceIntegrationResponses = { + subtotal: number; /** - * No Content + * subtotal − discountTotal, in minor units */ - 204: void; + total: number; + updatedAt: string; + voidReason: string; }; -export type DeleteInstanceIntegrationResponse = - DeleteInstanceIntegrationResponses[keyof DeleteInstanceIntegrationResponses]; - -export type GetInstanceIntegrationData = { - body?: never; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; -}; - -export type GetInstanceIntegrationErrors = { +export type Voucher = { /** - * Unauthorized + * Only instances holding one of these add-on versions can redeem it; any when empty */ - 401: Problem; + applicableAddonIds: Array; + applicableAddonPriceIds: Array; /** - * Forbidden + * Only instances on these licence versions can redeem it; any when empty */ - 403: Problem; + applicableLicenseIds: Array; + applicableLicensePriceIds: Array; /** - * Not Found + * The code to redeem. Returned to read:vouchers callers only; never in an event. */ - 404: Problem; + code?: string; /** - * Unprocessable Entity + * The last four characters of the normalized code */ - 422: Problem; + codeHint: string; + readonly createdAt: string; /** - * Internal Server Error + * The currency of a FIXED_AMOUNT discount */ - 500: Problem; -}; - -export type GetInstanceIntegrationError = - GetInstanceIntegrationErrors[keyof GetInstanceIntegrationErrors]; - -export type GetInstanceIntegrationResponses = { + currency?: string; + description?: string; /** - * OK + * PRICE: how many invoices it discounts (one, durationInPeriods, or every one). BOOST: how long a redemption lasts, in the subscription's billing periods. */ - 200: InstanceIntegration; + duration: "ONE_TIME" | "REPEATING" | "FOREVER"; + durationInPeriods?: number; + expiresAt?: string; + /** + * What an ENTITLEMENT_BOOST changes + */ + grants: Array; + readonly id: string; + maxRedemptions?: number; + name: string; + priceAppliesTo?: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; + priceDiscountType?: "PERCENTAGE" | "FIXED_AMOUNT"; + /** + * A percentage in (0, 100], or an integer amount in minor units of currency + */ + priceDiscountValue?: string; + redemptionRules: RedemptionRules; + redemptionsCount: number; + /** + * Only this customer's instances can redeem it + */ + restrictedCustomerSlug?: string; + startsAt?: string; + status: "DRAFT" | "ACTIVE" | "EXPIRED" | "EXHAUSTED" | "ARCHIVED"; + readonly updatedAt: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; }; -export type GetInstanceIntegrationResponse = - GetInstanceIntegrationResponses[keyof GetInstanceIntegrationResponses]; - -export type CreateInstanceIntegrationData = { +export type VoucherCheck = { + code: string; /** - * Integration payload + * Also run the checks that need the redeeming instance */ - body: InstanceIntegrationWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; - }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; + instanceSlug?: string; }; -export type CreateInstanceIntegrationErrors = { +export type VoucherCode = { + code: string; +}; + +export type VoucherDraft = { + applicableAddonIds?: Array | null; /** - * Bad Request + * With SELECTED_PRICES: the add-on prices it discounts */ - 400: Problem; + applicableAddonPriceIds?: Array | null; + applicableLicenseIds?: Array | null; /** - * Unauthorized + * With SELECTED_PRICES: the licence prices it discounts */ - 401: Problem; + applicableLicensePriceIds?: Array | null; /** - * Forbidden + * 8 to 64 of [A-Za-z0-9_-]. Generated when absent: 16 characters, 80 random bits. Matched without case or separators. */ - 403: Problem; + code?: string; /** - * Not Found + * Required with FIXED_AMOUNT, refused otherwise */ - 404: Problem; + currency?: string; + description?: string; + duration: "ONE_TIME" | "REPEATING" | "FOREVER"; /** - * Conflict + * Required with REPEATING, refused otherwise */ - 409: Problem; + durationInPeriods?: number; + expiresAt?: string; /** - * Unprocessable Entity + * Required on an ENTITLEMENT_BOOST, refused on a PRICE voucher */ - 422: Problem; + grants?: Array | null; + maxRedemptions?: number; + name: string; + priceAppliesTo?: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; + priceDiscountType?: "PERCENTAGE" | "FIXED_AMOUNT"; /** - * Internal Server Error + * A percentage in (0, 100], or an integer amount in minor units */ - 500: Problem; + priceDiscountValue?: string; + redemptionRules?: RedemptionRules; + restrictedCustomerSlug?: string; + startsAt?: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; }; -export type CreateInstanceIntegrationError = - CreateInstanceIntegrationErrors[keyof CreateInstanceIntegrationErrors]; - -export type CreateInstanceIntegrationResponses = { +export type AddonWritable = { + description: string; /** - * Created + * The family the version belongs to */ - 201: InstanceIntegration; + familySlug: string; + /** + * The version the family resolves to. Only a PUBLISHED version. + */ + isDefault: boolean; + /** + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. + */ + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; + /** + * The largest quantity an instance can hold; unbounded when absent + */ + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; + /** + * The version's slug, unique in the organization + */ + slug: string; + versionName: string; }; -export type CreateInstanceIntegrationResponse = - CreateInstanceIntegrationResponses[keyof CreateInstanceIntegrationResponses]; - -export type UpdateInstanceIntegrationData = { +export type AddonEntitlementWritable = { + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * Integration payload + * The overage the add-on allows; absent inherits the licence grant's */ - body: InstanceIntegrationWritable; - path: { - /** - * Instance slug - */ - instanceSlug: string; - /** - * Integration adapter name - */ - integrationName: string; + limitCapExceededOveragePercent?: number; + /** + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. + */ + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; + /** + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. + */ + value: { + [key: string]: unknown; }; - query?: never; - url: "/instances/{instanceSlug}/integrations/{integrationName}"; }; -export type UpdateInstanceIntegrationErrors = { +export type AddonFamilyWritable = { /** - * Bad Request + * The default version, else the highest PUBLISHED one; absent when none is published */ - 400: Problem; + currentVersion?: AddonWritable; /** - * Unauthorized + * Whether the family is listed in the public catalogue */ - 401: Problem; + isPublic: boolean; /** - * Forbidden + * The highest version number the family has assigned */ - 403: Problem; + lastVersion: number; + slug: string; /** - * Not Found + * Every version, newest first */ - 404: Problem; + versions: Array | null; +}; + +export type AddonGrantUpdateWritable = { /** - * Conflict + * The add-on version the grant belongs to */ - 409: Problem; + addonSlug: string; + entitlementSlug: string; + entitlementType: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * Unprocessable Entity + * The overage the add-on allows; absent inherits the licence grant's */ - 422: Problem; + limitCapExceededOveragePercent?: number; /** - * Internal Server Error + * How a number grant combines with the licence's: ADD sums value × quantity, OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger. A boolean always ORs, a config always overrides. */ - 500: Problem; -}; - -export type UpdateInstanceIntegrationError = - UpdateInstanceIntegrationErrors[keyof UpdateInstanceIntegrationErrors]; - -export type UpdateInstanceIntegrationResponses = { + overrideBehavior: "ADD" | "OVERRIDE" | "MAX"; /** - * OK + * {type, value}, shaped like a licence grant. A number counts once per unit of quantity. */ - 200: InstanceIntegration; -}; - -export type UpdateInstanceIntegrationResponse = - UpdateInstanceIntegrationResponses[keyof UpdateInstanceIntegrationResponses]; - -export type GetCustomerIntegrationByExternalIdData = { - body?: never; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; + value: { + [key: string]: unknown; }; - query?: never; - url: "/integration/{adapter}/customer/{externalId}"; }; -export type GetCustomerIntegrationByExternalIdErrors = { - /** - * Unauthorized - */ - 401: Problem; +export type AddonPriceUpdateWritable = { /** - * Forbidden + * The add-on version the price belongs to */ - 403: Problem; + addonSlug: string; /** - * Not Found + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 404: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unprocessable Entity + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 422: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Internal Server Error + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 500: Problem; -}; - -export type GetCustomerIntegrationByExternalIdError = - GetCustomerIntegrationByExternalIdErrors[keyof GetCustomerIntegrationByExternalIdErrors]; - -export type GetCustomerIntegrationByExternalIdResponses = { + billingTiming: "ADVANCE" | "ARREARS"; /** - * OK + * ISO 4217 code, upper case. One currency per licence version. */ - 200: CustomerIntegrationResource; -}; - -export type GetCustomerIntegrationByExternalIdResponse = - GetCustomerIntegrationByExternalIdResponses[keyof GetCustomerIntegrationByExternalIdResponses]; - -export type UpsertCustomerIntegrationByExternalIdData = { - body: CustomerBody; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; - }; - query?: never; - url: "/integration/{adapter}/customer/{externalId}"; -}; - -export type UpsertCustomerIntegrationByExternalIdErrors = { + currency: string; /** - * Bad Request + * When the price was deprecated */ - 400: Problem; + deprecatedAt?: string; /** - * Unauthorized + * The invoice line's label; a default is derived when absent. */ - 401: Problem; + displayLabel?: string; /** - * Forbidden + * Order among the version's prices */ - 403: Problem; + displayOrder: number; /** - * Not Found + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 404: Problem; + isDefault: boolean; /** - * Conflict + * What a metered price measures. Absent on FLAT_FEE prices. */ - 409: Problem; + metered?: Meter; /** - * Unprocessable Entity + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 422: Problem; + status: "ACTIVE" | "DEPRECATED"; /** - * Internal Server Error + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 500: Problem; + unitAmount?: number; /** - * Service Unavailable + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - 503: Problem; + unitAmountDecimal: string; }; -export type UpsertCustomerIntegrationByExternalIdError = - UpsertCustomerIntegrationByExternalIdErrors[keyof UpsertCustomerIntegrationByExternalIdErrors]; - -export type UpsertCustomerIntegrationByExternalIdResponses = { +export type AddonUpdateWritable = { /** - * OK + * The members the change touched, as the API names them */ - 200: CustomerIntegrationResource; -}; - -export type UpsertCustomerIntegrationByExternalIdResponse = - UpsertCustomerIntegrationByExternalIdResponses[keyof UpsertCustomerIntegrationByExternalIdResponses]; - -export type GetInstanceIntegrationByExternalIdData = { - body?: never; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; - }; - query?: never; - url: "/integration/{adapter}/instance/{externalId}"; -}; - -export type GetInstanceIntegrationByExternalIdErrors = { + changedFields: Array | null; /** - * Unauthorized + * The licence families the version fits after the change */ - 401: Problem; + compatibleLicenseFamilies: Array | null; + description: string; /** - * Forbidden + * The family the version belongs to */ - 403: Problem; + familySlug: string; /** - * Not Found + * The version the family resolves to. Only a PUBLISHED version. */ - 404: Problem; + isDefault: boolean; /** - * Unprocessable Entity + * A DRAFT can be attached to try it; an ARCHIVED version stays on the instances holding it but cannot be attached again. */ - 422: Problem; + lifecycleState: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Internal Server Error + * The largest quantity an instance can hold; unbounded when absent */ - 500: Problem; -}; - -export type GetInstanceIntegrationByExternalIdError = - GetInstanceIntegrationByExternalIdErrors[keyof GetInstanceIntegrationByExternalIdErrors]; - -export type GetInstanceIntegrationByExternalIdResponses = { + maxQuantity?: number; + name: string; + pricingType: "FREE" | "PAID" | "CUSTOM"; /** - * OK + * The version's slug, unique in the organization */ - 200: InstanceIntegrationResource; -}; - -export type GetInstanceIntegrationByExternalIdResponse = - GetInstanceIntegrationByExternalIdResponses[keyof GetInstanceIntegrationByExternalIdResponses]; - -export type UpsertInstanceIntegrationByExternalIdData = { - body: InstanceBody; - path: { - /** - * Integration adapter without the kaiten.integration. prefix - */ - adapter: string; - /** - * External identifier in the third-party system - */ - externalId: string; - }; - query?: never; - url: "/integration/{adapter}/instance/{externalId}"; + slug: string; + versionName: string; }; -export type UpsertInstanceIntegrationByExternalIdErrors = { +export type BillingStartedWritable = { /** - * Bad Request + * The instant its periods are counted from */ - 400: Problem; + anchorAt: string; /** - * Unauthorized + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 401: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Forbidden + * Effective: the subscription's own, else the organization's default */ - 403: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Not Found + * The subscription's own collection method; absent when it takes the organization's */ - 404: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Conflict + * The next boundary: the period closes, and its invoice is composed, after it */ - 409: Problem; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Unprocessable Entity + * Effective: the subscription's own, else the organization's default */ - 422: Problem; + daysUntilDue: number; /** - * Internal Server Error + * The subscription's own payment terms; absent when it takes the organization's */ - 500: Problem; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Service Unavailable + * As it was at the subscription's last write */ - 503: Problem; -}; - -export type UpsertInstanceIntegrationByExternalIdError = - UpsertInstanceIntegrationByExternalIdErrors[keyof UpsertInstanceIntegrationByExternalIdErrors]; - -export type UpsertInstanceIntegrationByExternalIdResponses = { + instanceSlug: string; + pastDueSince?: string; /** - * OK + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 200: InstanceIntegrationResource; -}; - -export type UpsertInstanceIntegrationByExternalIdResponse = - UpsertInstanceIntegrationByExternalIdResponses[keyof UpsertInstanceIntegrationByExternalIdResponses]; - -export type ListLicenseFamiliesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/license-families"; + providerKind: "NOOP" | "STRIPE"; + /** + * Set when a CANCELED subscription was subscribed again + */ + resubscribed: boolean; + /** + * A plan change waiting for the next boundary + */ + scheduledChange?: ScheduledChangeWritable; + /** + * When billing started: usage before it is never billed + */ + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type ListLicenseFamiliesErrors = { +export type CanceledSubscriptionWritable = { /** - * Bad Request + * The instant its periods are counted from */ - 400: Problem; + anchorAt: string; /** - * Unauthorized + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 401: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Forbidden + * Effective: the subscription's own, else the organization's default */ - 403: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * The subscription's own collection method; absent when it takes the organization's */ - 422: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Internal Server Error + * The next boundary: the period closes, and its invoice is composed, after it */ - 500: Problem; -}; - -export type ListLicenseFamiliesError = ListLicenseFamiliesErrors[keyof ListLicenseFamiliesErrors]; - -export type ListLicenseFamiliesResponses = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * OK + * Effective: the subscription's own, else the organization's default */ - 200: PageLicenseFamilyView; -}; - -export type ListLicenseFamiliesResponse = - ListLicenseFamiliesResponses[keyof ListLicenseFamiliesResponses]; - -export type GetLicenseFamilyData = { - body?: never; - path: { - /** - * License family slug - */ - familySlug: string; - }; - query?: { - /** - * Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply. - */ - version?: number; - /** - * Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type. - */ - include?: Array<"versions">; - }; - url: "/license-families/{familySlug}"; -}; - -export type GetLicenseFamilyErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; /** - * Unauthorized + * The FINAL invoice of an immediate cancellation */ - 401: Problem; + finalInvoice?: InvoiceSummary; + id: string; + instanceName: string; /** - * Forbidden + * As it was at the subscription's last write */ - 403: Problem; + instanceSlug: string; + pastDueSince?: string; /** - * Not Found + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 404: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unprocessable Entity + * A plan change waiting for the next boundary */ - 422: Problem; + scheduledChange?: ScheduledChangeWritable; /** - * Internal Server Error + * When billing started: usage before it is never billed */ - 500: Problem; -}; - -export type GetLicenseFamilyError = GetLicenseFamilyErrors[keyof GetLicenseFamilyErrors]; - -export type GetLicenseFamilyResponses = { + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * OK + * When the trial ends, or ended: usage before it is never billed */ - 200: LicenseFamilyView; -}; - -export type GetLicenseFamilyResponse = GetLicenseFamilyResponses[keyof GetLicenseFamilyResponses]; - -export type GetLicensesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/licenses"; + trialEndsAt?: string; + updatedAt: string; }; -export type GetLicensesErrors = { +export type CancellationWritable = { /** - * Bad Request + * The instant its periods are counted from */ - 400: Problem; + anchorAt: string; /** - * Unauthorized + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 401: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Forbidden + * Effective: the subscription's own, else the organization's default */ - 403: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * The subscription's own collection method; absent when it takes the organization's */ - 422: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Internal Server Error + * The next boundary: the period closes, and its invoice is composed, after it */ - 500: Problem; -}; - -export type GetLicensesError = GetLicensesErrors[keyof GetLicensesErrors]; - -export type GetLicensesResponses = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * OK + * Effective: the subscription's own, else the organization's default */ - 200: PageLicense; -}; - -export type GetLicensesResponse = GetLicensesResponses[keyof GetLicensesResponses]; - -export type CreateLicenseData = { - body: LicenseWritable; - path?: never; - query?: never; - url: "/licenses"; -}; - -export type CreateLicenseErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; /** - * Unauthorized + * The FINAL invoice, when the cancellation issued one */ - 401: Problem; + finalInvoiceId?: string; + id: string; + instanceName: string; /** - * Forbidden + * As it was at the subscription's last write */ - 403: Problem; + instanceSlug: string; /** - * Not Found + * How it was canceled; a trial is canceled at once in either mode */ - 404: Problem; + mode: "AT_PERIOD_END" | "IMMEDIATE"; + pastDueSince?: string; /** - * Conflict + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 409: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Unprocessable Entity + * A plan change waiting for the next boundary */ - 422: Problem; + scheduledChange?: ScheduledChangeWritable; /** - * Internal Server Error + * When billing started: usage before it is never billed */ - 500: Problem; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Service Unavailable + * When the trial ends, or ended: usage before it is never billed */ - 503: Problem; + trialEndsAt?: string; + updatedAt: string; }; -export type CreateLicenseError = CreateLicenseErrors[keyof CreateLicenseErrors]; - -export type CreateLicenseResponses = { +export type CancellationChangeWritable = { /** - * Created + * The instant its periods are counted from */ - 201: License; -}; - -export type CreateLicenseResponse = CreateLicenseResponses[keyof CreateLicenseResponses]; - -export type DeleteLicenseData = { - body?: never; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}"; -}; - -export type DeleteLicenseErrors = { + anchorAt: string; /** - * Bad Request + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 400: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Unauthorized + * Effective: the subscription's own, else the organization's default */ - 401: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Forbidden + * The subscription's own collection method; absent when it takes the organization's */ - 403: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Not Found + * The next boundary: the period closes, and its invoice is composed, after it */ - 404: Problem; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Conflict + * Effective: the subscription's own, else the organization's default */ - 409: Problem; + daysUntilDue: number; /** - * Unprocessable Entity + * The subscription's own payment terms; absent when it takes the organization's */ - 422: Problem; + daysUntilDueOverride?: number; /** - * Internal Server Error + * The boundary the cancellation takes effect at */ - 500: Problem; -}; - -export type DeleteLicenseError = DeleteLicenseErrors[keyof DeleteLicenseErrors]; - -export type DeleteLicenseResponses = { + effectiveAt: string; + id: string; + instanceName: string; /** - * No Content + * As it was at the subscription's last write */ - 204: void; -}; - -export type DeleteLicenseResponse = DeleteLicenseResponses[keyof DeleteLicenseResponses]; - -export type GetLicenseData = { - body?: never; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}"; + instanceSlug: string; + pastDueSince?: string; + /** + * Who collects its invoices. NOOP: the organization itself, through the handoff queue + */ + providerKind: "NOOP" | "STRIPE"; + /** + * A plan change waiting for the next boundary + */ + scheduledChange?: ScheduledChangeWritable; + /** + * When billing started: usage before it is never billed + */ + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type GetLicenseErrors = { +export type ComponentWritable = { /** - * Unauthorized + * Description of the component */ - 401: Problem; + description?: string; /** - * Forbidden + * Name of the component */ - 403: Problem; + name: string; /** - * Not Found + * Reference to the previous version of this component */ - 404: Problem; + previousComponentId?: string; /** - * Unprocessable Entity + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Version of the component */ - 500: Problem; + version: string; }; -export type GetLicenseError = GetLicenseErrors[keyof GetLicenseErrors]; - -export type GetLicenseResponses = { +export type ConnectorSettingsWritable = { /** - * OK + * Connector settings payload */ - 200: License; -}; - -export type GetLicenseResponse = GetLicenseResponses[keyof GetLicenseResponses]; - -export type UpdateLicenseData = { - body: LicenseWritable; - path: { - /** - * License slug - */ - licenseSlug: string; + settings: { + [key: string]: unknown; }; - query?: never; - url: "/licenses/{licenseSlug}"; }; -export type UpdateLicenseErrors = { - /** - * Bad Request - */ - 400: Problem; +export type CustomerWritable = { /** - * Unauthorized + * Where invoices sent to this customer are delivered, at most 254 characters (CreateCustomer.InvalidBillingEmail). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. Personal data: never included in event payloads. */ - 401: Problem; + billingEmail?: string; /** - * Forbidden + * Optional customer domain name */ - 403: Problem; + domain?: string; /** - * Not Found + * Optional identifier for the customer in an external system */ - 404: Problem; + externalCustomerId?: string | null; /** - * Conflict + * Integrations grouped by adapter name */ - 409: Problem; + integrations?: { + [key: string]: CustomerIntegrationWritable; + }; /** - * Unprocessable Entity + * Name of the customer */ - 422: Problem; + name: string; /** - * Internal Server Error + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 500: Problem; + slug?: string; }; -export type UpdateLicenseError = UpdateLicenseErrors[keyof UpdateLicenseErrors]; - -export type UpdateLicenseResponses = { +export type CustomerIntegrationWritable = { /** - * No Content + * External identifier in the third-party adapter */ - 204: void; -}; - -export type UpdateLicenseResponse = UpdateLicenseResponses[keyof UpdateLicenseResponses]; - -export type ArchiveLicenseData = { - body?: never; - path: { - /** - * License version slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/archive"; -}; - -export type ArchiveLicenseErrors = { + external_id: string; /** - * Bad Request + * Last synchronization error message, if any */ - 400: Problem; + last_error?: string; /** - * Unauthorized + * Adapter-specific integration metadata */ - 401: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Forbidden + * Absolute http(s) link to the record in the third-party system */ - 403: Problem; + web_url?: string; +}; + +export type DeploymentZoneWritable = { /** - * Not Found + * Description of the deployment zone */ - 404: Problem; + description: string; /** - * Conflict + * Typed metadata for the deployment zone, validated against the org-scoped MetadataField schema */ - 409: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Unprocessable Entity + * Name of the deployment zone */ - 422: Problem; + name: string; /** - * Internal Server Error + * Currently deployed release ID */ - 500: Problem; -}; - -export type ArchiveLicenseError = ArchiveLicenseErrors[keyof ArchiveLicenseErrors]; - -export type ArchiveLicenseResponses = { + releaseId?: string; /** - * OK + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 200: License; -}; - -export type ArchiveLicenseResponse = ArchiveLicenseResponses[keyof ArchiveLicenseResponses]; - -export type GetLicenseEntitlementsData = { - body?: never; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/licenses/{licenseSlug}/entitlements"; + slug?: string; + /** + * Environment class of the deployment zone. Free-form: any value is stored as sent, but production, staging and development are the ones the console labels, and feature-flag targeting rules match on this field as __kaiten.deploymentZone.type. + */ + type: string; }; -export type GetLicenseEntitlementsErrors = { +export type EntitlementWritable = { /** - * Bad Request + * Method used to fold each reported usage value into the stored total (NUMBER only). Defaults to SUM. */ - 400: Problem; + aggregationMethod?: "COUNT" | "SUM" | "AVERAGE" | "MIN" | "MAX" | "LATEST"; /** - * Unauthorized + * Description of the entitlement */ - 401: Problem; + description: string | null; /** - * Forbidden + * Sort order of this entitlement in customer-facing components (ascending). Defaults to 0. */ - 403: Problem; + displayOrder?: number; /** - * Not Found + * Groups associated with this entitlement, identified by slug */ - 404: Problem; + groupSlugs?: Array | null; /** - * Unprocessable Entity + * Optional icon, stored as a provider-namespaced token (provider:name). Decoupled from any specific icon library. */ - 422: Problem; + icon?: string; /** - * Internal Server Error + * Name of the entitlement */ - 500: Problem; -}; - -export type GetLicenseEntitlementsError = - GetLicenseEntitlementsErrors[keyof GetLicenseEntitlementsErrors]; - -export type GetLicenseEntitlementsResponses = { + name: string; /** - * OK + * Phase of the periodic usage window: CALENDAR (UTC calendar-aligned) or LICENSE_START (phased off the instance's license start date). Required exactly when resetPeriod is set; defaults to CALENDAR when omitted. Immutable once set. */ - 200: PageLicenseEntitlement; -}; - -export type GetLicenseEntitlementsResponse = - GetLicenseEntitlementsResponses[keyof GetLicenseEntitlementsResponses]; - -export type AssociateEntitlementWithLicenseData = { - body: LicenseEntitlementWritable; - path: { - /** - * License slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements"; -}; - -export type AssociateEntitlementWithLicenseErrors = { + resetAnchor?: "CALENDAR" | "LICENSE_START"; /** - * Bad Request + * Cadence at which usage automatically resets for this NUMBER entitlement. NULL means a lifetime counter (default). Immutable once set -- a full-replace PUT must echo back the stored value. */ - 400: Problem; + resetPeriod?: "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR"; /** - * Unauthorized + * Number of base units one sale unit represents (1 sale unit = N base units). */ - 401: Problem; + saleUnitFactor?: number; /** - * Forbidden + * Plural label of the unit this entitlement is sold in, when it differs from the base unit. */ - 403: Problem; + saleUnitPlural?: string; /** - * Not Found + * Singular label of the unit this entitlement is sold in, when it differs from the base unit. Requires the base unit labels and the full sale unit trio (saleUnitSingular, saleUnitPlural, saleUnitFactor). */ - 404: Problem; + saleUnitSingular?: string; /** - * Conflict + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 409: Problem; + slug?: string; /** - * Unprocessable Entity + * Type of the entitlement */ - 422: Problem; + type?: "BOOLEAN" | "NUMBER" | "CONFIG" | "NUMBER_AI_CREDIT"; /** - * Internal Server Error + * Plural label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitSingular. */ - 500: Problem; + unitPlural?: string; /** - * Service Unavailable + * Singular label of the base unit this entitlement is measured in (NUMBER type only). Must be provided together with unitPlural. */ - 503: Problem; -}; - -export type AssociateEntitlementWithLicenseError = - AssociateEntitlementWithLicenseErrors[keyof AssociateEntitlementWithLicenseErrors]; - -export type AssociateEntitlementWithLicenseResponses = { + unitSingular?: string; /** - * No Content + * Whether this entitlement is displayed in customer-facing components (e.g. plan and pricing pages). Defaults to false. */ - 204: void; + userFacing?: boolean; + /** + * Percentage of the cap at which an early-warning event fires before the cap is reached. 0 disables the warning (default). + */ + warningThresholdPercent?: number; }; -export type AssociateEntitlementWithLicenseResponse = - AssociateEntitlementWithLicenseResponses[keyof AssociateEntitlementWithLicenseResponses]; - -export type DeleteLicenseEntitlementData = { - body?: never; - path: { - licenseSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +export type EntitlementGroupWritable = { + /** + * Description of the entitlement group + */ + description: string | null; + /** + * Name of the entitlement group + */ + name: string; + /** + * URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; }; -export type DeleteLicenseEntitlementErrors = { +export type EntitlementGroupUsageWritable = { /** - * Bad Request + * End of the current usage window (exclusive). Null for a lifetime entitlement. */ - 400: Problem; + currentPeriodEnd?: string; /** - * Unauthorized + * Start of the current usage window (inclusive). Null for a lifetime entitlement. */ - 401: Problem; + currentPeriodStart?: string; /** - * Forbidden + * Entitlement ID */ - 403: Problem; + entitlementId: string; /** - * Not Found + * Entitlement name */ - 404: Problem; + entitlementName: string; /** - * Unprocessable Entity + * Entitlement slug */ - 422: Problem; + entitlementSlug: string; /** - * Internal Server Error + * Entitlement type */ - 500: Problem; -}; - -export type DeleteLicenseEntitlementError = - DeleteLicenseEntitlementErrors[keyof DeleteLicenseEntitlementErrors]; - -export type DeleteLicenseEntitlementResponses = { + entitlementType: string; /** - * No Content + * License limit value, discriminated by the 'type' field. Null when the license grants no value. */ - 204: void; -}; - -export type DeleteLicenseEntitlementResponse = - DeleteLicenseEntitlementResponses[keyof DeleteLicenseEntitlementResponses]; - -export type GetLicenseEntitlementData = { - body?: never; - path: { - licenseSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; + licenseValue?: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); + /** + * Current usage value, discriminated by the 'type' field. Null when nothing has been reported yet. + */ + usageValue?: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type GetLicenseEntitlementErrors = { +export type EntitlementUsageWritable = { /** - * Unauthorized + * End of the current usage window (exclusive). Null for a lifetime entitlement (no configured reset period). */ - 401: Problem; + currentPeriodEnd?: string; /** - * Forbidden + * Start of the current usage window (inclusive). Null for a lifetime entitlement (no configured reset period). */ - 403: Problem; + currentPeriodStart?: string; /** - * Not Found + * Unique identifier for the entitlement */ - 404: Problem; + entitlementId: string; /** - * Unprocessable Entity + * URL-friendly identifier of the entitlement */ - 422: Problem; + entitlementSlug: string; /** - * Internal Server Error + * Unique identifier for the license to which this entitlement usage belongs */ - 500: Problem; -}; - -export type GetLicenseEntitlementError = - GetLicenseEntitlementErrors[keyof GetLicenseEntitlementErrors]; - -export type GetLicenseEntitlementResponses = { + licenseId: string; /** - * OK + * URL-friendly identifier of the license */ - 200: LicenseEntitlement; -}; - -export type GetLicenseEntitlementResponse = - GetLicenseEntitlementResponses[keyof GetLicenseEntitlementResponses]; - -export type UpdateLicenseEntitlementData = { - body: LicenseEntitlementWritable; - path: { - licenseSlug: string; - entitlementSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; + licenseSlug: string; + /** + * License grant this usage is measured against, discriminated by the 'type' field. Null when the license grants no value; -1 means unlimited for a NUMBER entitlement. + */ + limit?: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); + /** + * Resolved entitlement value, discriminated by the 'type' field + */ + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type UpdateLicenseEntitlementErrors = { +export type EventWritable = { /** - * Bad Request + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Forbidden + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 403: Problem; + billingTiming: "ADVANCE" | "ARREARS"; /** - * Not Found + * ISO 4217 code, upper case. One currency per licence version. */ - 404: Problem; + currency: string; /** - * Unprocessable Entity + * When the price was deprecated */ - 422: Problem; + deprecatedAt?: string; /** - * Internal Server Error + * The invoice line's label; a default is derived when absent. */ - 500: Problem; -}; - -export type UpdateLicenseEntitlementError = - UpdateLicenseEntitlementErrors[keyof UpdateLicenseEntitlementErrors]; - -export type UpdateLicenseEntitlementResponses = { + displayLabel?: string; /** - * No Content + * Order among the version's prices */ - 204: void; -}; - -export type UpdateLicenseEntitlementResponse = - UpdateLicenseEntitlementResponses[keyof UpdateLicenseEntitlementResponses]; - -export type PublishLicenseData = { - body?: never; - path: { - /** - * License version slug - */ - licenseSlug: string; - }; - query?: never; - url: "/licenses/{licenseSlug}/publish"; -}; - -export type PublishLicenseErrors = { - /** - * Bad Request - */ - 400: Problem; + displayOrder: number; /** - * Unauthorized + * The family of that version */ - 401: Problem; + familySlug: string; /** - * Forbidden + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 403: Problem; + isDefault: boolean; /** - * Not Found + * The licence version the price belongs to */ - 404: Problem; + licenseSlug: string; /** - * Conflict + * What a metered price measures. Absent on FLAT_FEE prices. */ - 409: Problem; + metered?: Meter; /** - * Unprocessable Entity + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. */ - 422: Problem; + status: "ACTIVE" | "DEPRECATED"; /** - * Internal Server Error + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. */ - 500: Problem; -}; - -export type PublishLicenseError = PublishLicenseErrors[keyof PublishLicenseErrors]; - -export type PublishLicenseResponses = { + unitAmount?: number; /** - * OK + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. */ - 200: License; + unitAmountDecimal: string; }; -export type PublishLicenseResponse = PublishLicenseResponses[keyof PublishLicenseResponses]; - -export type UnarchiveLicenseData = { - body?: never; - path: { - /** - * License version slug - */ - licenseSlug: string; +export type FeatureFlagWritable = { + default_variant: DefaultVariant; + description: string | null; + enabled: boolean; + event_name: string; + metadata: { + [key: string]: unknown; }; - query?: never; - url: "/licenses/{licenseSlug}/unarchive"; + name: string; + slug?: string; + targetings: Targetings; + type: "boolean" | "string" | "number" | "object"; + variants: Array | null; }; -export type UnarchiveLicenseErrors = { - /** - * Bad Request - */ - 400: Problem; - /** - * Unauthorized - */ - 401: Problem; - /** - * Forbidden - */ - 403: Problem; +export type InstanceWritable = { /** - * Not Found + * ID of the customer associated with this instance */ - 404: Problem; + customerId: string; /** - * Conflict + * ID of the deployment zone associated with this instance (optional) */ - 409: Problem; + deploymentZoneId?: string; /** - * Unprocessable Entity + * Brief description of the instance */ - 422: Problem; + description: string; /** - * Internal Server Error + * End date of the license for this instance */ - 500: Problem; -}; - -export type UnarchiveLicenseError = UnarchiveLicenseErrors[keyof UnarchiveLicenseErrors]; - -export type UnarchiveLicenseResponses = { + endLicenseDate: string; /** - * OK + * Integrations grouped by adapter name */ - 200: License; -}; - -export type UnarchiveLicenseResponse = UnarchiveLicenseResponses[keyof UnarchiveLicenseResponses]; - -export type ListMetadataFieldsData = { - body?: never; - path?: never; - query: { - resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; + integrations?: { + [key: string]: InstanceIntegrationWritable; }; - url: "/metadata-fields"; -}; - -export type ListMetadataFieldsErrors = { /** - * Bad Request + * ID of the license version this instance is pinned to. An ARCHIVED version cannot be assigned, on create or by changing the license (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); an instance already on a version that is archived later keeps it. A DRAFT version can be assigned, to try it before publishing. */ - 400: Problem; + licenseId: string; /** - * Unauthorized + * Metadata for the instance */ - 401: Problem; + metadata?: { + [key: string]: unknown; + }; /** - * Forbidden + * Name of the instance */ - 403: Problem; + name: string; /** - * Unprocessable Entity + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. */ - 422: Problem; + slug?: string; /** - * Internal Server Error + * Start date of the license for this instance */ - 500: Problem; + startLicenseDate: string; }; -export type ListMetadataFieldsError = ListMetadataFieldsErrors[keyof ListMetadataFieldsErrors]; - -export type ListMetadataFieldsResponses = { +export type InstanceAddonWritable = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + maxQuantity?: number; /** - * OK + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - 200: PageMetadataField; -}; - -export type ListMetadataFieldsResponse = - ListMetadataFieldsResponses[keyof ListMetadataFieldsResponses]; - -export type CreateMetadataFieldData = { - body: MetadataFieldWritable; - path?: never; - query?: never; - url: "/metadata-fields"; + prices: Array; + quantity: number; + removedAt?: string; }; -export type CreateMetadataFieldErrors = { +export type InstanceAddonUpdateWritable = { + addonId: string; + addonSlug: string; + attachedAt: string; + familySlug: string; + instanceSlug: string; + maxQuantity?: number; /** - * Bad Request + * The quantity before a quantity change */ - 400: Problem; + previousQuantity?: number; /** - * Unauthorized + * What the instance's subscription bills for it: the default FLAT_FEE price of the subscription's period and the ACTIVE metered prices. Empty when the instance is not billed. */ - 401: Problem; + prices: Array; + quantity: number; + removedAt?: string; +}; + +export type InstanceBillingWritable = { /** - * Forbidden + * The instant its periods are counted from */ - 403: Problem; + anchorAt: string; /** - * Conflict + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 409: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Unprocessable Entity + * Effective: the subscription's own, else the organization's default */ - 422: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Internal Server Error + * The subscription's own collection method; absent when it takes the organization's */ - 500: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Service Unavailable + * The next boundary: the period closes, and its invoice is composed, after it */ - 503: Problem; -}; - -export type CreateMetadataFieldError = CreateMetadataFieldErrors[keyof CreateMetadataFieldErrors]; - -export type CreateMetadataFieldResponses = { + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; /** - * Created + * Effective: the subscription's own, else the organization's default */ - 201: MetadataField; -}; - -export type CreateMetadataFieldResponse = - CreateMetadataFieldResponses[keyof CreateMetadataFieldResponses]; - -export type ReorderMetadataFieldsData = { - body: ReorderMetadataFieldsInput; - path?: never; - query?: never; - url: "/metadata-fields/reorder"; -}; - -export type ReorderMetadataFieldsErrors = { + daysUntilDue: number; /** - * Bad Request + * The subscription's own payment terms; absent when it takes the organization's */ - 400: Problem; + daysUntilDueOverride?: number; + id: string; + instanceName: string; /** - * Unauthorized + * As it was at the subscription's last write */ - 401: Problem; + instanceSlug: string; + pastDueSince?: string; /** - * Forbidden + * Who collects its invoices. NOOP: the organization itself, through the handoff queue */ - 403: Problem; + providerKind: "NOOP" | "STRIPE"; /** - * Not Found + * A plan change waiting for the next boundary */ - 404: Problem; + scheduledChange?: ScheduledChangeWritable; /** - * Unprocessable Entity + * When billing started: usage before it is never billed */ - 422: Problem; + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; /** - * Internal Server Error + * When the trial ends, or ended: usage before it is never billed */ - 500: Problem; + trialEndsAt?: string; + updatedAt: string; }; -export type ReorderMetadataFieldsError = - ReorderMetadataFieldsErrors[keyof ReorderMetadataFieldsErrors]; - -export type ReorderMetadataFieldsResponses = { +export type InstanceEntitlementValueGetWritable = { /** - * No Content + * Unique identifier for the entitlement */ - 204: void; -}; - -export type ReorderMetadataFieldsResponse = - ReorderMetadataFieldsResponses[keyof ReorderMetadataFieldsResponses]; - -export type UpdateMetadataFieldData = { - body: MetadataFieldWritable; - path: { - id: string; - }; - query?: never; - url: "/metadata-fields/{id}"; -}; - -export type UpdateMetadataFieldErrors = { + entitlement_id: string; /** - * Bad Request + * URL-friendly identifier of the entitlement */ - 400: Problem; + entitlement_slug: string; /** - * Unauthorized + * Unique identifier for the instance the value was read for */ - 401: Problem; + instance_id: string; /** - * Forbidden + * Unique identifier for the license carrying the entitlement */ - 403: Problem; + license_id: string; /** - * Not Found + * Unique identifier for the owning organization */ - 404: Problem; + organization_id: string; /** - * Conflict + * When the value was read */ - 409: Problem; + timestamp: string; /** - * Unprocessable Entity + * Discriminator of the resolved entitlement value */ - 422: Problem; + type: string; /** - * Internal Server Error + * Resolved entitlement value at read time */ - 500: Problem; + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type UpdateMetadataFieldError = UpdateMetadataFieldErrors[keyof UpdateMetadataFieldErrors]; - -export type UpdateMetadataFieldResponses = { +export type InstanceIntegrationWritable = { /** - * OK + * External identifier in the third-party adapter */ - 200: MetadataField; -}; - -export type UpdateMetadataFieldResponse = - UpdateMetadataFieldResponses[keyof UpdateMetadataFieldResponses]; - -export type ArchiveMetadataFieldData = { - body?: never; - path: { - id: string; + external_id: string; + /** + * Last synchronization error message, if any + */ + last_error?: string; + /** + * Adapter-specific integration metadata + */ + metadata?: { + [key: string]: unknown; }; - query?: never; - url: "/metadata-fields/{id}/archive"; + /** + * Absolute http(s) link to the record in the third-party system + */ + web_url?: string; }; -export type ArchiveMetadataFieldErrors = { +export type LicenseWritable = { /** - * Bad Request + * Detailed description of the license capabilities and restrictions */ - 400: Problem; + description: string; /** - * Unauthorized + * Identifier of the license family this license is a version of. Stable across renames and new versions: two licenses sharing it are the same product. Always present in responses. On create, optional: names the family this license is a new version of, as familySlug does by slug; omit both to create a new family. On update, optional and must be the license's own family: a version cannot move between families (UpdateLicense.FamilyNotReassignable). */ - 401: Problem; + familyId?: string; /** - * Forbidden + * Write-only on create: slug of the family this license is a new version of. familyId names the same family by identifier; sent together they must agree. Omit both to create a new family, of which this license becomes version 1. Never returned -- see familyId. Refused on update: a version cannot move between families. */ - 403: Problem; + familySlug?: string; /** - * Not Found + * Whether this version is the one its family puts forward: at most one version per family, and only a PUBLISHED one (CreateLicense.DefaultMustBePublished, UpdateLicense.DefaultMustBePublished). Resolution hands it out ahead of the highest-numbered published version, so it keeps being served when a newer version is published. Setting it takes the flag from the family's previous default, which gets a LICENSE_UPDATED event of its own. On update, sending false unsets it; the default cannot be archived until another version takes its place or the flag is unset (ArchiveLicense.DefaultMustBePublished). */ - 404: Problem; + isDefault: boolean; /** - * Unprocessable Entity + * Whether this version may be served. Always present in responses. Optional on create, where it is DRAFT or PUBLISHED and PUBLISHED when omitted; ARCHIVED is refused (CreateLicense.LifecycleStateNotSettable), since a version is archived by withdrawing it from sale. After that it changes only through publish-license (DRAFT to PUBLISHED), archive-license (PUBLISHED to ARCHIVED) and unarchive-license (ARCHIVED to PUBLISHED); update accepts the stored state and refuses any other (UpdateLicense.LifecycleStateNotSettable). Only a PUBLISHED version can be the family's default. An ARCHIVED version cannot be assigned to an instance (CreateInstance.LicenseArchived, UpdateInstance.LicenseArchived); instances already on it keep it. */ - 422: Problem; + lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Internal Server Error + * Display name of the license */ - 500: Problem; -}; - -export type ArchiveMetadataFieldError = - ArchiveMetadataFieldErrors[keyof ArchiveMetadataFieldErrors]; - -export type ArchiveMetadataFieldResponses = { + name: string; /** - * OK + * How this version is sold. FREE and PAID can be bought self-serve; CUSTOM sends a buyer to selfServeCtaUrl or a conversation. Always present in responses. On create it defaults to CUSTOM; on update, omit it to keep the stored value. */ - 200: MetadataField; -}; - -export type ArchiveMetadataFieldResponse = - ArchiveMetadataFieldResponses[keyof ArchiveMetadataFieldResponses]; - -export type DryRunMetadataFieldData = { - body: MetadataFieldSchemaProposal; - path: { - id: string; - }; - query?: never; - url: "/metadata-fields/{id}/dry-run"; -}; - -export type DryRunMetadataFieldErrors = { + pricingType?: "FREE" | "PAID" | "CUSTOM"; /** - * Bad Request + * Whether self-serve signup captures a payment method before activation. Always present in responses; false when omitted on create. On update, omit it to keep the stored value. */ - 400: Problem; + requiresPaymentMethod?: boolean; /** - * Unauthorized + * Where a buyer is sent when this version cannot be bought self-serve: an http(s) URL of at most 2048 characters (CreateLicense.InvalidSelfServeCtaUrl). Absent when there is none. On update, omit it to keep the stored value, or send an empty string to remove it. */ - 401: Problem; + selfServeCtaUrl?: string; /** - * Forbidden + * Optional URL-friendly identifier, unique per organization. When omitted, a new version of an existing family takes {familySlug}-v{version}, and any other license gets one generated from its name. A license that opens a new family gives the family its slug. */ - 403: Problem; + slug?: string; /** - * Not Found + * Trial length, in days, a subscription to this version starts with by default. Absent when there is none. Must be at least 1 on create (CreateLicense.InvalidTrialPeriodDays). On update, omit it to keep the stored value, or send 0 to remove the trial. */ - 404: Problem; + trialPeriodDays?: number; /** - * Unprocessable Entity + * Type of the license determining its capabilities and restrictions */ - 422: Problem; + type: "DEVELOPMENT" | "TRIAL" | "PAID" | "COMMUNITY"; /** - * Internal Server Error + * Optional human-readable name for the license version. Defaults to "Version - ". */ - 500: Problem; + versionName?: string; }; -export type DryRunMetadataFieldError = DryRunMetadataFieldErrors[keyof DryRunMetadataFieldErrors]; - -export type DryRunMetadataFieldResponses = { +export type LicenseEntitlementWritable = { /** - * OK + * URL-friendly identifier for the entitlement */ - 200: Impact; -}; - -export type DryRunMetadataFieldResponse = - DryRunMetadataFieldResponses[keyof DryRunMetadataFieldResponses]; - -export type UnarchiveMetadataFieldData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/metadata-fields/{id}/unarchive"; -}; - -export type UnarchiveMetadataFieldErrors = { + entitlementSlug?: string; /** - * Bad Request + * Derives this grant's enforcement from its own numeric value: -1 when the value is unlimited (no cap, no overage); otherwise 0 rejects usage above the value (hard limit) and a positive percentage allows usage to exceed it by that much before being rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants. */ - 400: Problem; + limitCapExceededOveragePercent?: number; /** - * Unauthorized + * Typed entitlement value. Supported shapes: {type:number,value:number}, {type:boolean,value:boolean}, {type:object,value:{...}} */ - 401: Problem; + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); +}; + +export type LicenseFamilyViewWritable = { /** - * Forbidden + * The version this read is about. By default the version the family resolves to: its default version if it has one, otherwise its highest-numbered PUBLISHED version. Under ?version=N it is the version asked for instead, whatever its lifecycle state. Absent when the family has no PUBLISHED version, which only a list or an include=versions read returns. */ - 403: Problem; + currentVersion?: LicenseWritable; /** - * Not Found + * Whether the family's default PUBLISHED version is listed in the public catalogue. Private by default. */ - 404: Problem; + isPublic: boolean; /** - * Conflict + * URL-friendly identifier of the family, unique per organization and stable across renames and new versions. Deleting the family's last version deletes the family and frees the slug. */ - 409: Problem; + slug: string; /** - * Unprocessable Entity + * Number of versions in this family, whatever their lifecycle state */ - 422: Problem; + versionCount: number; /** - * Internal Server Error + * Every version of the family, oldest first. Only returned when explicitly requested with include=versions, and then never null: a family always has at least one version. */ - 500: Problem; + versions?: Array; }; -export type UnarchiveMetadataFieldError = - UnarchiveMetadataFieldErrors[keyof UnarchiveMetadataFieldErrors]; - -export type UnarchiveMetadataFieldResponses = { +export type MetadataFieldWritable = { /** - * OK + * Sort order in the admin UI; ties are broken by createdAt ASC. Settable only through POST /metadata-fields/reorder; never echoed back on update. */ - 200: MetadataField; -}; - -export type UnarchiveMetadataFieldResponse = - UnarchiveMetadataFieldResponses[keyof UnarchiveMetadataFieldResponses]; - -export type EvaluateFlagsBulkData = { + displayOrder?: number; /** - * EvaluateVariant multiple flags in one request + * JSON Schema 2020-12 document describing the value space. Example: {"type":"string","enum":["a","b"]} */ - body?: BulkEvaluationRequest; - headers?: { - /** - * The request will be processed only if ETag doesn't match any of the values listed. - */ - "If-None-Match"?: string; + jsonSchema: { + [key: string]: unknown; }; - path?: never; - query?: never; - url: "/ofrep/v1/evaluate/flags"; -}; - -export type EvaluateFlagsBulkErrors = { /** - * Bad evaluation request + * Stable identifier, unique per (organization, resource type) on non-archived rows. Immutable after creation; update must echo back the stored value. */ - 400: BulkEvaluationFailure; + key: string; /** - * Unauthorized - You need credentials to access the API + * Human-readable label shown in the admin UI */ - 401: unknown; + label: string; /** - * Forbidden - You are not authorized to access the API + * Resource type this field applies to. Immutable after creation; update must echo back the stored value. */ - 403: unknown; + resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; +}; + +export type NumberEntitlementValueWritable = { /** - * Rate limit reached on the Flag Management System + * Value type discriminator */ - 429: unknown; + type: "number"; /** - * Internal server error + * Numeric value */ - 500: BulkEvaluationFailure; + value: number; }; -export type EvaluateFlagsBulkError = EvaluateFlagsBulkErrors[keyof EvaluateFlagsBulkErrors]; - -export type EvaluateFlagsBulkResponses = { +export type PageComponentWritable = { /** - * OFREP successful evaluation response + * Whether more rows exist beyond this page. */ - 200: - | { - /** - * Array of evaluation results - */ - flags?: Array; - } - | BulkEvaluationFailure; -}; - -export type EvaluateFlagsBulkResponse = - EvaluateFlagsBulkResponses[keyof EvaluateFlagsBulkResponses]; - -export type EvaluateFlagData = { + hasMore: boolean; + items: Array; /** - * Evaluation context + * Opaque cursor for the next page. Absent when hasMore is false. */ - body: EvaluationRequest; - path: { - key: string; - }; - query?: never; - url: "/ofrep/v1/evaluate/flags/{key}"; + nextCursor?: string; }; -export type EvaluateFlagErrors = { +export type PageCustomerWritable = { /** - * Evaluation failed + * Whether more rows exist beyond this page. */ - 400: EvaluationFailure; + hasMore: boolean; + items: Array; /** - * Internal error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: EvaluationFailure; + nextCursor?: string; }; -export type EvaluateFlagError = EvaluateFlagErrors[keyof EvaluateFlagErrors]; - -export type EvaluateFlagResponses = { +export type PageDeploymentZoneWritable = { /** - * Flag evaluated successfully + * Whether more rows exist beyond this page. */ - 200: EvaluationSuccess; -}; - -export type EvaluateFlagResponse = EvaluateFlagResponses[keyof EvaluateFlagResponses]; - -export type GetOpenfeatureManifestData = { - body?: never; - path?: never; - query?: never; - url: "/openfeature/v0/manifest"; -}; - -export type GetOpenfeatureManifestErrors = { + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageEntitlementWritable = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Internal Server Error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: Problem; + nextCursor?: string; }; -export type GetOpenfeatureManifestError = - GetOpenfeatureManifestErrors[keyof GetOpenfeatureManifestErrors]; - -export type GetOpenfeatureManifestResponses = { +export type PageEntitlementGroupWritable = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: ManifestEnvelope; -}; - -export type GetOpenfeatureManifestResponse = - GetOpenfeatureManifestResponses[keyof GetOpenfeatureManifestResponses]; - -export type ListReleasesData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/releases"; -}; - -export type ListReleasesErrors = { + hasMore: boolean; + items: Array; /** - * Bad Request + * Opaque cursor for the next page. Absent when hasMore is false. */ - 400: Problem; + nextCursor?: string; +}; + +export type PageFeatureFlagWritable = { /** - * Unauthorized + * Whether more rows exist beyond this page. */ - 401: Problem; + hasMore: boolean; + items: Array; /** - * Forbidden + * Opaque cursor for the next page. Absent when hasMore is false. */ - 403: Problem; + nextCursor?: string; +}; + +export type PageInstanceWritable = { /** - * Unprocessable Entity + * Whether more rows exist beyond this page. */ - 422: Problem; + hasMore: boolean; + items: Array; /** - * Internal Server Error + * Opaque cursor for the next page. Absent when hasMore is false. */ - 500: Problem; + nextCursor?: string; }; -export type ListReleasesError = ListReleasesErrors[keyof ListReleasesErrors]; - -export type ListReleasesResponses = { +export type PageLicenseWritable = { /** - * OK + * Whether more rows exist beyond this page. */ - 200: PageRelease; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type ListReleasesResponse = ListReleasesResponses[keyof ListReleasesResponses]; - -export type CreateReleaseData = { - body: ReleaseWritable; - path?: never; - query?: never; - url: "/releases"; +export type PageLicenseEntitlementWritable = { + /** + * Whether more rows exist beyond this page. + */ + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateReleaseErrors = { +export type PageLicenseFamilyViewWritable = { /** - * Bad Request + * Whether more rows exist beyond this page. */ - 400: Problem; + hasMore: boolean; + items: Array; /** - * Unauthorized + * Opaque cursor for the next page. Absent when hasMore is false. */ - 401: Problem; + nextCursor?: string; +}; + +export type PageMetadataFieldWritable = { /** - * Forbidden + * Whether more rows exist beyond this page. */ - 403: Problem; + hasMore: boolean; + items: Array; /** - * Not Found + * Opaque cursor for the next page. Absent when hasMore is false. */ - 404: Problem; + nextCursor?: string; +}; + +export type PageReleaseWritable = { /** - * Conflict + * Whether more rows exist beyond this page. */ - 409: Problem; + hasMore: boolean; + items: Array; /** - * Unprocessable Entity + * Opaque cursor for the next page. Absent when hasMore is false. */ - 422: Problem; + nextCursor?: string; +}; + +export type PageServiceAccountWritable = { /** - * Internal Server Error + * Whether more rows exist beyond this page. */ - 500: Problem; + hasMore: boolean; + items: Array; /** - * Service Unavailable + * Opaque cursor for the next page. Absent when hasMore is false. */ - 503: Problem; + nextCursor?: string; }; -export type CreateReleaseError = CreateReleaseErrors[keyof CreateReleaseErrors]; - -export type CreateReleaseResponses = { +export type PageTokenWritable = { /** - * Created + * Whether more rows exist beyond this page. */ - 201: Release; + hasMore: boolean; + items: Array; + /** + * Opaque cursor for the next page. Absent when hasMore is false. + */ + nextCursor?: string; }; -export type CreateReleaseResponse = CreateReleaseResponses[keyof CreateReleaseResponses]; - -export type DeleteReleaseData = { - body?: never; - path: { - /** - * Release slug - */ - releaseSlug: string; - }; - query?: never; - url: "/releases/{releaseSlug}"; +export type PlainTokenWritable = { + expiresAt?: string; + name: string; + scopes: Array | null; + /** + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + */ + slug?: string; }; -export type DeleteReleaseErrors = { +export type PriceWritable = { /** - * Bad Request + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 400: Problem; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; /** - * Unauthorized + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. */ - 401: Problem; + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; /** - * Forbidden + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. */ - 403: Problem; + billingTiming: "ADVANCE" | "ARREARS"; /** - * Not Found + * ISO 4217 code, upper case. One currency per licence version. */ - 404: Problem; + currency: string; /** - * Conflict + * When the price was deprecated */ - 409: Problem; + deprecatedAt?: string; /** - * Unprocessable Entity + * The invoice line's label; a default is derived when absent. */ - 422: Problem; + displayLabel?: string; /** - * Internal Server Error + * Order among the version's prices */ - 500: Problem; -}; - -export type DeleteReleaseError = DeleteReleaseErrors[keyof DeleteReleaseErrors]; - -export type DeleteReleaseResponses = { + displayOrder: number; /** - * No Content + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. */ - 204: void; + isDefault: boolean; + /** + * What a metered price measures. Absent on FLAT_FEE prices. + */ + metered?: Meter; + /** + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + */ + status: "ACTIVE" | "DEPRECATED"; + /** + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. + */ + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; }; -export type DeleteReleaseResponse = DeleteReleaseResponses[keyof DeleteReleaseResponses]; - -export type GetReleaseBySlugData = { - body?: never; - path: { - /** - * Release slug - */ - releaseSlug: string; - }; - query?: never; - url: "/releases/{releaseSlug}"; +export type PublishableKeyWritable = { + /** + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. + */ + allowedOrigins: Array; + /** + * What the key is for, to tell keys apart + */ + label: string; }; -export type GetReleaseBySlugErrors = { +export type PublishableKeyCreatedWritable = { /** - * Unauthorized + * Browser origins allowed to send the key. Empty: no browser origin may; requests without an Origin header (server-side rendering) still may. */ - 401: Problem; + allowedOrigins: Array; /** - * Forbidden + * What the key is for, to tell keys apart */ - 403: Problem; + label: string; +}; + +export type RedemptionWritable = { /** - * Not Found + * Invoices a PRICE voucher discounted */ - 404: Problem; + applicationsCount: number; /** - * Unprocessable Entity + * 1 for ONE_TIME, durationInPeriods for REPEATING; absent for FOREVER */ - 422: Problem; + applicationsMax?: number; + codeHint: string; /** - * Internal Server Error + * When a boost stops applying; absent for a PRICE voucher, counted in invoices, and for FOREVER */ - 500: Problem; + effectiveExpiresAt?: string; + effectiveStartsAt: string; + expiredAt?: string; + instanceSlug: string; + redeemedAt: string; + revokedAt?: string; + revokedReason?: string; + status: "ACTIVE" | "EXPIRED" | "REVOKED"; + voucherId: string; + voucherName: string; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; }; -export type GetReleaseBySlugError = GetReleaseBySlugErrors[keyof GetReleaseBySlugErrors]; +export type ReleaseWritable = { + /** + * List of component IDs to link to this release + */ + componentIds?: Array | null; + /** + * Description of the release + */ + description?: string; + /** + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; + /** + * Version of the release + */ + version: string; +}; -export type GetReleaseBySlugResponses = { +export type ReportEntitlementUsageBodyWritable = { /** - * OK + * Report behavior: append folds the value into the stored total through the aggregation method; set overwrites it */ - 200: Release; + behavior?: "append" | "set"; + /** + * Optional metadata for the usage report, a JSON object stored with it in the usage history when its compact encoding is at most 4 KiB. Above that it is not stored, the report is still counted, and the response carries Kaiten-Metadata-Dropped: too_large. It must contain no personal data: anyone who can read the organization's instances can read it, for as long as the usage history is kept. Numbers are read as 64-bit floats, so send large identifiers as strings. + */ + metadata?: { + [key: string]: unknown; + }; + /** + * Optional idempotency key, 1 to 128 characters of [A-Za-z0-9._:-], matched exactly and case-sensitively. A report sent again with the same key and the same behavior and value within KAITEN_USAGE_IDEMPOTENCY_WINDOW (35 days by default) is applied once: the retry answers 200 with the original response and the Idempotent-Replayed header, and changes nothing. The same key with another behavior or value answers 409 ReportEntitlementUsageMetric.TransactionIdReused. A rejected report does not consume its key. Scoped to the instance and entitlement: one business event may feed two meters under one key. + */ + transactionId?: string; + /** + * Reported entitlement value, discriminated by the 'type' field. Usage reporting accepts the number variant only. + */ + value: + | ({ + type: "number"; + } & NumberEntitlementValueWritable) + | ({ + type: "boolean"; + } & BooleanEntitlementValue) + | ({ + type: "object"; + } & ConfigEntitlementValue); }; -export type GetReleaseBySlugResponse = GetReleaseBySlugResponses[keyof GetReleaseBySlugResponses]; +export type ScheduledChangeWritable = { + /** + * The boundary it applies at: the current period's end + */ + effectiveAt: string; + /** + * The FLAT_FEE price the subscription moves to + */ + price: PriceWritable; + scheduledAt: string; +}; -export type GetServiceAccountsData = { - body?: never; - path?: never; - query?: { - /** - * Opaque pagination cursor from a previous response's nextCursor - */ - cursor?: string; - /** - * Maximum number of entries to return (default 50, max 200) - */ - limit?: number; - }; - url: "/service-accounts"; +export type ServiceAccountWritable = { + name: string; + /** + * Optional URL-friendly identifier, unique per organization. Auto-generated if not provided. + */ + slug?: string; }; -export type GetServiceAccountsErrors = { +export type StartedSubscriptionWritable = { /** - * Bad Request + * The invoice of the first period, when the base price bills in advance; absent otherwise. Charged automatically, it is pushed and charged before this answer when the provider answers within 20 seconds: its status says how it went. */ - 400: Problem; + activationInvoice?: InvoiceSummary; /** - * Unauthorized + * The instant its periods are counted from */ - 401: Problem; + anchorAt: string; /** - * Forbidden + * The FLAT_FEE price the subscription is pinned to, deprecated or not */ - 403: Problem; + basePrice: PriceWritable; + billingPeriod: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + cancelAtPeriodEnd: boolean; + cancelRequestedAt?: string; + canceledAt?: string; + cancellationReason?: string; /** - * Not Found + * Effective: the subscription's own, else the organization's default */ - 404: Problem; + collectionMethod: "SEND_INVOICE" | "CHARGE_AUTOMATICALLY"; /** - * Unprocessable Entity + * The subscription's own collection method; absent when it takes the organization's */ - 422: Problem; + collectionMethodOverride?: string; + createdAt: string; + currency: string; /** - * Internal Server Error + * The next boundary: the period closes, and its invoice is composed, after it */ - 500: Problem; + currentPeriodEnd: string; + currentPeriodStart: string; + customerName: string; + customerSlug: string; + /** + * Effective: the subscription's own, else the organization's default + */ + daysUntilDue: number; + /** + * The subscription's own payment terms; absent when it takes the organization's + */ + daysUntilDueOverride?: number; + id: string; + instanceName: string; + /** + * As it was at the subscription's last write + */ + instanceSlug: string; + pastDueSince?: string; + /** + * Who collects its invoices. NOOP: the organization itself, through the handoff queue + */ + providerKind: "NOOP" | "STRIPE"; + /** + * A plan change waiting for the next boundary + */ + scheduledChange?: ScheduledChangeWritable; + /** + * When billing started: usage before it is never billed + */ + startedAt: string; + status: "TRIAL" | "ACTIVE" | "PAST_DUE" | "CANCELED"; + /** + * When the trial ends, or ended: usage before it is never billed + */ + trialEndsAt?: string; + updatedAt: string; }; -export type GetServiceAccountsError = GetServiceAccountsErrors[keyof GetServiceAccountsErrors]; +export type TokenWritable = { + expiresAt?: string; + name: string; + scopes: Array | null; + /** + * Optional URL-friendly identifier, unique per service account. Auto-generated if not provided. + */ + slug?: string; +}; -export type GetServiceAccountsResponses = { +export type UpdatedEventWritable = { /** - * OK + * FLAT_FEE: an amount per billing period. USAGE_BASED: an amount per sale unit of the metered entitlement's usage. OVERAGE: an amount per sale unit of the usage above the licence's limit. */ - 200: PageServiceAccount; + billingModel: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; + /** + * The period a FLAT_FEE price is charged for. Absent on metered prices, which bill on the subscription's period. + */ + billingPeriod?: "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL"; + /** + * ADVANCE bills the period that starts; ARREARS the period that ended. Metered prices are always ARREARS. + */ + billingTiming: "ADVANCE" | "ARREARS"; + /** + * The members the update changed, as the API names them + */ + changedFields: Array | null; + /** + * ISO 4217 code, upper case. One currency per licence version. + */ + currency: string; + /** + * When the price was deprecated + */ + deprecatedAt?: string; + /** + * The invoice line's label; a default is derived when absent. + */ + displayLabel?: string; + /** + * Order among the version's prices + */ + displayOrder: number; + /** + * The family of that version + */ + familySlug: string; + /** + * The FLAT_FEE price picked for its billing period when none is named. At most one per period; only an ACTIVE FLAT_FEE price. + */ + isDefault: boolean; + /** + * The licence version the price belongs to + */ + licenseSlug: string; + /** + * What a metered price measures. Absent on FLAT_FEE prices. + */ + metered?: Meter; + /** + * A DEPRECATED price keeps billing what is already pinned to it but is no longer offered. + */ + status: "ACTIVE" | "DEPRECATED"; + /** + * unitAmountDecimal as an integer number of minor units, when it is one; absent otherwise. + */ + unitAmount?: number; + /** + * Amount in the currency's minor units (cents for EUR): per period for FLAT_FEE, per sale unit for metered prices. Up to 12 decimal places. + */ + unitAmountDecimal: string; }; -export type GetServiceAccountsResponse = - GetServiceAccountsResponses[keyof GetServiceAccountsResponses]; +export type ValidityWritable = { + /** + * The first failing check + */ + reason?: + | "NOT_FOUND" + | "NOT_ACTIVE" + | "NOT_YET_VALID" + | "EXPIRED" + | "EXHAUSTED" + | "ALREADY_REDEEMED" + | "NOT_ELIGIBLE" + | "CURRENCY_MISMATCH"; + /** + * With NOT_ELIGIBLE: the eligibility rule + */ + rule?: + | "RESTRICTED_CUSTOMER" + | "LICENSE_NOT_APPLICABLE" + | "ADDON_NOT_APPLICABLE" + | "FIRST_TIME_ONLY" + | "ANNUAL_ONLY" + | "MINIMUM_SUBSCRIPTION_AMOUNT" + | "NOTHING_TO_BOOST"; + valid: boolean; + /** + * The voucher, without its code, when the code names one + */ + voucher?: VoucherWritable; +}; -export type CreateServiceAccountData = { +export type VoucherWritable = { /** - * Service account details + * Only instances holding one of these add-on versions can redeem it; any when empty */ - body: ServiceAccountWritable; + applicableAddonIds: Array; + applicableAddonPriceIds: Array; + /** + * Only instances on these licence versions can redeem it; any when empty + */ + applicableLicenseIds: Array; + applicableLicensePriceIds: Array; + /** + * The code to redeem. Returned to read:vouchers callers only; never in an event. + */ + code?: string; + /** + * The last four characters of the normalized code + */ + codeHint: string; + /** + * The currency of a FIXED_AMOUNT discount + */ + currency?: string; + description?: string; + /** + * PRICE: how many invoices it discounts (one, durationInPeriods, or every one). BOOST: how long a redemption lasts, in the subscription's billing periods. + */ + duration: "ONE_TIME" | "REPEATING" | "FOREVER"; + durationInPeriods?: number; + expiresAt?: string; + /** + * What an ENTITLEMENT_BOOST changes + */ + grants: Array; + maxRedemptions?: number; + name: string; + priceAppliesTo?: "LICENSE_BASE" | "ADDONS" | "BOTH" | "SELECTED_PRICES"; + priceDiscountType?: "PERCENTAGE" | "FIXED_AMOUNT"; + /** + * A percentage in (0, 100], or an integer amount in minor units of currency + */ + priceDiscountValue?: string; + redemptionRules: RedemptionRules; + redemptionsCount: number; + /** + * Only this customer's instances can redeem it + */ + restrictedCustomerSlug?: string; + startsAt?: string; + status: "DRAFT" | "ACTIVE" | "EXPIRED" | "EXHAUSTED" | "ARCHIVED"; + voucherType: "PRICE" | "ENTITLEMENT_BOOST"; +}; + +export type ListAddonFamiliesData = { + body?: never; path?: never; query?: never; - url: "/service-accounts"; + url: "/addon-families"; }; -export type CreateServiceAccountErrors = { +export type ListAddonFamiliesErrors = { /** * Bad Request */ @@ -8146,10 +7905,6 @@ export type CreateServiceAccountErrors = { * Not Found */ 404: Problem; - /** - * Conflict - */ - 409: Problem; /** * Unprocessable Entity */ @@ -8164,32 +7919,31 @@ export type CreateServiceAccountErrors = { 503: Problem; }; -export type CreateServiceAccountError = - CreateServiceAccountErrors[keyof CreateServiceAccountErrors]; +export type ListAddonFamiliesError = ListAddonFamiliesErrors[keyof ListAddonFamiliesErrors]; -export type CreateServiceAccountResponses = { +export type ListAddonFamiliesResponses = { /** - * Created service account + * OK */ - 201: ServiceAccount; + 200: Array; }; -export type CreateServiceAccountResponse = - CreateServiceAccountResponses[keyof CreateServiceAccountResponses]; +export type ListAddonFamiliesResponse = + ListAddonFamiliesResponses[keyof ListAddonFamiliesResponses]; -export type GetServiceAccountData = { +export type GetAddonFamilyData = { body?: never; path: { /** - * Service account slug + * Add-on family slug */ - serviceAccountSlug: string; + familySlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}"; + url: "/addon-families/{familySlug}"; }; -export type GetServiceAccountErrors = { +export type GetAddonFamilyErrors = { /** * Bad Request */ @@ -8214,36 +7968,36 @@ export type GetServiceAccountErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type GetServiceAccountError = GetServiceAccountErrors[keyof GetServiceAccountErrors]; +export type GetAddonFamilyError = GetAddonFamilyErrors[keyof GetAddonFamilyErrors]; -export type GetServiceAccountResponses = { +export type GetAddonFamilyResponses = { /** - * Service account details + * OK */ - 200: ServiceAccount; + 200: AddonFamily; }; -export type GetServiceAccountResponse = - GetServiceAccountResponses[keyof GetServiceAccountResponses]; +export type GetAddonFamilyResponse = GetAddonFamilyResponses[keyof GetAddonFamilyResponses]; -export type UpdateServiceAccountData = { - /** - * Service account update details - */ - body: ServiceAccountWritable; +export type UpdateAddonFamilyData = { + body: AddonFamilyVisibility; path: { /** - * Service account slug + * Add-on family slug */ - serviceAccountSlug: string; + familySlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}"; + url: "/addon-families/{familySlug}"; }; -export type UpdateServiceAccountErrors = { +export type UpdateAddonFamilyErrors = { /** * Bad Request */ @@ -8268,43 +8022,41 @@ export type UpdateServiceAccountErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type UpdateServiceAccountError = - UpdateServiceAccountErrors[keyof UpdateServiceAccountErrors]; +export type UpdateAddonFamilyError = UpdateAddonFamilyErrors[keyof UpdateAddonFamilyErrors]; -export type UpdateServiceAccountResponses = { +export type UpdateAddonFamilyResponses = { /** - * No Content + * OK */ - 204: void; + 200: AddonFamily; }; -export type UpdateServiceAccountResponse = - UpdateServiceAccountResponses[keyof UpdateServiceAccountResponses]; +export type UpdateAddonFamilyResponse = + UpdateAddonFamilyResponses[keyof UpdateAddonFamilyResponses]; -export type GetServiceAccountTokensData = { +export type ListAddonsData = { body?: never; - path: { - /** - * Service account slug - */ - serviceAccountSlug: string; - }; + path?: never; query?: { /** - * Opaque pagination cursor from a previous response's nextCursor + * Only versions in this state */ - cursor?: string; + lifecycleState?: "DRAFT" | "PUBLISHED" | "ARCHIVED"; /** - * Maximum number of entries to return (default 50, max 200) + * Only versions of this family */ - limit?: number; + familySlug?: string; }; - url: "/service-accounts/{serviceAccountSlug}/tokens"; + url: "/addons"; }; -export type GetServiceAccountTokensErrors = { +export type ListAddonsErrors = { /** * Bad Request */ @@ -8329,37 +8081,89 @@ export type GetServiceAccountTokensErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type GetServiceAccountTokensError = - GetServiceAccountTokensErrors[keyof GetServiceAccountTokensErrors]; +export type ListAddonsError = ListAddonsErrors[keyof ListAddonsErrors]; -export type GetServiceAccountTokensResponses = { +export type ListAddonsResponses = { /** * OK */ - 200: PageToken; + 200: Array; }; -export type GetServiceAccountTokensResponse = - GetServiceAccountTokensResponses[keyof GetServiceAccountTokensResponses]; +export type ListAddonsResponse = ListAddonsResponses[keyof ListAddonsResponses]; -export type CreateServiceAccountTokenData = { +export type CreateAddonData = { + body: NewAddon; + path?: never; + query?: never; + url: "/addons"; +}; + +export type CreateAddonErrors = { /** - * Token creation details + * Bad Request */ - body: PlainTokenWritable; + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateAddonError = CreateAddonErrors[keyof CreateAddonErrors]; + +export type CreateAddonResponses = { + /** + * Created + */ + 201: Addon; +}; + +export type CreateAddonResponse = CreateAddonResponses[keyof CreateAddonResponses]; + +export type DeleteAddonData = { + body?: never; path: { /** - * Service account slug + * Add-on version slug */ - serviceAccountSlug: string; + addonSlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}/tokens"; + url: "/addons/{addonSlug}"; }; -export type CreateServiceAccountTokenErrors = { +export type DeleteAddonErrors = { /** * Bad Request */ @@ -8394,36 +8198,30 @@ export type CreateServiceAccountTokenErrors = { 503: Problem; }; -export type CreateServiceAccountTokenError = - CreateServiceAccountTokenErrors[keyof CreateServiceAccountTokenErrors]; +export type DeleteAddonError = DeleteAddonErrors[keyof DeleteAddonErrors]; -export type CreateServiceAccountTokenResponses = { +export type DeleteAddonResponses = { /** - * Created token with secret value (only shown once) + * No Content */ - 201: PlainToken; + 204: void; }; -export type CreateServiceAccountTokenResponse = - CreateServiceAccountTokenResponses[keyof CreateServiceAccountTokenResponses]; +export type DeleteAddonResponse = DeleteAddonResponses[keyof DeleteAddonResponses]; -export type DeleteServiceAccountTokenData = { +export type GetAddonData = { body?: never; path: { /** - * Service account slug - */ - serviceAccountSlug: string; - /** - * Token slug to revoke + * Add-on version slug */ - tokenSlug: string; + addonSlug: string; }; query?: never; - url: "/service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}"; + url: "/addons/{addonSlug}"; }; -export type DeleteServiceAccountTokenErrors = { +export type GetAddonErrors = { /** * Bad Request */ @@ -8448,58 +8246,36 @@ export type DeleteServiceAccountTokenErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type DeleteServiceAccountTokenError = - DeleteServiceAccountTokenErrors[keyof DeleteServiceAccountTokenErrors]; +export type GetAddonError = GetAddonErrors[keyof GetAddonErrors]; -export type DeleteServiceAccountTokenResponses = { +export type GetAddonResponses = { /** - * No Content + * OK */ - 204: void; + 200: Addon; }; -export type DeleteServiceAccountTokenResponse = - DeleteServiceAccountTokenResponses[keyof DeleteServiceAccountTokenResponses]; +export type GetAddonResponse = GetAddonResponses[keyof GetAddonResponses]; -export type ExportOrganizationUsageReportsData = { - body?: never; - path?: never; - query?: { - /** - * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. - */ - from?: string; - /** - * End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. - */ - to?: string; - /** - * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat. - */ - format?: string; - /** - * Only this instance's reports - */ - instanceSlug?: string; - /** - * Only this instance's reports. Reaches a deleted instance, whose reports are kept. - */ - instanceId?: string; - /** - * Only this entitlement's reports - */ - entitlementSlug?: string; +export type UpdateAddonData = { + body: AddonChanges; + path: { /** - * Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. + * Add-on version slug */ - entitlementId?: string; + addonSlug: string; }; - url: "/usage/reports/export"; + query?: never; + url: "/addons/{addonSlug}"; }; -export type ExportOrganizationUsageReportsErrors = { +export type UpdateAddonErrors = { /** * Bad Request */ @@ -8516,6 +8292,10 @@ export type ExportOrganizationUsageReportsErrors = { * Not Found */ 404: Problem; + /** + * Conflict + */ + 409: Problem; /** * Unprocessable Entity */ @@ -8524,29 +8304,40 @@ export type ExportOrganizationUsageReportsErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type ExportOrganizationUsageReportsError = - ExportOrganizationUsageReportsErrors[keyof ExportOrganizationUsageReportsErrors]; +export type UpdateAddonError = UpdateAddonErrors[keyof UpdateAddonErrors]; -export type ExportOrganizationUsageReportsResponses = { +export type UpdateAddonResponses = { /** - * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + * OK */ - 200: string; + 200: Addon; }; -export type ExportOrganizationUsageReportsResponse = - ExportOrganizationUsageReportsResponses[keyof ExportOrganizationUsageReportsResponses]; +export type UpdateAddonResponse = UpdateAddonResponses[keyof UpdateAddonResponses]; -export type GetNotificationPreferencesData = { +export type ArchiveAddonData = { body?: never; - path?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; query?: never; - url: "/v1/notification-preferences"; + url: "/addons/{addonSlug}/archive"; }; -export type GetNotificationPreferencesErrors = { +export type ArchiveAddonErrors = { + /** + * Bad Request + */ + 400: Problem; /** * Unauthorized */ @@ -8555,33 +8346,52 @@ export type GetNotificationPreferencesErrors = { * Forbidden */ 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; /** * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type GetNotificationPreferencesError = - GetNotificationPreferencesErrors[keyof GetNotificationPreferencesErrors]; +export type ArchiveAddonError = ArchiveAddonErrors[keyof ArchiveAddonErrors]; -export type GetNotificationPreferencesResponses = { +export type ArchiveAddonResponses = { /** * OK */ - 200: PreferenceMatrix; + 200: Addon; }; -export type GetNotificationPreferencesResponse = - GetNotificationPreferencesResponses[keyof GetNotificationPreferencesResponses]; +export type ArchiveAddonResponse = ArchiveAddonResponses[keyof ArchiveAddonResponses]; -export type PutNotificationPreferencesData = { - body: PreferenceChoices; - path?: never; +export type ListAddonCompatibilityData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; query?: never; - url: "/v1/notification-preferences"; + url: "/addons/{addonSlug}/compatible-license-families"; }; -export type PutNotificationPreferencesErrors = { +export type ListAddonCompatibilityErrors = { /** * Bad Request */ @@ -8594,6 +8404,10 @@ export type PutNotificationPreferencesErrors = { * Forbidden */ 403: Problem; + /** + * Not Found + */ + 404: Problem; /** * Unprocessable Entity */ @@ -8602,672 +8416,11625 @@ export type PutNotificationPreferencesErrors = { * Internal Server Error */ 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; }; -export type PutNotificationPreferencesError = - PutNotificationPreferencesErrors[keyof PutNotificationPreferencesErrors]; +export type ListAddonCompatibilityError = + ListAddonCompatibilityErrors[keyof ListAddonCompatibilityErrors]; -export type PutNotificationPreferencesResponses = { +export type ListAddonCompatibilityResponses = { /** * OK */ - 200: PreferenceMatrix; + 200: CompatibleLicenseFamilies; }; -export type PutNotificationPreferencesResponse = - PutNotificationPreferencesResponses[keyof PutNotificationPreferencesResponses]; +export type ListAddonCompatibilityResponse = + ListAddonCompatibilityResponses[keyof ListAddonCompatibilityResponses]; -export type ListNotificationsData = { +export type RemoveAddonCompatibilityData = { body?: never; - path?: never; - query?: { - /** - * Which notifications to return (default all) - */ - status?: "all" | "unread"; - /** - * Only notifications about these kinds of object; repeat the parameter for several (default: all) - */ - objectType?: Array< - "instance" | "customer" | "release" | "deployment_zone" | "component" | "license" | "token" - > | null; + path: { /** - * Opaque cursor from a previous response's next_cursor + * Add-on version slug */ - cursor?: string; + addonSlug: string; /** - * Page size (default 20, max 50) + * License family slug */ - limit?: number; + familySlug: string; }; - url: "/v1/notifications"; + query?: never; + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}"; }; -export type ListNotificationsErrors = { +export type RemoveAddonCompatibilityErrors = { /** * Bad Request */ 400: Problem; /** - * Unauthorized + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RemoveAddonCompatibilityError = + RemoveAddonCompatibilityErrors[keyof RemoveAddonCompatibilityErrors]; + +export type RemoveAddonCompatibilityResponses = { + /** + * No Content + */ + 204: void; +}; + +export type RemoveAddonCompatibilityResponse = + RemoveAddonCompatibilityResponses[keyof RemoveAddonCompatibilityResponses]; + +export type SetAddonCompatibilityData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * License family slug + */ + familySlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/compatible-license-families/{familySlug}"; +}; + +export type SetAddonCompatibilityErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SetAddonCompatibilityError = + SetAddonCompatibilityErrors[keyof SetAddonCompatibilityErrors]; + +export type SetAddonCompatibilityResponses = { + /** + * No Content + */ + 204: void; +}; + +export type SetAddonCompatibilityResponse = + SetAddonCompatibilityResponses[keyof SetAddonCompatibilityResponses]; + +export type ListAddonEntitlementsData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements"; +}; + +export type ListAddonEntitlementsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListAddonEntitlementsError = + ListAddonEntitlementsErrors[keyof ListAddonEntitlementsErrors]; + +export type ListAddonEntitlementsResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListAddonEntitlementsResponse = + ListAddonEntitlementsResponses[keyof ListAddonEntitlementsResponses]; + +export type AssignAddonEntitlementData = { + body: NewAddonGrant; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements"; +}; + +export type AssignAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AssignAddonEntitlementError = + AssignAddonEntitlementErrors[keyof AssignAddonEntitlementErrors]; + +export type AssignAddonEntitlementResponses = { + /** + * Created + */ + 201: AddonEntitlement; +}; + +export type AssignAddonEntitlementResponse = + AssignAddonEntitlementResponses[keyof AssignAddonEntitlementResponses]; + +export type UnassignAddonEntitlementData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}"; +}; + +export type UnassignAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UnassignAddonEntitlementError = + UnassignAddonEntitlementErrors[keyof UnassignAddonEntitlementErrors]; + +export type UnassignAddonEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UnassignAddonEntitlementResponse = + UnassignAddonEntitlementResponses[keyof UnassignAddonEntitlementResponses]; + +export type GetAddonEntitlementData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}"; +}; + +export type GetAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetAddonEntitlementError = GetAddonEntitlementErrors[keyof GetAddonEntitlementErrors]; + +export type GetAddonEntitlementResponses = { + /** + * OK + */ + 200: AddonEntitlement; +}; + +export type GetAddonEntitlementResponse = + GetAddonEntitlementResponses[keyof GetAddonEntitlementResponses]; + +export type UpdateAddonEntitlementData = { + body: AddonGrant; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/entitlements/{entitlementSlug}"; +}; + +export type UpdateAddonEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateAddonEntitlementError = + UpdateAddonEntitlementErrors[keyof UpdateAddonEntitlementErrors]; + +export type UpdateAddonEntitlementResponses = { + /** + * OK + */ + 200: AddonEntitlement; +}; + +export type UpdateAddonEntitlementResponse = + UpdateAddonEntitlementResponses[keyof UpdateAddonEntitlementResponses]; + +export type ListAddonPricesData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: { + /** + * Only prices in this status; both when omitted + */ + status?: "ACTIVE" | "DEPRECATED"; + }; + url: "/addons/{addonSlug}/prices"; +}; + +export type ListAddonPricesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListAddonPricesError = ListAddonPricesErrors[keyof ListAddonPricesErrors]; + +export type ListAddonPricesResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListAddonPricesResponse = ListAddonPricesResponses[keyof ListAddonPricesResponses]; + +export type CreateAddonPriceData = { + body: NewAddonPrice; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/prices"; +}; + +export type CreateAddonPriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateAddonPriceError = CreateAddonPriceErrors[keyof CreateAddonPriceErrors]; + +export type CreateAddonPriceResponses = { + /** + * Created + */ + 201: Price; +}; + +export type CreateAddonPriceResponse = CreateAddonPriceResponses[keyof CreateAddonPriceResponses]; + +export type DeprecateAddonPriceData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + /** + * Price id + */ + priceId: string; + }; + query?: never; + url: "/addons/{addonSlug}/prices/{priceId}/deprecate"; +}; + +export type DeprecateAddonPriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DeprecateAddonPriceError = DeprecateAddonPriceErrors[keyof DeprecateAddonPriceErrors]; + +export type DeprecateAddonPriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type DeprecateAddonPriceResponse = + DeprecateAddonPriceResponses[keyof DeprecateAddonPriceResponses]; + +export type PublishAddonData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/publish"; +}; + +export type PublishAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type PublishAddonError = PublishAddonErrors[keyof PublishAddonErrors]; + +export type PublishAddonResponses = { + /** + * OK + */ + 200: Addon; +}; + +export type PublishAddonResponse = PublishAddonResponses[keyof PublishAddonResponses]; + +export type UnarchiveAddonData = { + body?: never; + path: { + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/addons/{addonSlug}/unarchive"; +}; + +export type UnarchiveAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UnarchiveAddonError = UnarchiveAddonErrors[keyof UnarchiveAddonErrors]; + +export type UnarchiveAddonResponses = { + /** + * OK + */ + 200: Addon; +}; + +export type UnarchiveAddonResponse = UnarchiveAddonResponses[keyof UnarchiveAddonResponses]; + +export type GetBillingCapabilitiesData = { + body?: never; + path?: never; + query?: never; + url: "/billing/capabilities"; +}; + +export type GetBillingCapabilitiesErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetBillingCapabilitiesError = + GetBillingCapabilitiesErrors[keyof GetBillingCapabilitiesErrors]; + +export type GetBillingCapabilitiesResponses = { + /** + * OK + */ + 200: BillingCapabilities; +}; + +export type GetBillingCapabilitiesResponse = + GetBillingCapabilitiesResponses[keyof GetBillingCapabilitiesResponses]; + +export type CloseBillingPeriodsData = { + body: ClosePeriodsScope; + path?: never; + query?: never; + url: "/billing/close-periods"; +}; + +export type CloseBillingPeriodsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CloseBillingPeriodsError = CloseBillingPeriodsErrors[keyof CloseBillingPeriodsErrors]; + +export type CloseBillingPeriodsResponses = { + /** + * OK + */ + 200: Report; +}; + +export type CloseBillingPeriodsResponse = + CloseBillingPeriodsResponses[keyof CloseBillingPeriodsResponses]; + +export type ListHandoffData = { + body?: never; + path?: never; + query?: { + /** + * PENDING (the default) or ACKNOWLEDGED + */ + status?: "PENDING" | "ACKNOWLEDGED"; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + }; + url: "/billing/handoff"; +}; + +export type ListHandoffErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListHandoffError = ListHandoffErrors[keyof ListHandoffErrors]; + +export type ListHandoffResponses = { + /** + * OK + */ + 200: PageQueuedInvoice; +}; + +export type ListHandoffResponse = ListHandoffResponses[keyof ListHandoffResponses]; + +export type ClaimHandoffData = { + body: HandoffClaimSize; + path?: never; + query?: never; + url: "/billing/handoff/claim"; +}; + +export type ClaimHandoffErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ClaimHandoffError = ClaimHandoffErrors[keyof ClaimHandoffErrors]; + +export type ClaimHandoffResponses = { + /** + * OK + */ + 200: HandoffClaim; +}; + +export type ClaimHandoffResponse = ClaimHandoffResponses[keyof ClaimHandoffResponses]; + +export type AckHandoffData = { + body: HandoffBooking; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/billing/handoff/{invoiceId}/ack"; +}; + +export type AckHandoffErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AckHandoffError = AckHandoffErrors[keyof AckHandoffErrors]; + +export type AckHandoffResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type AckHandoffResponse = AckHandoffResponses[keyof AckHandoffResponses]; + +export type GetBillingHealthData = { + body?: never; + path?: never; + query?: never; + url: "/billing/health"; +}; + +export type GetBillingHealthErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetBillingHealthError = GetBillingHealthErrors[keyof GetBillingHealthErrors]; + +export type GetBillingHealthResponses = { + /** + * OK + */ + 200: BillingHealth; +}; + +export type GetBillingHealthResponse = GetBillingHealthResponses[keyof GetBillingHealthResponses]; + +export type GetBillingSettingsData = { + body?: never; + path?: never; + query?: never; + url: "/billing/settings"; +}; + +export type GetBillingSettingsErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetBillingSettingsError = GetBillingSettingsErrors[keyof GetBillingSettingsErrors]; + +export type GetBillingSettingsResponses = { + /** + * OK + */ + 200: BillingSettings; +}; + +export type GetBillingSettingsResponse = + GetBillingSettingsResponses[keyof GetBillingSettingsResponses]; + +export type UpdateBillingSettingsData = { + body: BillingSettings; + path?: never; + query?: never; + url: "/billing/settings"; +}; + +export type UpdateBillingSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateBillingSettingsError = + UpdateBillingSettingsErrors[keyof UpdateBillingSettingsErrors]; + +export type UpdateBillingSettingsResponses = { + /** + * OK + */ + 200: BillingSettings; +}; + +export type UpdateBillingSettingsResponse = + UpdateBillingSettingsResponses[keyof UpdateBillingSettingsResponses]; + +export type SyncBillingProviderData = { + body?: never; + path?: never; + query?: never; + url: "/billing/sync"; +}; + +export type SyncBillingProviderErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SyncBillingProviderError = SyncBillingProviderErrors[keyof SyncBillingProviderErrors]; + +export type SyncBillingProviderResponses = { + /** + * Accepted + */ + 202: SyncReport; +}; + +export type SyncBillingProviderResponse = + SyncBillingProviderResponses[keyof SyncBillingProviderResponses]; + +export type ListComponentsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/components"; +}; + +export type ListComponentsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListComponentsError = ListComponentsErrors[keyof ListComponentsErrors]; + +export type ListComponentsResponses = { + /** + * OK + */ + 200: PageComponent; +}; + +export type ListComponentsResponse = ListComponentsResponses[keyof ListComponentsResponses]; + +export type CreateComponentData = { + body: ComponentWritable; + path?: never; + query?: never; + url: "/components"; +}; + +export type CreateComponentErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateComponentError = CreateComponentErrors[keyof CreateComponentErrors]; + +export type CreateComponentResponses = { + /** + * Created + */ + 201: Component; +}; + +export type CreateComponentResponse = CreateComponentResponses[keyof CreateComponentResponses]; + +export type DeleteComponentData = { + body?: never; + path: { + /** + * Component slug + */ + componentSlug: string; + }; + query?: never; + url: "/components/{componentSlug}"; +}; + +export type DeleteComponentErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteComponentError = DeleteComponentErrors[keyof DeleteComponentErrors]; + +export type DeleteComponentResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteComponentResponse = DeleteComponentResponses[keyof DeleteComponentResponses]; + +export type GetComponentData = { + body?: never; + path: { + /** + * Component slug + */ + componentSlug: string; + }; + query?: never; + url: "/components/{componentSlug}"; +}; + +export type GetComponentErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetComponentError = GetComponentErrors[keyof GetComponentErrors]; + +export type GetComponentResponses = { + /** + * OK + */ + 200: Component; +}; + +export type GetComponentResponse = GetComponentResponses[keyof GetComponentResponses]; + +export type UpdateComponentData = { + body: ComponentWritable; + path: { + /** + * Component slug + */ + componentSlug: string; + }; + query?: never; + url: "/components/{componentSlug}"; +}; + +export type UpdateComponentErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateComponentError = UpdateComponentErrors[keyof UpdateComponentErrors]; + +export type UpdateComponentResponses = { + /** + * OK + */ + 200: Component; +}; + +export type UpdateComponentResponse = UpdateComponentResponses[keyof UpdateComponentResponses]; + +export type ListConnectorsData = { + body?: never; + path?: never; + query?: never; + url: "/connectors"; +}; + +export type ListConnectorsErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListConnectorsError = ListConnectorsErrors[keyof ListConnectorsErrors]; + +export type ListConnectorsResponses = { + /** + * OK + */ + 200: Array | null; +}; + +export type ListConnectorsResponse = ListConnectorsResponses[keyof ListConnectorsResponses]; + +export type GetConnectorData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}"; +}; + +export type GetConnectorErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetConnectorError = GetConnectorErrors[keyof GetConnectorErrors]; + +export type GetConnectorResponses = { + /** + * OK + */ + 200: Connector; +}; + +export type GetConnectorResponse = GetConnectorResponses[keyof GetConnectorResponses]; + +export type DeactivateConnectorData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/activation"; +}; + +export type DeactivateConnectorErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeactivateConnectorError = DeactivateConnectorErrors[keyof DeactivateConnectorErrors]; + +export type DeactivateConnectorResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeactivateConnectorResponse = + DeactivateConnectorResponses[keyof DeactivateConnectorResponses]; + +export type ActivateConnectorData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/activation"; +}; + +export type ActivateConnectorErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ActivateConnectorError = ActivateConnectorErrors[keyof ActivateConnectorErrors]; + +export type ActivateConnectorResponses = { + /** + * OK + */ + 200: ConnectorActivation; +}; + +export type ActivateConnectorResponse = + ActivateConnectorResponses[keyof ActivateConnectorResponses]; + +export type DeleteConnectorSettingsData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings"; +}; + +export type DeleteConnectorSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteConnectorSettingsError = + DeleteConnectorSettingsErrors[keyof DeleteConnectorSettingsErrors]; + +export type DeleteConnectorSettingsResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteConnectorSettingsResponse = + DeleteConnectorSettingsResponses[keyof DeleteConnectorSettingsResponses]; + +export type GetConnectorSettingsData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings"; +}; + +export type GetConnectorSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetConnectorSettingsError = + GetConnectorSettingsErrors[keyof GetConnectorSettingsErrors]; + +export type GetConnectorSettingsResponses = { + /** + * OK + */ + 200: ConnectorSettings; +}; + +export type GetConnectorSettingsResponse = + GetConnectorSettingsResponses[keyof GetConnectorSettingsResponses]; + +export type UpdateConnectorSettingsData = { + /** + * Connector settings payload to upsert + */ + body: ConnectorSettingsWritable; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings"; +}; + +export type UpdateConnectorSettingsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateConnectorSettingsError = + UpdateConnectorSettingsErrors[keyof UpdateConnectorSettingsErrors]; + +export type UpdateConnectorSettingsResponses = { + /** + * OK + */ + 200: ConnectorSettings; +}; + +export type UpdateConnectorSettingsResponse = + UpdateConnectorSettingsResponses[keyof UpdateConnectorSettingsResponses]; + +export type GetConnectorSettingsSchemaData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/settings/schema"; +}; + +export type GetConnectorSettingsSchemaErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetConnectorSettingsSchemaError = + GetConnectorSettingsSchemaErrors[keyof GetConnectorSettingsSchemaErrors]; + +export type GetConnectorSettingsSchemaResponses = { + /** + * OK + */ + 200: ConnectorSettingsSchema; +}; + +export type GetConnectorSettingsSchemaResponse = + GetConnectorSettingsSchemaResponses[keyof GetConnectorSettingsSchemaResponses]; + +export type GetConnectorStateData = { + body?: never; + path: { + /** + * Stable connector name + */ + connectorName: string; + }; + query?: never; + url: "/connectors/{connectorName}/state"; +}; + +export type GetConnectorStateErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetConnectorStateError = GetConnectorStateErrors[keyof GetConnectorStateErrors]; + +export type GetConnectorStateResponses = { + /** + * OK + */ + 200: ConnectorState; +}; + +export type GetConnectorStateResponse = + GetConnectorStateResponses[keyof GetConnectorStateResponses]; + +export type CreateCustomerSessionData = { + body: CustomerSessionDraft; + path?: never; + query?: never; + url: "/customer-sessions"; +}; + +export type CreateCustomerSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreateCustomerSessionError = + CreateCustomerSessionErrors[keyof CreateCustomerSessionErrors]; + +export type CreateCustomerSessionResponses = { + /** + * Created + */ + 201: CreatedCustomerSession; +}; + +export type CreateCustomerSessionResponse = + CreateCustomerSessionResponses[keyof CreateCustomerSessionResponses]; + +export type RevokeCustomerSessionData = { + body?: never; + path: { + /** + * Customer session id + */ + sessionId: string; + }; + query?: never; + url: "/customer-sessions/{sessionId}/revoke"; +}; + +export type RevokeCustomerSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type RevokeCustomerSessionError = + RevokeCustomerSessionErrors[keyof RevokeCustomerSessionErrors]; + +export type RevokeCustomerSessionResponses = { + /** + * No Content + */ + 204: void; +}; + +export type RevokeCustomerSessionResponse = + RevokeCustomerSessionResponses[keyof RevokeCustomerSessionResponses]; + +export type ListCustomersData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/customers"; +}; + +export type ListCustomersErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListCustomersError = ListCustomersErrors[keyof ListCustomersErrors]; + +export type ListCustomersResponses = { + /** + * OK + */ + 200: PageCustomer; +}; + +export type ListCustomersResponse = ListCustomersResponses[keyof ListCustomersResponses]; + +export type CreateCustomerData = { + body: CustomerWritable; + path?: never; + query?: never; + url: "/customers"; +}; + +export type CreateCustomerErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateCustomerError = CreateCustomerErrors[keyof CreateCustomerErrors]; + +export type CreateCustomerResponses = { + /** + * Created + */ + 201: Customer; +}; + +export type CreateCustomerResponse = CreateCustomerResponses[keyof CreateCustomerResponses]; + +export type DeleteCustomerData = { + body?: never; + path: { + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}"; +}; + +export type DeleteCustomerErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteCustomerError = DeleteCustomerErrors[keyof DeleteCustomerErrors]; + +export type DeleteCustomerResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteCustomerResponse = DeleteCustomerResponses[keyof DeleteCustomerResponses]; + +export type GetCustomerData = { + body?: never; + path: { + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}"; +}; + +export type GetCustomerErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors]; + +export type GetCustomerResponses = { + /** + * OK + */ + 200: Customer; +}; + +export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses]; + +export type UpdateCustomerData = { + body: CustomerWritable; + path: { + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}"; +}; + +export type UpdateCustomerErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateCustomerError = UpdateCustomerErrors[keyof UpdateCustomerErrors]; + +export type UpdateCustomerResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateCustomerResponse = UpdateCustomerResponses[keyof UpdateCustomerResponses]; + +export type GetCustomerBillingData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing"; +}; + +export type GetCustomerBillingErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetCustomerBillingError = GetCustomerBillingErrors[keyof GetCustomerBillingErrors]; + +export type GetCustomerBillingResponses = { + /** + * OK + */ + 200: CustomerBilling; +}; + +export type GetCustomerBillingResponse = + GetCustomerBillingResponses[keyof GetCustomerBillingResponses]; + +export type DetachPaymentMethodData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/payment-method"; +}; + +export type DetachPaymentMethodErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DetachPaymentMethodError = DetachPaymentMethodErrors[keyof DetachPaymentMethodErrors]; + +export type DetachPaymentMethodResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DetachPaymentMethodResponse = + DetachPaymentMethodResponses[keyof DetachPaymentMethodResponses]; + +export type CreatePaymentMethodSessionData = { + body: NewPaymentMethodSession; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/payment-method-session"; +}; + +export type CreatePaymentMethodSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreatePaymentMethodSessionError = + CreatePaymentMethodSessionErrors[keyof CreatePaymentMethodSessionErrors]; + +export type CreatePaymentMethodSessionResponses = { + /** + * OK + */ + 200: PaymentMethodSession; +}; + +export type CreatePaymentMethodSessionResponse = + CreatePaymentMethodSessionResponses[keyof CreatePaymentMethodSessionResponses]; + +export type CompletePaymentMethodSessionData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * The setup session id the customer came back with + */ + sessionId: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/payment-method-session/{sessionId}/complete"; +}; + +export type CompletePaymentMethodSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CompletePaymentMethodSessionError = + CompletePaymentMethodSessionErrors[keyof CompletePaymentMethodSessionErrors]; + +export type CompletePaymentMethodSessionResponses = { + /** + * OK + */ + 200: CompletedPaymentMethodSession; +}; + +export type CompletePaymentMethodSessionResponse = + CompletePaymentMethodSessionResponses[keyof CompletePaymentMethodSessionResponses]; + +export type CreatePortalSessionData = { + body: NewPortalSession; + path: { + /** + * Customer slug + */ + customerSlug: string; + }; + query?: never; + url: "/customers/{customerSlug}/billing/portal-session"; +}; + +export type CreatePortalSessionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreatePortalSessionError = CreatePortalSessionErrors[keyof CreatePortalSessionErrors]; + +export type CreatePortalSessionResponses = { + /** + * OK + */ + 200: PortalSession; +}; + +export type CreatePortalSessionResponse = + CreatePortalSessionResponses[keyof CreatePortalSessionResponses]; + +export type DeleteCustomerIntegrationData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type DeleteCustomerIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteCustomerIntegrationError = + DeleteCustomerIntegrationErrors[keyof DeleteCustomerIntegrationErrors]; + +export type DeleteCustomerIntegrationResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteCustomerIntegrationResponse = + DeleteCustomerIntegrationResponses[keyof DeleteCustomerIntegrationResponses]; + +export type GetCustomerIntegrationData = { + body?: never; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type GetCustomerIntegrationErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetCustomerIntegrationError = + GetCustomerIntegrationErrors[keyof GetCustomerIntegrationErrors]; + +export type GetCustomerIntegrationResponses = { + /** + * OK + */ + 200: CustomerIntegration; +}; + +export type GetCustomerIntegrationResponse = + GetCustomerIntegrationResponses[keyof GetCustomerIntegrationResponses]; + +export type CreateCustomerIntegrationData = { + /** + * Integration payload + */ + body: CustomerIntegrationWritable; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type CreateCustomerIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreateCustomerIntegrationError = + CreateCustomerIntegrationErrors[keyof CreateCustomerIntegrationErrors]; + +export type CreateCustomerIntegrationResponses = { + /** + * Created + */ + 201: CustomerIntegration; +}; + +export type CreateCustomerIntegrationResponse = + CreateCustomerIntegrationResponses[keyof CreateCustomerIntegrationResponses]; + +export type UpdateCustomerIntegrationData = { + /** + * Integration payload + */ + body: CustomerIntegrationWritable; + path: { + /** + * Customer slug + */ + customerSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/customers/{customerSlug}/integrations/{integrationName}"; +}; + +export type UpdateCustomerIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateCustomerIntegrationError = + UpdateCustomerIntegrationErrors[keyof UpdateCustomerIntegrationErrors]; + +export type UpdateCustomerIntegrationResponses = { + /** + * OK + */ + 200: CustomerIntegration; +}; + +export type UpdateCustomerIntegrationResponse = + UpdateCustomerIntegrationResponses[keyof UpdateCustomerIntegrationResponses]; + +export type ListDeploymentZonesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/deployment-zones"; +}; + +export type ListDeploymentZonesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListDeploymentZonesError = ListDeploymentZonesErrors[keyof ListDeploymentZonesErrors]; + +export type ListDeploymentZonesResponses = { + /** + * OK + */ + 200: PageDeploymentZone; +}; + +export type ListDeploymentZonesResponse = + ListDeploymentZonesResponses[keyof ListDeploymentZonesResponses]; + +export type CreateDeploymentZoneData = { + body: DeploymentZoneWritable; + path?: never; + query?: never; + url: "/deployment-zones"; +}; + +export type CreateDeploymentZoneErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateDeploymentZoneError = + CreateDeploymentZoneErrors[keyof CreateDeploymentZoneErrors]; + +export type CreateDeploymentZoneResponses = { + /** + * Created + */ + 201: DeploymentZone; +}; + +export type CreateDeploymentZoneResponse = + CreateDeploymentZoneResponses[keyof CreateDeploymentZoneResponses]; + +export type DeleteDeploymentZoneData = { + body?: never; + path: { + deploymentZoneSlug: string; + }; + query?: never; + url: "/deployment-zones/{deploymentZoneSlug}"; +}; + +export type DeleteDeploymentZoneErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteDeploymentZoneError = + DeleteDeploymentZoneErrors[keyof DeleteDeploymentZoneErrors]; + +export type DeleteDeploymentZoneResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteDeploymentZoneResponse = + DeleteDeploymentZoneResponses[keyof DeleteDeploymentZoneResponses]; + +export type GetDeploymentZoneBySlugData = { + body?: never; + path: { + deploymentZoneSlug: string; + }; + query?: never; + url: "/deployment-zones/{deploymentZoneSlug}"; +}; + +export type GetDeploymentZoneBySlugErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetDeploymentZoneBySlugError = + GetDeploymentZoneBySlugErrors[keyof GetDeploymentZoneBySlugErrors]; + +export type GetDeploymentZoneBySlugResponses = { + /** + * OK + */ + 200: DeploymentZone; +}; + +export type GetDeploymentZoneBySlugResponse = + GetDeploymentZoneBySlugResponses[keyof GetDeploymentZoneBySlugResponses]; + +export type UpdateDeploymentZoneData = { + body: DeploymentZoneWritable; + path: { + deploymentZoneSlug: string; + }; + query?: never; + url: "/deployment-zones/{deploymentZoneSlug}"; +}; + +export type UpdateDeploymentZoneErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateDeploymentZoneError = + UpdateDeploymentZoneErrors[keyof UpdateDeploymentZoneErrors]; + +export type UpdateDeploymentZoneResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateDeploymentZoneResponse = + UpdateDeploymentZoneResponses[keyof UpdateDeploymentZoneResponses]; + +export type ListEntitlementGroupsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/entitlement-groups"; +}; + +export type ListEntitlementGroupsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListEntitlementGroupsError = + ListEntitlementGroupsErrors[keyof ListEntitlementGroupsErrors]; + +export type ListEntitlementGroupsResponses = { + /** + * OK + */ + 200: PageEntitlementGroup; +}; + +export type ListEntitlementGroupsResponse = + ListEntitlementGroupsResponses[keyof ListEntitlementGroupsResponses]; + +export type CreateEntitlementGroupData = { + body: EntitlementGroupWritable; + path?: never; + query?: never; + url: "/entitlement-groups"; +}; + +export type CreateEntitlementGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateEntitlementGroupError = + CreateEntitlementGroupErrors[keyof CreateEntitlementGroupErrors]; + +export type CreateEntitlementGroupResponses = { + /** + * Created + */ + 201: EntitlementGroup; +}; + +export type CreateEntitlementGroupResponse = + CreateEntitlementGroupResponses[keyof CreateEntitlementGroupResponses]; + +export type DeleteEntitlementGroupData = { + body?: never; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}"; +}; + +export type DeleteEntitlementGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteEntitlementGroupError = + DeleteEntitlementGroupErrors[keyof DeleteEntitlementGroupErrors]; + +export type DeleteEntitlementGroupResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteEntitlementGroupResponse = + DeleteEntitlementGroupResponses[keyof DeleteEntitlementGroupResponses]; + +export type GetEntitlementGroupData = { + body?: never; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}"; +}; + +export type GetEntitlementGroupErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementGroupError = GetEntitlementGroupErrors[keyof GetEntitlementGroupErrors]; + +export type GetEntitlementGroupResponses = { + /** + * OK + */ + 200: EntitlementGroup; +}; + +export type GetEntitlementGroupResponse = + GetEntitlementGroupResponses[keyof GetEntitlementGroupResponses]; + +export type UpdateEntitlementGroupData = { + body: EntitlementGroupWritable; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}"; +}; + +export type UpdateEntitlementGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateEntitlementGroupError = + UpdateEntitlementGroupErrors[keyof UpdateEntitlementGroupErrors]; + +export type UpdateEntitlementGroupResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateEntitlementGroupResponse = + UpdateEntitlementGroupResponses[keyof UpdateEntitlementGroupResponses]; + +export type AddEntitlementToGroupData = { + body: Command; + path: { + entitlementGroupSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}/entitlements"; +}; + +export type AddEntitlementToGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type AddEntitlementToGroupError = + AddEntitlementToGroupErrors[keyof AddEntitlementToGroupErrors]; + +export type AddEntitlementToGroupResponses = { + /** + * Created + */ + 201: unknown; +}; + +export type RemoveEntitlementFromGroupData = { + body?: never; + path: { + entitlementGroupSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/entitlement-groups/{entitlementGroupSlug}/entitlements/{entitlementSlug}"; +}; + +export type RemoveEntitlementFromGroupErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type RemoveEntitlementFromGroupError = + RemoveEntitlementFromGroupErrors[keyof RemoveEntitlementFromGroupErrors]; + +export type RemoveEntitlementFromGroupResponses = { + /** + * No Content + */ + 204: void; +}; + +export type RemoveEntitlementFromGroupResponse = + RemoveEntitlementFromGroupResponses[keyof RemoveEntitlementFromGroupResponses]; + +export type GetEntitlementGroupUsageData = { + body?: never; + path: { + entitlementGroupSlug: string; + }; + query: { + /** + * Instance slug to get usage for + */ + instance: string; + }; + url: "/entitlement-groups/{entitlementGroupSlug}/usage"; +}; + +export type GetEntitlementGroupUsageErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementGroupUsageError = + GetEntitlementGroupUsageErrors[keyof GetEntitlementGroupUsageErrors]; + +export type GetEntitlementGroupUsageResponses = { + /** + * OK + */ + 200: Array | null; +}; + +export type GetEntitlementGroupUsageResponse = + GetEntitlementGroupUsageResponses[keyof GetEntitlementGroupUsageResponses]; + +export type ListEntitlementsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/entitlements"; +}; + +export type ListEntitlementsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListEntitlementsError = ListEntitlementsErrors[keyof ListEntitlementsErrors]; + +export type ListEntitlementsResponses = { + /** + * OK + */ + 200: PageEntitlement; +}; + +export type ListEntitlementsResponse = ListEntitlementsResponses[keyof ListEntitlementsResponses]; + +export type CreateEntitlementData = { + body: EntitlementWritable; + path?: never; + query?: never; + url: "/entitlements"; +}; + +export type CreateEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateEntitlementError = CreateEntitlementErrors[keyof CreateEntitlementErrors]; + +export type CreateEntitlementResponses = { + /** + * Created + */ + 201: Entitlement; +}; + +export type CreateEntitlementResponse = + CreateEntitlementResponses[keyof CreateEntitlementResponses]; + +export type DeleteEntitlementData = { + body?: never; + path: { + entitlementSlug: string; + }; + query?: never; + url: "/entitlements/{entitlementSlug}"; +}; + +export type DeleteEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteEntitlementError = DeleteEntitlementErrors[keyof DeleteEntitlementErrors]; + +export type DeleteEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteEntitlementResponse = + DeleteEntitlementResponses[keyof DeleteEntitlementResponses]; + +export type GetEntitlementData = { + body?: never; + path: { + entitlementSlug: string; + }; + query?: never; + url: "/entitlements/{entitlementSlug}"; +}; + +export type GetEntitlementErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementError = GetEntitlementErrors[keyof GetEntitlementErrors]; + +export type GetEntitlementResponses = { + /** + * OK + */ + 200: Entitlement; +}; + +export type GetEntitlementResponse = GetEntitlementResponses[keyof GetEntitlementResponses]; + +export type UpdateEntitlementData = { + body: EntitlementWritable; + path: { + entitlementSlug: string; + }; + query?: never; + url: "/entitlements/{entitlementSlug}"; +}; + +export type UpdateEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateEntitlementError = UpdateEntitlementErrors[keyof UpdateEntitlementErrors]; + +export type UpdateEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateEntitlementResponse = + UpdateEntitlementResponses[keyof UpdateEntitlementResponses]; + +export type GetFeatureFlagsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/feature-flags"; +}; + +export type GetFeatureFlagsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetFeatureFlagsError = GetFeatureFlagsErrors[keyof GetFeatureFlagsErrors]; + +export type GetFeatureFlagsResponses = { + /** + * OK + */ + 200: PageFeatureFlag; +}; + +export type GetFeatureFlagsResponse = GetFeatureFlagsResponses[keyof GetFeatureFlagsResponses]; + +export type CreateFeatureFlagData = { + /** + * Feature flag details + */ + body: FeatureFlagWritable; + path?: never; + query?: never; + url: "/feature-flags"; +}; + +export type CreateFeatureFlagErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateFeatureFlagError = CreateFeatureFlagErrors[keyof CreateFeatureFlagErrors]; + +export type CreateFeatureFlagResponses = { + /** + * Created feature flag + */ + 201: FeatureFlag; +}; + +export type CreateFeatureFlagResponse = + CreateFeatureFlagResponses[keyof CreateFeatureFlagResponses]; + +export type GetTargetingContextData = { + body?: never; + path?: never; + query?: never; + url: "/feature-flags/targeting/context"; +}; + +export type GetTargetingContextErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetTargetingContextError = GetTargetingContextErrors[keyof GetTargetingContextErrors]; + +export type GetTargetingContextResponses = { + /** + * OK + */ + 200: TargetingContext; +}; + +export type GetTargetingContextResponse = + GetTargetingContextResponses[keyof GetTargetingContextResponses]; + +export type LintTargetingRuleData = { + body: TargetingRuleDraft; + path?: never; + query?: never; + url: "/feature-flags/targeting/lint"; +}; + +export type LintTargetingRuleErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type LintTargetingRuleError = LintTargetingRuleErrors[keyof LintTargetingRuleErrors]; + +export type LintTargetingRuleResponses = { + /** + * OK + */ + 200: TargetingRuleVerdict; +}; + +export type LintTargetingRuleResponse = + LintTargetingRuleResponses[keyof LintTargetingRuleResponses]; + +export type TestTargetingRuleData = { + body: TargetingRuleTrial; + path?: never; + query?: never; + url: "/feature-flags/targeting/test"; +}; + +export type TestTargetingRuleErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type TestTargetingRuleError = TestTargetingRuleErrors[keyof TestTargetingRuleErrors]; + +export type TestTargetingRuleResponses = { + /** + * OK + */ + 200: TargetingRuleRehearsal; +}; + +export type TestTargetingRuleResponse = + TestTargetingRuleResponses[keyof TestTargetingRuleResponses]; + +export type DeleteFeatureFlagData = { + body?: never; + path: { + featureFlagSlug: string; + }; + query?: never; + url: "/feature-flags/{featureFlagSlug}"; +}; + +export type DeleteFeatureFlagErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteFeatureFlagError = DeleteFeatureFlagErrors[keyof DeleteFeatureFlagErrors]; + +export type DeleteFeatureFlagResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteFeatureFlagResponse = + DeleteFeatureFlagResponses[keyof DeleteFeatureFlagResponses]; + +export type GetFeatureFlagData = { + body?: never; + path: { + featureFlagSlug: string; + }; + query?: never; + url: "/feature-flags/{featureFlagSlug}"; +}; + +export type GetFeatureFlagErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetFeatureFlagError = GetFeatureFlagErrors[keyof GetFeatureFlagErrors]; + +export type GetFeatureFlagResponses = { + /** + * OK + */ + 200: FeatureFlag; +}; + +export type GetFeatureFlagResponse = GetFeatureFlagResponses[keyof GetFeatureFlagResponses]; + +export type UpdateFeatureFlagData = { + /** + * Feature flag details + */ + body: FeatureFlagWritable; + path: { + featureFlagSlug: string; + }; + query?: never; + url: "/feature-flags/{featureFlagSlug}"; +}; + +export type UpdateFeatureFlagErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateFeatureFlagError = UpdateFeatureFlagErrors[keyof UpdateFeatureFlagErrors]; + +export type UpdateFeatureFlagResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateFeatureFlagResponse = + UpdateFeatureFlagResponses[keyof UpdateFeatureFlagResponses]; + +export type GetInstancesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/instances"; +}; + +export type GetInstancesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstancesError = GetInstancesErrors[keyof GetInstancesErrors]; + +export type GetInstancesResponses = { + /** + * OK + */ + 200: PageInstance; +}; + +export type GetInstancesResponse = GetInstancesResponses[keyof GetInstancesResponses]; + +export type CreateInstanceData = { + body: InstanceWritable; + path?: never; + query?: never; + url: "/instances"; +}; + +export type CreateInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateInstanceError = CreateInstanceErrors[keyof CreateInstanceErrors]; + +export type CreateInstanceResponses = { + /** + * Created + */ + 201: Instance; +}; + +export type CreateInstanceResponse = CreateInstanceResponses[keyof CreateInstanceResponses]; + +export type DeleteInstanceData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type DeleteInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteInstanceError = DeleteInstanceErrors[keyof DeleteInstanceErrors]; + +export type DeleteInstanceResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteInstanceResponse = DeleteInstanceResponses[keyof DeleteInstanceResponses]; + +export type GetInstanceData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type GetInstanceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstanceError = GetInstanceErrors[keyof GetInstanceErrors]; + +export type GetInstanceResponses = { + /** + * OK + */ + 200: Instance; +}; + +export type GetInstanceResponse = GetInstanceResponses[keyof GetInstanceResponses]; + +export type PatchInstanceData = { + body: PatchInstanceBody; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type PatchInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type PatchInstanceError = PatchInstanceErrors[keyof PatchInstanceErrors]; + +export type PatchInstanceResponses = { + /** + * No Content + */ + 204: void; +}; + +export type PatchInstanceResponse = PatchInstanceResponses[keyof PatchInstanceResponses]; + +export type UpdateInstanceData = { + body: InstanceWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}"; +}; + +export type UpdateInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateInstanceError = UpdateInstanceErrors[keyof UpdateInstanceErrors]; + +export type UpdateInstanceResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateInstanceResponse = UpdateInstanceResponses[keyof UpdateInstanceResponses]; + +export type ListInstanceAddonsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + /** + * Also list the add-ons removed from the instance + */ + includeRemoved?: boolean; + }; + url: "/instances/{instanceSlug}/addons"; +}; + +export type ListInstanceAddonsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInstanceAddonsError = ListInstanceAddonsErrors[keyof ListInstanceAddonsErrors]; + +export type ListInstanceAddonsResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListInstanceAddonsResponse = + ListInstanceAddonsResponses[keyof ListInstanceAddonsResponses]; + +export type AttachInstanceAddonData = { + body: NewInstanceAddon; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/addons"; +}; + +export type AttachInstanceAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AttachInstanceAddonError = AttachInstanceAddonErrors[keyof AttachInstanceAddonErrors]; + +export type AttachInstanceAddonResponses = { + /** + * Created + */ + 201: InstanceAddon; +}; + +export type AttachInstanceAddonResponse = + AttachInstanceAddonResponses[keyof AttachInstanceAddonResponses]; + +export type DetachInstanceAddonData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/addons/{addonSlug}"; +}; + +export type DetachInstanceAddonErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DetachInstanceAddonError = DetachInstanceAddonErrors[keyof DetachInstanceAddonErrors]; + +export type DetachInstanceAddonResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DetachInstanceAddonResponse = + DetachInstanceAddonResponses[keyof DetachInstanceAddonResponses]; + +export type SetInstanceAddonQuantityData = { + body: AddonQuantity; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Add-on version slug + */ + addonSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/addons/{addonSlug}"; +}; + +export type SetInstanceAddonQuantityErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SetInstanceAddonQuantityError = + SetInstanceAddonQuantityErrors[keyof SetInstanceAddonQuantityErrors]; + +export type SetInstanceAddonQuantityResponses = { + /** + * OK + */ + 200: InstanceAddon; +}; + +export type SetInstanceAddonQuantityResponse = + SetInstanceAddonQuantityResponses[keyof SetInstanceAddonQuantityResponses]; + +export type GetAuditTrailsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + /** + * Filter by exact event name (e.g. ENTITLEMENT_VALUE_GET) + */ + event_name?: string; + /** + * RFC3339 timestamp — include entries with timestamp ≥ this value + */ + after?: string; + /** + * RFC3339 timestamp — include entries with timestamp ≤ this value + */ + before?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + }; + url: "/instances/{instanceSlug}/audit-trails"; +}; + +export type GetAuditTrailsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetAuditTrailsError = GetAuditTrailsErrors[keyof GetAuditTrailsErrors]; + +export type GetAuditTrailsResponses = { + /** + * OK + */ + 200: PageAuditTrail; +}; + +export type GetAuditTrailsResponse = GetAuditTrailsResponses[keyof GetAuditTrailsResponses]; + +export type GetInstanceBillingData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing"; +}; + +export type GetInstanceBillingErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetInstanceBillingError = GetInstanceBillingErrors[keyof GetInstanceBillingErrors]; + +export type GetInstanceBillingResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type GetInstanceBillingResponse = + GetInstanceBillingResponses[keyof GetInstanceBillingResponses]; + +export type UpdateInstanceBillingData = { + body: SubscriptionTerms; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing"; +}; + +export type UpdateInstanceBillingErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateInstanceBillingError = + UpdateInstanceBillingErrors[keyof UpdateInstanceBillingErrors]; + +export type UpdateInstanceBillingResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type UpdateInstanceBillingResponse = + UpdateInstanceBillingResponses[keyof UpdateInstanceBillingResponses]; + +export type SubscribeInstanceData = { + body: NewSubscription; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing"; +}; + +export type SubscribeInstanceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SubscribeInstanceError = SubscribeInstanceErrors[keyof SubscribeInstanceErrors]; + +export type SubscribeInstanceResponses = { + /** + * Created + */ + 201: StartedSubscription; +}; + +export type SubscribeInstanceResponse = + SubscribeInstanceResponses[keyof SubscribeInstanceResponses]; + +export type CancelSubscriptionData = { + body: SubscriptionCancellation; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/cancel"; +}; + +export type CancelSubscriptionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CancelSubscriptionError = CancelSubscriptionErrors[keyof CancelSubscriptionErrors]; + +export type CancelSubscriptionResponses = { + /** + * OK + */ + 200: CanceledSubscription; +}; + +export type CancelSubscriptionResponse = + CancelSubscriptionResponses[keyof CancelSubscriptionResponses]; + +export type ReactivateSubscriptionData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/reactivate"; +}; + +export type ReactivateSubscriptionErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ReactivateSubscriptionError = + ReactivateSubscriptionErrors[keyof ReactivateSubscriptionErrors]; + +export type ReactivateSubscriptionResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type ReactivateSubscriptionResponse = + ReactivateSubscriptionResponses[keyof ReactivateSubscriptionResponses]; + +export type CancelPlanChangeData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/scheduled-change"; +}; + +export type CancelPlanChangeErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CancelPlanChangeError = CancelPlanChangeErrors[keyof CancelPlanChangeErrors]; + +export type CancelPlanChangeResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type CancelPlanChangeResponse = CancelPlanChangeResponses[keyof CancelPlanChangeResponses]; + +export type SchedulePlanChangeData = { + body: PlanChangeTarget; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/scheduled-change"; +}; + +export type SchedulePlanChangeErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SchedulePlanChangeError = SchedulePlanChangeErrors[keyof SchedulePlanChangeErrors]; + +export type SchedulePlanChangeResponses = { + /** + * OK + */ + 200: InstanceBilling; +}; + +export type SchedulePlanChangeResponse = + SchedulePlanChangeResponses[keyof SchedulePlanChangeResponses]; + +export type GetUpcomingInvoiceData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/billing/upcoming-invoice"; +}; + +export type GetUpcomingInvoiceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetUpcomingInvoiceError = GetUpcomingInvoiceErrors[keyof GetUpcomingInvoiceErrors]; + +export type GetUpcomingInvoiceResponses = { + /** + * OK + */ + 200: InvoicePreview; +}; + +export type GetUpcomingInvoiceResponse = + GetUpcomingInvoiceResponses[keyof GetUpcomingInvoiceResponses]; + +export type GetEntitlementsUsageMetricsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/entitlements/usage"; +}; + +export type GetEntitlementsUsageMetricsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementsUsageMetricsError = + GetEntitlementsUsageMetricsErrors[keyof GetEntitlementsUsageMetricsErrors]; + +export type GetEntitlementsUsageMetricsResponses = { + /** + * OK + */ + 200: Array | null; +}; + +export type GetEntitlementsUsageMetricsResponse = + GetEntitlementsUsageMetricsResponses[keyof GetEntitlementsUsageMetricsResponses]; + +export type GetEntitlementUsageMetricsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; +}; + +export type GetEntitlementUsageMetricsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetEntitlementUsageMetricsError = + GetEntitlementUsageMetricsErrors[keyof GetEntitlementUsageMetricsErrors]; + +export type GetEntitlementUsageMetricsResponses = { + /** + * OK + */ + 200: EntitlementUsage; +}; + +export type GetEntitlementUsageMetricsResponse = + GetEntitlementUsageMetricsResponses[keyof GetEntitlementUsageMetricsResponses]; + +export type ReportEntitlementUsageMetricData = { + body: ReportEntitlementUsageBodyWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage"; +}; + +export type ReportEntitlementUsageMetricErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ReportEntitlementUsageMetricError = + ReportEntitlementUsageMetricErrors[keyof ReportEntitlementUsageMetricErrors]; + +export type ReportEntitlementUsageMetricResponses = { + /** + * OK + */ + 200: EntitlementUsage; +}; + +export type ReportEntitlementUsageMetricResponse = + ReportEntitlementUsageMetricResponses[keyof ReportEntitlementUsageMetricResponses]; + +export type ListUsageReportsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: { + /** + * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ListUsageReports.OutsideRetention. + */ + from?: string; + /** + * End of the range, exclusive (RFC 3339). Defaults to now. + */ + to?: string; + /** + * Return the reports after this reportSeq: the nextAfterSeq of the previous page + */ + afterSeq?: number; + /** + * Maximum number of reports to return (default 100, max 500) + */ + limit?: number; + /** + * Only the report sent with this idempotency key + */ + transactionId?: string; + }; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports"; +}; + +export type ListUsageReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListUsageReportsError = ListUsageReportsErrors[keyof ListUsageReportsErrors]; + +export type ListUsageReportsResponses = { + /** + * OK + */ + 200: UsageReportPage; +}; + +export type ListUsageReportsResponse = ListUsageReportsResponses[keyof ListUsageReportsResponses]; + +export type ExportUsageReportsData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Entitlement slug + */ + entitlementSlug: string; + }; + query?: { + /** + * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + */ + from?: string; + /** + * End of the range, exclusive (RFC 3339). Defaults to now. At most 366 days after from. + */ + to?: string; + /** + * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line, in the shape listUsageReports returns. Anything else answers 422 ExportUsageReports.InvalidFormat. + */ + format?: string; + }; + url: "/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage/reports/export"; +}; + +export type ExportUsageReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ExportUsageReportsError = ExportUsageReportsErrors[keyof ExportUsageReportsErrors]; + +export type ExportUsageReportsResponses = { + /** + * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + */ + 200: string; +}; + +export type ExportUsageReportsResponse = + ExportUsageReportsResponses[keyof ExportUsageReportsResponses]; + +export type DeleteInstanceIntegrationData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type DeleteInstanceIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteInstanceIntegrationError = + DeleteInstanceIntegrationErrors[keyof DeleteInstanceIntegrationErrors]; + +export type DeleteInstanceIntegrationResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteInstanceIntegrationResponse = + DeleteInstanceIntegrationResponses[keyof DeleteInstanceIntegrationResponses]; + +export type GetInstanceIntegrationData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type GetInstanceIntegrationErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstanceIntegrationError = + GetInstanceIntegrationErrors[keyof GetInstanceIntegrationErrors]; + +export type GetInstanceIntegrationResponses = { + /** + * OK + */ + 200: InstanceIntegration; +}; + +export type GetInstanceIntegrationResponse = + GetInstanceIntegrationResponses[keyof GetInstanceIntegrationResponses]; + +export type CreateInstanceIntegrationData = { + /** + * Integration payload + */ + body: InstanceIntegrationWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type CreateInstanceIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreateInstanceIntegrationError = + CreateInstanceIntegrationErrors[keyof CreateInstanceIntegrationErrors]; + +export type CreateInstanceIntegrationResponses = { + /** + * Created + */ + 201: InstanceIntegration; +}; + +export type CreateInstanceIntegrationResponse = + CreateInstanceIntegrationResponses[keyof CreateInstanceIntegrationResponses]; + +export type UpdateInstanceIntegrationData = { + /** + * Integration payload + */ + body: InstanceIntegrationWritable; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Integration adapter name + */ + integrationName: string; + }; + query?: never; + url: "/instances/{instanceSlug}/integrations/{integrationName}"; +}; + +export type UpdateInstanceIntegrationErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateInstanceIntegrationError = + UpdateInstanceIntegrationErrors[keyof UpdateInstanceIntegrationErrors]; + +export type UpdateInstanceIntegrationResponses = { + /** + * OK + */ + 200: InstanceIntegration; +}; + +export type UpdateInstanceIntegrationResponse = + UpdateInstanceIntegrationResponses[keyof UpdateInstanceIntegrationResponses]; + +export type ListInstanceInvoicesData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + /** + * Only invoices in these statuses; repeat the parameter for several + */ + status?: Array< + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID" + > | null; + kind?: "ACTIVATION" | "RENEWAL" | "FINAL"; + providerKind?: "NOOP" | "STRIPE"; + /** + * Only this customer's invoices: composed under this slug, or of the customer that has it now + */ + customerSlug?: string; + /** + * Only issued invoices still unpaid past their due date + */ + overdue?: boolean; + /** + * Only DRAFTs held for their usage journal + */ + held?: boolean; + handoffStatus?: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + /** + * Issued at or after this instant (RFC 3339) + */ + issuedFrom?: string; + /** + * Issued before this instant (RFC 3339) + */ + issuedTo?: string; + /** + * Billing a boundary at or after this instant + */ + boundaryFrom?: string; + /** + * Billing a boundary before this instant + */ + boundaryTo?: string; + /** + * Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change + */ + updatedSince?: string; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + }; + url: "/instances/{instanceSlug}/invoices"; +}; + +export type ListInstanceInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInstanceInvoicesError = + ListInstanceInvoicesErrors[keyof ListInstanceInvoicesErrors]; + +export type ListInstanceInvoicesResponses = { + /** + * OK + */ + 200: PageInvoiceSummary; +}; + +export type ListInstanceInvoicesResponse = + ListInstanceInvoicesResponses[keyof ListInstanceInvoicesResponses]; + +export type ListInstanceVouchersData = { + body?: never; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: { + status?: "ACTIVE" | "EXPIRED" | "REVOKED"; + }; + url: "/instances/{instanceSlug}/vouchers"; +}; + +export type ListInstanceVouchersErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInstanceVouchersError = + ListInstanceVouchersErrors[keyof ListInstanceVouchersErrors]; + +export type ListInstanceVouchersResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListInstanceVouchersResponse = + ListInstanceVouchersResponses[keyof ListInstanceVouchersResponses]; + +export type RedeemVoucherData = { + body: RedeemableCode; + path: { + /** + * Instance slug + */ + instanceSlug: string; + }; + query?: never; + url: "/instances/{instanceSlug}/vouchers/redeem"; +}; + +export type RedeemVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RedeemVoucherError = RedeemVoucherErrors[keyof RedeemVoucherErrors]; + +export type RedeemVoucherResponses = { + /** + * Created + */ + 201: Redemption; +}; + +export type RedeemVoucherResponse = RedeemVoucherResponses[keyof RedeemVoucherResponses]; + +export type RevokeInstanceVoucherData = { + body: RevocationReason; + path: { + /** + * Instance slug + */ + instanceSlug: string; + /** + * Redemption id + */ + instanceVoucherId: string; + }; + query?: never; + url: "/instances/{instanceSlug}/vouchers/{instanceVoucherId}/revoke"; +}; + +export type RevokeInstanceVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RevokeInstanceVoucherError = + RevokeInstanceVoucherErrors[keyof RevokeInstanceVoucherErrors]; + +export type RevokeInstanceVoucherResponses = { + /** + * OK + */ + 200: Redemption; +}; + +export type RevokeInstanceVoucherResponse = + RevokeInstanceVoucherResponses[keyof RevokeInstanceVoucherResponses]; + +export type GetCustomerIntegrationByExternalIdData = { + body?: never; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/customer/{externalId}"; +}; + +export type GetCustomerIntegrationByExternalIdErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetCustomerIntegrationByExternalIdError = + GetCustomerIntegrationByExternalIdErrors[keyof GetCustomerIntegrationByExternalIdErrors]; + +export type GetCustomerIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: CustomerIntegrationResource; +}; + +export type GetCustomerIntegrationByExternalIdResponse = + GetCustomerIntegrationByExternalIdResponses[keyof GetCustomerIntegrationByExternalIdResponses]; + +export type UpsertCustomerIntegrationByExternalIdData = { + body: CustomerBody; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/customer/{externalId}"; +}; + +export type UpsertCustomerIntegrationByExternalIdErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpsertCustomerIntegrationByExternalIdError = + UpsertCustomerIntegrationByExternalIdErrors[keyof UpsertCustomerIntegrationByExternalIdErrors]; + +export type UpsertCustomerIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: CustomerIntegrationResource; +}; + +export type UpsertCustomerIntegrationByExternalIdResponse = + UpsertCustomerIntegrationByExternalIdResponses[keyof UpsertCustomerIntegrationByExternalIdResponses]; + +export type GetInstanceIntegrationByExternalIdData = { + body?: never; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/instance/{externalId}"; +}; + +export type GetInstanceIntegrationByExternalIdErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetInstanceIntegrationByExternalIdError = + GetInstanceIntegrationByExternalIdErrors[keyof GetInstanceIntegrationByExternalIdErrors]; + +export type GetInstanceIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: InstanceIntegrationResource; +}; + +export type GetInstanceIntegrationByExternalIdResponse = + GetInstanceIntegrationByExternalIdResponses[keyof GetInstanceIntegrationByExternalIdResponses]; + +export type UpsertInstanceIntegrationByExternalIdData = { + body: InstanceBody; + path: { + /** + * Integration adapter without the kaiten.integration. prefix + */ + adapter: string; + /** + * External identifier in the third-party system + */ + externalId: string; + }; + query?: never; + url: "/integration/{adapter}/instance/{externalId}"; +}; + +export type UpsertInstanceIntegrationByExternalIdErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpsertInstanceIntegrationByExternalIdError = + UpsertInstanceIntegrationByExternalIdErrors[keyof UpsertInstanceIntegrationByExternalIdErrors]; + +export type UpsertInstanceIntegrationByExternalIdResponses = { + /** + * OK + */ + 200: InstanceIntegrationResource; +}; + +export type UpsertInstanceIntegrationByExternalIdResponse = + UpsertInstanceIntegrationByExternalIdResponses[keyof UpsertInstanceIntegrationByExternalIdResponses]; + +export type ListInvoicesData = { + body?: never; + path?: never; + query?: { + /** + * Only invoices in these statuses; repeat the parameter for several + */ + status?: Array< + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID" + > | null; + kind?: "ACTIVATION" | "RENEWAL" | "FINAL"; + providerKind?: "NOOP" | "STRIPE"; + /** + * Only this customer's invoices: composed under this slug, or of the customer that has it now + */ + customerSlug?: string; + /** + * Only issued invoices still unpaid past their due date + */ + overdue?: boolean; + /** + * Only DRAFTs held for their usage journal + */ + held?: boolean; + handoffStatus?: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + /** + * Issued at or after this instant (RFC 3339) + */ + issuedFrom?: string; + /** + * Issued before this instant (RFC 3339) + */ + issuedTo?: string; + /** + * Billing a boundary at or after this instant + */ + boundaryFrom?: string; + /** + * Billing a boundary before this instant + */ + boundaryTo?: string; + /** + * Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change + */ + updatedSince?: string; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + /** + * Only this instance's invoices: composed under this slug, or of the instance that has it now + */ + instanceSlug?: string; + }; + url: "/invoices"; +}; + +export type ListInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInvoicesError = ListInvoicesErrors[keyof ListInvoicesErrors]; + +export type ListInvoicesResponses = { + /** + * OK + */ + 200: PageInvoiceSummary; +}; + +export type ListInvoicesResponse = ListInvoicesResponses[keyof ListInvoicesResponses]; + +export type ExportInvoicesData = { + body?: never; + path?: never; + query?: { + /** + * Only invoices in these statuses; repeat the parameter for several + */ + status?: Array< + | "DRAFT" + | "PUSHED" + | "PUSH_FAILED" + | "MANUAL" + | "PAID" + | "PAYMENT_FAILED" + | "UNCOLLECTIBLE" + | "VOID" + > | null; + kind?: "ACTIVATION" | "RENEWAL" | "FINAL"; + providerKind?: "NOOP" | "STRIPE"; + /** + * Only this customer's invoices: composed under this slug, or of the customer that has it now + */ + customerSlug?: string; + /** + * Only issued invoices still unpaid past their due date + */ + overdue?: boolean; + /** + * Only DRAFTs held for their usage journal + */ + held?: boolean; + handoffStatus?: "NOT_REQUIRED" | "PENDING" | "ACKNOWLEDGED"; + /** + * Issued at or after this instant (RFC 3339) + */ + issuedFrom?: string; + /** + * Issued before this instant (RFC 3339) + */ + issuedTo?: string; + /** + * Billing a boundary at or after this instant + */ + boundaryFrom?: string; + /** + * Billing a boundary before this instant + */ + boundaryTo?: string; + /** + * Only invoices changed at or after this instant, oldest change first instead of newest invoice first: store the last updatedAt read and pass it next time to miss no change + */ + updatedSince?: string; + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + /** + * Only this instance's invoices + */ + instanceSlug?: string; + /** + * csv (the default): RFC 4180 with a header row. json: NDJSON, one invoice with its lines per line. Anything else answers 422 ExportInvoices.InvalidFormat. + */ + format?: string; + /** + * For csv: line (the default), one row per invoice line with the invoice's columns repeated; invoice, one row per invoice. Anything else answers 422 ExportInvoices.InvalidGranularity. + */ + granularity?: string; + }; + url: "/invoices/export"; +}; + +export type ExportInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ExportInvoicesError = ExportInvoicesErrors[keyof ExportInvoicesErrors]; + +export type ExportInvoicesResponses = { + /** + * The invoices, as an attachment + */ + 200: string; +}; + +export type ExportInvoicesResponse = ExportInvoicesResponses[keyof ExportInvoicesResponses]; + +export type GetInvoiceData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}"; +}; + +export type GetInvoiceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetInvoiceError = GetInvoiceErrors[keyof GetInvoiceErrors]; + +export type GetInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type GetInvoiceResponse = GetInvoiceResponses[keyof GetInvoiceResponses]; + +export type ListInvoiceLineReportsData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + /** + * Line identifier, as the invoice's lines carry it + */ + lineId: string; + }; + query?: { + /** + * Reports after this reportSeq; 0 starts at the first + */ + afterSeq?: number; + /** + * Page size, 100 by default, 500 at most + */ + limit?: number; + /** + * json (the default): one page. csv: every report, streamed as RFC 4180 with a header row. Anything else answers 422 ListInvoiceLineReports.InvalidFormat. + */ + format?: string; + }; + url: "/invoices/{invoiceId}/lines/{lineId}/reports"; +}; + +export type ListInvoiceLineReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListInvoiceLineReportsError = + ListInvoiceLineReportsErrors[keyof ListInvoiceLineReportsErrors]; + +export type ListInvoiceLineReportsResponses = { + /** + * One page of reports (json), or every report as a CSV attachment (csv) + */ + 200: LineReportPage; +}; + +export type ListInvoiceLineReportsResponse = + ListInvoiceLineReportsResponses[keyof ListInvoiceLineReportsResponses]; + +export type MarkInvoicePaidData = { + body: InvoicePayment; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/mark-paid"; +}; + +export type MarkInvoicePaidErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type MarkInvoicePaidError = MarkInvoicePaidErrors[keyof MarkInvoicePaidErrors]; + +export type MarkInvoicePaidResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type MarkInvoicePaidResponse = MarkInvoicePaidResponses[keyof MarkInvoicePaidResponses]; + +export type RecomposeInvoiceData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/recompose"; +}; + +export type RecomposeInvoiceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RecomposeInvoiceError = RecomposeInvoiceErrors[keyof RecomposeInvoiceErrors]; + +export type RecomposeInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type RecomposeInvoiceResponse = RecomposeInvoiceResponses[keyof RecomposeInvoiceResponses]; + +export type ReleaseInvoiceHoldData = { + body: HoldRelease; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/release-hold"; +}; + +export type ReleaseInvoiceHoldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ReleaseInvoiceHoldError = ReleaseInvoiceHoldErrors[keyof ReleaseInvoiceHoldErrors]; + +export type ReleaseInvoiceHoldResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type ReleaseInvoiceHoldResponse = + ReleaseInvoiceHoldResponses[keyof ReleaseInvoiceHoldResponses]; + +export type RetryInvoicePushData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/retry-push"; +}; + +export type RetryInvoicePushErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type RetryInvoicePushError = RetryInvoicePushErrors[keyof RetryInvoicePushErrors]; + +export type RetryInvoicePushResponses = { + /** + * Accepted + */ + 202: Invoice; +}; + +export type RetryInvoicePushResponse = RetryInvoicePushResponses[keyof RetryInvoicePushResponses]; + +export type SyncInvoiceData = { + body?: never; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/sync"; +}; + +export type SyncInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type SyncInvoiceError = SyncInvoiceErrors[keyof SyncInvoiceErrors]; + +export type SyncInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type SyncInvoiceResponse = SyncInvoiceResponses[keyof SyncInvoiceResponses]; + +export type VoidInvoiceData = { + body: InvoiceVoid; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/void"; +}; + +export type VoidInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type VoidInvoiceError = VoidInvoiceErrors[keyof VoidInvoiceErrors]; + +export type VoidInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type VoidInvoiceResponse = VoidInvoiceResponses[keyof VoidInvoiceResponses]; + +export type WriteOffInvoiceData = { + body: InvoiceWriteOff; + path: { + /** + * Invoice identifier + */ + invoiceId: string; + }; + query?: never; + url: "/invoices/{invoiceId}/write-off"; +}; + +export type WriteOffInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type WriteOffInvoiceError = WriteOffInvoiceErrors[keyof WriteOffInvoiceErrors]; + +export type WriteOffInvoiceResponses = { + /** + * OK + */ + 200: Invoice; +}; + +export type WriteOffInvoiceResponse = WriteOffInvoiceResponses[keyof WriteOffInvoiceResponses]; + +export type ListLicenseFamiliesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/license-families"; +}; + +export type ListLicenseFamiliesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListLicenseFamiliesError = ListLicenseFamiliesErrors[keyof ListLicenseFamiliesErrors]; + +export type ListLicenseFamiliesResponses = { + /** + * OK + */ + 200: PageLicenseFamilyView; +}; + +export type ListLicenseFamiliesResponse = + ListLicenseFamiliesResponses[keyof ListLicenseFamiliesResponses]; + +export type GetLicenseFamilyData = { + body?: never; + path: { + /** + * License family slug + */ + familySlug: string; + }; + query?: { + /** + * Address this version number instead of resolving the current one. Explicit historical access: the version is returned in currentVersion whatever its lifecycle state, draft and archived included, and the resolution rule does not apply. + */ + version?: number; + /** + * Extra representations to add, comma-separated. Only 'versions' exists today: it adds every version of the family, oldest first, and makes a family with no PUBLISHED version readable instead of a 404. A list, so that another representation can be added later without changing the parameter's type. + */ + include?: Array<"versions">; + }; + url: "/license-families/{familySlug}"; +}; + +export type GetLicenseFamilyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseFamilyError = GetLicenseFamilyErrors[keyof GetLicenseFamilyErrors]; + +export type GetLicenseFamilyResponses = { + /** + * OK + */ + 200: LicenseFamilyView; +}; + +export type GetLicenseFamilyResponse = GetLicenseFamilyResponses[keyof GetLicenseFamilyResponses]; + +export type UpdateLicenseFamilyData = { + body: LicenseFamilyVisibility; + path: { + /** + * License family slug + */ + familySlug: string; + }; + query?: never; + url: "/license-families/{familySlug}"; +}; + +export type UpdateLicenseFamilyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateLicenseFamilyError = UpdateLicenseFamilyErrors[keyof UpdateLicenseFamilyErrors]; + +export type UpdateLicenseFamilyResponses = { + /** + * OK + */ + 200: LicenseFamilyView; +}; + +export type UpdateLicenseFamilyResponse = + UpdateLicenseFamilyResponses[keyof UpdateLicenseFamilyResponses]; + +export type GetLicensesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/licenses"; +}; + +export type GetLicensesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicensesError = GetLicensesErrors[keyof GetLicensesErrors]; + +export type GetLicensesResponses = { + /** + * OK + */ + 200: PageLicense; +}; + +export type GetLicensesResponse = GetLicensesResponses[keyof GetLicensesResponses]; + +export type CreateLicenseData = { + body: LicenseWritable; + path?: never; + query?: never; + url: "/licenses"; +}; + +export type CreateLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateLicenseError = CreateLicenseErrors[keyof CreateLicenseErrors]; + +export type CreateLicenseResponses = { + /** + * Created + */ + 201: License; +}; + +export type CreateLicenseResponse = CreateLicenseResponses[keyof CreateLicenseResponses]; + +export type DeleteLicenseData = { + body?: never; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}"; +}; + +export type DeleteLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteLicenseError = DeleteLicenseErrors[keyof DeleteLicenseErrors]; + +export type DeleteLicenseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteLicenseResponse = DeleteLicenseResponses[keyof DeleteLicenseResponses]; + +export type GetLicenseData = { + body?: never; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}"; +}; + +export type GetLicenseErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseError = GetLicenseErrors[keyof GetLicenseErrors]; + +export type GetLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type GetLicenseResponse = GetLicenseResponses[keyof GetLicenseResponses]; + +export type UpdateLicenseData = { + body: LicenseWritable; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}"; +}; + +export type UpdateLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateLicenseError = UpdateLicenseErrors[keyof UpdateLicenseErrors]; + +export type UpdateLicenseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateLicenseResponse = UpdateLicenseResponses[keyof UpdateLicenseResponses]; + +export type ArchiveLicenseData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/archive"; +}; + +export type ArchiveLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ArchiveLicenseError = ArchiveLicenseErrors[keyof ArchiveLicenseErrors]; + +export type ArchiveLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type ArchiveLicenseResponse = ArchiveLicenseResponses[keyof ArchiveLicenseResponses]; + +export type GetLicenseEntitlementsData = { + body?: never; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/licenses/{licenseSlug}/entitlements"; +}; + +export type GetLicenseEntitlementsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseEntitlementsError = + GetLicenseEntitlementsErrors[keyof GetLicenseEntitlementsErrors]; + +export type GetLicenseEntitlementsResponses = { + /** + * OK + */ + 200: PageLicenseEntitlement; +}; + +export type GetLicenseEntitlementsResponse = + GetLicenseEntitlementsResponses[keyof GetLicenseEntitlementsResponses]; + +export type AssociateEntitlementWithLicenseData = { + body: LicenseEntitlementWritable; + path: { + /** + * License slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements"; +}; + +export type AssociateEntitlementWithLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type AssociateEntitlementWithLicenseError = + AssociateEntitlementWithLicenseErrors[keyof AssociateEntitlementWithLicenseErrors]; + +export type AssociateEntitlementWithLicenseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type AssociateEntitlementWithLicenseResponse = + AssociateEntitlementWithLicenseResponses[keyof AssociateEntitlementWithLicenseResponses]; + +export type DeleteLicenseEntitlementData = { + body?: never; + path: { + licenseSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +}; + +export type DeleteLicenseEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteLicenseEntitlementError = + DeleteLicenseEntitlementErrors[keyof DeleteLicenseEntitlementErrors]; + +export type DeleteLicenseEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteLicenseEntitlementResponse = + DeleteLicenseEntitlementResponses[keyof DeleteLicenseEntitlementResponses]; + +export type GetLicenseEntitlementData = { + body?: never; + path: { + licenseSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +}; + +export type GetLicenseEntitlementErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetLicenseEntitlementError = + GetLicenseEntitlementErrors[keyof GetLicenseEntitlementErrors]; + +export type GetLicenseEntitlementResponses = { + /** + * OK + */ + 200: LicenseEntitlement; +}; + +export type GetLicenseEntitlementResponse = + GetLicenseEntitlementResponses[keyof GetLicenseEntitlementResponses]; + +export type UpdateLicenseEntitlementData = { + body: LicenseEntitlementWritable; + path: { + licenseSlug: string; + entitlementSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/entitlements/{entitlementSlug}"; +}; + +export type UpdateLicenseEntitlementErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateLicenseEntitlementError = + UpdateLicenseEntitlementErrors[keyof UpdateLicenseEntitlementErrors]; + +export type UpdateLicenseEntitlementResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateLicenseEntitlementResponse = + UpdateLicenseEntitlementResponses[keyof UpdateLicenseEntitlementResponses]; + +export type PreviewLicenseInvoiceData = { + body: InvoicePreviewScenario; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/invoice-preview"; +}; + +export type PreviewLicenseInvoiceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type PreviewLicenseInvoiceError = + PreviewLicenseInvoiceErrors[keyof PreviewLicenseInvoiceErrors]; + +export type PreviewLicenseInvoiceResponses = { + /** + * OK + */ + 200: InvoicePreview; +}; + +export type PreviewLicenseInvoiceResponse = + PreviewLicenseInvoiceResponses[keyof PreviewLicenseInvoiceResponses]; + +export type ListLicensePricesData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: { + /** + * Only prices in this status; both when omitted + */ + status?: "ACTIVE" | "DEPRECATED"; + /** + * Only prices of this billing model + */ + billingModel?: "FLAT_FEE" | "USAGE_BASED" | "OVERAGE"; + }; + url: "/licenses/{licenseSlug}/prices"; +}; + +export type ListLicensePricesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListLicensePricesError = ListLicensePricesErrors[keyof ListLicensePricesErrors]; + +export type ListLicensePricesResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListLicensePricesResponse = + ListLicensePricesResponses[keyof ListLicensePricesResponses]; + +export type CreateLicensePriceData = { + body: NewLicensePrice; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices"; +}; + +export type CreateLicensePriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateLicensePriceError = CreateLicensePriceErrors[keyof CreateLicensePriceErrors]; + +export type CreateLicensePriceResponses = { + /** + * Created + */ + 201: Price; +}; + +export type CreateLicensePriceResponse = + CreateLicensePriceResponses[keyof CreateLicensePriceResponses]; + +export type GetLicensePriceData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + /** + * Price identifier + */ + priceId: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices/{priceId}"; +}; + +export type GetLicensePriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetLicensePriceError = GetLicensePriceErrors[keyof GetLicensePriceErrors]; + +export type GetLicensePriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type GetLicensePriceResponse = GetLicensePriceResponses[keyof GetLicensePriceResponses]; + +export type UpdateLicensePriceData = { + body: LicensePriceChanges; + path: { + /** + * License version slug + */ + licenseSlug: string; + /** + * Price identifier + */ + priceId: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices/{priceId}"; +}; + +export type UpdateLicensePriceErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateLicensePriceError = UpdateLicensePriceErrors[keyof UpdateLicensePriceErrors]; + +export type UpdateLicensePriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type UpdateLicensePriceResponse = + UpdateLicensePriceResponses[keyof UpdateLicensePriceResponses]; + +export type DeprecateLicensePriceData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + /** + * Price identifier + */ + priceId: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/prices/{priceId}/deprecate"; +}; + +export type DeprecateLicensePriceErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type DeprecateLicensePriceError = + DeprecateLicensePriceErrors[keyof DeprecateLicensePriceErrors]; + +export type DeprecateLicensePriceResponses = { + /** + * OK + */ + 200: Price; +}; + +export type DeprecateLicensePriceResponse = + DeprecateLicensePriceResponses[keyof DeprecateLicensePriceResponses]; + +export type PublishLicenseData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/publish"; +}; + +export type PublishLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type PublishLicenseError = PublishLicenseErrors[keyof PublishLicenseErrors]; + +export type PublishLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type PublishLicenseResponse = PublishLicenseResponses[keyof PublishLicenseResponses]; + +export type UnarchiveLicenseData = { + body?: never; + path: { + /** + * License version slug + */ + licenseSlug: string; + }; + query?: never; + url: "/licenses/{licenseSlug}/unarchive"; +}; + +export type UnarchiveLicenseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UnarchiveLicenseError = UnarchiveLicenseErrors[keyof UnarchiveLicenseErrors]; + +export type UnarchiveLicenseResponses = { + /** + * OK + */ + 200: License; +}; + +export type UnarchiveLicenseResponse = UnarchiveLicenseResponses[keyof UnarchiveLicenseResponses]; + +export type ListMetadataFieldsData = { + body?: never; + path?: never; + query: { + resourceType: "DEPLOYMENT_ZONE" | "INSTANCE"; + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/metadata-fields"; +}; + +export type ListMetadataFieldsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListMetadataFieldsError = ListMetadataFieldsErrors[keyof ListMetadataFieldsErrors]; + +export type ListMetadataFieldsResponses = { + /** + * OK + */ + 200: PageMetadataField; +}; + +export type ListMetadataFieldsResponse = + ListMetadataFieldsResponses[keyof ListMetadataFieldsResponses]; + +export type CreateMetadataFieldData = { + body: MetadataFieldWritable; + path?: never; + query?: never; + url: "/metadata-fields"; +}; + +export type CreateMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateMetadataFieldError = CreateMetadataFieldErrors[keyof CreateMetadataFieldErrors]; + +export type CreateMetadataFieldResponses = { + /** + * Created + */ + 201: MetadataField; +}; + +export type CreateMetadataFieldResponse = + CreateMetadataFieldResponses[keyof CreateMetadataFieldResponses]; + +export type ReorderMetadataFieldsData = { + body: ReorderMetadataFieldsInput; + path?: never; + query?: never; + url: "/metadata-fields/reorder"; +}; + +export type ReorderMetadataFieldsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ReorderMetadataFieldsError = + ReorderMetadataFieldsErrors[keyof ReorderMetadataFieldsErrors]; + +export type ReorderMetadataFieldsResponses = { + /** + * No Content + */ + 204: void; +}; + +export type ReorderMetadataFieldsResponse = + ReorderMetadataFieldsResponses[keyof ReorderMetadataFieldsResponses]; + +export type UpdateMetadataFieldData = { + body: MetadataFieldWritable; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}"; +}; + +export type UpdateMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateMetadataFieldError = UpdateMetadataFieldErrors[keyof UpdateMetadataFieldErrors]; + +export type UpdateMetadataFieldResponses = { + /** + * OK + */ + 200: MetadataField; +}; + +export type UpdateMetadataFieldResponse = + UpdateMetadataFieldResponses[keyof UpdateMetadataFieldResponses]; + +export type ArchiveMetadataFieldData = { + body?: never; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}/archive"; +}; + +export type ArchiveMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ArchiveMetadataFieldError = + ArchiveMetadataFieldErrors[keyof ArchiveMetadataFieldErrors]; + +export type ArchiveMetadataFieldResponses = { + /** + * OK + */ + 200: MetadataField; +}; + +export type ArchiveMetadataFieldResponse = + ArchiveMetadataFieldResponses[keyof ArchiveMetadataFieldResponses]; + +export type DryRunMetadataFieldData = { + body: MetadataFieldSchemaProposal; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}/dry-run"; +}; + +export type DryRunMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DryRunMetadataFieldError = DryRunMetadataFieldErrors[keyof DryRunMetadataFieldErrors]; + +export type DryRunMetadataFieldResponses = { + /** + * OK + */ + 200: Impact; +}; + +export type DryRunMetadataFieldResponse = + DryRunMetadataFieldResponses[keyof DryRunMetadataFieldResponses]; + +export type UnarchiveMetadataFieldData = { + body?: never; + path: { + id: string; + }; + query?: never; + url: "/metadata-fields/{id}/unarchive"; +}; + +export type UnarchiveMetadataFieldErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UnarchiveMetadataFieldError = + UnarchiveMetadataFieldErrors[keyof UnarchiveMetadataFieldErrors]; + +export type UnarchiveMetadataFieldResponses = { + /** + * OK + */ + 200: MetadataField; +}; + +export type UnarchiveMetadataFieldResponse = + UnarchiveMetadataFieldResponses[keyof UnarchiveMetadataFieldResponses]; + +export type EvaluateFlagsBulkData = { + /** + * EvaluateVariant multiple flags in one request + */ + body?: BulkEvaluationRequest; + headers?: { + /** + * The request will be processed only if ETag doesn't match any of the values listed. + */ + "If-None-Match"?: string; + }; + path?: never; + query?: never; + url: "/ofrep/v1/evaluate/flags"; +}; + +export type EvaluateFlagsBulkErrors = { + /** + * Bad evaluation request + */ + 400: BulkEvaluationFailure; + /** + * Unauthorized - You need credentials to access the API + */ + 401: unknown; + /** + * Forbidden - You are not authorized to access the API + */ + 403: unknown; + /** + * Rate limit reached on the Flag Management System + */ + 429: unknown; + /** + * Internal server error + */ + 500: BulkEvaluationFailure; +}; + +export type EvaluateFlagsBulkError = EvaluateFlagsBulkErrors[keyof EvaluateFlagsBulkErrors]; + +export type EvaluateFlagsBulkResponses = { + /** + * OFREP successful evaluation response + */ + 200: + | { + /** + * Array of evaluation results + */ + flags?: Array; + } + | BulkEvaluationFailure; +}; + +export type EvaluateFlagsBulkResponse = + EvaluateFlagsBulkResponses[keyof EvaluateFlagsBulkResponses]; + +export type EvaluateFlagData = { + /** + * Evaluation context + */ + body: EvaluationRequest; + path: { + key: string; + }; + query?: never; + url: "/ofrep/v1/evaluate/flags/{key}"; +}; + +export type EvaluateFlagErrors = { + /** + * Evaluation failed + */ + 400: EvaluationFailure; + /** + * Internal error + */ + 500: EvaluationFailure; +}; + +export type EvaluateFlagError = EvaluateFlagErrors[keyof EvaluateFlagErrors]; + +export type EvaluateFlagResponses = { + /** + * Flag evaluated successfully + */ + 200: EvaluationSuccess; +}; + +export type EvaluateFlagResponse = EvaluateFlagResponses[keyof EvaluateFlagResponses]; + +export type GetOpenfeatureManifestData = { + body?: never; + path?: never; + query?: never; + url: "/openfeature/v0/manifest"; +}; + +export type GetOpenfeatureManifestErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetOpenfeatureManifestError = + GetOpenfeatureManifestErrors[keyof GetOpenfeatureManifestErrors]; + +export type GetOpenfeatureManifestResponses = { + /** + * OK + */ + 200: ManifestEnvelope; +}; + +export type GetOpenfeatureManifestResponse = + GetOpenfeatureManifestResponses[keyof GetOpenfeatureManifestResponses]; + +export type GetPublicCatalogData = { + body?: never; + path?: never; + query?: { + /** + * Only this licence family + */ + familySlug?: string; + /** + * addons (the default) lists the public add-ons too; none leaves them out + */ + include?: Array<"addons" | "none"> | null; + }; + url: "/public/catalog"; +}; + +export type GetPublicCatalogErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetPublicCatalogError = GetPublicCatalogErrors[keyof GetPublicCatalogErrors]; + +export type GetPublicCatalogResponses = { + /** + * OK + */ + 200: PublicCatalog; +}; + +export type GetPublicCatalogResponse = GetPublicCatalogResponses[keyof GetPublicCatalogResponses]; + +export type CreateSessionCheckoutData = { + body: SessionCheckoutOrder; + path?: never; + query?: never; + url: "/public/session/checkout"; +}; + +export type CreateSessionCheckoutErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateSessionCheckoutError = + CreateSessionCheckoutErrors[keyof CreateSessionCheckoutErrors]; + +export type CreateSessionCheckoutResponses = { + /** + * Created + */ + 201: SessionCheckout; +}; + +export type CreateSessionCheckoutResponse = + CreateSessionCheckoutResponses[keyof CreateSessionCheckoutResponses]; + +export type ListSessionInvoicesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque cursor from the previous page's nextCursor + */ + cursor?: string; + /** + * Page size, 50 by default, 200 at most + */ + limit?: number; + }; + url: "/public/session/invoices"; +}; + +export type ListSessionInvoicesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Too Many Requests + */ + 429: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListSessionInvoicesError = ListSessionInvoicesErrors[keyof ListSessionInvoicesErrors]; + +export type ListSessionInvoicesResponses = { + /** + * OK + */ + 200: PageSessionInvoice; +}; + +export type ListSessionInvoicesResponse = + ListSessionInvoicesResponses[keyof ListSessionInvoicesResponses]; + +export type ListPublishableKeysData = { + body?: never; + path?: never; + query?: { + /** + * Also list revoked keys + */ + includeRevoked?: boolean; + }; + url: "/publishable-keys"; +}; + +export type ListPublishableKeysErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListPublishableKeysError = ListPublishableKeysErrors[keyof ListPublishableKeysErrors]; + +export type ListPublishableKeysResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListPublishableKeysResponse = + ListPublishableKeysResponses[keyof ListPublishableKeysResponses]; + +export type CreatePublishableKeyData = { + body: PublishableKeyDraft; + path?: never; + query?: never; + url: "/publishable-keys"; +}; + +export type CreatePublishableKeyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type CreatePublishableKeyError = + CreatePublishableKeyErrors[keyof CreatePublishableKeyErrors]; + +export type CreatePublishableKeyResponses = { + /** + * Created + */ + 201: PublishableKeyCreated; +}; + +export type CreatePublishableKeyResponse = + CreatePublishableKeyResponses[keyof CreatePublishableKeyResponses]; + +export type UpdatePublishableKeyData = { + body: PublishableKeyPatch; + path: { + /** + * Publishable key id + */ + keyId: string; + }; + query?: never; + url: "/publishable-keys/{keyId}"; +}; + +export type UpdatePublishableKeyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdatePublishableKeyError = + UpdatePublishableKeyErrors[keyof UpdatePublishableKeyErrors]; + +export type UpdatePublishableKeyResponses = { + /** + * OK + */ + 200: PublishableKey; +}; + +export type UpdatePublishableKeyResponse = + UpdatePublishableKeyResponses[keyof UpdatePublishableKeyResponses]; + +export type RevokePublishableKeyData = { + body?: never; + path: { + /** + * Publishable key id + */ + keyId: string; + }; + query?: never; + url: "/publishable-keys/{keyId}/revoke"; +}; + +export type RevokePublishableKeyErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type RevokePublishableKeyError = + RevokePublishableKeyErrors[keyof RevokePublishableKeyErrors]; + +export type RevokePublishableKeyResponses = { + /** + * OK + */ + 200: PublishableKey; +}; + +export type RevokePublishableKeyResponse = + RevokePublishableKeyResponses[keyof RevokePublishableKeyResponses]; + +export type ListReleasesData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/releases"; +}; + +export type ListReleasesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListReleasesError = ListReleasesErrors[keyof ListReleasesErrors]; + +export type ListReleasesResponses = { + /** + * OK + */ + 200: PageRelease; +}; + +export type ListReleasesResponse = ListReleasesResponses[keyof ListReleasesResponses]; + +export type CreateReleaseData = { + body: ReleaseWritable; + path?: never; + query?: never; + url: "/releases"; +}; + +export type CreateReleaseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateReleaseError = CreateReleaseErrors[keyof CreateReleaseErrors]; + +export type CreateReleaseResponses = { + /** + * Created + */ + 201: Release; +}; + +export type CreateReleaseResponse = CreateReleaseResponses[keyof CreateReleaseResponses]; + +export type DeleteReleaseData = { + body?: never; + path: { + /** + * Release slug + */ + releaseSlug: string; + }; + query?: never; + url: "/releases/{releaseSlug}"; +}; + +export type DeleteReleaseErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteReleaseError = DeleteReleaseErrors[keyof DeleteReleaseErrors]; + +export type DeleteReleaseResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteReleaseResponse = DeleteReleaseResponses[keyof DeleteReleaseResponses]; + +export type GetReleaseBySlugData = { + body?: never; + path: { + /** + * Release slug + */ + releaseSlug: string; + }; + query?: never; + url: "/releases/{releaseSlug}"; +}; + +export type GetReleaseBySlugErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetReleaseBySlugError = GetReleaseBySlugErrors[keyof GetReleaseBySlugErrors]; + +export type GetReleaseBySlugResponses = { + /** + * OK + */ + 200: Release; +}; + +export type GetReleaseBySlugResponse = GetReleaseBySlugResponses[keyof GetReleaseBySlugResponses]; + +export type GetServiceAccountsData = { + body?: never; + path?: never; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/service-accounts"; +}; + +export type GetServiceAccountsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetServiceAccountsError = GetServiceAccountsErrors[keyof GetServiceAccountsErrors]; + +export type GetServiceAccountsResponses = { + /** + * OK + */ + 200: PageServiceAccount; +}; + +export type GetServiceAccountsResponse = + GetServiceAccountsResponses[keyof GetServiceAccountsResponses]; + +export type CreateServiceAccountData = { + /** + * Service account details + */ + body: ServiceAccountWritable; + path?: never; + query?: never; + url: "/service-accounts"; +}; + +export type CreateServiceAccountErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateServiceAccountError = + CreateServiceAccountErrors[keyof CreateServiceAccountErrors]; + +export type CreateServiceAccountResponses = { + /** + * Created service account + */ + 201: ServiceAccount; +}; + +export type CreateServiceAccountResponse = + CreateServiceAccountResponses[keyof CreateServiceAccountResponses]; + +export type GetServiceAccountData = { + body?: never; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}"; +}; + +export type GetServiceAccountErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetServiceAccountError = GetServiceAccountErrors[keyof GetServiceAccountErrors]; + +export type GetServiceAccountResponses = { + /** + * Service account details + */ + 200: ServiceAccount; +}; + +export type GetServiceAccountResponse = + GetServiceAccountResponses[keyof GetServiceAccountResponses]; + +export type UpdateServiceAccountData = { + /** + * Service account update details + */ + body: ServiceAccountWritable; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}"; +}; + +export type UpdateServiceAccountErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type UpdateServiceAccountError = + UpdateServiceAccountErrors[keyof UpdateServiceAccountErrors]; + +export type UpdateServiceAccountResponses = { + /** + * No Content + */ + 204: void; +}; + +export type UpdateServiceAccountResponse = + UpdateServiceAccountResponses[keyof UpdateServiceAccountResponses]; + +export type GetServiceAccountTokensData = { + body?: never; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: { + /** + * Opaque pagination cursor from a previous response's nextCursor + */ + cursor?: string; + /** + * Maximum number of entries to return (default 50, max 200) + */ + limit?: number; + }; + url: "/service-accounts/{serviceAccountSlug}/tokens"; +}; + +export type GetServiceAccountTokensErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetServiceAccountTokensError = + GetServiceAccountTokensErrors[keyof GetServiceAccountTokensErrors]; + +export type GetServiceAccountTokensResponses = { + /** + * OK + */ + 200: PageToken; +}; + +export type GetServiceAccountTokensResponse = + GetServiceAccountTokensResponses[keyof GetServiceAccountTokensResponses]; + +export type CreateServiceAccountTokenData = { + /** + * Token creation details + */ + body: PlainTokenWritable; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}/tokens"; +}; + +export type CreateServiceAccountTokenErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateServiceAccountTokenError = + CreateServiceAccountTokenErrors[keyof CreateServiceAccountTokenErrors]; + +export type CreateServiceAccountTokenResponses = { + /** + * Created token with secret value (only shown once) + */ + 201: PlainToken; +}; + +export type CreateServiceAccountTokenResponse = + CreateServiceAccountTokenResponses[keyof CreateServiceAccountTokenResponses]; + +export type DeleteServiceAccountTokenData = { + body?: never; + path: { + /** + * Service account slug + */ + serviceAccountSlug: string; + /** + * Token slug to revoke + */ + tokenSlug: string; + }; + query?: never; + url: "/service-accounts/{serviceAccountSlug}/tokens/{tokenSlug}"; +}; + +export type DeleteServiceAccountTokenErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type DeleteServiceAccountTokenError = + DeleteServiceAccountTokenErrors[keyof DeleteServiceAccountTokenErrors]; + +export type DeleteServiceAccountTokenResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteServiceAccountTokenResponse = + DeleteServiceAccountTokenResponses[keyof DeleteServiceAccountTokenResponses]; + +export type ExportOrganizationUsageReportsData = { + body?: never; + path?: never; + query?: { + /** + * Start of the range, inclusive (RFC 3339). Defaults to 30 days before to, moved up to the start of the organization's usage history when that is later. An explicit from before it answers 422 ExportUsageReports.OutsideRetention. + */ + from?: string; + /** + * End of the range, exclusive (RFC 3339). Defaults to now. At most 31 days after from. + */ + to?: string; + /** + * csv (the default): RFC 4180 with a header row. json: NDJSON, one report per line. Anything else answers 422 ExportUsageReports.InvalidFormat. + */ + format?: string; + /** + * Only this instance's reports + */ + instanceSlug?: string; + /** + * Only this instance's reports. Reaches a deleted instance, whose reports are kept. + */ + instanceId?: string; + /** + * Only this entitlement's reports + */ + entitlementSlug?: string; + /** + * Only this entitlement's reports. Reaches a deleted entitlement, whose reports are kept. + */ + entitlementId?: string; + }; + url: "/usage/reports/export"; +}; + +export type ExportOrganizationUsageReportsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ExportOrganizationUsageReportsError = + ExportOrganizationUsageReportsErrors[keyof ExportOrganizationUsageReportsErrors]; + +export type ExportOrganizationUsageReportsResponses = { + /** + * The reports, as an attachment: CSV with a header row for format=csv, one JSON object per line for format=json + */ + 200: string; +}; + +export type ExportOrganizationUsageReportsResponse = + ExportOrganizationUsageReportsResponses[keyof ExportOrganizationUsageReportsResponses]; + +export type GetNotificationPreferencesData = { + body?: never; + path?: never; + query?: never; + url: "/v1/notification-preferences"; +}; + +export type GetNotificationPreferencesErrors = { + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type GetNotificationPreferencesError = + GetNotificationPreferencesErrors[keyof GetNotificationPreferencesErrors]; + +export type GetNotificationPreferencesResponses = { + /** + * OK + */ + 200: PreferenceMatrix; +}; + +export type GetNotificationPreferencesResponse = + GetNotificationPreferencesResponses[keyof GetNotificationPreferencesResponses]; + +export type PutNotificationPreferencesData = { + body: PreferenceChoices; + path?: never; + query?: never; + url: "/v1/notification-preferences"; +}; + +export type PutNotificationPreferencesErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type PutNotificationPreferencesError = + PutNotificationPreferencesErrors[keyof PutNotificationPreferencesErrors]; + +export type PutNotificationPreferencesResponses = { + /** + * OK + */ + 200: PreferenceMatrix; +}; + +export type PutNotificationPreferencesResponse = + PutNotificationPreferencesResponses[keyof PutNotificationPreferencesResponses]; + +export type ListNotificationsData = { + body?: never; + path?: never; + query?: { + /** + * Which notifications to return (default all) + */ + status?: "all" | "unread"; + /** + * Only notifications about these kinds of object; repeat the parameter for several (default: all) + */ + objectType?: Array< + "instance" | "customer" | "release" | "deployment_zone" | "component" | "license" | "token" + > | null; + /** + * Opaque cursor from a previous response's next_cursor + */ + cursor?: string; + /** + * Page size (default 20, max 50) + */ + limit?: number; + }; + url: "/v1/notifications"; +}; + +export type ListNotificationsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type ListNotificationsError = ListNotificationsErrors[keyof ListNotificationsErrors]; + +export type ListNotificationsResponses = { + /** + * OK + */ + 200: List; +}; + +export type ListNotificationsResponse = + ListNotificationsResponses[keyof ListNotificationsResponses]; + +export type MarkNotificationsReadData = { + body: ReadSelection; + path?: never; + query?: never; + url: "/v1/notifications/mark-read"; +}; + +export type MarkNotificationsReadErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; +}; + +export type MarkNotificationsReadError = + MarkNotificationsReadErrors[keyof MarkNotificationsReadErrors]; + +export type MarkNotificationsReadResponses = { + /** + * OK + */ + 200: MarkReadResult; +}; + +export type MarkNotificationsReadResponse = + MarkNotificationsReadResponses[keyof MarkNotificationsReadResponses]; + +export type ListVouchersData = { + body?: never; + path?: never; + query?: { + status?: "DRAFT" | "ACTIVE" | "EXPIRED" | "EXHAUSTED" | "ARCHIVED"; + voucherType?: "PRICE" | "ENTITLEMENT_BOOST"; + restrictedCustomerSlug?: string; + }; + url: "/vouchers"; +}; + +export type ListVouchersErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListVouchersError = ListVouchersErrors[keyof ListVouchersErrors]; + +export type ListVouchersResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListVouchersResponse = ListVouchersResponses[keyof ListVouchersResponses]; + +export type CreateVoucherData = { + body: VoucherDraft; + path?: never; + query?: never; + url: "/vouchers"; +}; + +export type CreateVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type CreateVoucherError = CreateVoucherErrors[keyof CreateVoucherErrors]; + +export type CreateVoucherResponses = { + /** + * Created + */ + 201: Voucher; +}; + +export type CreateVoucherResponse = CreateVoucherResponses[keyof CreateVoucherResponses]; + +export type LookupVoucherData = { + body: VoucherCode; + path?: never; + query?: never; + url: "/vouchers/lookup"; +}; + +export type LookupVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type LookupVoucherError = LookupVoucherErrors[keyof LookupVoucherErrors]; + +export type LookupVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type LookupVoucherResponse = LookupVoucherResponses[keyof LookupVoucherResponses]; + +export type ValidateVoucherData = { + body: VoucherCheck; + path?: never; + query?: never; + url: "/vouchers/validate"; +}; + +export type ValidateVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ValidateVoucherError = ValidateVoucherErrors[keyof ValidateVoucherErrors]; + +export type ValidateVoucherResponses = { + /** + * OK + */ + 200: Validity; +}; + +export type ValidateVoucherResponse = ValidateVoucherResponses[keyof ValidateVoucherResponses]; + +export type GetVoucherData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}"; +}; + +export type GetVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type GetVoucherError = GetVoucherErrors[keyof GetVoucherErrors]; + +export type GetVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type GetVoucherResponse = GetVoucherResponses[keyof GetVoucherResponses]; + +export type UpdateVoucherData = { + body: VoucherDraft; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}"; +}; + +export type UpdateVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type UpdateVoucherError = UpdateVoucherErrors[keyof UpdateVoucherErrors]; + +export type UpdateVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type UpdateVoucherResponse = UpdateVoucherResponses[keyof UpdateVoucherResponses]; + +export type ArchiveVoucherData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}/archive"; +}; + +export type ArchiveVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ArchiveVoucherError = ArchiveVoucherErrors[keyof ArchiveVoucherErrors]; + +export type ArchiveVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type ArchiveVoucherResponse = ArchiveVoucherResponses[keyof ArchiveVoucherResponses]; + +export type PublishVoucherData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}/publish"; +}; + +export type PublishVoucherErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Conflict + */ + 409: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type PublishVoucherError = PublishVoucherErrors[keyof PublishVoucherErrors]; + +export type PublishVoucherResponses = { + /** + * OK + */ + 200: Voucher; +}; + +export type PublishVoucherResponse = PublishVoucherResponses[keyof PublishVoucherResponses]; + +export type ListVoucherRedemptionsData = { + body?: never; + path: { + /** + * Voucher id + */ + voucherId: string; + }; + query?: never; + url: "/vouchers/{voucherId}/redemptions"; +}; + +export type ListVoucherRedemptionsErrors = { + /** + * Bad Request + */ + 400: Problem; + /** + * Unauthorized + */ + 401: Problem; + /** + * Forbidden + */ + 403: Problem; + /** + * Not Found + */ + 404: Problem; + /** + * Unprocessable Entity + */ + 422: Problem; + /** + * Internal Server Error + */ + 500: Problem; + /** + * Service Unavailable + */ + 503: Problem; +}; + +export type ListVoucherRedemptionsError = + ListVoucherRedemptionsErrors[keyof ListVoucherRedemptionsErrors]; + +export type ListVoucherRedemptionsResponses = { + /** + * OK + */ + 200: Array; +}; + +export type ListVoucherRedemptionsResponse = + ListVoucherRedemptionsResponses[keyof ListVoucherRedemptionsResponses]; + +export type OnAddonEntitlementAssignedWebhookPayload = { + data: AddonGrantUpdateWritable; + /** + * Event name + */ + name: "ADDON_ENTITLEMENT_ASSIGNED"; + /** + * Event type + */ + type: "com.kaiten.addon.entitlement.v1.assigned"; +}; + +export type OnAddonEntitlementAssignedWebhookRequest = { + body: OnAddonEntitlementAssignedWebhookPayload; + key: "com.kaiten.addon.entitlement.v1.assigned"; + path?: never; + query?: never; +}; + +export type OnAddonEntitlementUnassignedWebhookPayload = { + data: AddonGrantUpdateWritable; + /** + * Event name + */ + name: "ADDON_ENTITLEMENT_UNASSIGNED"; + /** + * Event type + */ + type: "com.kaiten.addon.entitlement.v1.unassigned"; +}; + +export type OnAddonEntitlementUnassignedWebhookRequest = { + body: OnAddonEntitlementUnassignedWebhookPayload; + key: "com.kaiten.addon.entitlement.v1.unassigned"; + path?: never; + query?: never; +}; + +export type OnAddonEntitlementUpdatedWebhookPayload = { + data: AddonGrantUpdateWritable; + /** + * Event name + */ + name: "ADDON_ENTITLEMENT_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.addon.entitlement.v1.updated"; +}; + +export type OnAddonEntitlementUpdatedWebhookRequest = { + body: OnAddonEntitlementUpdatedWebhookPayload; + key: "com.kaiten.addon.entitlement.v1.updated"; + path?: never; + query?: never; +}; + +export type OnAddonPriceCreatedWebhookPayload = { + data: AddonPriceUpdateWritable; + /** + * Event name + */ + name: "ADDON_PRICE_CREATED"; + /** + * Event type + */ + type: "com.kaiten.addon.price.v1.created"; +}; + +export type OnAddonPriceCreatedWebhookRequest = { + body: OnAddonPriceCreatedWebhookPayload; + key: "com.kaiten.addon.price.v1.created"; + path?: never; + query?: never; +}; + +export type OnAddonPriceDeprecatedWebhookPayload = { + data: AddonPriceUpdateWritable; + /** + * Event name + */ + name: "ADDON_PRICE_DEPRECATED"; + /** + * Event type + */ + type: "com.kaiten.addon.price.v1.deprecated"; +}; + +export type OnAddonPriceDeprecatedWebhookRequest = { + body: OnAddonPriceDeprecatedWebhookPayload; + key: "com.kaiten.addon.price.v1.deprecated"; + path?: never; + query?: never; +}; + +export type OnAddonArchivedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_ARCHIVED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.archived"; +}; + +export type OnAddonArchivedWebhookRequest = { + body: OnAddonArchivedWebhookPayload; + key: "com.kaiten.addon.v1.archived"; + path?: never; + query?: never; +}; + +export type OnAddonCreatedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_CREATED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.created"; +}; + +export type OnAddonCreatedWebhookRequest = { + body: OnAddonCreatedWebhookPayload; + key: "com.kaiten.addon.v1.created"; + path?: never; + query?: never; +}; + +export type OnAddonDeletedWebhookPayload = { + data: DeletedAddon; + /** + * Event name + */ + name: "ADDON_DELETED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.deleted"; +}; + +export type OnAddonDeletedWebhookRequest = { + body: OnAddonDeletedWebhookPayload; + key: "com.kaiten.addon.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnAddonPublishedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_PUBLISHED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.published"; +}; + +export type OnAddonPublishedWebhookRequest = { + body: OnAddonPublishedWebhookPayload; + key: "com.kaiten.addon.v1.published"; + path?: never; + query?: never; +}; + +export type OnAddonUnarchivedWebhookPayload = { + data: AddonWritable; + /** + * Event name + */ + name: "ADDON_UNARCHIVED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.unarchived"; +}; + +export type OnAddonUnarchivedWebhookRequest = { + body: OnAddonUnarchivedWebhookPayload; + key: "com.kaiten.addon.v1.unarchived"; + path?: never; + query?: never; +}; + +export type OnAddonUpdatedWebhookPayload = { + data: AddonUpdateWritable; + /** + * Event name + */ + name: "ADDON_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.addon.v1.updated"; +}; + +export type OnAddonUpdatedWebhookRequest = { + body: OnAddonUpdatedWebhookPayload; + key: "com.kaiten.addon.v1.updated"; + path?: never; + query?: never; +}; + +export type OnBillingProviderConnectedWebhookPayload = { + data: Connection; + /** + * Event name + */ + name: "BILLING_PROVIDER_CONNECTED"; + /** + * Event type + */ + type: "com.kaiten.billing_provider.v1.connected"; +}; + +export type OnBillingProviderConnectedWebhookRequest = { + body: OnBillingProviderConnectedWebhookPayload; + key: "com.kaiten.billing_provider.v1.connected"; + path?: never; + query?: never; +}; + +export type OnBillingProviderDisconnectedWebhookPayload = { + data: Connection; + /** + * Event name + */ + name: "BILLING_PROVIDER_DISCONNECTED"; + /** + * Event type + */ + type: "com.kaiten.billing_provider.v1.disconnected"; +}; + +export type OnBillingProviderDisconnectedWebhookRequest = { + body: OnBillingProviderDisconnectedWebhookPayload; + key: "com.kaiten.billing_provider.v1.disconnected"; + path?: never; + query?: never; +}; + +export type OnBillingProviderSyncFailedWebhookPayload = { + data: SyncFailure; + /** + * Event name + */ + name: "BILLING_PROVIDER_SYNC_FAILED"; + /** + * Event type + */ + type: "com.kaiten.billing_provider.v1.sync_failed"; +}; + +export type OnBillingProviderSyncFailedWebhookRequest = { + body: OnBillingProviderSyncFailedWebhookPayload; + key: "com.kaiten.billing_provider.v1.sync_failed"; + path?: never; + query?: never; +}; + +export type OnComponentCreatedWebhookPayload = { + data: ComponentWritable; + /** + * Event name + */ + name: "COMPONENT_CREATED"; + /** + * Event type + */ + type: "com.kaiten.component.v1.created"; +}; + +export type OnComponentCreatedWebhookRequest = { + body: OnComponentCreatedWebhookPayload; + key: "com.kaiten.component.v1.created"; + path?: never; + query?: never; +}; + +export type OnComponentDeletedWebhookPayload = { + data: ComponentWritable; + /** + * Event name + */ + name: "COMPONENT_DELETED"; + /** + * Event type + */ + type: "com.kaiten.component.v1.deleted"; +}; + +export type OnComponentDeletedWebhookRequest = { + body: OnComponentDeletedWebhookPayload; + key: "com.kaiten.component.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnComponentUpdatedWebhookPayload = { + data: ComponentWritable; + /** + * Event name + */ + name: "COMPONENT_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.component.v1.updated"; +}; + +export type OnComponentUpdatedWebhookRequest = { + body: OnComponentUpdatedWebhookPayload; + key: "com.kaiten.component.v1.updated"; + path?: never; + query?: never; +}; + +export type OnCustomerPaymentMethodAttachedWebhookPayload = { + data: PaymentMethodAttached; + /** + * Event name + */ + name: "CUSTOMER_PAYMENT_METHOD_ATTACHED"; + /** + * Event type + */ + type: "com.kaiten.customer.payment_method.v1.attached"; +}; + +export type OnCustomerPaymentMethodAttachedWebhookRequest = { + body: OnCustomerPaymentMethodAttachedWebhookPayload; + key: "com.kaiten.customer.payment_method.v1.attached"; + path?: never; + query?: never; +}; + +export type OnCustomerPaymentMethodDetachedWebhookPayload = { + data: PaymentMethodDetached; + /** + * Event name + */ + name: "CUSTOMER_PAYMENT_METHOD_DETACHED"; + /** + * Event type + */ + type: "com.kaiten.customer.payment_method.v1.detached"; +}; + +export type OnCustomerPaymentMethodDetachedWebhookRequest = { + body: OnCustomerPaymentMethodDetachedWebhookPayload; + key: "com.kaiten.customer.payment_method.v1.detached"; + path?: never; + query?: never; +}; + +export type OnCustomerPaymentMethodExpiringWebhookPayload = { + data: PaymentMethodExpiring; + /** + * Event name + */ + name: "CUSTOMER_PAYMENT_METHOD_EXPIRING"; + /** + * Event type + */ + type: "com.kaiten.customer.payment_method.v1.expiring"; +}; + +export type OnCustomerPaymentMethodExpiringWebhookRequest = { + body: OnCustomerPaymentMethodExpiringWebhookPayload; + key: "com.kaiten.customer.payment_method.v1.expiring"; + path?: never; + query?: never; +}; + +export type OnCustomerCreatedWebhookPayload = { + data: CustomerWritable; + /** + * Event name + */ + name: "CUSTOMER_CREATED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.created"; +}; + +export type OnCustomerCreatedWebhookRequest = { + body: OnCustomerCreatedWebhookPayload; + key: "com.kaiten.customer.v1.created"; + path?: never; + query?: never; +}; + +export type OnCustomerCreationRejectedWebhookPayload = { + data: CustomerCreationRejected; + /** + * Event name + */ + name: "CUSTOMER_CREATION_REJECTED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.creation_rejected"; +}; + +export type OnCustomerCreationRejectedWebhookRequest = { + body: OnCustomerCreationRejectedWebhookPayload; + key: "com.kaiten.customer.v1.creation_rejected"; + path?: never; + query?: never; +}; + +export type OnCustomerDeletedWebhookPayload = { + data: CustomerWritable; + /** + * Event name + */ + name: "CUSTOMER_DELETED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.deleted"; +}; + +export type OnCustomerDeletedWebhookRequest = { + body: OnCustomerDeletedWebhookPayload; + key: "com.kaiten.customer.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnCustomerUpdatedWebhookPayload = { + data: CustomerWritable; + /** + * Event name + */ + name: "CUSTOMER_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.customer.v1.updated"; +}; + +export type OnCustomerUpdatedWebhookRequest = { + body: OnCustomerUpdatedWebhookPayload; + key: "com.kaiten.customer.v1.updated"; + path?: never; + query?: never; +}; + +export type OnDeploymentZoneCreatedWebhookPayload = { + data: DeploymentZoneWritable; + /** + * Event name + */ + name: "DEPLOYMENT_ZONE_CREATED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.created"; +}; + +export type OnDeploymentZoneCreatedWebhookRequest = { + body: OnDeploymentZoneCreatedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.created"; + path?: never; + query?: never; +}; + +export type OnDeploymentZoneDeletedWebhookPayload = { + data: DeploymentZoneWritable; + /** + * Event name + */ + name: "DEPLOYMENT_ZONE_DELETED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.deleted"; +}; + +export type OnDeploymentZoneDeletedWebhookRequest = { + body: OnDeploymentZoneDeletedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnReleaseDeployedWebhookPayload = { + data: Deployment; + /** + * Event name + */ + name: "RELEASE_DEPLOYED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.release_deployed"; +}; + +export type OnReleaseDeployedWebhookRequest = { + body: OnReleaseDeployedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.release_deployed"; + path?: never; + query?: never; +}; + +export type OnDeploymentZoneUpdatedWebhookPayload = { + data: DeploymentZoneWritable; + /** + * Event name + */ + name: "DEPLOYMENT_ZONE_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.deployment_zone.v1.updated"; +}; + +export type OnDeploymentZoneUpdatedWebhookRequest = { + body: OnDeploymentZoneUpdatedWebhookPayload; + key: "com.kaiten.deployment_zone.v1.updated"; + path?: never; + query?: never; +}; + +export type OnEntitlementCreatedWebhookPayload = { + data: EntitlementWritable; + /** + * Event name + */ + name: "ENTITLEMENT_CREATED"; + /** + * Event type + */ + type: "com.kaiten.entitlement.v1.created"; +}; + +export type OnEntitlementCreatedWebhookRequest = { + body: OnEntitlementCreatedWebhookPayload; + key: "com.kaiten.entitlement.v1.created"; + path?: never; + query?: never; +}; + +export type OnEntitlementDeletedWebhookPayload = { + data: EntitlementWritable; + /** + * Event name + */ + name: "ENTITLEMENT_DELETED"; + /** + * Event type + */ + type: "com.kaiten.entitlement.v1.deleted"; +}; + +export type OnEntitlementDeletedWebhookRequest = { + body: OnEntitlementDeletedWebhookPayload; + key: "com.kaiten.entitlement.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnEntitlementUpdatedWebhookPayload = { + data: EntitlementWritable; + /** + * Event name + */ + name: "ENTITLEMENT_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.entitlement.v1.updated"; +}; + +export type OnEntitlementUpdatedWebhookRequest = { + body: OnEntitlementUpdatedWebhookPayload; + key: "com.kaiten.entitlement.v1.updated"; + path?: never; + query?: never; +}; + +export type OnEntitlementGroupCreatedWebhookPayload = { + data: EntitlementGroupWritable; + /** + * Event name + */ + name: "ENTITLEMENT_GROUP_CREATED"; + /** + * Event type + */ + type: "com.kaiten.entitlement_group.v1.created"; +}; + +export type OnEntitlementGroupCreatedWebhookRequest = { + body: OnEntitlementGroupCreatedWebhookPayload; + key: "com.kaiten.entitlement_group.v1.created"; + path?: never; + query?: never; +}; + +export type OnEntitlementGroupDeletedWebhookPayload = { + data: EntitlementGroupWritable; + /** + * Event name + */ + name: "ENTITLEMENT_GROUP_DELETED"; + /** + * Event type + */ + type: "com.kaiten.entitlement_group.v1.deleted"; +}; + +export type OnEntitlementGroupDeletedWebhookRequest = { + body: OnEntitlementGroupDeletedWebhookPayload; + key: "com.kaiten.entitlement_group.v1.deleted"; + path?: never; + query?: never; +}; + +export type OnEntitlementGroupUpdatedWebhookPayload = { + data: EntitlementGroupWritable; + /** + * Event name */ - 401: Problem; + name: "ENTITLEMENT_GROUP_UPDATED"; /** - * Forbidden + * Event type */ - 403: Problem; + type: "com.kaiten.entitlement_group.v1.updated"; +}; + +export type OnEntitlementGroupUpdatedWebhookRequest = { + body: OnEntitlementGroupUpdatedWebhookPayload; + key: "com.kaiten.entitlement_group.v1.updated"; + path?: never; + query?: never; +}; + +export type OnFeatureFlagCreatedWebhookPayload = { + data: FeatureFlagWritable; /** - * Unprocessable Entity + * Event name */ - 422: Problem; + name: "FEATURE_FLAG_CREATED"; /** - * Internal Server Error + * Event type */ - 500: Problem; + type: "com.kaiten.feature_flag.v1.created"; }; -export type ListNotificationsError = ListNotificationsErrors[keyof ListNotificationsErrors]; +export type OnFeatureFlagCreatedWebhookRequest = { + body: OnFeatureFlagCreatedWebhookPayload; + key: "com.kaiten.feature_flag.v1.created"; + path?: never; + query?: never; +}; -export type ListNotificationsResponses = { +export type OnFeatureFlagDeletedWebhookPayload = { + data: FeatureFlagWritable; /** - * OK + * Event name */ - 200: List; + name: "FEATURE_FLAG_DELETED"; + /** + * Event type + */ + type: "com.kaiten.feature_flag.v1.deleted"; }; -export type ListNotificationsResponse = - ListNotificationsResponses[keyof ListNotificationsResponses]; - -export type MarkNotificationsReadData = { - body: ReadSelection; +export type OnFeatureFlagDeletedWebhookRequest = { + body: OnFeatureFlagDeletedWebhookPayload; + key: "com.kaiten.feature_flag.v1.deleted"; path?: never; query?: never; - url: "/v1/notifications/mark-read"; }; -export type MarkNotificationsReadErrors = { - /** - * Bad Request - */ - 400: Problem; +export type OnFeatureFlagEvaluatedWebhookPayload = { + data: FeatureFlagEvaluated; /** - * Unauthorized + * Event name */ - 401: Problem; + name: "FEATURE_FLAG_EVALUATED"; /** - * Forbidden + * Event type */ - 403: Problem; + type: "com.kaiten.feature_flag.v1.evaluated"; +}; + +export type OnFeatureFlagEvaluatedWebhookRequest = { + body: OnFeatureFlagEvaluatedWebhookPayload; + key: "com.kaiten.feature_flag.v1.evaluated"; + path?: never; + query?: never; +}; + +export type OnFeatureFlagUpdatedWebhookPayload = { + data: FeatureFlagWritable; /** - * Unprocessable Entity + * Event name */ - 422: Problem; + name: "FEATURE_FLAG_UPDATED"; /** - * Internal Server Error + * Event type */ - 500: Problem; + type: "com.kaiten.feature_flag.v1.updated"; }; -export type MarkNotificationsReadError = - MarkNotificationsReadErrors[keyof MarkNotificationsReadErrors]; +export type OnFeatureFlagUpdatedWebhookRequest = { + body: OnFeatureFlagUpdatedWebhookPayload; + key: "com.kaiten.feature_flag.v1.updated"; + path?: never; + query?: never; +}; -export type MarkNotificationsReadResponses = { +export type OnSystemOrganizationTokenIssuedWebhookPayload = { + data: SystemTokenIssuance; /** - * OK + * Event name */ - 200: MarkReadResult; + name: "SYSTEM_ORGANIZATION_TOKEN_ISSUED"; + /** + * Event type + */ + type: "com.kaiten.identity.v1.system_token_issued"; }; -export type MarkNotificationsReadResponse = - MarkNotificationsReadResponses[keyof MarkNotificationsReadResponses]; +export type OnSystemOrganizationTokenIssuedWebhookRequest = { + body: OnSystemOrganizationTokenIssuedWebhookPayload; + key: "com.kaiten.identity.v1.system_token_issued"; + path?: never; + query?: never; +}; -export type OnComponentCreatedWebhookPayload = { - data: ComponentWritable; +export type OnInstanceAddonAddedWebhookPayload = { + data: InstanceAddonUpdateWritable; /** * Event name */ - name: "COMPONENT_CREATED"; + name: "INSTANCE_ADDON_ADDED"; /** * Event type */ - type: "com.kaiten.component.v1.created"; + type: "com.kaiten.instance.addon.v1.added"; }; -export type OnComponentCreatedWebhookRequest = { - body: OnComponentCreatedWebhookPayload; - key: "com.kaiten.component.v1.created"; +export type OnInstanceAddonAddedWebhookRequest = { + body: OnInstanceAddonAddedWebhookPayload; + key: "com.kaiten.instance.addon.v1.added"; path?: never; query?: never; }; -export type OnComponentDeletedWebhookPayload = { - data: ComponentWritable; +export type OnInstanceAddonQuantityChangedWebhookPayload = { + data: InstanceAddonUpdateWritable; /** * Event name */ - name: "COMPONENT_DELETED"; + name: "INSTANCE_ADDON_QUANTITY_CHANGED"; /** * Event type */ - type: "com.kaiten.component.v1.deleted"; + type: "com.kaiten.instance.addon.v1.quantity_changed"; }; -export type OnComponentDeletedWebhookRequest = { - body: OnComponentDeletedWebhookPayload; - key: "com.kaiten.component.v1.deleted"; +export type OnInstanceAddonQuantityChangedWebhookRequest = { + body: OnInstanceAddonQuantityChangedWebhookPayload; + key: "com.kaiten.instance.addon.v1.quantity_changed"; path?: never; query?: never; }; -export type OnComponentUpdatedWebhookPayload = { - data: ComponentWritable; +export type OnInstanceAddonRemovedWebhookPayload = { + data: InstanceAddonUpdateWritable; /** * Event name */ - name: "COMPONENT_UPDATED"; + name: "INSTANCE_ADDON_REMOVED"; /** * Event type */ - type: "com.kaiten.component.v1.updated"; + type: "com.kaiten.instance.addon.v1.removed"; }; -export type OnComponentUpdatedWebhookRequest = { - body: OnComponentUpdatedWebhookPayload; - key: "com.kaiten.component.v1.updated"; +export type OnInstanceAddonRemovedWebhookRequest = { + body: OnInstanceAddonRemovedWebhookPayload; + key: "com.kaiten.instance.addon.v1.removed"; path?: never; query?: never; }; -export type OnCustomerCreatedWebhookPayload = { - data: CustomerWritable; +export type OnInstanceBillingCanceledWebhookPayload = { + data: CancellationWritable; /** * Event name */ - name: "CUSTOMER_CREATED"; + name: "INSTANCE_BILLING_CANCELED"; /** * Event type */ - type: "com.kaiten.customer.v1.created"; + type: "com.kaiten.instance.billing.v1.canceled"; }; -export type OnCustomerCreatedWebhookRequest = { - body: OnCustomerCreatedWebhookPayload; - key: "com.kaiten.customer.v1.created"; +export type OnInstanceBillingCanceledWebhookRequest = { + body: OnInstanceBillingCanceledWebhookPayload; + key: "com.kaiten.instance.billing.v1.canceled"; path?: never; query?: never; }; -export type OnCustomerCreationRejectedWebhookPayload = { - data: CustomerCreationRejected; +export type OnInstanceBillingCancellationRevertedWebhookPayload = { + data: CancellationChangeWritable; /** * Event name */ - name: "CUSTOMER_CREATION_REJECTED"; + name: "INSTANCE_BILLING_CANCELLATION_REVERTED"; /** * Event type */ - type: "com.kaiten.customer.v1.creation_rejected"; + type: "com.kaiten.instance.billing.v1.cancellation_reverted"; }; -export type OnCustomerCreationRejectedWebhookRequest = { - body: OnCustomerCreationRejectedWebhookPayload; - key: "com.kaiten.customer.v1.creation_rejected"; +export type OnInstanceBillingCancellationRevertedWebhookRequest = { + body: OnInstanceBillingCancellationRevertedWebhookPayload; + key: "com.kaiten.instance.billing.v1.cancellation_reverted"; path?: never; query?: never; }; -export type OnCustomerDeletedWebhookPayload = { - data: CustomerWritable; +export type OnInstanceBillingCancellationScheduledWebhookPayload = { + data: CancellationChangeWritable; /** * Event name */ - name: "CUSTOMER_DELETED"; + name: "INSTANCE_BILLING_CANCELLATION_SCHEDULED"; /** * Event type */ - type: "com.kaiten.customer.v1.deleted"; + type: "com.kaiten.instance.billing.v1.cancellation_scheduled"; }; -export type OnCustomerDeletedWebhookRequest = { - body: OnCustomerDeletedWebhookPayload; - key: "com.kaiten.customer.v1.deleted"; +export type OnInstanceBillingCancellationScheduledWebhookRequest = { + body: OnInstanceBillingCancellationScheduledWebhookPayload; + key: "com.kaiten.instance.billing.v1.cancellation_scheduled"; path?: never; query?: never; }; -export type OnCustomerUpdatedWebhookPayload = { - data: CustomerWritable; +export type OnInstanceBillingPlanChangeCancelledWebhookPayload = { + data: PlanChangeSchedule; /** * Event name */ - name: "CUSTOMER_UPDATED"; + name: "INSTANCE_BILLING_PLAN_CHANGE_CANCELLED"; /** * Event type */ - type: "com.kaiten.customer.v1.updated"; + type: "com.kaiten.instance.billing.v1.plan_change_cancelled"; }; -export type OnCustomerUpdatedWebhookRequest = { - body: OnCustomerUpdatedWebhookPayload; - key: "com.kaiten.customer.v1.updated"; +export type OnInstanceBillingPlanChangeCancelledWebhookRequest = { + body: OnInstanceBillingPlanChangeCancelledWebhookPayload; + key: "com.kaiten.instance.billing.v1.plan_change_cancelled"; path?: never; query?: never; }; -export type OnDeploymentZoneCreatedWebhookPayload = { - data: DeploymentZoneWritable; +export type OnInstanceBillingPlanChangeScheduledWebhookPayload = { + data: PlanChangeSchedule; /** * Event name */ - name: "DEPLOYMENT_ZONE_CREATED"; + name: "INSTANCE_BILLING_PLAN_CHANGE_SCHEDULED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.created"; + type: "com.kaiten.instance.billing.v1.plan_change_scheduled"; }; -export type OnDeploymentZoneCreatedWebhookRequest = { - body: OnDeploymentZoneCreatedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.created"; +export type OnInstanceBillingPlanChangeScheduledWebhookRequest = { + body: OnInstanceBillingPlanChangeScheduledWebhookPayload; + key: "com.kaiten.instance.billing.v1.plan_change_scheduled"; path?: never; query?: never; }; -export type OnDeploymentZoneDeletedWebhookPayload = { - data: DeploymentZoneWritable; +export type OnInstanceBillingPlanChangedWebhookPayload = { + data: PlanChange; /** * Event name */ - name: "DEPLOYMENT_ZONE_DELETED"; + name: "INSTANCE_BILLING_PLAN_CHANGED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.deleted"; + type: "com.kaiten.instance.billing.v1.plan_changed"; }; -export type OnDeploymentZoneDeletedWebhookRequest = { - body: OnDeploymentZoneDeletedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.deleted"; +export type OnInstanceBillingPlanChangedWebhookRequest = { + body: OnInstanceBillingPlanChangedWebhookPayload; + key: "com.kaiten.instance.billing.v1.plan_changed"; path?: never; query?: never; }; -export type OnReleaseDeployedWebhookPayload = { - data: Deployment; +export type OnInstanceBillingProviderChangedWebhookPayload = { + data: ProviderChange; /** * Event name */ - name: "RELEASE_DEPLOYED"; + name: "INSTANCE_BILLING_PROVIDER_CHANGED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.release_deployed"; + type: "com.kaiten.instance.billing.v1.provider_changed"; }; -export type OnReleaseDeployedWebhookRequest = { - body: OnReleaseDeployedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.release_deployed"; +export type OnInstanceBillingProviderChangedWebhookRequest = { + body: OnInstanceBillingProviderChangedWebhookPayload; + key: "com.kaiten.instance.billing.v1.provider_changed"; path?: never; query?: never; }; -export type OnDeploymentZoneUpdatedWebhookPayload = { - data: DeploymentZoneWritable; +export type OnInstanceBillingStartedWebhookPayload = { + data: BillingStartedWritable; /** * Event name */ - name: "DEPLOYMENT_ZONE_UPDATED"; + name: "INSTANCE_BILLING_STARTED"; /** * Event type */ - type: "com.kaiten.deployment_zone.v1.updated"; + type: "com.kaiten.instance.billing.v1.started"; }; -export type OnDeploymentZoneUpdatedWebhookRequest = { - body: OnDeploymentZoneUpdatedWebhookPayload; - key: "com.kaiten.deployment_zone.v1.updated"; +export type OnInstanceBillingStartedWebhookRequest = { + body: OnInstanceBillingStartedWebhookPayload; + key: "com.kaiten.instance.billing.v1.started"; path?: never; query?: never; }; -export type OnEntitlementCreatedWebhookPayload = { - data: EntitlementWritable; +export type OnInstanceBillingStatusChangedWebhookPayload = { + data: StatusChange; /** * Event name */ - name: "ENTITLEMENT_CREATED"; + name: "INSTANCE_BILLING_STATUS_CHANGED"; /** * Event type */ - type: "com.kaiten.entitlement.v1.created"; + type: "com.kaiten.instance.billing.v1.status_changed"; }; -export type OnEntitlementCreatedWebhookRequest = { - body: OnEntitlementCreatedWebhookPayload; - key: "com.kaiten.entitlement.v1.created"; +export type OnInstanceBillingStatusChangedWebhookRequest = { + body: OnInstanceBillingStatusChangedWebhookPayload; + key: "com.kaiten.instance.billing.v1.status_changed"; path?: never; query?: never; }; -export type OnEntitlementDeletedWebhookPayload = { - data: EntitlementWritable; +export type OnInstanceEntitlementCapExceededWebhookPayload = { + data: InstanceEntitlementCapExceeded; /** * Event name */ - name: "ENTITLEMENT_DELETED"; + name: "INSTANCE_ENTITLEMENT_CAP_EXCEEDED"; /** * Event type */ - type: "com.kaiten.entitlement.v1.deleted"; + type: "com.kaiten.instance.entitlement.v1.cap_exceeded"; }; -export type OnEntitlementDeletedWebhookRequest = { - body: OnEntitlementDeletedWebhookPayload; - key: "com.kaiten.entitlement.v1.deleted"; +export type OnInstanceEntitlementCapExceededWebhookRequest = { + body: OnInstanceEntitlementCapExceededWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.cap_exceeded"; path?: never; query?: never; }; -export type OnEntitlementUpdatedWebhookPayload = { - data: EntitlementWritable; +export type OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload = { + data: InstanceEntitlementUsagePeriodRolledOver; /** * Event name */ - name: "ENTITLEMENT_UPDATED"; + name: "INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER"; /** * Event type */ - type: "com.kaiten.entitlement.v1.updated"; + type: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; }; -export type OnEntitlementUpdatedWebhookRequest = { - body: OnEntitlementUpdatedWebhookPayload; - key: "com.kaiten.entitlement.v1.updated"; +export type OnInstanceEntitlementUsagePeriodRolledOverWebhookRequest = { + body: OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; path?: never; query?: never; }; -export type OnEntitlementGroupCreatedWebhookPayload = { - data: EntitlementGroupWritable; +export type OnInstanceEntitlementUsageReachedWebhookPayload = { + data: EntitlementUsageWritable; /** * Event name */ - name: "ENTITLEMENT_GROUP_CREATED"; + name: "INSTANCE_ENTITLEMENT_USAGE_REACHED"; /** * Event type */ - type: "com.kaiten.entitlement_group.v1.created"; + type: "com.kaiten.instance.entitlement.v1.usage_reached"; }; -export type OnEntitlementGroupCreatedWebhookRequest = { - body: OnEntitlementGroupCreatedWebhookPayload; - key: "com.kaiten.entitlement_group.v1.created"; +export type OnInstanceEntitlementUsageReachedWebhookRequest = { + body: OnInstanceEntitlementUsageReachedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_reached"; + path?: never; + query?: never; +}; + +export type OnInstanceEntitlementUsageReportAcceptedWebhookPayload = { + data: InstanceEntitlementUsageReportAccepted; + /** + * Event name + */ + name: "ENTITLEMENT_USAGE_REPORT_ACCEPTED"; + /** + * Event type + */ + type: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; +}; + +export type OnInstanceEntitlementUsageReportAcceptedWebhookRequest = { + body: OnInstanceEntitlementUsageReportAcceptedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; path?: never; query?: never; }; -export type OnEntitlementGroupDeletedWebhookPayload = { - data: EntitlementGroupWritable; +export type OnInstanceEntitlementUsageReportRejectedWebhookPayload = { + data: InstanceEntitlementUsageReportAccepted; /** * Event name */ - name: "ENTITLEMENT_GROUP_DELETED"; + name: "ENTITLEMENT_USAGE_REPORT_REJECTED"; /** * Event type */ - type: "com.kaiten.entitlement_group.v1.deleted"; + type: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; }; -export type OnEntitlementGroupDeletedWebhookRequest = { - body: OnEntitlementGroupDeletedWebhookPayload; - key: "com.kaiten.entitlement_group.v1.deleted"; +export type OnInstanceEntitlementUsageReportRejectedWebhookRequest = { + body: OnInstanceEntitlementUsageReportRejectedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; path?: never; query?: never; }; -export type OnEntitlementGroupUpdatedWebhookPayload = { - data: EntitlementGroupWritable; +export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload = { + data: InstanceEntitlementUsageWarningThresholdReached; /** * Event name */ - name: "ENTITLEMENT_GROUP_UPDATED"; + name: "INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED"; /** * Event type */ - type: "com.kaiten.entitlement_group.v1.updated"; + type: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; }; -export type OnEntitlementGroupUpdatedWebhookRequest = { - body: OnEntitlementGroupUpdatedWebhookPayload; - key: "com.kaiten.entitlement_group.v1.updated"; +export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest = { + body: OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; path?: never; query?: never; }; -export type OnFeatureFlagCreatedWebhookPayload = { - data: FeatureFlagWritable; +export type OnInstanceEntitlementValueGetWebhookPayload = { + data: InstanceEntitlementValueGetWritable; /** * Event name */ - name: "FEATURE_FLAG_CREATED"; + name: "ENTITLEMENT_VALUE_GET"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.created"; + type: "com.kaiten.instance.entitlement.v1.value_get"; }; -export type OnFeatureFlagCreatedWebhookRequest = { - body: OnFeatureFlagCreatedWebhookPayload; - key: "com.kaiten.feature_flag.v1.created"; +export type OnInstanceEntitlementValueGetWebhookRequest = { + body: OnInstanceEntitlementValueGetWebhookPayload; + key: "com.kaiten.instance.entitlement.v1.value_get"; path?: never; query?: never; }; -export type OnFeatureFlagDeletedWebhookPayload = { - data: FeatureFlagWritable; +export type OnInstanceInvoiceHandoffAcknowledgedWebhookPayload = { + data: HandoffAcknowledgement; /** * Event name */ - name: "FEATURE_FLAG_DELETED"; + name: "INSTANCE_INVOICE_HANDOFF_ACKNOWLEDGED"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.deleted"; + type: "com.kaiten.instance.invoice.v1.handoff_acknowledged"; }; -export type OnFeatureFlagDeletedWebhookRequest = { - body: OnFeatureFlagDeletedWebhookPayload; - key: "com.kaiten.feature_flag.v1.deleted"; +export type OnInstanceInvoiceHandoffAcknowledgedWebhookRequest = { + body: OnInstanceInvoiceHandoffAcknowledgedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.handoff_acknowledged"; path?: never; query?: never; }; -export type OnFeatureFlagEvaluatedWebhookPayload = { - data: FeatureFlagEvaluated; +export type OnInstanceInvoiceHeldWebhookPayload = { + data: HeldInvoice; /** * Event name */ - name: "FEATURE_FLAG_EVALUATED"; + name: "INSTANCE_INVOICE_HELD"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.evaluated"; + type: "com.kaiten.instance.invoice.v1.held"; }; -export type OnFeatureFlagEvaluatedWebhookRequest = { - body: OnFeatureFlagEvaluatedWebhookPayload; - key: "com.kaiten.feature_flag.v1.evaluated"; +export type OnInstanceInvoiceHeldWebhookRequest = { + body: OnInstanceInvoiceHeldWebhookPayload; + key: "com.kaiten.instance.invoice.v1.held"; path?: never; query?: never; }; -export type OnFeatureFlagUpdatedWebhookPayload = { - data: FeatureFlagWritable; +export type OnInstanceInvoiceIssuedWebhookPayload = { + data: IssuedInvoice; /** * Event name */ - name: "FEATURE_FLAG_UPDATED"; + name: "INSTANCE_INVOICE_ISSUED"; /** * Event type */ - type: "com.kaiten.feature_flag.v1.updated"; + type: "com.kaiten.instance.invoice.v1.issued"; }; -export type OnFeatureFlagUpdatedWebhookRequest = { - body: OnFeatureFlagUpdatedWebhookPayload; - key: "com.kaiten.feature_flag.v1.updated"; +export type OnInstanceInvoiceIssuedWebhookRequest = { + body: OnInstanceInvoiceIssuedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.issued"; path?: never; query?: never; }; -export type OnSystemOrganizationTokenIssuedWebhookPayload = { - data: SystemTokenIssuance; +export type OnInstanceInvoiceMarkedUncollectibleWebhookPayload = { + data: UncollectibleInvoice; /** * Event name */ - name: "SYSTEM_ORGANIZATION_TOKEN_ISSUED"; + name: "INSTANCE_INVOICE_MARKED_UNCOLLECTIBLE"; /** * Event type */ - type: "com.kaiten.identity.v1.system_token_issued"; + type: "com.kaiten.instance.invoice.v1.marked_uncollectible"; }; -export type OnSystemOrganizationTokenIssuedWebhookRequest = { - body: OnSystemOrganizationTokenIssuedWebhookPayload; - key: "com.kaiten.identity.v1.system_token_issued"; +export type OnInstanceInvoiceMarkedUncollectibleWebhookRequest = { + body: OnInstanceInvoiceMarkedUncollectibleWebhookPayload; + key: "com.kaiten.instance.invoice.v1.marked_uncollectible"; path?: never; query?: never; }; -export type OnInstanceEntitlementCapExceededWebhookPayload = { - data: InstanceEntitlementCapExceeded; +export type OnInstanceInvoicePaidWebhookPayload = { + data: PaidInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_CAP_EXCEEDED"; + name: "INSTANCE_INVOICE_PAID"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.cap_exceeded"; + type: "com.kaiten.instance.invoice.v1.paid"; }; -export type OnInstanceEntitlementCapExceededWebhookRequest = { - body: OnInstanceEntitlementCapExceededWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.cap_exceeded"; +export type OnInstanceInvoicePaidWebhookRequest = { + body: OnInstanceInvoicePaidWebhookPayload; + key: "com.kaiten.instance.invoice.v1.paid"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload = { - data: InstanceEntitlementUsagePeriodRolledOver; +export type OnInstanceInvoicePaymentFailedWebhookPayload = { + data: PaymentFailedInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_USAGE_PERIOD_ROLLED_OVER"; + name: "INSTANCE_INVOICE_PAYMENT_FAILED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; + type: "com.kaiten.instance.invoice.v1.payment_failed"; }; -export type OnInstanceEntitlementUsagePeriodRolledOverWebhookRequest = { - body: OnInstanceEntitlementUsagePeriodRolledOverWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_period_rolled_over"; +export type OnInstanceInvoicePaymentFailedWebhookRequest = { + body: OnInstanceInvoicePaymentFailedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.payment_failed"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageReachedWebhookPayload = { - data: EntitlementUsageWritable; +export type OnInstanceInvoicePushFailedWebhookPayload = { + data: PushFailedInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_USAGE_REACHED"; + name: "INSTANCE_INVOICE_PUSH_FAILED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_reached"; + type: "com.kaiten.instance.invoice.v1.push_failed"; }; -export type OnInstanceEntitlementUsageReachedWebhookRequest = { - body: OnInstanceEntitlementUsageReachedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_reached"; +export type OnInstanceInvoicePushFailedWebhookRequest = { + body: OnInstanceInvoicePushFailedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.push_failed"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageReportAcceptedWebhookPayload = { - data: InstanceEntitlementUsageReportAccepted; +export type OnInstanceInvoicePushedWebhookPayload = { + data: PushedInvoice; /** * Event name */ - name: "ENTITLEMENT_USAGE_REPORT_ACCEPTED"; + name: "INSTANCE_INVOICE_PUSHED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; + type: "com.kaiten.instance.invoice.v1.pushed"; }; -export type OnInstanceEntitlementUsageReportAcceptedWebhookRequest = { - body: OnInstanceEntitlementUsageReportAcceptedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_report_accepted"; +export type OnInstanceInvoicePushedWebhookRequest = { + body: OnInstanceInvoicePushedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.pushed"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageReportRejectedWebhookPayload = { - data: InstanceEntitlementUsageReportAccepted; +export type OnInstanceInvoiceReconciliationMismatchWebhookPayload = { + data: MismatchedInvoice; /** * Event name */ - name: "ENTITLEMENT_USAGE_REPORT_REJECTED"; + name: "INSTANCE_INVOICE_RECONCILIATION_MISMATCH"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; + type: "com.kaiten.instance.invoice.v1.reconciliation_mismatch"; }; -export type OnInstanceEntitlementUsageReportRejectedWebhookRequest = { - body: OnInstanceEntitlementUsageReportRejectedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_report_rejected"; +export type OnInstanceInvoiceReconciliationMismatchWebhookRequest = { + body: OnInstanceInvoiceReconciliationMismatchWebhookPayload; + key: "com.kaiten.instance.invoice.v1.reconciliation_mismatch"; path?: never; query?: never; }; -export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload = { - data: InstanceEntitlementUsageWarningThresholdReached; +export type OnInstanceInvoiceReleasedWebhookPayload = { + data: ReleasedInvoice; /** * Event name */ - name: "INSTANCE_ENTITLEMENT_USAGE_WARNING_THRESHOLD_REACHED"; + name: "INSTANCE_INVOICE_RELEASED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; + type: "com.kaiten.instance.invoice.v1.released"; }; -export type OnInstanceEntitlementUsageWarningThresholdReachedWebhookRequest = { - body: OnInstanceEntitlementUsageWarningThresholdReachedWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.usage_warning_threshold_reached"; +export type OnInstanceInvoiceReleasedWebhookRequest = { + body: OnInstanceInvoiceReleasedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.released"; path?: never; query?: never; }; -export type OnInstanceEntitlementValueGetWebhookPayload = { - data: InstanceEntitlementValueGetWritable; +export type OnInstanceInvoiceVoidedWebhookPayload = { + data: VoidedInvoice; /** * Event name */ - name: "ENTITLEMENT_VALUE_GET"; + name: "INSTANCE_INVOICE_VOIDED"; /** * Event type */ - type: "com.kaiten.instance.entitlement.v1.value_get"; + type: "com.kaiten.instance.invoice.v1.voided"; }; -export type OnInstanceEntitlementValueGetWebhookRequest = { - body: OnInstanceEntitlementValueGetWebhookPayload; - key: "com.kaiten.instance.entitlement.v1.value_get"; +export type OnInstanceInvoiceVoidedWebhookRequest = { + body: OnInstanceInvoiceVoidedWebhookPayload; + key: "com.kaiten.instance.invoice.v1.voided"; path?: never; query?: never; }; @@ -9405,6 +20172,63 @@ export type OnInstanceUpdatedWebhookRequest = { query?: never; }; +export type OnInstanceVoucherExpiredWebhookPayload = { + data: RedemptionWritable; + /** + * Event name + */ + name: "INSTANCE_VOUCHER_EXPIRED"; + /** + * Event type + */ + type: "com.kaiten.instance.voucher.v1.expired"; +}; + +export type OnInstanceVoucherExpiredWebhookRequest = { + body: OnInstanceVoucherExpiredWebhookPayload; + key: "com.kaiten.instance.voucher.v1.expired"; + path?: never; + query?: never; +}; + +export type OnInstanceVoucherRedeemedWebhookPayload = { + data: RedemptionWritable; + /** + * Event name + */ + name: "INSTANCE_VOUCHER_REDEEMED"; + /** + * Event type + */ + type: "com.kaiten.instance.voucher.v1.redeemed"; +}; + +export type OnInstanceVoucherRedeemedWebhookRequest = { + body: OnInstanceVoucherRedeemedWebhookPayload; + key: "com.kaiten.instance.voucher.v1.redeemed"; + path?: never; + query?: never; +}; + +export type OnInstanceVoucherRevokedWebhookPayload = { + data: RedemptionWritable; + /** + * Event name + */ + name: "INSTANCE_VOUCHER_REVOKED"; + /** + * Event type + */ + type: "com.kaiten.instance.voucher.v1.revoked"; +}; + +export type OnInstanceVoucherRevokedWebhookRequest = { + body: OnInstanceVoucherRevokedWebhookPayload; + key: "com.kaiten.instance.voucher.v1.revoked"; + path?: never; + query?: never; +}; + export type OnLicenseEntitlementAssignedWebhookPayload = { data: LicenseEntitlementWritable; /** @@ -9462,6 +20286,63 @@ export type OnLicenseEntitlementUpdatedWebhookRequest = { query?: never; }; +export type OnLicensePriceCreatedWebhookPayload = { + data: EventWritable; + /** + * Event name + */ + name: "LICENSE_PRICE_CREATED"; + /** + * Event type + */ + type: "com.kaiten.license.price.v1.created"; +}; + +export type OnLicensePriceCreatedWebhookRequest = { + body: OnLicensePriceCreatedWebhookPayload; + key: "com.kaiten.license.price.v1.created"; + path?: never; + query?: never; +}; + +export type OnLicensePriceDeprecatedWebhookPayload = { + data: EventWritable; + /** + * Event name + */ + name: "LICENSE_PRICE_DEPRECATED"; + /** + * Event type + */ + type: "com.kaiten.license.price.v1.deprecated"; +}; + +export type OnLicensePriceDeprecatedWebhookRequest = { + body: OnLicensePriceDeprecatedWebhookPayload; + key: "com.kaiten.license.price.v1.deprecated"; + path?: never; + query?: never; +}; + +export type OnLicensePriceUpdatedWebhookPayload = { + data: UpdatedEventWritable; + /** + * Event name + */ + name: "LICENSE_PRICE_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.license.price.v1.updated"; +}; + +export type OnLicensePriceUpdatedWebhookRequest = { + body: OnLicensePriceUpdatedWebhookPayload; + key: "com.kaiten.license.price.v1.updated"; + path?: never; + query?: never; +}; + export type OnLicenseArchivedWebhookPayload = { data: LicenseWritable; /** @@ -9765,3 +20646,98 @@ export type OnReleaseDeletedWebhookRequest = { path?: never; query?: never; }; + +export type OnVoucherArchivedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_ARCHIVED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.archived"; +}; + +export type OnVoucherArchivedWebhookRequest = { + body: OnVoucherArchivedWebhookPayload; + key: "com.kaiten.voucher.v1.archived"; + path?: never; + query?: never; +}; + +export type OnVoucherCreatedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_CREATED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.created"; +}; + +export type OnVoucherCreatedWebhookRequest = { + body: OnVoucherCreatedWebhookPayload; + key: "com.kaiten.voucher.v1.created"; + path?: never; + query?: never; +}; + +export type OnVoucherExhaustedWebhookPayload = { + data: ExhaustedEvent; + /** + * Event name + */ + name: "VOUCHER_EXHAUSTED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.exhausted"; +}; + +export type OnVoucherExhaustedWebhookRequest = { + body: OnVoucherExhaustedWebhookPayload; + key: "com.kaiten.voucher.v1.exhausted"; + path?: never; + query?: never; +}; + +export type OnVoucherPublishedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_PUBLISHED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.published"; +}; + +export type OnVoucherPublishedWebhookRequest = { + body: OnVoucherPublishedWebhookPayload; + key: "com.kaiten.voucher.v1.published"; + path?: never; + query?: never; +}; + +export type OnVoucherUpdatedWebhookPayload = { + data: VoucherWritable; + /** + * Event name + */ + name: "VOUCHER_UPDATED"; + /** + * Event type + */ + type: "com.kaiten.voucher.v1.updated"; +}; + +export type OnVoucherUpdatedWebhookRequest = { + body: OnVoucherUpdatedWebhookPayload; + key: "com.kaiten.voucher.v1.updated"; + path?: never; + query?: never; +}; diff --git a/packages/server/tests/index.test.ts b/packages/server/tests/index.test.ts index b4ce05c..3635710 100644 --- a/packages/server/tests/index.test.ts +++ b/packages/server/tests/index.test.ts @@ -1,6 +1,7 @@ import { describe, expect, test } from "vite-plus/test"; import { Customers, + CustomerSessions, createKaitenClient, Instances, KaitenError, @@ -29,6 +30,36 @@ describe("@kaitencloud/server", () => { expect(typeof Instances.createInstance).toBe("function"); }); + test("mints a customer session for the browser", async () => { + const { seen, fetch } = recordingFetch( + async () => + new Response( + JSON.stringify({ + id: "s1", + token: "kst_x", + expiresAt: "2026-10-08T10:30:00Z", + customerSlug: "acme", + }), + { status: 201, headers: { "content-type": "application/json" } }, + ), + ); + const client = createKaitenClient({ + token: "ksh_vendor", + baseUrl: "https://example.test", + fetch, + }); + + const { data } = await CustomerSessions.createCustomerSession({ + client, + body: { customerSlug: "acme", instanceSlug: "acme-prod" }, + }); + + expect(data?.token).toBe("kst_x"); + expect(seen[0]?.method).toBe("POST"); + expect(new URL(seen[0]!.url).pathname).toBe("/api/customer-sessions"); + expect(seen[0]?.headers.get("Authorization")).toBe("Bearer ksh_vendor"); + }); + test("createKaitenClient injects Bearer auth and the base URL", async () => { const { seen, fetch } = recordingFetch(); const client = createKaitenClient({