{"openapi":"3.1.0","info":{"title":"Base316 API","version":"1.0.0","description":"Identity, entitlements and billing for applications and the agents that build them. Every write accepts an `Idempotency-Key`; every refusal names a code, the offending field, what to do about it, and where it is documented."},"servers":[{"url":"https://api.base316.com"}],"components":{"schemas":{"ApiError":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string","enum":["INVALID_API_KEY","MISSING_API_KEY","SECRET_KEY_REQUIRED","KEY_PERMISSION_DENIED","FORBIDDEN","NOT_FOUND","INVALID_REQUEST","CONFLICT","IDEMPOTENCY_KEY_REUSED","IDEMPOTENCY_KEY_IN_FLIGHT","PLAN_LIMIT","PLAN_FEATURE","RATE_LIMITED","SERVICE_UNAVAILABLE","INTERNAL"]},"message":{"type":"string"},"param":{"type":"string","description":"The offending field, when one was named."},"fix":{"type":"string","description":"What to do about it."},"docs":{"type":"string","format":"uri"}},"required":["type","code","message","fix","docs"]},"requestId":{"type":"string"}},"required":["error","requestId"]}},"responses":{"Error":{"description":"A refusal, carrying a code, the offending field and what to do about it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A Base316 API key. `b316_sk_` keys are secret and act from a server; `b316_pk_` keys are publishable and may only read."}}},"paths":{"/":{"get":{"operationId":"get","tags":["root"],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/.well-known/oauth-authorization-server/oidc/{environmentId}":{"get":{"operationId":"get-well-known-oauth-authorization-server-oidc-by-environmentId","tags":[".well-known"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/.well-known/openid-configuration/oidc/{environmentId}":{"get":{"operationId":"get-well-known-openid-configuration-oidc-by-environmentId","tags":[".well-known"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}":{"get":{"operationId":"get-agreements-by-environmentId","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/activate":{"post":{"operationId":"post-agreements-by-environmentId-activate","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/card":{"post":{"operationId":"post-agreements-by-environmentId-card","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/card/complete":{"get":{"operationId":"get-agreements-by-environmentId-card-complete","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/code":{"post":{"operationId":"post-agreements-by-environmentId-code","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/document.pdf":{"get":{"operationId":"get-agreements-by-environmentId-document-pdf","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/open":{"get":{"operationId":"get-agreements-by-environmentId-open","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-agreements-by-environmentId-open","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/relink":{"post":{"operationId":"post-agreements-by-environmentId-relink","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/sign":{"post":{"operationId":"post-agreements-by-environmentId-sign","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/agreements/{environmentId}/verify":{"post":{"operationId":"post-agreements-by-environmentId-verify","tags":["agreements"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/health":{"get":{"operationId":"get-health","tags":["health"],"summary":"Liveness check.","security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/llms.txt":{"get":{"operationId":"get-llms-txt","tags":["llms.txt"],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/openapi.json":{"get":{"operationId":"get-openapi-json","tags":["openapi.json"],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/scim/v2/{environmentId}/Groups":{"get":{"operationId":"get-scim-v2-by-environmentId-Groups","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-scim-v2-by-environmentId-Groups","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/scim/v2/{environmentId}/Groups/{id}":{"delete":{"operationId":"delete-scim-v2-by-environmentId-Groups-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-scim-v2-by-environmentId-Groups-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-scim-v2-by-environmentId-Groups-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/scim/v2/{environmentId}/ResourceTypes":{"get":{"operationId":"get-scim-v2-by-environmentId-ResourceTypes","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/scim/v2/{environmentId}/ServiceProviderConfig":{"get":{"operationId":"get-scim-v2-by-environmentId-ServiceProviderConfig","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/scim/v2/{environmentId}/Users":{"get":{"operationId":"get-scim-v2-by-environmentId-Users","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-scim-v2-by-environmentId-Users","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/scim/v2/{environmentId}/Users/{id}":{"delete":{"operationId":"delete-scim-v2-by-environmentId-Users-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-scim-v2-by-environmentId-Users-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-scim-v2-by-environmentId-Users-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-scim-v2-by-environmentId-Users-by-id","tags":["scim"],"parameters":[{"name":"environmentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/access/check":{"post":{"operationId":"post-access-check","tags":["access"],"summary":"Decide whether a customer may use a feature.","description":"Any combination of an entitlement (`feature`), a role permission (`permission`) and a relationship to one object (`relation` + `object`). Allowed only when every part passes. A metered feature whose plan version prices its usage (a non-FLAT price on that feature) is a soft limit: usage past `limit + credits` is allowed and billed, and `usage.overage` is true when this request lands in it (`usage.billableOverage` is what is already billable this period). Without such a price the limit is hard and refuses with USAGE_LIMIT_EXCEEDED. Either way `usage.hardCap`, when set, is an absolute ceiling on the period's usage that credits do not raise, refused with HARD_CAP_REACHED.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/addons":{"get":{"operationId":"get-addons","tags":["addons"],"summary":"List addons.","x-base316-secret-key-only":true,"parameters":[{"name":"includeArchived","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-addons","tags":["addons"],"summary":"Create an addon.","description":"`includedQuantity` (PER_UNIT only, default 0) is the units included before the addon charges: it bills `max(0, quantity - includedQuantity) × amount`, so \"10 clients included, then $12 each\" is one addon. The attachment keeps the real quantity; the invoice line records the included units in `allowance`. 400 for included units on a FLAT addon.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"kind":{"type":"string","enum":["RECURRING","ONE_TIME"]},"model":{"type":"string","enum":["FLAT","PER_UNIT"]},"currency":{"type":"string","minLength":3,"maxLength":3},"amount":{"type":"string","minLength":1,"pattern":"^-?\\d+(\\.\\d+)?$"},"countsManagedTenants":{"type":"boolean"},"includedQuantity":{"type":"integer","minimum":0,"maximum":1000000000}},"required":["key","name","currency","amount"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/addons/{id}":{"delete":{"operationId":"delete-addons-by-id","tags":["addons"],"summary":"Archive an addon.","description":"Archived rather than deleted, because invoices referring to it still have to resolve.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-addons-by-id","tags":["addons"],"summary":"Rename or reprice an addon.","description":"Key, kind, model and currency cannot change: each is something an attached subscription was priced against. `amount` and `includedQuantity` apply from the next invoice.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"amount":{"type":"string","minLength":1,"pattern":"^-?\\d+(\\.\\d+)?$"},"countsManagedTenants":{"type":"boolean"},"includedQuantity":{"type":"integer","minimum":0,"maximum":1000000000}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/addons/attached":{"post":{"operationId":"post-addons-attached","tags":["addons"],"summary":"Attach an addon to a subscription.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subscriptionId":{"type":"string","minLength":1},"addonId":{"type":"string","minLength":1},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["subscriptionId","addonId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/addons/attached/{id}":{"delete":{"operationId":"delete-addons-attached-by-id","tags":["addons"],"summary":"Detach an addon.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-addons-attached-by-id","tags":["addons"],"summary":"Change an attached quantity.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["quantity"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/addons/attached/{subscriptionId}":{"get":{"operationId":"get-addons-attached-by-subscriptionId","tags":["addons"],"summary":"List the addons a subscription carries.","x-base316-secret-key-only":true,"parameters":[{"name":"subscriptionId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements":{"get":{"operationId":"get-agreements","tags":["agreements"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-agreements","tags":["agreements"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}":{"get":{"operationId":"get-agreements-by-id","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/certificate":{"get":{"operationId":"get-agreements-by-id-certificate","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/documents":{"post":{"operationId":"post-agreements-by-id-documents","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/documents/{versionId}/pdf":{"get":{"operationId":"get-agreements-by-id-documents-by-versionId-pdf","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/events":{"get":{"operationId":"get-agreements-by-id-events","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/resend":{"post":{"operationId":"post-agreements-by-id-resend","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/revoke":{"post":{"operationId":"post-agreements-by-id-revoke","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/{id}/send":{"post":{"operationId":"post-agreements-by-id-send","tags":["agreements"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/agreements/import":{"post":{"operationId":"post-agreements-import","tags":["agreements"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/api-clients":{"get":{"operationId":"get-api-clients","tags":["api-clients"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-api-clients","tags":["api-clients"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/api-resources":{"get":{"operationId":"get-api-resources","tags":["api-resources"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-api-resources","tags":["api-resources"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/api-resources/{id}":{"delete":{"operationId":"delete-api-resources-by-id","tags":["api-resources"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-api-resources-by-id","tags":["api-resources"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-api-resources-by-id","tags":["api-resources"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/api-resources/{id}/scopes":{"post":{"operationId":"post-api-resources-by-id-scopes","tags":["api-resources"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/api-resources/{id}/scopes/{key}":{"delete":{"operationId":"delete-api-resources-by-id-scopes-by-key","tags":["api-resources"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/audit-logs":{"get":{"operationId":"get-audit-logs","tags":["audit-logs"],"summary":"Read the audit trail.","description":"Filterable by action prefix, actor, resource, outcome and date. Read-only by construction: a log the API can edit is not an audit log.","x-base316-secret-key-only":true,"parameters":[{"name":"action","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"actorId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"resourceType","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"resourceId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"outcome","in":"query","required":false,"schema":{"type":"string","enum":["SUCCEEDED","DENIED","FAILED"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-config/hosted":{"get":{"operationId":"get-auth-config-hosted","tags":["auth-config"],"summary":"Read the hosted sign-in configuration.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-auth-config-hosted","tags":["auth-config"],"summary":"Replace the hosted sign-in configuration.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"brandName":{"type":"string","minLength":1,"maxLength":200},"tagline":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"logoKey":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"backgroundImageKey":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"brandDisplay":{"type":"string","enum":["LOGO","NAME","BOTH"]},"primaryColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"backgroundColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"redirectUris":{"type":"array","items":{"type":"string","format":"uri"}},"allowSignUp":{"type":"boolean"},"allowPassword":{"type":"boolean"},"allowMagicLink":{"type":"boolean"},"allowPasskeys":{"type":"boolean"},"allowPhone":{"type":"boolean"},"supportEmail":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"termsUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"termsContent":{"anyOf":[{"type":"string","maxLength":100000},{"type":"null"}]},"privacyUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"privacyContent":{"anyOf":[{"type":"string","maxLength":100000},{"type":"null"}]}},"required":["brandName"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-config/providers":{"get":{"operationId":"get-auth-config-providers","tags":["auth-config"],"summary":"List social sign-in providers.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-config/providers/{provider}":{"delete":{"operationId":"delete-auth-config-providers-by-provider","tags":["auth-config"],"summary":"Remove a provider.","x-base316-secret-key-only":true,"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-auth-config-providers-by-provider","tags":["auth-config"],"summary":"Configure a social provider.","description":"Client secrets are stored encrypted and never returned; responses carry only a last-four.","x-base316-secret-key-only":true,"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clientId":{"type":"string","minLength":1,"maxLength":500},"clientSecret":{"type":"string","minLength":1,"maxLength":2000},"appleTeamId":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"appleKeyId":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"tenantMode":{"type":"string","enum":["COMMON","ORGANIZATIONS","CONSUMERS","SPECIFIC"]},"allowedTenantIds":{"maxItems":50,"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}},"required":["clientId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-config/sso":{"get":{"operationId":"get-auth-config-sso","tags":["auth-config"],"summary":"List SSO connections.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-auth-config-sso","tags":["auth-config"],"summary":"Create an SSO connection.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"protocol":{"type":"string","enum":["OIDC","SAML"]},"domains":{"minItems":1,"type":"array","items":{"type":"string","minLength":1,"maxLength":253}},"issuer":{"type":"string","maxLength":500},"clientId":{"type":"string","maxLength":500},"clientSecret":{"type":"string","maxLength":2000},"scopes":{"type":"array","items":{"type":"string","minLength":1}},"idpEntityId":{"type":"string","maxLength":500},"idpSsoUrl":{"type":"string","format":"uri"},"idpCertificate":{"type":"string","maxLength":20000},"jitProvisioning":{"type":"boolean"},"groupsClaim":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}]},"roleMappings":{"anyOf":[{"maxItems":100,"type":"array","items":{"type":"object","properties":{"group":{"type":"string","minLength":1,"maxLength":256},"roleKey":{"type":"string","minLength":1,"maxLength":128}},"required":["group","roleKey"]}},{"type":"null"}]},"syncRolesOnLogin":{"type":"boolean"},"defaultRoleId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"runtimeOrganizationId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["name","domains"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-config/sso/{id}":{"delete":{"operationId":"delete-auth-config-sso-by-id","tags":["auth-config"],"summary":"Remove an SSO connection.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-auth-config-sso-by-id","tags":["auth-config"],"summary":"Read one SSO connection.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-auth-config-sso-by-id","tags":["auth-config"],"summary":"Update an SSO connection.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"protocol":{"type":"string","enum":["OIDC","SAML"]},"domains":{"minItems":1,"type":"array","items":{"type":"string","minLength":1,"maxLength":253}},"issuer":{"type":"string","maxLength":500},"clientId":{"type":"string","maxLength":500},"clientSecret":{"type":"string","maxLength":2000},"scopes":{"type":"array","items":{"type":"string","minLength":1}},"idpEntityId":{"type":"string","maxLength":500},"idpSsoUrl":{"type":"string","format":"uri"},"idpCertificate":{"type":"string","maxLength":20000},"jitProvisioning":{"type":"boolean"},"groupsClaim":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}]},"roleMappings":{"anyOf":[{"maxItems":100,"type":"array","items":{"type":"object","properties":{"group":{"type":"string","minLength":1,"maxLength":256},"roleKey":{"type":"string","minLength":1,"maxLength":128}},"required":["group","roleKey"]}},{"type":"null"}]},"syncRolesOnLogin":{"type":"boolean"},"defaultRoleId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"runtimeOrganizationId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["name","domains"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-config/sso/{id}/enabled":{"post":{"operationId":"post-auth-config-sso-by-id-enabled","tags":["auth-config"],"summary":"Enable or disable a connection.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-hooks":{"delete":{"operationId":"delete-auth-hooks","tags":["auth-hooks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-auth-hooks","tags":["auth-hooks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-auth-hooks","tags":["auth-hooks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth-policy":{"get":{"operationId":"get-auth-policy","tags":["auth-policy"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-auth-policy","tags":["auth-policy"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/code/exchange":{"post":{"operationId":"post-auth-code-exchange","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/connected-apps":{"get":{"operationId":"get-auth-connected-apps","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/connected-apps/{clientId}":{"delete":{"operationId":"delete-auth-connected-apps-by-clientId","tags":["auth"],"parameters":[{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/events":{"get":{"operationId":"get-auth-events","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/impersonate":{"post":{"operationId":"post-auth-impersonate","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/magic-link/request":{"post":{"operationId":"post-auth-magic-link-request","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/magic-link/verify":{"post":{"operationId":"post-auth-magic-link-verify","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/me/data":{"get":{"operationId":"get-auth-me-data","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/me/erase":{"post":{"operationId":"post-auth-me-erase","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/me/password":{"post":{"operationId":"post-auth-me-password","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/confirm":{"post":{"operationId":"post-auth-mfa-confirm","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/disable":{"post":{"operationId":"post-auth-mfa-disable","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/email/enroll":{"post":{"operationId":"post-auth-mfa-email-enroll","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/enroll":{"post":{"operationId":"post-auth-mfa-enroll","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/factors":{"get":{"operationId":"get-auth-mfa-factors","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/required/complete":{"post":{"operationId":"post-auth-mfa-required-complete","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/required/start":{"post":{"operationId":"post-auth-mfa-required-start","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/resend":{"post":{"operationId":"post-auth-mfa-resend","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/sms/enroll":{"post":{"operationId":"post-auth-mfa-sms-enroll","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/mfa/verify":{"post":{"operationId":"post-auth-mfa-verify","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/passkeys":{"get":{"operationId":"get-auth-passkeys","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/passkeys/{id}":{"delete":{"operationId":"delete-auth-passkeys-by-id","tags":["auth"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/passkeys/register/finish":{"post":{"operationId":"post-auth-passkeys-register-finish","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/passkeys/register/start":{"post":{"operationId":"post-auth-passkeys-register-start","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/passkeys/signin/finish":{"post":{"operationId":"post-auth-passkeys-signin-finish","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/passkeys/signin/start":{"post":{"operationId":"post-auth-passkeys-signin-start","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/password-policy":{"get":{"operationId":"get-auth-password-policy","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/password/reset":{"post":{"operationId":"post-auth-password-reset","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/password/reset-request":{"post":{"operationId":"post-auth-password-reset-request","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/phone/start":{"post":{"operationId":"post-auth-phone-start","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/phone/verification/confirm":{"post":{"operationId":"post-auth-phone-verification-confirm","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/phone/verification/start":{"post":{"operationId":"post-auth-phone-verification-start","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/phone/verify":{"post":{"operationId":"post-auth-phone-verify","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/session":{"get":{"operationId":"get-auth-session","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/sessions":{"get":{"operationId":"get-auth-sessions","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/sessions/revoke-all":{"post":{"operationId":"post-auth-sessions-revoke-all","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/signin":{"post":{"operationId":"post-auth-signin","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/signout":{"post":{"operationId":"post-auth-signout","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/signup":{"post":{"operationId":"post-auth-signup","tags":["auth"],"summary":"Create an end user's account.","description":"Publishable key. Every sign-up opens a personal organization (and, where the environment opens billing accounts for tenants, a customer beside it) — unless it carries `invitationToken`: a live invitation sent to the same address creates the account straight into the inviting organization instead, with no personal organization, the address marked verified (`verificationToken` is then null) and the invitation accepted. A token that is not live is refused (`INVITATION_INVALID`), one sent to another address is refused (`INVITATION_EMAIL_MISMATCH`), and a full tenant is refused with 409 (`SEAT_LIMIT_REACHED`). An invitation also admits the address to an invitation-only environment; a blocked address stays blocked. The response names the organization the person now belongs to and whether an invitation was accepted.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":1,"maxLength":512},"name":{"type":"string","minLength":1,"maxLength":200},"externalId":{"type":"string","minLength":1,"maxLength":200},"invitationToken":{"type":"string","minLength":1,"maxLength":256}},"required":["email","password"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/auth/verify-email":{"post":{"operationId":"post-auth-verify-email","tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/billing-portal/sessions":{"post":{"operationId":"post-billing-portal-sessions","tags":["billing-portal"],"summary":"Open the hosted billing portal for a customer.","description":"Body `{ customerId, returnUrl?, page? }`. Returns `{ id, url, expiresAt }`: send the customer to `url` within ten minutes. The link opens once, is exchanged for a 30-minute visit cookie, and opens only the billing portal — plan, next invoice, plan changes with a review step, seats, cancel and resume, invoices and their PDFs, paying an open invoice and updating the card, plus its Credits (balances, packs, auto-recharge) and Payment methods (saved cards) sections. `page` (`overview`, `credits` or `payment-methods`) is the section the link lands on. `returnUrl` must be one of the environment's redirect URIs, exactly (400 with `param: returnUrl`). Another environment's customer is 404.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"returnUrl":{"type":"string","format":"uri"},"page":{"type":"string","enum":["overview","credits","payment-methods"]}},"required":["customerId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/cancellations":{"get":{"operationId":"get-cancellations","tags":["cancellations"],"summary":"List cancellation attempts, newest first.","x-base316-secret-key-only":true,"parameters":[{"name":"customerId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"outcome","in":"query","required":false,"schema":{"type":"string","enum":["PENDING","SAVED","CANCELED"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/cancellations/{id}":{"get":{"operationId":"get-cancellations-by-id","tags":["cancellations"],"summary":"Get a cancellation attempt.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/cancellations/{id}/accept":{"post":{"operationId":"post-cancellations-by-id-accept","tags":["cancellations"],"summary":"Accept the retention offer on a cancellation attempt.","description":"Applies the coupon, lifts a scheduled cancellation and emits `subscription.updated` with `change: retention_offer_accepted`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/cancellations/{id}/confirm":{"post":{"operationId":"post-cancellations-by-id-confirm","tags":["cancellations"],"summary":"Go ahead with a cancellation attempt.","description":"Cancels at the period end and emits `subscription.updated` with `change: cancel_scheduled`, carrying `cancellationId` and `cancellationReason`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string","enum":["TOO_EXPENSIVE","NOT_USING","MISSING_FEATURES","SWITCHING","TECHNICAL_ISSUES","TEMPORARY","OTHER"]},{"type":"null"}]},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/checkout/sessions":{"post":{"operationId":"post-checkout-sessions","tags":["checkout"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections":{"get":{"operationId":"get-collections","tags":["collections"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-collections","tags":["collections"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}":{"delete":{"operationId":"delete-collections-by-key","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-collections-by-key","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-collections-by-key","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}/fields":{"post":{"operationId":"post-collections-by-key-fields","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}/fields/{field}":{"delete":{"operationId":"delete-collections-by-key-fields-by-field","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"field","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-collections-by-key-fields-by-field","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"field","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}/records":{"get":{"operationId":"get-collections-by-key-records","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-collections-by-key-records","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}/records/{id}":{"delete":{"operationId":"delete-collections-by-key-records-by-id","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-collections-by-key-records-by-id","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-collections-by-key-records-by-id","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}/schema":{"get":{"operationId":"get-collections-by-key-schema","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/collections/{key}/titles":{"get":{"operationId":"get-collections-by-key-titles","tags":["collections"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/coupons":{"get":{"operationId":"get-coupons","tags":["coupons"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-coupons","tags":["coupons"],"summary":"Define a coupon.","description":"PERCENTAGE needs `percentOff` (at most 100). FIXED needs `amountOff` **and** `currency`, and only discounts invoices in that currency. REPEATING needs `durationInPeriods`. Send amounts as decimal strings (`\"12.50\"`); numbers are accepted too. `maxRedemptions` counts customers, not invoices.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["PERCENTAGE","FIXED"]},"percentOff":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},"amountOff":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"duration":{"type":"string","enum":["ONCE","REPEATING","FOREVER"]},"durationInPeriods":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRedemptions":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"redeemBy":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["code","name","type"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/coupons/{id}":{"delete":{"operationId":"delete-coupons-by-id","tags":["coupons"],"summary":"Archive a coupon.","description":"Archived, never deleted: invoices and subscription discounts refer to it. Returns the coupon with `active: false`. It can no longer be redeemed on an invoice, a quote or a subscription; a subscription that already carries it keeps the discount it was promised, since those terms were copied onto the subscription — remove that with `DELETE /v1/subscriptions/{id}/discounts`. 404 for an id outside this environment.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-notes":{"get":{"operationId":"get-credit-notes","tags":["credit-notes"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-credit-notes","tags":["credit-notes"],"summary":"Issue a credit note — and refund it.","description":"The total (the sum of `lines`) may not exceed what is left uncredited on the invoice. It first reduces any amount still owed; the rest is money already received, and `settlement` says where it goes: `CREDIT` (default) to the customer's wallet, `REFUND` all of it back to the invoice's payments, or `SPLIT` — `refundAmount` refunded and the rest credited. A card refund is sent through the connected Stripe account and is `PENDING` until Stripe settles it (`refund.succeeded` / `refund.failed`); Base316's application fee is refunded pro rata with it. A refund against cash, a cheque or a wire is recorded, not sent — issuing it says the money went back — and takes `refundReference` and `refundMethod`. Refunds go cards first, newest first, unless `paymentId` names one; each is capped at the payment less what is already refunded, in the invoice's currency. Refused with `param` naming the field: `refundAmount` past what was received or what is left to refund, `settlement` when nothing was paid or card refunds are unavailable, `paymentId` for a payment not on this invoice. Returns `reducedDue`, `refundAmount`, `walletAmount` and the refunds created. Send an `Idempotency-Key`: a retry replays the first response rather than issuing a second note.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoiceId":{"type":"string","minLength":1},"reason":{"type":"string","enum":["DUPLICATE","FRAUDULENT","ORDER_CHANGE","PRODUCT_UNSATISFACTORY","BILLING_ERROR","OTHER"]},"memo":{"type":"string","maxLength":1000},"lines":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]}},"required":["description","amount"]}},"settlement":{"type":"string","enum":["CREDIT","REFUND","SPLIT"]},"refundAmount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},"paymentId":{"type":"string","minLength":1},"refundReference":{"type":"string","minLength":1,"maxLength":200},"refundMethod":{"type":"string","enum":["BANK_TRANSFER","CHECK","CASH","OTHER"]}},"required":["invoiceId","lines"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-notes/{id}/pdf":{"get":{"operationId":"get-credit-notes-by-id-pdf","tags":["credit-notes"],"summary":"Download a credit note as a PDF.","description":"Names the invoice it credits, its reason, its lines and the total credited, and where the money went: applied to the amount owed, refunded to the card (\"Refunded to card ending 4242\", marked pending until Stripe settles it), refunded by cheque or transfer, or credited to the account.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-notes/{id}/void":{"post":{"operationId":"post-credit-notes-by-id-void","tags":["credit-notes"],"summary":"Void a credit note.","description":"Gives the credited amount back to the invoice as owed. Refused once money has moved on the note — a refund pending or made, or wallet balance credited — because the customer may already hold or have spent it.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-packs":{"get":{"operationId":"get-credit-packs","tags":["credit-packs"],"summary":"List credit packs.","x-base316-secret-key-only":true,"parameters":[{"name":"includeArchived","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-credit-packs","tags":["credit-packs"],"summary":"Create a credit pack.","description":"A one-off price that buys `units` of a METERED feature. `tiers` is a volume discount over the number of packs bought, priced TIERED_VOLUME (the whole quantity at the band it lands in; exactly one band has `upTo: null`). `expiresInDays` is how long purchased credits last from payment (default 365; null never expires). `maxQuantity` is the most packs one checkout may buy, 1 to 1,000,000 (default 1,000). 409 when the key is taken.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"featureKey":{"type":"string","minLength":1,"maxLength":200},"featureId":{"type":"string","minLength":1},"units":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"tiers":{"anyOf":[{"maxItems":20,"type":"array","items":{"type":"object","properties":{"upTo":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"unitAmount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}},"required":["upTo","unitAmount"]}},{"type":"null"}]},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":3650},{"type":"null"}]},"maxQuantity":{"anyOf":[{"type":"integer","minimum":1,"maximum":1000000},{"type":"null"}]}},"required":["key","name","units","currency","amount"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-packs/{id}":{"delete":{"operationId":"delete-credit-packs-by-id","tags":["credit-packs"],"summary":"Archive a credit pack.","description":"No longer for sale; past purchases keep naming it.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-credit-packs-by-id","tags":["credit-packs"],"summary":"Reprice or rename a credit pack.","description":"Key, feature, units and currency cannot change: each is what an existing purchase bought. Price, expiry and `maxQuantity` changes apply to purchases made afterwards; `maxQuantity: null` restores the default of 1,000.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"tiers":{"anyOf":[{"maxItems":20,"type":"array","items":{"type":"object","properties":{"upTo":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"unitAmount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}},"required":["upTo","unitAmount"]}},{"type":"null"}]},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":3650},{"type":"null"}]},"maxQuantity":{"anyOf":[{"type":"integer","minimum":1,"maximum":1000000},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-packs/checkout":{"post":{"operationId":"post-credit-packs-checkout","tags":["credit-packs"],"summary":"Start a credit pack purchase.","description":"Raises a one-off invoice for `quantity` packs, at most the pack's `maxQuantity` (400 past it, naming the cap) (tax and wallet applied at finalization) and returns the hosted pay page `url`, which links back to `returnUrl` (must be an allowed redirect URL). Credits are granted as a PURCHASE credit grant when the invoice is paid, once, and `credit_pack.purchased` is sent. `status` is PAID with `url: null` when the wallet covered it. An unpaid checkout is never charged to a card on file, and lapses at `expiresAt` (default 24 hours), when its invoice is voided. A credit note on the invoice is the refund: the grant keeps only the uncredited share, never less than what was spent. 409 for a managed tenant billed to its parent, an archived pack, or an environment that cannot take payments.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1},"creditPackKey":{"type":"string","minLength":1},"creditPackId":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1,"maximum":1000000},"returnUrl":{"type":"string","format":"uri"},"expiresInMinutes":{"type":"integer","minimum":5,"maximum":10080}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credit-packs/purchases":{"get":{"operationId":"get-credit-packs-purchases","tags":["credit-packs"],"summary":"List a customer's credit pack purchases.","description":"Newest first. `status` is PENDING (awaiting payment), PAID (granted) or EXPIRED (lapsed unpaid, invoice voided). `remaining` is what is left on the grant as of the last invoice.","x-base316-secret-key-only":true,"parameters":[{"name":"customerId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credits":{"get":{"operationId":"get-credits","tags":["credits"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-credits","tags":["credits"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credits-portal/sessions":{"post":{"operationId":"post-credits-portal-sessions","tags":["credits-portal"],"summary":"Open the hosted credits page for a customer.","description":"Body `{ customerId, returnUrl? }`. Returns `{ id, url, expiresAt }`: send the customer to `url` within ten minutes. The link opens once, is exchanged for a 30-minute visit cookie, and opens only the credits page — balances for each metered feature with a pack on sale, buying a pack now, and auto-recharge. A billing or credentials link does not open it, and it opens neither of those. `returnUrl` must be one of the environment's redirect URIs, exactly (400 with `param: returnUrl`). Another environment's customer is 404.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"returnUrl":{"type":"string","format":"uri"},"page":{"type":"string","enum":["overview","credits","payment-methods"]}},"required":["customerId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credits/alert":{"put":{"operationId":"put-credits-alert","tags":["credits"],"summary":"Set a customer's low-balance threshold.","description":"`credits.low_balance` is sent once each time the feature's remaining balance falls below `threshold`, and re-arms when it is next seen at or above it. Overrides the product's threshold (`lowBalanceThreshold` on the feature); `threshold: null` falls back to it. Evaluated at once.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1},"featureKey":{"type":"string","minLength":1,"maxLength":200},"threshold":{"anyOf":[{"anyOf":[{"type":"number","minimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},{"type":"null"}]}},"required":["featureKey","threshold"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credits/auto-recharge":{"get":{"operationId":"get-credits-auto-recharge","tags":["credits"],"summary":"Get a customer's auto-recharge settings.","description":"One row per metered feature with a setting: `enabled`, `threshold`, the pack, `monthlyMaxCount` / `monthlyMaxAmount`, and `thisMonth` (automatic purchases pending or paid this calendar month, UTC, and their total). `inFlight` is a charge waiting on the bank; `needsPaymentMethod` means a charge was due with no card on file (or the account is invoiced on terms) and it is still on; `disabledReason` is PAYMENT_FAILED after two declines in a row, PACK_UNAVAILABLE, or CREDITS_REFUNDED after `POST /v1/credits/refund`. A managed tenant reports its payer's.","x-base316-secret-key-only":true,"parameters":[{"name":"customerId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"featureKey","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-credits-auto-recharge","tags":["credits"],"summary":"Set a customer's auto-recharge.","description":"Off by default. When the feature's remaining balance falls below `threshold`, Base316 raises the pack's invoice and charges the default saved card off session; payment grants the credits as a PURCHASE grant and sends `credits.auto_recharged`. Never more than the monthly maximum (at least one of `monthlyMaxCount` and `monthlyMaxAmount` is required to enable), never two charges in flight, and at least 10 minutes between attempts. A decline voids the invoice and retries once an hour later; a second decline turns auto-recharge off, emails the customer and sends `credits.auto_recharge_failed` with `disabled: true`. No card on file charges nothing and leaves it on. Fields left out keep their stored value. 409 for a managed tenant billed to its parent.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1},"featureKey":{"type":"string","minLength":1,"maxLength":200},"enabled":{"type":"boolean"},"threshold":{"anyOf":[{"type":"number","minimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},"creditPackKey":{"type":"string","minLength":1},"creditPackId":{"type":"string","minLength":1},"monthlyMaxCount":{"anyOf":[{"type":"integer","minimum":1,"maximum":1000},{"type":"null"}]},"monthlyMaxAmount":{"anyOf":[{"anyOf":[{"type":"number","minimum":0},{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}]},{"type":"null"}]}},"required":["featureKey"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credits/balance":{"get":{"operationId":"get-credits-balance","tags":["credits"],"summary":"Get a customer's balance on a metered feature.","description":"The plan allowance is spent first, then credits soonest-to-expire first (voided and expired grants skipped), then overage where the plan prices it. Returns `allowance` (null unlimited), `used` this period, `allowanceRemaining`, `purchasedRemaining` (PURCHASE grants), `creditsRemaining` (all grants) and `remaining` (`allowance + credits - used`, as `access.check` reports it). Credit figures apply this period's usage as the billing run will draw it at the period's close. `lowBalance` gives the threshold in force and whether the balance is below it. A managed tenant reports its payer's balance.","x-base316-secret-key-only":true,"parameters":[{"name":"customerId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"featureKey","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":200}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/credits/refund":{"post":{"operationId":"post-credits-refund","tags":["credits"],"summary":"Refund a customer's unused purchased credit for a feature.","description":"For each live PURCHASE grant of `featureKey`, refunds what is really unused — this period's usage is drawn first, as the billing run will draw it, so credit already spent is never refunded. Each refund is a credit note on the grant's purchase invoice (tax included pro rata), sent back to the payment that bought it, or to the wallet for the part the wallet paid; rounded down to the currency's smallest unit. The note shrinks the grant to what this period has used. Credit that cannot be refunded (PROMOTIONAL or MANUAL grants, rounding slivers) is withdrawn, and auto-recharge for the feature is turned off (`disabledReason: CREDITS_REFUNDED`). Returns `refundedCents`, `currency`, `creditNotes`, `grantsVoided`, and `skipped` (purchases whose refund was refused, left untouched). Sends `credits.refunded`. `idempotencyKey` is required: a retry with the same key returns the first result, whenever it arrives. 404 for a customer or feature outside this environment; 409 for a managed tenant billed to its parent, a key used for another customer or feature, or a refund already running for this customer and feature.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1},"featureKey":{"type":"string","minLength":1,"maxLength":200},"reason":{"type":"string","minLength":1,"maxLength":500},"idempotencyKey":{"type":"string","minLength":1,"maxLength":255}},"required":["featureKey","idempotencyKey"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/custom-fields":{"get":{"operationId":"get-custom-fields","tags":["custom-fields"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers":{"get":{"operationId":"get-customers","tags":["customers"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-customers","tags":["customers"],"summary":"Create a customer.","description":"`address` is the billing address (`line1`, `line2`, `city`, `state`, `postalCode`, `country`); its `country` and `state` are the customer's `country` and `region`, the jurisdiction tax rates match on. `taxIds` are tax registrations by Stripe's type name (`eu_vat`, `gb_vat`, `au_abn` …), format-checked per type before anything is written (400 naming `taxIds[n]`); EU VAT numbers are then checked against VIES, and each id's `status` is VERIFIED, INVALID, UNAVAILABLE (VIES unreachable, retried in the background) or UNVERIFIED (no registry to ask). The response carries `address` and `taxIds`.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"currency":{"type":"string","minLength":3,"maxLength":3},"country":{"type":"string","pattern":"^[A-Za-z]{2}$"},"region":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line1":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"line2":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"state":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"country":{"anyOf":[{"type":"string","pattern":"^[A-Za-z]{2}$"},{"type":"null"}]}}},"taxIds":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":20},"value":{"type":"string","minLength":1,"maxLength":64},"country":{"type":"string","pattern":"^[A-Za-z]{2}$"}},"required":["type","value"]}},"runtimeOrganizationId":{"type":"string","minLength":1},"runtimeOrganizationExternalId":{"type":"string","minLength":1,"maxLength":200},"runtimeUserId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"runtimeUserExternalId":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"standalone":{"type":"boolean"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}":{"get":{"operationId":"get-customers-by-id","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-customers-by-id","tags":["customers"],"summary":"Update a customer.","description":"Fields left out are kept. `address` fields left out are kept and `address: null` clears the address, country included. `taxIds`, when sent, replaces the list: ids already held keep their verification, new EU VAT numbers are checked with VIES.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"name":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"email":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"country":{"anyOf":[{"type":"string","pattern":"^[A-Za-z]{2}$"},{"type":"null"}]},"region":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"line2":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"state":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"country":{"anyOf":[{"type":"string","pattern":"^[A-Za-z]{2}$"},{"type":"null"}]}}},{"type":"null"}]},"taxIds":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":20},"value":{"type":"string","minLength":1,"maxLength":64},"country":{"type":"string","pattern":"^[A-Za-z]{2}$"}},"required":["type","value"]}},"runtimeOrganizationId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"runtimeOrganizationExternalId":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"runtimeUserId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"runtimeUserExternalId":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"standalone":{"type":"boolean"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/billed":{"get":{"operationId":"get-customers-by-id-billed","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/entitlements":{"get":{"operationId":"get-customers-by-id-entitlements","tags":["customers"],"summary":"Evaluate every feature for a customer.","description":"Each live feature as `POST /v1/access/check` would answer it right now with the default `requested` of 1 — `allowed`, and `reason` when refused (NO_SUBSCRIPTION, SUBSCRIPTION_INACTIVE, ENTITLEMENT_REQUIRED, USAGE_LIMIT_EXCEEDED, HARD_CAP_REACHED) — computed by the same evaluator, so it explains a refusal rather than approximating one. Metered features carry `used` this period; `limit` is null when unlimited and already scaled by the subscription's quantity for a per-unit allowance; `credits` and `remaining` are as `check()` reports them. `overagePriced` is true for a soft limit (usage past the allowance is billed, not refused), `overage` when the next unit would be billed, `billableOverage` the usage already billable this period, and `hardCap` the scaled ceiling (null when none). A feature priced by a MATRIX price carries `byDimension`: this period's usage per row (`dimensions`, `{}` for the default row), with `billable`, `unitAmount` and `amount` rated as the next invoice will rate them and `unpriced` for values no row prices; null otherwise. `source.plan` names the subscription and plan version (`listed` is false when the version does not mention the feature, which denies it), `source.credits` the live credit grants extending the allowance, and `source.payer` the paying account when this customer is a managed tenant billed to its parent — whose plan, credits and usage then decide. Nothing is consumed. 404 when the customer is not in this environment.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/merge":{"post":{"operationId":"post-customers-by-id-merge","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/merge-preview":{"post":{"operationId":"post-customers-by-id-merge-preview","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/payment-methods":{"get":{"operationId":"get-customers-by-id-payment-methods","tags":["customers"],"summary":"List a customer's saved cards.","description":"Default first, then newest. Brand, last four and expiry only; the number never reaches Base316. 404 for a customer outside this environment. There is no endpoint that adds a card: the customer enters one on Stripe's hosted page from the billing portal or the credits page.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/payment-methods/{paymentMethodId}":{"delete":{"operationId":"delete-customers-by-id-payment-methods-by-paymentMethodId","tags":["customers"],"summary":"Remove a saved card.","description":"Detached at Stripe first; if Stripe refuses, the card stays on file (503). Removing the default promotes the newest remaining card; `defaultId` says which, or null.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"paymentMethodId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/payment-methods/{paymentMethodId}/default":{"post":{"operationId":"post-customers-by-id-payment-methods-by-paymentMethodId-default","tags":["customers"],"summary":"Make a saved card the default.","description":"Invoices and auto-recharge charge the default card. Exactly one card is.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"paymentMethodId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/tax-ids":{"get":{"operationId":"get-customers-by-id-tax-ids","tags":["customers"],"summary":"List a customer's tax ids.","description":"Oldest first. Each carries `status` and, once a registry has been asked, `verification` — the registered `name` and `address` VIES returned, its `consultationNumber`, and the registry's `error` code from a failed check.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-customers-by-id-tax-ids","tags":["customers"],"summary":"Add a tax id to a customer.","description":"`type` is Stripe's tax ID type and `value` the number; an EU VAT number typed without its prefix takes it from `country`. The format is checked per type (400). An EU VAT number is checked against VIES before this answers; VIES never refuses the add — a number it rejects is stored INVALID and is not sent to Stripe Tax, and one it cannot answer for is UNAVAILABLE and retried. 409 when the customer already holds the id; at most 10 per customer.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":20},"value":{"type":"string","minLength":1,"maxLength":64},"country":{"type":"string","pattern":"^[A-Za-z]{2}$"}},"required":["type","value"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/tax-ids/{taxIdId}":{"delete":{"operationId":"delete-customers-by-id-tax-ids-by-taxIdId","tags":["customers"],"summary":"Remove a tax id from a customer.","description":"Invoices already issued keep the tax they were issued with.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"taxIdId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/{id}/tax-ids/{taxIdId}/verify":{"post":{"operationId":"post-customers-by-id-tax-ids-by-taxIdId-verify","tags":["customers"],"summary":"Check a tax id with VIES again, now.","description":"Only EU VAT numbers have a registry to ask; any other type is returned unchanged. A number already VERIFIED stays VERIFIED through a VIES outage.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"taxIdId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/health":{"get":{"operationId":"get-customers-health","tags":["customers"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/customers/link-tenants":{"post":{"operationId":"post-customers-link-tenants","tags":["customers"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/device/decide":{"post":{"operationId":"post-device-decide","tags":["device"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/device/lookup":{"post":{"operationId":"post-device-lookup","tags":["device"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/dunning":{"get":{"operationId":"get-dunning","tags":["dunning"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-dunning","tags":["dunning"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/email-domains":{"get":{"operationId":"get-email-domains","tags":["email-domains"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-email-domains","tags":["email-domains"],"summary":"Add a sending domain.","description":"Returns the DNS records to publish; the domain verifies once they resolve.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":1,"maxLength":253},"fromAddress":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"fromName":{"type":"string","maxLength":255},"replyTo":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["domain","fromAddress"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/email-domains/{id}":{"delete":{"operationId":"delete-email-domains-by-id","tags":["email-domains"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-email-domains-by-id","tags":["email-domains"],"summary":"Change a sending domain's from address, from name or reply-to.","description":"Never touches DNS or verification. The from address must stay at the domain; `null` clears the name or reply-to.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fromAddress":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"fromName":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"replyTo":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/email-domains/{id}/default":{"post":{"operationId":"post-email-domains-by-id-default","tags":["email-domains"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/email-domains/{id}/refresh":{"post":{"operationId":"post-email-domains-by-id-refresh","tags":["email-domains"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/email-templates":{"get":{"operationId":"get-email-templates","tags":["email-templates"],"summary":"List transactional email templates.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/email-templates/{key}":{"delete":{"operationId":"delete-email-templates-by-key","tags":["email-templates"],"summary":"Remove a template.","x-base316-secret-key-only":true,"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-email-templates-by-key","tags":["email-templates"],"summary":"Create or replace a template.","description":"Keyed by the caller's own identifier, so a deployment that runs twice converges.","x-base316-secret-key-only":true,"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"subject":{"type":"string","minLength":1,"maxLength":500},"blocks":{"type":"array","items":{}},"trigger":{"anyOf":[{"type":"string","enum":["customer.created","subscription.created","subscription.updated","subscription.canceled","invoice.created","invoice.paid","payment.failed","invoice.uncollectible","usage.limit_reached","credits.low_balance","credit_pack.purchased","credits.auto_recharged","credits.auto_recharge_failed"]},{"type":"null"}]},"enabled":{"type":"boolean"}},"required":["name","subject","blocks"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/events":{"post":{"operationId":"post-events","tags":["events"],"summary":"Record a usage event.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/export/{resource}":{"get":{"operationId":"get-export-by-resource","tags":["export"],"parameters":[{"name":"resource","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/features":{"get":{"operationId":"get-features","tags":["features"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-features","tags":["features"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/features/{id}":{"delete":{"operationId":"delete-features-by-id","tags":["features"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-features-by-id","tags":["features"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-features-by-id","tags":["features"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/fga/check":{"post":{"operationId":"post-fga-check","tags":["fga"],"summary":"Check whether a user has a relation to an object.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"},"contextualTuples":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"},"condition":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}},"required":["user","relation","object"]}},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["user","relation","object"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/fga/list-objects":{"post":{"operationId":"post-fga-list-objects","tags":["fga"],"summary":"List the objects of a type a user has a relation to.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"type":{"type":"string","minLength":1,"maxLength":254,"pattern":"^[^\\s:#@]+$"},"contextualTuples":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"},"condition":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}},"required":["user","relation","object"]}},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["user","relation","type"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/fga/list-users":{"post":{"operationId":"post-fga-list-users","tags":["fga"],"summary":"List the users with a relation to an object.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"userFilters":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":254,"pattern":"^[^\\s:#@]+$"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"}},"required":["type"]}},"contextualTuples":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"},"condition":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}},"required":["user","relation","object"]}},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["object","relation","userFilters"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/fga/model":{"get":{"operationId":"get-fga-model","tags":["fga"],"summary":"Read the environment's authorization model, as DSL and JSON.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-fga-model","tags":["fga"],"summary":"Replace the authorization model.","description":"Send `{ dsl }` (OpenFGA's modelling language) or `{ model }` (its JSON). A model that does not validate is refused with the first problem located by line.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"dsl":{"type":"string","minLength":1}},"required":["dsl"],"additionalProperties":false},{"type":"object","properties":{"model":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["model"],"additionalProperties":false}]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/fga/tuples":{"get":{"operationId":"get-fga-tuples","tags":["fga"],"summary":"Read stored relationship tuples, paged.","x-base316-secret-key-only":true,"parameters":[{"name":"user","in":"query","required":false,"description":"`type:id`, `type:id#relation` or `type:*`","schema":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"}},{"name":"relation","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"}},{"name":"object","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":256}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":2048}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/fga/write":{"post":{"operationId":"post-fga-write","tags":["fga"],"summary":"Write and delete relationship tuples atomically.","description":"Idempotent in both directions: writing a tuple that exists, or deleting one that does not, succeeds. At most 100 tuples per call.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"writes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"},"condition":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}},"required":["user","relation","object"]}},"deletes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"user":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\S+$","description":"`type:id`, `type:id#relation` or `type:*`"},"relation":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[^\\s:#@]+$"},"object":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[^\\s:#]+:[^\\s#]+$","description":"`type:id`"}},"required":["user","relation","object"]}}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/import/{resource}":{"post":{"operationId":"post-import-by-resource","tags":["import"],"parameters":[{"name":"resource","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/import/{resource}/template":{"get":{"operationId":"get-import-by-resource-template","tags":["import"],"parameters":[{"name":"resource","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/integrations":{"get":{"operationId":"get-integrations","tags":["integrations"],"summary":"List accounting and CRM connections.","description":"QuickBooks Online, Xero and HubSpot, each with its status, the connected account, when it last synced, the last error and how many sync jobs are pending or failed. Read-only: connecting is an OAuth consent given in the dashboard.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invitations/{token}":{"get":{"operationId":"get-invitations-by-token","tags":["invitations"],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invitations/{token}/accept":{"post":{"operationId":"post-invitations-by-token-accept","tags":["invitations"],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices":{"get":{"operationId":"get-invoices","tags":["invoices"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-invoices","tags":["invoices"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}":{"get":{"operationId":"get-invoices-by-id","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/finalize":{"post":{"operationId":"post-invoices-by-id-finalize","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/pay":{"post":{"operationId":"post-invoices-by-id-pay","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/payment-links":{"get":{"operationId":"get-invoices-by-id-payment-links","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-invoices-by-id-payment-links","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/payment-links/{linkId}":{"delete":{"operationId":"delete-invoices-by-id-payment-links-by-linkId","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"linkId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/payments":{"get":{"operationId":"get-invoices-by-id-payments","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-invoices-by-id-payments","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/payments/{paymentId}/reverse":{"post":{"operationId":"post-invoices-by-id-payments-by-paymentId-reverse","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"paymentId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/pdf":{"get":{"operationId":"get-invoices-by-id-pdf","tags":["invoices"],"summary":"Download an invoice as a PDF.","description":"Rendered from the stored invoice on each request: seller details from the environment's branding, the customer, every line, discounts, tax, credit notes, wallet and payments applied, and the amount due. A draft renders too, marked as one. `Content-Disposition` names the file after the invoice number.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/invoices/{id}/void":{"post":{"operationId":"post-invoices-by-id-void","tags":["invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/log-streams":{"get":{"operationId":"get-log-streams","tags":["log-streams"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-log-streams","tags":["log-streams"],"summary":"Add a log stream.","description":"Copies the audit trail and end-user security events to an HTTPS JSON sink, Datadog or Splunk HEC. The token is write-only.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","maxLength":2048,"format":"uri"},"destination":{"type":"string","enum":["HTTPS_JSON","DATADOG","SPLUNK_HEC"]},"token":{"type":"string","minLength":8,"maxLength":512},"sendAudit":{"type":"boolean"},"sendAuthEvents":{"type":"boolean"}},"required":["name","url"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/log-streams/{id}":{"delete":{"operationId":"delete-log-streams-by-id","tags":["log-streams"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-log-streams-by-id","tags":["log-streams"],"summary":"Update a log stream.","description":"Fields left out are kept. `token: null` removes the stored key; omitting it keeps it. The stream keeps its place in the trail, so nothing already sent is sent again.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","maxLength":2048,"format":"uri"},"destination":{"type":"string","enum":["HTTPS_JSON","DATADOG","SPLUNK_HEC"]},"token":{"anyOf":[{"type":"string","minLength":8,"maxLength":512},{"type":"null"}]},"sendAudit":{"type":"boolean"},"sendAuthEvents":{"type":"boolean"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/log-streams/{id}/enabled":{"post":{"operationId":"post-log-streams-by-id-enabled","tags":["log-streams"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/api-credentials":{"get":{"operationId":"get-me-api-credentials","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-me-api-credentials","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/api-credentials/{clientId}":{"delete":{"operationId":"delete-me-api-credentials-by-clientId","tags":["me"],"parameters":[{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/api-credentials/{clientId}/rotate":{"post":{"operationId":"post-me-api-credentials-by-clientId-rotate","tags":["me"],"parameters":[{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/api-resources":{"get":{"operationId":"get-me-api-resources","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/billing-details":{"get":{"operationId":"get-me-billing-details","tags":["me"],"summary":"The signed-in user's billing address and tax ids.","description":"Publishable key plus the end user's session in `x-base316-session`; the account is resolved from the session. Tax ids carry `status` but not the registry's record of the business. 403 `billed_by_parent` for a managed tenant's members, 404 `no_customer` when the user has no billing account.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-me-billing-details","tags":["me"],"summary":"Set the signed-in user's billing address and tax ids.","description":"Body `{ address?, taxIds? }` — the same shapes as on a customer; `taxIds` replaces the list. Nothing else on the account can be changed here. 400 `invalid_tax_id` with `param` for a malformed number; 403 `billed_by_parent` for a managed tenant. EU VAT numbers are checked with VIES before this answers.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/checkout/sessions":{"post":{"operationId":"post-me-checkout-sessions","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/credits":{"get":{"operationId":"get-me-credits","tags":["me"],"summary":"The signed-in user's credit balances, packs on sale, auto-recharge and purchases.","description":"One entry in `features` per metered feature with a pack on sale or an auto-recharge set: remaining, allowance, purchased remaining, the packs, and the auto-recharge with its status. `purchases` is the newest 20. A managed tenant sees the pool it spends, `managedBy` set and no purchases.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/credits/auto-recharge":{"put":{"operationId":"put-me-credits-auto-recharge","tags":["me"],"summary":"Set the signed-in user's auto-recharge for one metered feature.","description":"Body `{ featureId, enabled, threshold, creditPackId?, monthlyMaxCount?, monthlyMaxAmount? }`. At least one monthly maximum is required when enabled. 400 with the refusal (`maximum_required`, `pack_archived`, …); 403 `billed_by_parent` for a managed tenant, whose parent recharges.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/credits/purchase":{"post":{"operationId":"post-me-credits-purchase","tags":["me"],"summary":"Buy a credit pack for the signed-in user.","description":"Body `{ creditPackId }`. Raises the purchase invoice and returns `{ url, paid: false }` for the hosted pay page, or `{ url: null, paid: true }` when the account balance covered it. Credits are granted on payment. 409 `no_payment_account`; 403 `billed_by_parent` for a managed tenant.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/invoices":{"get":{"operationId":"get-me-invoices","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/invoices/{id}":{"get":{"operationId":"get-me-invoices-by-id","tags":["me"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/invoices/{id}/pay-link":{"post":{"operationId":"post-me-invoices-by-id-pay-link","tags":["me"],"summary":"A link to pay one of the signed-in user's own open invoices.","description":"Returns `{ url, expiresAt }` for the hosted pay page, valid for an hour. 404 for an invoice that is not the session's own; 409 `not_payable` / `nothing_due` when nothing is owed, `no_payment_account` when the environment cannot take cards.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/invoices/{id}/pdf":{"get":{"operationId":"get-me-invoices-by-id-pdf","tags":["me"],"summary":"Download one of the signed-in user's own invoices as a PDF.","description":"Publishable key plus the user's session in `X-Base316-Session`. Scoped to the account the user bills through; another account's invoice, and a draft, are both 404.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/organizations":{"get":{"operationId":"get-me-organizations","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/organizations/{id}/invitations":{"get":{"operationId":"get-me-organizations-by-id-invitations","tags":["me"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-me-organizations-by-id-invitations","tags":["me"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/organizations/{id}/invitations/{invitationId}":{"delete":{"operationId":"delete-me-organizations-by-id-invitations-by-invitationId","tags":["me"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"invitationId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/organizations/{id}/members":{"get":{"operationId":"get-me-organizations-by-id-members","tags":["me"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/organizations/{id}/members/{userId}":{"delete":{"operationId":"delete-me-organizations-by-id-members-by-userId","tags":["me"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/payment-method":{"get":{"operationId":"get-me-payment-method","tags":["me"],"summary":"The signed-in user's card on file.","description":"`paymentMethod` is `{ id, brand, last4, expMonth, expYear }` or null — never more of the card than that. `billedByParent` is true for a managed tenant, whose payer's card is the one charged and is not shown.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/payment-method/update-session":{"post":{"operationId":"post-me-payment-method-update-session","tags":["me"],"summary":"Start replacing the signed-in user's card on a Stripe-hosted page.","description":"Body `{ returnUrl, cancelUrl? }`, each one of the environment's redirect URIs exactly (400 `return_url_not_allowed` otherwise). Returns `{ url }`: send the browser there. Stripe collects the card on the connected account — none of it passes through your application or Base316 — and the browser returns through Base316, which stores the card as the default, then on to `returnUrl`. 409 `no_payment_account` when the environment cannot take cards; 403 `billed_by_parent` for a managed tenant.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/payment-methods":{"get":{"operationId":"get-me-payment-methods","tags":["me"],"summary":"Every card the signed-in user's account has saved.","description":"`data` is `[{ id, brand, last4, expMonth, expYear, isDefault }]`, the default first. `billedByParent` is true (and `data` empty) for a managed tenant, whose payer holds the cards.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/payment-methods/{id}":{"delete":{"operationId":"delete-me-payment-methods-by-id","tags":["me"],"summary":"Remove one of the signed-in user's saved cards.","description":"Detached at Stripe first, then deleted. Removing the default promotes the newest remaining card (`defaultId`). 404 for a card that is not the session's own; 502 `provider_error` when Stripe refuses; 403 `billed_by_parent` for a managed tenant.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/payment-methods/{id}/default":{"post":{"operationId":"post-me-payment-methods-by-id-default","tags":["me"],"summary":"Make one of the signed-in user's saved cards the default.","description":"Invoices and auto-recharge charge the default card. 404 for a card that is not the session's own; 403 `billed_by_parent` for a managed tenant.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription":{"get":{"operationId":"get-me-subscription","tags":["me"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/cancel":{"post":{"operationId":"post-me-subscription-cancel","tags":["me"],"summary":"Cancel the signed-in user's subscription at the period end, in one step.","description":"Makes no retention offer — use `POST /v1/me/subscription/cancellation` for a flow that can. Body `{ reason?, comment? }` is optional and recorded for the retention report. 403 `billed_by_parent` for a managed tenant.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string","enum":["TOO_EXPENSIVE","NOT_USING","MISSING_FEATURES","SWITCHING","TECHNICAL_ISSUES","TEMPORARY","OTHER"]},{"type":"null"}]},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/cancellation":{"post":{"operationId":"post-me-subscription-cancellation","tags":["me"],"summary":"Start cancelling the signed-in user's subscription.","description":"Records why (`reason`, `comment`, both optional) and returns the attempt with `offer`: the retention discount to show, or null. Nothing is cancelled yet — follow with `.../accept` or `.../confirm`. Never show the user `ineligibleReason`. Starting again while an attempt is open returns that one.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string","enum":["TOO_EXPENSIVE","NOT_USING","MISSING_FEATURES","SWITCHING","TECHNICAL_ISSUES","TEMPORARY","OTHER"]},{"type":"null"}]},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/cancellation/{id}/accept":{"post":{"operationId":"post-me-subscription-cancellation-by-id-accept","tags":["me"],"summary":"Accept the retention offer and stay.","description":"Applies the offered coupon to the subscription and lifts a cancellation already scheduled. Returns the attempt with `discount` and `resumed`. 409 `offer_expired` a day after the offer was made, `offer_unavailable` when the coupon or plan changed since, `already_resolved` on a second answer.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/cancellation/{id}/confirm":{"post":{"operationId":"post-me-subscription-cancellation-by-id-confirm","tags":["me"],"summary":"Decline the offer and cancel at the period end.","description":"Works whether or not an offer was made. Confirming twice answers as the first time did. 409 `already_resolved` after the offer was accepted.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string","enum":["TOO_EXPENSIVE","NOT_USING","MISSING_FEATURES","SWITCHING","TECHNICAL_ISSUES","TEMPORARY","OTHER"]},{"type":"null"}]},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/change":{"post":{"operationId":"post-me-subscription-change","tags":["me"],"summary":"Change the signed-in user's plan.","description":"Body: `planVersionId`, optional `timing` (NOW or PERIOD_END). Omitted, an upgrade happens now and a downgrade is scheduled for the renewal, so the user keeps what they paid for until then. Now charges the stored card (402 `no_payment_method` with `useCheckout` when there is none); at period end needs no card and answers `scheduled: true` with `effectiveAt`. 409 `no_subscription` with `useCheckout` for a first purchase; 403 `billed_by_parent` for a managed tenant.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/plan-change-preview":{"get":{"operationId":"get-me-subscription-plan-change-preview","tags":["me"],"summary":"Preview a plan change for the signed-in user.","description":"The same preview as `GET /v1/subscriptions/{id}/plan-change-preview`, for the session's own subscription. Query: `planVersionId`, optional `timing`. A managed tenant's members get 403 `billed_by_parent`.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/quantity":{"post":{"operationId":"post-me-subscription-quantity","tags":["me"],"summary":"Change the signed-in user's seat count.","description":"Body `{ quantity }`. Settled with the defaults — the end user cannot choose not to be charged. 403 `billed_by_parent` for a managed tenant; 402 `no_payment_method` when a charged increase has no stored card on an account that pays by card; 400 `quantity_limit_exceeded`. Honours `Idempotency-Key`.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/quantity/preview":{"get":{"operationId":"get-me-subscription-quantity-preview","tags":["me"],"summary":"Preview a change to the signed-in user's seat count.","description":"`?quantity=N`. The same preview as the secret-key route, for the session's own subscription, always with the default settlement: an increase invoiced now, a decrease at the period end. A managed tenant's members get 403 `billed_by_parent`; a count over the plan's limit is 400 `quantity_limit_exceeded` with `limit`.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/resume":{"post":{"operationId":"post-me-subscription-resume","tags":["me"],"summary":"Undo the signed-in user's scheduled cancellation.","description":"The subscription renews as normal again. 409 `not_canceling` when no cancellation was scheduled; 403 `billed_by_parent` for a managed tenant.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/scheduled-change":{"delete":{"operationId":"delete-me-subscription-scheduled-change","tags":["me"],"summary":"Undo the signed-in user's scheduled plan change.","description":"Withdraws the pending schedule on the session's own subscription. 409 `nothing_scheduled` when there is none; 403 `billed_by_parent` for a managed tenant.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/me/subscription/upcoming-invoice":{"get":{"operationId":"get-me-subscription-upcoming-invoice","tags":["me"],"summary":"Preview the signed-in user's next invoice.","description":"The same preview as `GET /v1/subscriptions/{id}/upcoming-invoice`, for the subscription the session's own account holds. Publishable key plus the end user's session in `x-base316-session`; the account is resolved from the session, never from the request. A managed tenant's members get 403 `billed_by_parent`, because the payer's invoice lists every client's usage.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/meters":{"get":{"operationId":"get-meters","tags":["meters"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-meters","tags":["meters"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/meters/{id}":{"delete":{"operationId":"delete-meters-by-id","tags":["meters"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-meters-by-id","tags":["meters"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-meters-by-id","tags":["meters"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations":{"get":{"operationId":"get-organizations","tags":["organizations"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-organizations","tags":["organizations"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}":{"delete":{"operationId":"delete-organizations-by-id","tags":["organizations"],"summary":"Delete an organization.","description":"Refused with 409 while it has members other than `exceptUserId` (`HAS_MEMBERS`), a subscription that is ACTIVE, PAST_DUE or PAUSED on a priced plan (`ACTIVE_SUBSCRIPTION`), managed tenants (`HAS_CHILDREN`), a connected payment account (`HAS_PAYMENT_ACCOUNT`) or its own client plans or packs (`HAS_CLIENT_CATALOG`). A TRIALING or INCOMPLETE subscription, or an ACTIVE one on a free version, is cancelled as part of the delete. Memberships, invitations, branding, its custom domain and its tenant-scoped records go with it; its billing account is unlinked and kept, standalone unless something else owns it. Sends `organization.deleted`. Idempotent: deleting it again answers 200 with `alreadyDeleted: true`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"exceptUserId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-organizations-by-id","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/branding":{"get":{"operationId":"get-organizations-by-id-branding","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-organizations-by-id-branding","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/children":{"get":{"operationId":"get-organizations-by-id-children","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-checkout":{"post":{"operationId":"post-organizations-by-id-client-checkout","tags":["organizations"],"summary":"A hosted checkout for a client to buy one of its firm's plans.","description":"The page is in the firm's brand and the card is saved on the firm's account. `returnUrl` must be an allowed redirect URL. `:id` is the client.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"planId":{"type":"string","minLength":1},"returnUrl":{"type":"string","format":"uri"},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["planId","returnUrl"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-packs":{"get":{"operationId":"get-organizations-by-id-client-packs","tags":["organizations"],"summary":"The credit packs a firm sells its clients.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-organizations-by-id-client-packs","tags":["organizations"],"summary":"Create a credit pack a firm sells its clients.","description":"For a metered feature the firm's own plan grants, in the firm's currency. A client's purchase is granted to the client — its own balance — never to the firm's pool.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"featureKey":{"type":"string","minLength":1,"maxLength":200},"units":{"type":["string","number"]},"amount":{"type":"string","minLength":1},"tiers":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"upTo":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"unitAmount":{"type":"string"}},"required":["upTo","unitAmount"]}},{"type":"null"}]},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":3650},{"type":"null"}]},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["name","featureKey","units","amount"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-packs/{packId}":{"patch":{"operationId":"patch-organizations-by-id-client-packs-by-packId","tags":["organizations"],"summary":"Change a firm's client pack's name, price or expiry.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"packId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"amount":{"type":"string","minLength":1},"tiers":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"upTo":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"unitAmount":{"type":"string"}},"required":["upTo","unitAmount"]}},{"type":"null"}]},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":3650},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-packs/{packId}/archive":{"post":{"operationId":"post-organizations-by-id-client-packs-by-packId-archive","tags":["organizations"],"summary":"Take a firm's client pack off sale.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"packId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-plan":{"put":{"operationId":"put-organizations-by-id-client-plan","tags":["organizations"],"summary":"Put a client on one of its firm's plans, without a checkout.","description":"Subscribes the client (its first period billed on the firm's account), or moves it from its current firm plan with the default timing. `:id` is the client.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"planId":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1,"maximum":9007199254740991},"trialDays":{"type":"integer","minimum":0,"maximum":730}},"required":["planId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-plans":{"get":{"operationId":"get-organizations-by-id-client-plans","tags":["organizations"],"summary":"The plans a firm sells its clients.","description":"Firm-owned plans are offered only to the firm's own clients, priced in the firm's account currency and charged on its account. `?includeArchived=true` includes plans taken off sale.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-organizations-by-id-client-plans","tags":["organizations"],"summary":"Create a plan a firm sells its clients.","description":"A firm may include only features its own plan grants, and no more of a metered or quantity feature than its plan allows (unlimited only where the firm's is). Refusals name every offending feature. Published at once.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"interval":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"intervalCount":{"type":"integer","minimum":1,"maximum":36},"trialDays":{"type":"integer","minimum":0,"maximum":730},"currency":{"type":"string","minLength":3,"maxLength":3},"entitlements":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":200},"enabled":{"type":"boolean"},"limit":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"limitPerUnit":{"type":"boolean"},"hardCap":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"resetInterval":{"anyOf":[{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},{"type":"null"}]},"rollover":{"type":"boolean"}},"required":["featureKey"]}},"prices":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"featureKey":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE","MATRIX"]},"amount":{"type":["string","number","null"]},"packageSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"tiers":{},"rows":{"anyOf":[{"maxItems":1000,"type":"array","items":{}},{"type":"null"}]}},"required":["model"]}},"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"required":["interval","entitlements","name"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-plans/{planId}":{"patch":{"operationId":"patch-organizations-by-id-client-plans-by-planId","tags":["organizations"],"summary":"Rename a firm's client plan, or publish new terms for it.","description":"New `terms` publish a new version, validated against the firm's plan as it is now; clients already on the plan keep the version they bought.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"terms":{"type":"object","properties":{"interval":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"intervalCount":{"type":"integer","minimum":1,"maximum":36},"trialDays":{"type":"integer","minimum":0,"maximum":730},"currency":{"type":"string","minLength":3,"maxLength":3},"entitlements":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":200},"enabled":{"type":"boolean"},"limit":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"limitPerUnit":{"type":"boolean"},"hardCap":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"resetInterval":{"anyOf":[{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},{"type":"null"}]},"rollover":{"type":"boolean"}},"required":["featureKey"]}},"prices":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"featureKey":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE","MATRIX"]},"amount":{"type":["string","number","null"]},"packageSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"tiers":{},"rows":{"anyOf":[{"maxItems":1000,"type":"array","items":{}},{"type":"null"}]}},"required":["model"]}}},"required":["interval","entitlements"]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-plans/{planId}/archive":{"post":{"operationId":"post-organizations-by-id-client-plans-by-planId-archive","tags":["organizations"],"summary":"Take a firm's client plan off sale.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/client-portal":{"post":{"operationId":"post-organizations-by-id-client-portal","tags":["organizations"],"summary":"A billing-portal link for a client of a reselling firm.","description":"The client's own plan, packs, cards and invoices with its firm, in the firm's brand. `:id` is the client.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"returnUrl":{"type":"string","format":"uri"},"page":{"type":"string","enum":["overview","credits","payment-methods"]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/detach":{"post":{"operationId":"post-organizations-by-id-detach","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/domain":{"delete":{"operationId":"delete-organizations-by-id-domain","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-organizations-by-id-domain","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-organizations-by-id-domain","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/domain/verify":{"post":{"operationId":"post-organizations-by-id-domain-verify","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/inherited-roles":{"get":{"operationId":"get-organizations-by-id-inherited-roles","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-organizations-by-id-inherited-roles","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/margins":{"get":{"operationId":"get-organizations-by-id-margins","tags":["organizations"],"summary":"Per client, retail revenue against wholesale cost.","description":"`basis=current` (default) rates this period as the next invoices will: each client's firm-plan fee and usage, against its share of the firm's usage charges (pro rata by usage) and of the per-client add-on. `basis=invoiced&from=&to=` totals invoices issued in the window. Before tax and discounts.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/members":{"post":{"operationId":"post-organizations-by-id-members","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/members/{userId}":{"delete":{"operationId":"delete-organizations-by-id-members-by-userId","tags":["organizations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/payment-account":{"get":{"operationId":"get-organizations-by-id-payment-account","tags":["organizations"],"summary":"A firm's own Stripe account.","description":"A client of a firm with an account is charged on that account, never on the environment's; `ready` says whether it can take a charge now.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-organizations-by-id-payment-account","tags":["organizations"],"summary":"Connect a firm's Stripe account and start onboarding.","description":"Creates a Standard connected account for a parent organization and returns a Stripe-hosted `onboardingUrl` for a person at the firm. `returnUrl` and `refreshUrl` must be allowed redirect URLs. 201 when created; 200 with a fresh link when the firm is already connected.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"returnUrl":{"type":"string","format":"uri"},"refreshUrl":{"type":"string","format":"uri"},"country":{"type":"string","minLength":2,"maxLength":2,"pattern":"^[A-Za-z]{2}$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["returnUrl","refreshUrl"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/payment-account/onboarding-link":{"post":{"operationId":"post-organizations-by-id-payment-account-onboarding-link","tags":["organizations"],"summary":"A fresh onboarding URL for a firm's account.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"returnUrl":{"type":"string","format":"uri"},"refreshUrl":{"type":"string","format":"uri"}},"required":["returnUrl","refreshUrl"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/payment-account/refresh":{"post":{"operationId":"post-organizations-by-id-payment-account-refresh","tags":["organizations"],"summary":"Pull a firm's account state from Stripe.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/payment-account/session":{"post":{"operationId":"post-organizations-by-id-payment-account-session","tags":["organizations"],"summary":"An Account Session for Stripe's embedded components on a firm's account.","description":"Mount Stripe's Connect embedded components (notification banner, payments, payouts) in your firm settings with the returned `clientSecret` and `publishableKey`. Short-lived: mint one when the components mount.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/organizations/{id}/reseller-settings":{"get":{"operationId":"get-organizations-by-id-reseller-settings","tags":["organizations"],"summary":"A firm's reseller settings.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-organizations-by-id-reseller-settings","tags":["organizations"],"summary":"Change what a client's failed payment does.","description":"`clientPaymentFailure` is `none`, `pause_ai` or `pause_client`. While a client's firm-owned subscription is past due, `check()` for that client carries it as `clientPaymentEffect` for your application to act on; Base316 enforces nothing itself.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clientPaymentFailure":{"type":"string","enum":["none","pause_ai","pause_client"]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/payment-accounts":{"get":{"operationId":"get-payment-accounts","tags":["payment-accounts"],"summary":"The connected Stripe account for this environment.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-payment-accounts","tags":["payment-accounts"],"summary":"Connect an account and start onboarding.","description":"Returns a Stripe-hosted `onboardingUrl` for a person to complete — identity documents and bank details are legally acts of a human being. Hand it over, then poll this resource until `ready`.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/payment-accounts/onboarding-link":{"post":{"operationId":"post-payment-accounts-onboarding-link","tags":["payment-accounts"],"summary":"Mint a fresh onboarding URL.","description":"Stripe's links are single-use and expire, so the first one is often already dead.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/payment-accounts/refresh":{"post":{"operationId":"post-payment-accounts-refresh","tags":["payment-accounts"],"summary":"Pull fresh account state from Stripe.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/payment-credentials":{"delete":{"operationId":"delete-payment-credentials","tags":["payment-credentials"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-payment-credentials","tags":["payment-credentials"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-payment-credentials","tags":["payment-credentials"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/pending-charges":{"get":{"operationId":"get-pending-charges","tags":["pending-charges"],"summary":"List one-off charges awaiting the next invoice.","x-base316-secret-key-only":true,"parameters":[{"name":"customerId","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"includeInvoiced","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-pending-charges","tags":["pending-charges"],"summary":"Raise a one-off charge.","description":"A negative amount is how a one-off credit is applied.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"subscriptionId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"description":{"type":"string","minLength":1,"maxLength":500},"currency":{"type":"string","minLength":3,"maxLength":3},"amount":{"type":"string","minLength":1,"pattern":"^-?\\d+(\\.\\d+)?$"},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customerId","description","currency","amount"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/pending-charges/{id}":{"delete":{"operationId":"delete-pending-charges-by-id","tags":["pending-charges"],"summary":"Void a charge before it is invoiced.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/permissions":{"get":{"operationId":"get-permissions","tags":["permissions"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-permissions","tags":["permissions"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/permissions/{id}":{"delete":{"operationId":"delete-permissions-by-id","tags":["permissions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-permissions-by-id","tags":["permissions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-permissions-by-id","tags":["permissions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plan-migrations/{id}":{"get":{"operationId":"get-plan-migrations-by-id","tags":["plan-migrations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans":{"get":{"operationId":"get-plans","tags":["plans"],"summary":"List plans with their versions, newest first.","description":"Each version carries `status` (DRAFT, PUBLISHED or ARCHIVED) and `subscriberCount` — its TRIALING, ACTIVE and PAST_DUE subscriptions; canceled and paused ones are not counted. Only PUBLISHED versions can be subscribed to.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-plans","tags":["plans"],"summary":"Create a plan and its first version.","description":"`trialEndAction` decides what a trial on the version turns into: CONVERT (the default) bills it; DOWNGRADE moves a subscription whose payer has no usable payment method to `trialDowngradePlanVersionId` — a published version of another plan in the same product and currency — with no invoice. An entitlement's optional `hardCap` is the spend ceiling on a soft limit: it needs a numeric `limit`, cannot be below it, and scales with quantity when `limitPerUnit`. A MATRIX price charges a metered feature a different unit price per value of its meter's dimensions — per AI model, per region: `rows` is `[{ dimensions: { model: \"opus\" }, unitAmount: \"0.000015\" }]`, every row naming the same keys from the meter's `groupBy`, and `amount` is the default row for values no row names. Without a default, unmatched usage is listed on the invoice as `unpriced` and not charged. The meter must aggregate by SUM or COUNT, unit amounts carry at most eight decimal places, and the allowance and credits cover the dearest rows first. A bad row is a 400 whose `param` names it, e.g. `prices[0].rows[2].dimensions.model`.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":1000},"familyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"defaultPropagation":{"type":"string","enum":["GRANDFATHER","MIGRATE_NOW","MIGRATE_AT_PERIOD_END","AUTO"]},"currency":{"type":"string","minLength":3,"maxLength":3},"interval":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"intervalCount":{"type":"integer","exclusiveMinimum":0,"maximum":52},"trialDays":{"type":"integer","minimum":0,"maximum":365},"trialEndAction":{"type":"string","enum":["CONVERT","DOWNGRADE"]},"trialDowngradePlanVersionId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"prices":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE","MATRIX"]},"featureId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"amount":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"packageSize":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"tiers":{"type":"array","items":{}},"rows":{"anyOf":[{"maxItems":1000,"type":"array","items":{}},{"type":"null"}]}},"required":["model"]}},"publish":{"type":"boolean"},"entitlements":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"featureId":{"type":"string","minLength":1},"enabled":{"type":"boolean"},"limit":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"limitPerUnit":{"type":"boolean"},"hardCap":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"resetInterval":{"anyOf":[{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},{"type":"null"}]},"rollover":{"type":"boolean"}},"required":["featureId"]}}},"required":["key","name","currency","interval"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}":{"delete":{"operationId":"delete-plans-by-id","tags":["plans"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-plans-by-id","tags":["plans"],"summary":"Read one plan with its versions.","description":"Versions newest first, each with `status` and `subscriberCount` (live subscriptions: TRIALING, ACTIVE, PAST_DUE).","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-plans-by-id","tags":["plans"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/family":{"put":{"operationId":"put-plans-by-id-family","tags":["plans"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/migrations":{"get":{"operationId":"get-plans-by-id-migrations","tags":["plans"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/versions":{"post":{"operationId":"post-plans-by-id-versions","tags":["plans"],"summary":"Add a version to a plan — published, or as a draft.","description":"Every term is the new version's own, including `trialEndAction` and `trialDowngradePlanVersionId`; nothing is carried from the previous version. Published by default and immutable from then on. `publish: false` writes a DRAFT instead, which can be edited in place and published later, and which nothing can subscribe to; a plan has at most one draft, and starting a second is a 409 naming the open one.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"familyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"currency":{"type":"string","minLength":3,"maxLength":3},"interval":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"intervalCount":{"type":"integer","exclusiveMinimum":0,"maximum":52},"trialDays":{"type":"integer","minimum":0,"maximum":365},"trialEndAction":{"type":"string","enum":["CONVERT","DOWNGRADE"]},"trialDowngradePlanVersionId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"prices":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE","MATRIX"]},"featureId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"amount":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"packageSize":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"tiers":{"type":"array","items":{}},"rows":{"anyOf":[{"maxItems":1000,"type":"array","items":{}},{"type":"null"}]}},"required":["model"]}},"publish":{"type":"boolean"},"entitlements":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"featureId":{"type":"string","minLength":1},"enabled":{"type":"boolean"},"limit":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"limitPerUnit":{"type":"boolean"},"hardCap":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"resetInterval":{"anyOf":[{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},{"type":"null"}]},"rollover":{"type":"boolean"}},"required":["featureId"]}},"propagation":{"type":"string","enum":["GRANDFATHER","MIGRATE_NOW","MIGRATE_AT_PERIOD_END","AUTO"]}},"required":["currency","interval"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/versions/{versionId}":{"delete":{"operationId":"delete-plans-by-id-versions-by-versionId","tags":["plans"],"summary":"Discard a draft version.","description":"Only a draft, which has no subscribers by construction. Published versions are never deleted (409): subscriptions are rated against them.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-plans-by-id-versions-by-versionId","tags":["plans"],"summary":"Edit a draft version in place.","description":"Fields left out are kept; `prices` and `entitlements`, when sent, replace the whole list; `trialDays: null` removes the trial. The trial-end target is re-checked against the draft's resulting currency. A published or archived version is a 409 — published versions are immutable, so publish a new version instead. MATRIX prices are checked row by row exactly as on create.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3},"interval":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"intervalCount":{"type":"integer","exclusiveMinimum":0,"maximum":52},"trialEndAction":{"type":"string","enum":["CONVERT","DOWNGRADE"]},"trialDowngradePlanVersionId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"prices":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE","MATRIX"]},"featureId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"amount":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"packageSize":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"tiers":{"type":"array","items":{}},"rows":{"anyOf":[{"maxItems":1000,"type":"array","items":{}},{"type":"null"}]}},"required":["model"]}},"entitlements":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"featureId":{"type":"string","minLength":1},"enabled":{"type":"boolean"},"limit":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"limitPerUnit":{"type":"boolean"},"hardCap":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"resetInterval":{"anyOf":[{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},{"type":"null"}]},"rollover":{"type":"boolean"}},"required":["featureId"]}},"trialDays":{"anyOf":[{"type":"integer","minimum":0,"maximum":365},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/versions/{versionId}/migration-preview":{"post":{"operationId":"post-plans-by-id-versions-by-versionId-migration-preview","tags":["plans"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/versions/{versionId}/migrations":{"post":{"operationId":"post-plans-by-id-versions-by-versionId-migrations","tags":["plans"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/plans/{id}/versions/{versionId}/publish":{"post":{"operationId":"post-plans-by-id-versions-by-versionId-publish","tags":["plans"],"summary":"Publish a draft version.","description":"From this moment the version is immutable and can be subscribed to, exactly like one created published. Idempotent: publishing a published version returns it. If a published version was added above the draft while it was open, the draft takes the next number, so versions are numbered in the order they went on sale.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/portal-sessions":{"post":{"operationId":"post-portal-sessions","tags":["portal-sessions"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/processed-transactions":{"get":{"operationId":"get-processed-transactions","tags":["processed-transactions"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/product-families":{"get":{"operationId":"get-product-families","tags":["product-families"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-product-families","tags":["product-families"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/product-families/{id}":{"delete":{"operationId":"delete-product-families-by-id","tags":["product-families"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-product-families-by-id","tags":["product-families"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/public/addons":{"get":{"operationId":"get-public-addons","tags":["public"],"summary":"List the addons on sale.","description":"Publishable-key safe, for a pricing page: each addon's `amount`, `model`, `includedQuantity` and `countsManagedTenants` (\"10 clients included, then $12 each\"). Archived addons are left out and nothing about who carries one is included.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/public/branding":{"get":{"operationId":"get-public-branding","tags":["public"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/public/credit-packs":{"get":{"operationId":"get-public-credit-packs","tags":["public"],"summary":"List the credit packs on sale.","description":"Publishable-key safe: archived packs are left out and nothing per-customer is included. Buying one is `POST /v1/credit-packs/checkout`, from your server.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/public/plans":{"get":{"operationId":"get-public-plans","tags":["public"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/quotes":{"get":{"operationId":"get-quotes","tags":["quotes"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-quotes","tags":["quotes"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/quotes/{id}":{"get":{"operationId":"get-quotes-by-id","tags":["quotes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/quotes/{id}/accept":{"post":{"operationId":"post-quotes-by-id-accept","tags":["quotes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/quotes/{id}/decline":{"post":{"operationId":"post-quotes-by-id-decline","tags":["quotes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/quotes/{id}/pdf":{"get":{"operationId":"get-quotes-by-id-pdf","tags":["quotes"],"summary":"Download a quote as a PDF.","description":"The proposed lines, discount and total, the date it lapses, and its status with expiry applied.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/quotes/{id}/send":{"post":{"operationId":"post-quotes-by-id-send","tags":["quotes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/rate-limits":{"get":{"operationId":"get-rate-limits","tags":["rate-limits"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-rate-limits","tags":["rate-limits"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/rate-limits/{id}":{"delete":{"operationId":"delete-rate-limits-by-id","tags":["rate-limits"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/refunds":{"get":{"operationId":"get-refunds","tags":["refunds"],"summary":"List refunds.","description":"Newest first, filtered by `invoiceId`, `creditNoteId` or `status` (PENDING, SUCCEEDED, FAILED, CANCELED). A refund is created only by issuing a credit note. `cardLast4` is the card it went back to; `failureReason` is Stripe's.","x-base316-secret-key-only":true,"parameters":[{"name":"invoiceId","in":"query","required":false,"schema":{"type":"string"}},{"name":"creditNoteId","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["PENDING","SUCCEEDED","FAILED","CANCELED"]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/refunds/{id}":{"get":{"operationId":"get-refunds-by-id","tags":["refunds"],"summary":"Get a refund.","description":"404 for an id outside this environment, the same as one that does not exist.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/refunds/{id}/credit-to-wallet":{"post":{"operationId":"post-refunds-by-id-credit-to-wallet","tags":["refunds"],"summary":"Credit a failed refund to the wallet instead.","description":"A refund that failed or was canceled leaves the money owed. This credits it to the customer's wallet, once; the refund stays FAILED and the credit note records the extra balance. Nothing does this automatically — whether a customer gets balance or a retried refund by another route is your call.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/reports/ageing":{"get":{"operationId":"get-reports-ageing","tags":["reports"],"summary":"Receivables by age.","x-base316-secret-key-only":true,"parameters":[{"name":"at","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"worstCustomerLimit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"maximum":100}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/reports/mrr":{"get":{"operationId":"get-reports-mrr","tags":["reports"],"summary":"Monthly recurring revenue, by currency.","description":"Not converted to a single currency: that needs an exchange rate and a date, and inventing either makes the number wrong in a way nobody can see.","x-base316-secret-key-only":true,"parameters":[{"name":"at","in":"query","required":false,"schema":{"type":"string","format":"date-time"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/reseller":{"get":{"operationId":"get-reseller","tags":["reseller"],"summary":"Reseller mode for this environment.","description":"Whether parent organizations (firms) may connect their own Stripe account and charge their clients on it, and the feature their plan must grant to do so.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-reseller","tags":["reseller"],"summary":"Turn reseller mode on or off.","description":"Turning it off stops new firms connecting. A firm already connected keeps charging its clients on its own account, where their Stripe customers and cards live.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"featureKey":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/reseller/accounts":{"get":{"operationId":"get-reseller-accounts","tags":["reseller"],"summary":"Every firm's connected account, with its client count.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/reseller/catalogs":{"get":{"operationId":"get-reseller-catalogs","tags":["reseller"],"summary":"Every firm's own client plans and packs, read-only.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/retention":{"get":{"operationId":"get-retention","tags":["retention"],"summary":"The retention offer's settings.","description":"`settings` and `defaults` are `{ enabled, couponId, cooldownDays, headline, message }`; `reasons` lists the cancellation reasons in order.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-retention","tags":["retention"],"summary":"Change the retention offer.","description":"Patch semantics. Turning it on needs a `couponId` that can be applied today and the Pro plan or above (403 `PLAN_FEATURE`).","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"couponId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"cooldownDays":{"type":"integer","minimum":0,"maximum":3650},"headline":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"message":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/retention/report":{"get":{"operationId":"get-retention-report","tags":["retention"],"summary":"How the retention offer is doing.","description":"Attempts, saves, abandoned attempts, offers made and the save rate over `from`–`to` (default: the last thirty days), with the monthly recurring value kept per currency — before the discount — and a breakdown by reason.","x-base316-secret-key-only":true,"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/roles":{"get":{"operationId":"get-roles","tags":["roles"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-roles","tags":["roles"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/roles/{id}":{"delete":{"operationId":"delete-roles-by-id","tags":["roles"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-roles-by-id","tags":["roles"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-roles-by-id","tags":["roles"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/saml-applications":{"get":{"operationId":"get-saml-applications","tags":["saml-applications"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-saml-applications","tags":["saml-applications"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/saml-applications/{id}":{"delete":{"operationId":"delete-saml-applications-by-id","tags":["saml-applications"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-saml-applications-by-id","tags":["saml-applications"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-saml-applications-by-id","tags":["saml-applications"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/saml-applications/idp":{"get":{"operationId":"get-saml-applications-idp","tags":["saml-applications"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/saml-applications/idp/rotate":{"post":{"operationId":"post-saml-applications-idp-rotate","tags":["saml-applications"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/seed":{"get":{"operationId":"get-seed","tags":["seed"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-seed","tags":["seed"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions":{"get":{"operationId":"get-subscriptions","tags":["subscriptions"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-subscriptions","tags":["subscriptions"],"summary":"Subscribe a customer to a plan version.","description":"`trialDays` overrides the version's trial length: 0 for none, a positive number to open the subscription TRIALING with no card and no checkout. A paid subscription's first period is invoiced at once; a trial's when it ends. `billingAnchorDay` (1–31, monthly and yearly plans) bills on that day of the month: the first period runs to the next such date and its fee is prorated. `purchaseOrderNumber` and `invoiceMemo` are printed on every invoice it raises. The first invoice is charged by the hourly collection sweep unless `collect: true`, which charges it before answering, against the customer's default card — the sweep's own charge, so a missing or declined card leaves the invoice OPEN, a decline makes the subscription PAST_DUE and starts dunning with the usual `payment.failed` and notices, and the request still succeeds. `collect` is ignored for a TRIALING start. Every subscription response carries `latestInvoice` (`id`, `number`, `status`, `total`, `amountPaid`, `currency`, `issuedAt`, or null): `status` PAID means the charge went through. Send an `Idempotency-Key` to retry safely; the replay returns the first response and charges nothing.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1},"planVersionId":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1,"maximum":1000000},"startAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"trialDays":{"type":"integer","minimum":0,"maximum":365},"billingAnchorDay":{"type":"integer","minimum":1,"maximum":31},"purchaseOrderNumber":{"type":"string","maxLength":100},"invoiceMemo":{"type":"string","maxLength":1000},"collect":{"type":"boolean"}},"required":["planVersionId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}":{"delete":{"operationId":"delete-subscriptions-by-id","tags":["subscriptions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-subscriptions-by-id","tags":["subscriptions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/cancellations":{"post":{"operationId":"post-subscriptions-by-id-cancellations","tags":["subscriptions"],"summary":"Start cancelling a subscription.","description":"For an integration with its own sign-in. Records why and returns the attempt with `offer` (or null); nothing is cancelled yet. 404 for a subscription that is not live in this environment.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string","enum":["TOO_EXPENSIVE","NOT_USING","MISSING_FEATURES","SWITCHING","TECHNICAL_ISSUES","TEMPORARY","OTHER"]},{"type":"null"}]},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/contract":{"patch":{"operationId":"patch-subscriptions-by-id-contract","tags":["subscriptions"],"summary":"Set a subscription's PO number, invoice memo or billing day.","description":"Each field optional; null or an empty string clears it. `purchaseOrderNumber` and `invoiceMemo` are printed on every invoice the subscription raises and on its PDF, copied onto the invoice when it is generated so later edits never rewrite one already sent. `billingAnchorDay` (1–31, monthly and yearly plans only) fixes the day every period ends on; a short month ends on its last day. Changing it leaves the period already paid for alone: the next period runs to the next anchor date as a stub, and the renewal bills its recurring fee prorated (usage is never prorated); every period after is aligned. Preview first with `GET /v1/subscriptions/{id}/contract/billing-anchor-preview`. Returns the subscription.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"purchaseOrderNumber":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"invoiceMemo":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"billingAnchorDay":{"anyOf":[{"type":"integer","minimum":1,"maximum":31},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/contract/billing-anchor-preview":{"get":{"operationId":"get-subscriptions-by-id-contract-billing-anchor-preview","tags":["subscriptions"],"summary":"Preview a billing-day change.","description":"Writes nothing. `nextPeriod` is the period that opens at `currentPeriodEnd` under the new day, `stub` says whether it is short, `prorationFactor` is the share of a full period's fee it is billed, `nextPeriodFee` and `fullPeriodFee` are the recurring fee for the stub and for an aligned period, and `upcomingInvoice` is the renewal as it would be raised. `billingAnchorDay=none` previews clearing it.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"billingAnchorDay","in":"query","required":true,"schema":{"anyOf":[{"type":"string","const":"none"},{"type":"integer","minimum":1,"maximum":31}]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/discounts":{"delete":{"operationId":"delete-subscriptions-by-id-discounts","tags":["subscriptions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-subscriptions-by-id-discounts","tags":["subscriptions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-subscriptions-by-id-discounts","tags":["subscriptions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/phases":{"delete":{"operationId":"delete-subscriptions-by-id-phases","tags":["subscriptions"],"summary":"Withdraw a subscription's pending schedule.","description":"The undo for a scheduled plan change or ramp; the subscription carries on as it is. 409 when nothing is scheduled. Announced as `change: \"schedule_canceled\"`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-subscriptions-by-id-phases","tags":["subscriptions"],"summary":"List a subscription's scheduled phases.","description":"`pending` is the schedule still to apply, in order, each with the period boundary it is projected to take effect at (`effectiveAt`); `history` is what already applied, was superseded or was withdrawn.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"put":{"operationId":"put-subscriptions-by-id-phases","tags":["subscriptions"],"summary":"Set a subscription's schedule of phases (a ramp).","description":"Replaces the pending schedule. Each phase names a published plan version in the subscription's currency and a `startsAt`; it takes effect at the first period boundary on or after that date, never mid-period. Dates must be in the future and increasing, consecutive phases must change the plan, and no two may land on the same renewal. At most 24. An empty list clears the schedule. Refused while a cancellation is pending. Announced as `subscription.updated` with `change: \"phases_scheduled\"`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phases":{"maxItems":24,"type":"array","items":{"type":"object","properties":{"planVersionId":{"type":"string","minLength":1},"startsAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["planVersionId","startsAt"]}}},"required":["phases"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/plan-change":{"post":{"operationId":"post-subscriptions-by-id-plan-change","tags":["subscriptions"],"summary":"Change a subscription's plan, now or at the period end.","description":"`timing` NOW closes this subscription and opens a replacement with a new id: the unused fee is credited, usage so far is invoiced on the old plan, and the new plan's first period is invoiced in advance (collected by the sweep). PERIOD_END keeps the id and stores the change as a phase; the renewal applies it, rating the closing period's usage on the old version and the new period's fee on the new one, and announces `subscription.updated` with `change: \"renewed\"` and a `planChange`. Omitted, a downgrade waits for the period end and anything else happens now. Either replaces whatever was scheduled. Refused (409) at period end while a cancellation is pending or during a trial.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"planVersionId":{"type":"string","minLength":1},"timing":{"type":"string","enum":["NOW","PERIOD_END"]}},"required":["planVersionId"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/plan-change-preview":{"get":{"operationId":"get-subscriptions-by-id-plan-change-preview","tags":["subscriptions"],"summary":"Preview a plan change, now and at the period end.","description":"Writes nothing. `direction` is UPGRADE, DOWNGRADE or LATERAL by the recurring fee per day; `defaultTiming` is what `POST /plan-change` does without a `timing` (a downgrade waits for the period end, anything else — and anything during a trial — happens now). `timings` says whether NOW and PERIOD_END are open, and the reason when one is not (TRIALING, CANCELLATION_PENDING, NOT_RENEWING, CURRENCY_MISMATCH). `entitlements` lists every feature either plan grants as GAINED, LOST, INCREASED, DECREASED or UNCHANGED, with the limits before and after (null is unlimited). `now` is the settlement a change now makes: `credit` for the unused share of the fee and addons already paid (`unusedFraction`), `closingUsage` billed on the old plan, `newPeriodCharge` for the new plan's first period in advance, and `net`. Only the fee and addons are prorated, never usage. `atPeriodEnd` is the renewal invoice as the billing run will raise it on the new plan. `replaces` is the pending schedule either timing would replace. `customPricesEnding` lists the subscription's custom prices the change would end (every price-targeted one, and a feature-targeted one the new plan does not price); `from.recurringFee` is what the customer pays now, custom prices included. Money is decimal strings.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"planVersionId","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"timing","in":"query","required":false,"schema":{"type":"string","enum":["NOW","PERIOD_END"]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/price-overrides":{"get":{"operationId":"get-subscriptions-by-id-price-overrides","tags":["subscriptions"],"summary":"List a subscription's custom prices.","description":"Newest first, ended ones included. Each names its target (`priceId`, or `featureId` for a feature's usage price on whatever version the subscription is on), its terms in the same shape as a plan price (`model`, `amount`, `packageSize`, `tiers`, decimal strings), `startsAt`/`endsAt`, `status` (ACTIVE, SCHEDULED or ENDED) and `planPrice` — the plan price it replaces, for comparison.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-subscriptions-by-id-price-overrides","tags":["subscriptions"],"summary":"Give a subscription a custom price.","description":"Negotiated pricing for one subscription without a new plan; the plan version stays as every other subscriber has it. Name exactly one of `priceId` (a price on the version the subscription is on: the recurring fee or a usage price) and `featureId` (a feature that version prices). The custom price applies to a line when it is in effect at the start of the window that line bills — the fee's period, the usage period, a seat proration's remaining window — so it never splits a period; no `startsAt` means the current usage too. Every invoice, the upcoming-invoice preview, the plan-change preview and seat prorations rate through it. A plan change ends it unless the new version still has the price it overrides (only a feature-targeted one can); the plan-change preview lists those in `customPricesEnding`. A coupon on the subscription still applies on top. 409 when another custom price covers the same price for overlapping dates; 400 for a price not on the plan, a feature it does not price, a MATRIX price (`MATRIX_NOT_SUPPORTED`: a matrix of per-dimension rates cannot take a single custom price; publish a version with the negotiated rows), or terms that cannot rate (a tier table with no open-ended band, a PACKAGE without `packageSize`).","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"priceId":{"type":"string","minLength":1},"featureId":{"type":"string","minLength":1},"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE"]},"amount":{"anyOf":[{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},{"type":"null"}]},"packageSize":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"tiers":{"anyOf":[{"maxItems":50,"type":"array","items":{"type":"object","properties":{"upTo":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"unitAmount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"flatAmount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}},"required":["upTo"]}},{"type":"null"}]},"startsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},{"type":"null"}]},"endsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},{"type":"null"}]},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}},"required":["model"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/price-overrides/{overrideId}":{"delete":{"operationId":"delete-subscriptions-by-id-price-overrides-by-overrideId","tags":["subscriptions"],"summary":"Remove a custom price.","description":"Every line not yet invoiced goes back to the plan's price, the current period's usage included. Issued invoices are untouched; their lines name the override by `priceOverrideId`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"overrideId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-subscriptions-by-id-price-overrides-by-overrideId","tags":["subscriptions"],"summary":"Change a custom price.","description":"Terms, dates or note; the target is fixed. Omitted fields keep their value. Invoices already issued keep the amounts they were raised for.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"overrideId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["FLAT","PER_UNIT","TIERED_GRADUATED","TIERED_VOLUME","PACKAGE"]},"amount":{"anyOf":[{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},{"type":"null"}]},"packageSize":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"tiers":{"anyOf":[{"maxItems":50,"type":"array","items":{"type":"object","properties":{"upTo":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"unitAmount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"flatAmount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"}},"required":["upTo"]}},{"type":"null"}]},"startsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},{"type":"null"}]},"endsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},{"type":"null"}]},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/quantity":{"patch":{"operationId":"patch-subscriptions-by-id-quantity","tags":["subscriptions"],"summary":"Change a subscription's quantity, prorated.","description":"An increase applies now and is charged for the rest of the period: `proration` is `invoice_now` (default — an invoice for the prorated difference, finalized with tax and collected per the customer's `autoCollection`), `next_invoice` (a pending charge on the renewal) or `none`. Only the recurring per-unit fee is prorated — never usage, never a FLAT fee — by the fraction of the period left, rounded once in the currency's scale. A decrease waits for the period end by default (`effective: period_end`, shown as `scheduledQuantity`) and is never credited; `effective: immediately` applies it at once, still uncredited, and asking for proration on a decrease is refused. A count above the plan's seat limit (the environment's seat feature) is refused before anything is charged. Send an `Idempotency-Key`: a retry replays the first response rather than charging again. Returns the subscription with `quantityChange` describing what was done.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer","minimum":1,"maximum":1000000},"proration":{"type":"string","enum":["invoice_now","next_invoice","none"]},"effective":{"type":"string","enum":["immediately","period_end"]}},"required":["quantity"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/quantity/preview":{"get":{"operationId":"get-subscriptions-by-id-quantity-preview","tags":["subscriptions"],"summary":"Preview a quantity change.","description":"What `PATCH /v1/subscriptions/{id}/quantity` would do with the same options, writing nothing: `proratedAmount`, `taxTotal` and `total` (what the change raises), `newRecurringAmount`, `effectiveAt` and the resolved `proration` and `effective`. The same refusals as the change. Money is decimal strings.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"quantity","in":"query","required":true,"schema":{"type":"integer","minimum":1,"maximum":1000000}},{"name":"proration","in":"query","required":false,"schema":{"type":"string","enum":["invoice_now","next_invoice","none"]}},{"name":"effective","in":"query","required":false,"schema":{"type":"string","enum":["immediately","period_end"]}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/resume":{"post":{"operationId":"post-subscriptions-by-id-resume","tags":["subscriptions"],"summary":"Undo a cancellation scheduled for the period end.","description":"409 when the subscription is not scheduled to cancel.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/{id}/upcoming-invoice":{"get":{"operationId":"get-subscriptions-by-id-upcoming-invoice","tags":["subscriptions"],"summary":"Preview the subscription's next invoice.","description":"Computed now and stored nowhere: no invoice number is drawn and nothing is marked billed, spent or debited, so it can be called as often as you like. `reason` is RENEWAL (usage for the current period plus the fee for the next), FINAL (cancelled at period end: usage only) or TRIAL_END (the first period's fee when a trial converts); a reverse trial whose payer has no card previews the downgrade plan's first renewal. Lines include usage so far, recurring and one-off addons, and pending charges; then the standing discount, tax, prepaid credits (`creditsApplied`) and wallet balance (`walletApplied`), in the order the billing run applies them. `issuesAt` is when it will be raised; `willBeIssued` is false when it would have no lines, because none is raised then. A feature priced by a MATRIX price has one usage line per row with usage, carrying `dimensions` (`{}` for the default row) and `unpriced` (true when no row and no default prices the values: shown, charged nothing). Money is decimal strings. `taxEngine` is MANUAL (the environment's tax rates) or STRIPE_TAX; with Stripe Tax each tax line carries `country` and `taxabilityReason`, and `reverseCharge` is true when the customer accounts for the VAT. 404 when the subscription is not in this environment, or is canceled, paused or incomplete; 503 when Stripe Tax is on and could not be reached — the preview is withheld rather than shown without its tax.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/subscriptions/outdated":{"get":{"operationId":"get-subscriptions-outdated","tags":["subscriptions"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/tax-rates":{"get":{"operationId":"get-tax-rates","tags":["tax-rates"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-tax-rates","tags":["tax-rates"],"summary":"Define a tax rate.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":200},"percentage":{"type":"number","minimum":0,"maximum":100},"inclusive":{"type":"boolean"},"country":{"type":"string","minLength":2,"maxLength":2},"region":{"type":"string","maxLength":100}},"required":["code","name","percentage"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/tax-rates/{id}":{"delete":{"operationId":"delete-tax-rates-by-id","tags":["tax-rates"],"summary":"Archive a tax rate.","description":"Archived, never deleted: issued invoices copied the rate onto themselves and are unaffected. Returns the rate with `active: false`; nothing finalized afterwards is charged it. 404 for an id outside this environment.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/test-clocks":{"delete":{"operationId":"delete-test-clocks","tags":["test-clocks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-test-clocks","tags":["test-clocks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-test-clocks","tags":["test-clocks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/test-clocks/advance":{"post":{"operationId":"post-test-clocks-advance","tags":["test-clocks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/trusted-issuers":{"get":{"operationId":"get-trusted-issuers","tags":["trusted-issuers"],"summary":"List the external issuers this environment trusts for workload identity.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-trusted-issuers","tags":["trusted-issuers"],"summary":"Trust an external issuer in the JWT bearer grant.","description":"A Kubernetes cluster, GitHub Actions or another cloud. Tokens must carry this exact `iss` and the configured `aud`; `rules` map subjects onto existing OIDC clients that allow `urn:ietf:params:oauth:grant-type:jwt-bearer`.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"issuer":{"type":"string","minLength":1,"maxLength":2000},"audience":{"type":"string","minLength":1,"maxLength":500},"jwksUri":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"jwks":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"maxTokenLifetime":{"type":"integer","minimum":60,"maximum":604800},"disabled":{"type":"boolean"},"rules":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":512},"requiredClaims":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":100},"additionalProperties":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]}},"clientId":{"type":"string","minLength":1}},"required":["subject","clientId"]}}},"required":["name","issuer","audience"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/trusted-issuers/{id}":{"delete":{"operationId":"delete-trusted-issuers-by-id","tags":["trusted-issuers"],"summary":"Stop trusting an issuer.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"get-trusted-issuers-by-id","tags":["trusted-issuers"],"summary":"Read one trusted issuer.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-trusted-issuers-by-id","tags":["trusted-issuers"],"summary":"Change a trusted issuer. `rules`, when sent, replaces the whole list.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/trusted-issuers/test":{"post":{"operationId":"post-trusted-issuers-test","tags":["trusted-issuers"],"summary":"Verify a workload token without minting anything, and say why it matched or not.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1,"maxLength":16384}},"required":["token"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users":{"get":{"operationId":"get-users","tags":["users"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-users","tags":["users"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{id}":{"get":{"operationId":"get-users-by-id","tags":["users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-users-by-id","tags":["users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{id}/connected-apps":{"get":{"operationId":"get-users-by-id-connected-apps","tags":["users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{id}/connected-apps/{clientId}":{"delete":{"operationId":"delete-users-by-id-connected-apps-by-clientId","tags":["users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{id}/disable":{"post":{"operationId":"post-users-by-id-disable","tags":["users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{id}/enable":{"post":{"operationId":"post-users-by-id-enable","tags":["users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{userId}":{"delete":{"operationId":"delete-users-by-userId","tags":["users"],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/users/{userId}/data":{"get":{"operationId":"get-users-by-userId-data","tags":["users"],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/wallets":{"get":{"operationId":"get-wallets","tags":["wallets"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/wallets/{customerId}":{"get":{"operationId":"get-wallets-by-customerId","tags":["wallets"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/wallets/credit":{"post":{"operationId":"post-wallets-credit","tags":["wallets"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/wallets/debit":{"post":{"operationId":"post-wallets-debit","tags":["wallets"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/webhooks/deliveries":{"get":{"operationId":"get-webhooks-deliveries","tags":["webhooks"],"summary":"List recent delivery attempts.","description":"What was sent, and how it went — the first place to look when an integration is quiet.","x-base316-secret-key-only":true,"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"maximum":200}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/webhooks/endpoints":{"get":{"operationId":"get-webhooks-endpoints","tags":["webhooks"],"summary":"List webhook endpoints.","x-base316-secret-key-only":true,"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"post-webhooks-endpoints","tags":["webhooks"],"summary":"Register a webhook endpoint.","description":"The signing secret is returned once here and never again. A caller that does not store it cannot verify a delivery signature later.","x-base316-secret-key-only":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":500},"eventTypes":{"type":"array","items":{"type":"string","minLength":1}}},"required":["url"]}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/webhooks/endpoints/{id}":{"delete":{"operationId":"delete-webhooks-endpoints-by-id","tags":["webhooks"],"summary":"Remove an endpoint.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"patch-webhooks-endpoints-by-id","tags":["webhooks"],"summary":"Update an endpoint: URL, description, event types, or disabled.","description":"Fields left out are kept. The signing secret is not rotated by an edit, so a receiver that moves keeps verifying with the secret it stores. A new URL is checked like one at creation.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"eventTypes":{"type":"array","items":{"type":"string","minLength":1}},"disabled":{"type":"boolean"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/webhooks/events":{"get":{"operationId":"get-webhooks-events","tags":["webhooks"],"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/webhooks/events/{id}/replay":{"post":{"operationId":"post-webhooks-events-by-id-replay","tags":["webhooks"],"summary":"Send an event again.","description":"To every enabled subscriber, or only to `endpointId`. Refused when nothing would receive it, rather than answering `queued: 0`.","x-base316-secret-key-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"endpointId":{"type":"string","minLength":1}}}}}},"security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/whoami":{"get":{"operationId":"get-whoami","tags":["whoami"],"summary":"Describe the scope this key resolves to.","description":"The fastest way to confirm which environment a key is wired to. Derived purely from the credential.","security":[{"bearerAuth":[]}],"responses":{"2XX":{"description":"Success."},"default":{"$ref":"#/components/responses/Error"}}}}}}