{"lexicon":1,"id":"money.atmosphere.catalog.registerAppLink","defs":{"main":{"type":"procedure","description":"Private app callback that links a creator-owned ATM product record to the app surface responsible for selling or fulfillment. Requires a service-auth JWT signed by the app DID.","input":{"encoding":"application/json","schema":{"type":"object","required":["creatorDid","product"],"properties":{"creatorDid":{"type":"string","format":"did"},"product":{"type":"ref","ref":"com.atproto.repo.strongRef"},"appProductRef":{"type":"object","properties":{"type":{"type":"string","knownValues":["shop","commission","membership","membership-tier","custom"],"maxLength":32},"id":{"type":"string","maxLength":512},"uri":{"type":"string","format":"at-uri"},"cid":{"type":"string","format":"cid"}}},"fulfillmentUrl":{"type":"string","format":"uri"},"appLabel":{"type":"string","maxGraphemes":80,"maxLength":800},"appUrl":{"type":"string","format":"uri"},"appIconUrl":{"type":"string","format":"uri"},"environment":{"type":"string","description":"ATM app environment for this private fulfillment link. Defaults to live.","knownValues":["test","live"],"maxLength":16},"role":{"type":"string","knownValues":["fulfillment","storefront","analytics"],"maxLength":32},"status":{"type":"string","knownValues":["active","archived"],"maxLength":32},"sourceUpdatedAt":{"type":"string","format":"datetime","description":"Optional caller-owned app-link generation for the canonical payload, which includes the exact Product strongRef and therefore requires a newer timestamp for every Product CID rotation even when the sidecar fields are unchanged. It is independent of the Product record's updatedAt only as an ordering source, not independent of the Product CID. ATM accepts millisecond precision; distinct generations must differ by at least one millisecond. Reuse one strictly monotonic timestamp for exact retries and mint a newer timestamp whenever any canonical payload field changes. Once a link opts in, older generations cannot overwrite it. Upgrade every writer for this link before opting in: afterward, a divergent unversioned writer fails with SourceGenerationRequired.","maxLength":64},"createOnly":{"type":"boolean","description":"When true, atomically insert only if no link exists for this product, app, and environment. A concurrent or pre-existing link is preserved unchanged."}}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"},"created":{"type":"boolean","description":"True when this call inserted a new link. False when createOnly preserved an existing row."},"applied":{"type":"boolean","description":"True when this call inserted or updated the row. False when it idempotently adopted the already-current row, including an exact unversioned compatibility retry."},"sourceUpdatedAt":{"type":"string","format":"datetime","description":"The source generation currently stored for the row, when it is versioned.","maxLength":64}}}},"errors":[{"name":"CreatorProductMismatch","description":"Product URI authority must match creatorDid."},{"name":"ProductUnavailable","description":"The supplied product strongRef is not the exact current creator-owned record."},{"name":"RecipientAppApprovalRequired","description":"The creator has not approved this app for the linked payment type."},{"name":"RecipientAppApprovalBlocked","description":"The creator blocked this app."},{"name":"RecipientAppReapprovalRequired","description":"The app's approval terms changed and need creator re-approval."},{"name":"AppEnvironmentNotConfigured","description":"This app environment is not configured in ATM."},{"name":"InvalidUrl","description":"A supplied URL is not an acceptable http(s) URL."},{"name":"StaleSourceGeneration","description":"A newer sourceUpdatedAt is already stored for this product app link."},{"name":"SourceGenerationConflict","description":"The same sourceUpdatedAt is already stored with a different canonical link payload."},{"name":"SourceGenerationRequired","description":"The stored link is versioned and an unversioned request tried to change its canonical payload."},{"name":"RegistrationFailed","description":"The product app link could not be registered."}]}}}