{"lexicon":1,"id":"money.atmosphere.catalog.configureInventory","defs":{"main":{"type":"procedure","description":"Configure ATM's shared inventory authority for an exact current creator-owned root product and optional exact variant. Requires registered-app service auth, an active fulfillment link, current creator approval, compare-and-swap revision, and (unless the app is the creator) a fresh single-use creator assertion scoped to this method.","input":{"encoding":"application/json","schema":{"type":"object","required":["idempotencyKey","creatorDid","product","environment","expectedRevision","policy"],"properties":{"idempotencyKey":{"type":"string","minLength":1,"maxLength":200,"description":"Required ATM app-operation key matching ^[A-Za-z0-9._:/-]+$. Retry an ambiguous response with the exact same body and key. After a definitive revision, quantity, or authority conflict, repair or re-read and use a new key for the next concrete CAS attempt."},"creatorDid":{"type":"string","format":"did"},"product":{"type":"ref","ref":"com.atproto.repo.strongRef","description":"Exact current root product strongRef. A variant cannot be supplied here; use variant instead."},"variant":{"type":"ref","ref":"com.atproto.repo.strongRef","description":"Optional exact current variant strongRef whose variantOf must bind product's exact URI and CID."},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"expectedRevision":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Compare-and-swap fence. Use 0 only when no inventory configuration exists yet."},"policy":{"type":"string","knownValues":["finite","unlimited"],"maxLength":16},"quantityTotal":{"type":"integer","minimum":0,"maximum":1000000,"description":"Required for finite policy and omitted for unlimited policy."},"creatorAssertionJwt":{"type":"string","minLength":1,"maxLength":8192,"description":"Fresh single-use creator service-auth assertion with aud = ATM broker and lxm = money.atmosphere.catalog.configureInventory. Required unless the registered app DID equals creatorDid."}}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["inventory"],"properties":{"inventory":{"type":"ref","ref":"#inventoryView"}}}},"errors":[{"name":"FeatureUnavailable","description":"Federated finite inventory is not enabled."},{"name":"AppNotRegistered","description":"The caller is not a registered ATM app."},{"name":"RateLimited","description":"The app is configuring 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":"CreatorProductMismatch","description":"The product or variant URI is not owned by creatorDid."},{"name":"ProductUnavailable","description":"The supplied product or variant is not the exact current active creator-owned record."},{"name":"UpstreamFailure","description":"The creator's account host could not be reached to verify current records."},{"name":"FulfillmentLinkRequired","description":"The app has no active 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":"CreatorAssertionRequired","description":"A fresh creator assertion is required for this cross-DID mutation."},{"name":"CreatorAssertionInvalid","description":"The creator assertion could not be verified or was already used."},{"name":"CreatorDidMismatch","description":"The creator assertion issuer does not match creatorDid."},{"name":"InventoryIdempotencyConflict","description":"The app/environment idempotency key was already used for a different canonical inventory request."},{"name":"InventoryRevisionConflict","description":"expectedRevision does not match the authoritative inventory revision."},{"name":"InventoryProductKindUnsupported","description":"Shared product inventory is limited to physical and digital products."},{"name":"InventoryQuantityTooLow","description":"Finite total is below units already reserved or sold."},{"name":"ProductInventoryAuthorityConflict","description":"Inventory authority cannot change without reconciling existing routed orders."},{"name":"ProductInventoryBusy","description":"The product's inventory counter is contended right now. This is transient — retry the same request shortly."},{"name":"InventoryWriteFailed","description":"ATM could not persist the inventory configuration."}]},"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."}}}}}