{"lexicon":1,"id":"money.atmosphere.membership.createProgram","defs":{"main":{"type":"procedure","description":"Create a portable money.atmosphere.membership.program record in the creator's repo. Requires registered-app service auth. When creatorDid equals the calling app the program is written directly; otherwise the app must hold creator consent (an approved recipient approval covering subscription payments, or a verified recipientAssertionJwt issued by creatorDid). ATM writes to the creator's repo only while it holds a live membership-write OAuth grant; otherwise it returns MembershipCreatorAuthorizationRequired without fabricating a record.","input":{"encoding":"application/json","schema":{"type":"object","required":["creatorDid","environment","title"],"properties":{"creatorDid":{"type":"string","format":"did","description":"Creator/project DID that will own the membership program."},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"title":{"type":"string","minLength":1,"maxGraphemes":100,"maxLength":1000},"description":{"type":"string","maxGraphemes":1000,"maxLength":10000},"scope":{"type":"string","knownValues":["creator-wide","app-specific"],"maxLength":32},"product":{"type":"ref","ref":"com.atproto.repo.strongRef","description":"Optional money.atmosphere.product (kind=membership) in the creator's repo."},"defaultPrice":{"type":"ref","ref":"com.atproto.repo.strongRef","description":"Optional recurring money.atmosphere.price in the creator's repo."},"recipientAssertionJwt":{"type":"string","maxLength":8192,"description":"Optional creator presence token (com.atproto.server.getServiceAuth JWT, iss=creatorDid, aud=ATM broker, lxm=money.atmosphere.app.assertRecipient) authorizing this app to author the membership without a standing approval."}}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["program"],"properties":{"program":{"type":"ref","ref":"com.atproto.repo.strongRef"}}}},"errors":[{"name":"AppEnvironmentNotConfigured","description":"The app environment is not configured in ATM."},{"name":"NotAuthorized","description":"The calling app is not authorized to create memberships for this creator."},{"name":"MembershipCreatorAuthorizationRequired","description":"ATM holds no live grant to write membership records to the creator's repo; the creator must sign in to ATM (or re-authorize) to grant membership-write access."},{"name":"InvalidMembershipEntitlement","description":"A supplied product/price is not a valid membership listing in the creator's repo."},{"name":"WriteFailed","description":"ATM could not write the membership program record."}]}}}