{"lexicon":1,"id":"money.atmosphere.catalog.getInventory","defs":{"main":{"type":"query","description":"Read ATM's authoritative inventory projection for an exact active linked creator-owned root physical or digital product and optional exact variant. Requires registered-app service auth, an active storefront or fulfillment link, and current creator approval for shop payments.","parameters":{"type":"params","required":["productUri","environment"],"properties":{"productUri":{"type":"string","format":"at-uri","description":"Current root product AT-URI. A variant cannot be supplied here; use variantUri instead."},"variantUri":{"type":"string","format":"at-uri","description":"Optional current variant AT-URI whose variantOf must bind productUri's exact current URI and CID."},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["inventory"],"properties":{"inventory":{"type":"ref","ref":"#inventoryView"}}}},"errors":[{"name":"AppNotRegistered","description":"The caller is not a registered ATM app."},{"name":"RateLimited","description":"The app is reading inventory too quickly."},{"name":"AppEnvironmentNotConfigured","description":"The app environment is not configured in ATM."},{"name":"AppModuleDisabled","description":"Products or federated commerce orders are not enabled for this app environment."},{"name":"ProductUnavailable","description":"The product or variant is invalid, archived, not creator-owned, or no longer has the exact current parent binding."},{"name":"InventoryProductKindUnsupported","description":"Shared product inventory is limited to physical and digital products."},{"name":"InventoryAccessDenied","description":"The app has no active storefront or fulfillment link for this product."},{"name":"RecipientAppApprovalRequired","description":"The creator has not approved this app for the product's payment type."},{"name":"RecipientAppReapprovalRequired","description":"The creator must review changed app payment terms."},{"name":"RecipientAppApprovalBlocked","description":"The creator blocked or revoked this app."},{"name":"InventoryNotConfigured","description":"ATM has no inventory configuration for this exact product or variant."},{"name":"ProductInventoryBusy","description":"The product's inventory counter is contended right now. This is transient — retry the same request shortly."}]},"inventoryView":{"type":"object","description":"ATM's private authoritative inventory projection for one creator-owned product or variant in one app environment. Finite counts are null when policy is unlimited.","required":["creatorDid","productUri","environment","checkoutMode","policy","status","revision","quantityTotal","quantityReserved","quantitySold","available"],"nullable":["quantityTotal","quantityReserved","quantitySold","available"],"properties":{"creatorDid":{"type":"string","format":"did"},"productUri":{"type":"string","format":"at-uri"},"variantUri":{"type":"string","format":"at-uri"},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"checkoutMode":{"type":"string","knownValues":["hosted","routed"],"maxLength":16,"description":"Checkout authority for this inventory row. hosted is the legacy ATM-hosted lane and remains readable so an authorized app can CAS-upgrade it; routed is shared federated checkout authority."},"policy":{"type":"string","knownValues":["finite","unlimited"],"maxLength":16},"status":{"type":"string","knownValues":["active","archived"],"maxLength":16},"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"quantityTotal":{"type":"integer","minimum":0,"maximum":1000000},"quantityReserved":{"type":"integer","minimum":0,"maximum":1000000},"quantitySold":{"type":"integer","minimum":0,"maximum":1000000},"available":{"type":"integer","minimum":0,"maximum":1000000,"description":"Units available to reserve now. Null for unlimited inventory."}}}}}