{"openapi":"3.0.0","info":{"version":"1.0.0","title":"API"},"servers":[{"url":"https://api2.sesamy.com","description":"Current environment"}],"security":[{"OpenID":["openid","email","profile","entitlements"]}],"components":{"securitySchemes":{"OpenID":{"type":"openIdConnect","openIdConnectUrl":"https://token.sesamy.com/.well-known/openid-configuration"},"Basic":{"type":"http","scheme":"basic"}},"schemas":{"Contract":{"type":"object","properties":{"id":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"name":{"type":"string"},"userId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"price":{"type":"number"},"nextBillAt":{"type":"string","nullable":true},"nextPrice":{"type":"number","nullable":true},"currency":{"type":"string"},"manageUrl":{"type":"string"},"contractDuration":{"type":"string","enum":["RECURRING","RENEWABLE","PERPETUAL"]},"issuesRemaining":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"purchaseOptionId":{"type":"string"},"purchaseOptionName":{"type":"string"},"name":{"type":"string"},"cover":{"type":"string"},"purchaseType":{"type":"string"}},"required":["sku","name"]}},"status":{"type":"string"},"isActive":{"type":"boolean"},"recurringInterval":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"recurringTime":{"type":"number"},"willCancelAt":{"type":"string","nullable":true},"cancelRequestedAt":{"type":"string","nullable":true},"expiresAt":{"type":"string"},"paymentData":{"type":"object","properties":{"method":{"type":"string"},"description":{"type":"string"},"brand":{"type":"string"}}},"appliedDiscounts":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"id":{"type":"string"}},"required":["code","name","description","id"]}}},"required":["id","name","userId","createdAt","updatedAt","price","nextBillAt","nextPrice","currency","items","status","isActive","willCancelAt","cancelRequestedAt","appliedDiscounts"]},"Amendment":{"type":"object","properties":{"id":{"type":"string"},"contractId":{"type":"string"},"status":{"type":"string"},"appliedDiscounts":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"status":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["code","status"]}},"amendmentType":{"type":"string"},"nextBill":{"type":"object","properties":{"total":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string"}},"required":["total","currency"]}},"required":["id","contractId","status","appliedDiscounts","amendmentType"]},"Bill":{"type":"object","properties":{"id":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"title":{"type":"string"},"purchaseOptionId":{"type":"string"}},"required":["sku","title"]}},"price":{"type":"number"},"currency":{"type":"string"},"receiptUrl":{"type":"string"},"paymentProvider":{"type":"string"},"paymentMethod":{"type":"string"},"status":{"type":"string"},"updatedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","items","price","receiptUrl","paymentProvider","paymentMethod","status","updatedAt","createdAt"]},"EntitlementType":{"type":"string","enum":["article","audiobook","ebook","bundle","podcast","pass","publication","physical_issue"]},"Entitlement":{"type":"object","properties":{"id":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"sku":{"type":"string"},"purchaseOption":{"type":"string"},"cover":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"presentationUrl":{"type":"string"},"publisherContentId":{"type":"string"},"type":{"$ref":"#/components/schemas/EntitlementType"},"origin":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["EXTERNAL"]},"id":{"type":"string"},"listId":{"type":"string"},"name":{"type":"string"}},"required":["type","id"]},{"type":"object","properties":{"type":{"type":"string","enum":["PAYMENTS"]},"contractId":{"type":"string"}},"required":["type"]}]},"hasAccess":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"token":{"type":"string"},"expiresAt":{"type":"string"}},"required":["id","sku","title","type","hasAccess","createdAt","updatedAt"]},"Transaction":{"type":"object","properties":{"id":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"amount":{"type":"number"},"currency":{"type":"string"},"contractId":{"type":"string"},"isRefund":{"type":"boolean"},"userId":{"type":"string"},"billId":{"type":"string"},"updatedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","amount","contractId","isRefund","userId","billId","updatedAt","createdAt"]},"Subscription":{"type":"object","properties":{"id":{"type":"string"},"currency":{"type":"string"},"cancelAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"status":{"type":"string"},"product":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","format":"uri"},"optionId":{"type":"string"},"sku":{"type":"string"}},"required":["name","description","image","optionId","sku"]},"totalIssues":{"type":"number"},"remainingIssues":{"type":"number"},"price":{"type":"number"},"nextPrice":{"type":"number"},"nextPaymentAt":{"type":"string"},"hasAccess":{"type":"boolean"},"manageUrl":{"type":"string"},"userId":{"type":"string"}},"required":["id","currency","createdAt","status","product","hasAccess","manageUrl","userId"]},"UserMetadata":{"anyOf":[{"type":"string"},{"type":"number"},{"nullable":true},{"nullable":true}]},"TallyValue":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"Tally":{"type":"object","properties":{"id":{"type":"string"},"value":{"$ref":"#/components/schemas/TallyValue"},"policies":{"type":"object","properties":{"ttl":{"type":"number","description":"Time to live in seconds"},"maxItems":{"type":"number"},"unique":{"type":"boolean"},"overflow":{"type":"string","enum":["fifo","block"]},"ipSessionSharing":{"type":"boolean"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"expiresAt":{"type":"string"}},"required":["id","value","createdAt","updatedAt"]},"TallyInsert":{"type":"object","properties":{"value":{"anyOf":[{"type":"string"},{"type":"number"}]},"policies":{"type":"object","properties":{"ttl":{"type":"number","description":"Time to live in seconds"},"maxItems":{"type":"number"},"unique":{"type":"boolean"},"overflow":{"type":"string","enum":["fifo","block"]},"ipSessionSharing":{"type":"boolean"}}}},"required":["value"]},"UserFulfillment":{"type":"object","properties":{"status":{"type":"string"},"updatedAt":{"type":"string"},"createdAt":{"type":"string"},"deliversAt":{"type":"string"},"sku":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"cover":{"type":"string","format":"uri"},"numericId":{"type":"number"},"deliveryProvider":{"type":"string"},"itemId":{"type":"string"},"copies":{"type":"number"}},"required":["status","updatedAt","createdAt","sku","title","id","numericId","deliveryProvider","itemId","copies"]},"Profile":{"type":"object","properties":{"userId":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"emailVerified":{"type":"boolean"},"locale":{"type":"string"},"nickname":{"type":"string"},"picture":{"type":"string"},"name":{"type":"string"},"mobilePhone":{"type":"string"},"workPhone":{"type":"string"},"homePhone":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"user_metadata":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"}]}},"billingAddress":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}}},"deliveryAddress":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"company":{"type":"string"},"sub":{"type":"string"},"given_name":{"type":"string"},"family_name":{"type":"string"},"phone_number":{"type":"string"}},"required":["userId","createdAt","updatedAt"]},"Product":{"type":"object","properties":{"cover":{"type":"string"},"language":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"sku":{"type":"string"},"title":{"type":"string"},"productType":{"type":"string"},"publisherContentId":{"type":"string"}},"required":["cover","language","createdAt","updatedAt","sku","title","productType"]},"PaymentIssue":{"type":"object","properties":{"contractId":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"nextPaymentAt":{"type":"string"},"manageUrl":{"type":"string"},"status":{"type":"string","enum":["OVERDUE","CARD_EXPIRED","CARD_WILL_EXPIRE"]}},"required":["createdAt","updatedAt","status"]},"Attribution":{"type":"object","properties":{"utmSource":{"type":"string"},"utmMedium":{"type":"string"},"utmCampaign":{"type":"string"},"utmTerm":{"type":"string"},"utmContent":{"type":"string"},"source":{"type":"string","enum":["CHECKOUT","PAYWALL","OTHER"]},"sourceId":{"type":"string"},"itemSrc":{"type":"string"},"publisherContentId":{"type":"string"},"_ga":{"type":"string"},"_gid":{"type":"string"},"_fbp":{"type":"string"},"_fbc":{"type":"string"}}},"PaymentMethods":{"type":"object","properties":{"provider":{"type":"string"},"methods":{"type":"array","items":{"type":"string"}}},"required":["methods"]},"AppliedDiscountCodes":{"type":"object","properties":{"name":{"type":"string"},"id":{"type":"string"},"code":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["APPLIED","UNAPPLICABLE"]}},"required":["code","status"]},"Checkout":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"url":{"type":"string"},"purchaseOptionId":{"type":"string"},"price":{"type":"number"},"currency":{"type":"string"},"geoRestrictions":{"type":"object","properties":{"countries":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["ALLOW","BLOCK"]}},"required":["countries","type"]}}}},"address":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}}},"businessAddress":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}}},"email":{"type":"string"},"givenName":{"type":"string"},"familyName":{"type":"string"},"birthDate":{"type":"string"},"phoneNumber":{"type":"string"},"country":{"type":"string"},"referralEmail":{"type":"string"},"language":{"type":"string"},"redirectUrl":{"type":"string"},"isBusiness":{"type":"boolean"},"price":{"type":"number"},"currency":{"type":"string"},"anonymousUserId":{"type":"string"},"attribution":{"$ref":"#/components/schemas/Attribution"},"paymentData":{"type":"object","properties":{"provider":{"type":"string"},"method":{"type":"string"}},"required":["provider","method"]},"paymentMethodsFilter":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethods"}},"fieldSettings":{"type":"object","properties":{"name":{"type":"object","properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean"}},"required":["enabled"]},"phone":{"type":"object","properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean"}},"required":["enabled"]},"birthdate":{"type":"object","properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean"}},"required":["enabled"]},"referral":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]}}},"giftMode":{"type":"boolean"},"requireAddress":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"id":{"type":"string"},"checkoutUrl":{"type":"string"},"status":{"type":"string","enum":["PENDING","WAITING_PAYMENT_CONFIRMATION","COMPLETED"]},"type":{"type":"string","enum":["RECURRING","SINGLE"]},"itemsOwned":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"purchaseOptionId":{"type":"string"},"title":{"type":"string"}},"required":["sku","purchaseOptionId","title"]}},"appliedDiscountCodes":{"type":"array","items":{"$ref":"#/components/schemas/AppliedDiscountCodes"}},"availablePaymentMethods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethods"}},"payer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"}},"required":["id","email"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["items","redirectUrl","id","checkoutUrl","status","type","itemsOwned","appliedDiscountCodes","availablePaymentMethods","createdAt","updatedAt"]},"CreateCheckoutRequest":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"url":{"type":"string"},"purchaseOptionId":{"type":"string"},"price":{"type":"number"},"currency":{"type":"string"},"geoRestrictions":{"type":"object","properties":{"countries":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["ALLOW","BLOCK"]}},"required":["countries","type"]}}}},"address":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}}},"businessAddress":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}}},"email":{"type":"string"},"givenName":{"type":"string"},"familyName":{"type":"string"},"birthDate":{"type":"string"},"phoneNumber":{"type":"string"},"country":{"type":"string"},"referralEmail":{"type":"string"},"language":{"type":"string"},"redirectUrl":{"type":"string"},"isBusiness":{"type":"boolean"},"price":{"type":"number"},"currency":{"type":"string"},"anonymousUserId":{"type":"string"},"attribution":{"$ref":"#/components/schemas/Attribution"},"paymentData":{"type":"object","properties":{"provider":{"type":"string"},"method":{"type":"string"}},"required":["provider","method"]},"paymentMethodsFilter":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethods"}},"fieldSettings":{"type":"object","properties":{"name":{"type":"object","properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean"}},"required":["enabled"]},"phone":{"type":"object","properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean"}},"required":["enabled"]},"birthdate":{"type":"object","properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean"}},"required":["enabled"]},"referral":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]}}},"giftMode":{"type":"boolean"},"requireAddress":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"requestedDiscountCodes":{"type":"array","items":{"type":"string"}},"payerEmail":{"type":"string"}},"required":["items","redirectUrl"]},"Paywall":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the paywall","example":"aM8o7LqpkGZJ-szyPwe_E"},"vendorId":{"type":"string","description":"Vendor identifier","example":"24victoria"},"currency":{"type":"string","description":"Currency code for pricing","example":"DKK"},"version":{"type":"number","description":"Paywall version number","example":2},"settings":{"type":"object","properties":{"template":{"type":"string","enum":["LOGIN","BOXES","ARTICLE"],"description":"Paywall template type - LOGIN for authentication-only, BOXES for subscription options","example":"BOXES"},"useDefaultLogo":{"type":"boolean","description":"Whether to use the default vendor logo","example":true},"useDefaultCurrency":{"type":"boolean","description":"Whether to use the default vendor currency","example":true},"useDefaultColor":{"type":"boolean","description":"Whether to use the default vendor color","example":true},"styling":{"type":"object","properties":{"dropShadow":{"type":"boolean","description":"Whether to show drop shadow on paywall elements","example":true},"backgroundColor":{"type":"string","description":"Background color in hex format","example":"#000000"},"showBackground":{"type":"boolean","description":"Whether to show the background","example":false}},"required":["dropShadow","backgroundColor","showBackground"]}},"required":["template","useDefaultLogo","useDefaultCurrency","useDefaultColor"]},"showLoginButton":{"type":"boolean","description":"Whether to show a login button. When true, indicates a subscription/entitlement paywall. When false with LOGIN template, indicates a login-only paywall.","example":true},"subscriptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Subscription identifier","example":"R4gX0YSbSU1WJA7bCrbQw"},"sku":{"type":"string","description":"Product SKU","example":"sid:fGb4GbMUclADQtBxoX1rl"},"poId":{"type":"string","description":"Purchase option identifier","example":"VDuH_poxqIPKW638Ok43q"},"title":{"type":"string","description":"Subscription title","example":"Månedsabonnement"},"description":{"type":"string","description":"Subscription description (can contain HTML)","example":"<p>Kun 720 kr./år – spar 20%</p>"},"price":{"type":"number","description":"Regular price","example":99},"discountPrice":{"type":"number","description":"Discounted price if applicable","example":75},"discountCode":{"type":"string","description":"Applied discount code","example":""},"periodText":{"type":"string","description":"Period text (e.g., \"måned\", \"month\")","example":"måned"},"tag":{"type":"string","description":"Tag for categorization","example":""},"selected":{"type":"boolean","description":"Whether this subscription is pre-selected","example":true},"features":{"type":"array","items":{"type":"string"},"description":"List of features included in this subscription","example":["Daglige nyheder om tech, startups og scaleups","Eksklusive interviews med founders"]},"buttonText":{"type":"string","description":"Custom button text","example":"KØB ADGANG"},"readMoreText":{"type":"string","description":"Read more link text","example":"Læs mere"},"preferBusiness":{"type":"boolean","description":"Whether this option is preferred for business customers","example":false},"url":{"type":"string","description":"External URL for more information","example":"https://24victoria.dk/business"}},"required":["id","sku","poId","title","description","discountCode","periodText","tag","selected"]}},"features":{"type":"array","items":{"type":"string"},"description":"General features displayed on the paywall","example":["Danmarks nyhedsmedie om techvirksomeder. startups & scaleups"]},"mainColor":{"type":"string","description":"Main brand color in hex format","example":"#3377fe"},"headline":{"type":"string","description":"Paywall headline text","example":"Login for at læse artiklen"},"logoUrl":{"type":"string","description":"URL to the vendor logo","example":"https://assets.sesamy.com/vendor-assets/24victoria/ad29ee3a-4648-453e-92ad-a2d43c68cd39.svg"},"footerPaymentMethods":{"type":"array","items":{"type":"string"},"description":"Payment methods displayed in the footer","example":["visa","mastercard","google-pay","apple-pay"]},"singlePurchase":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether single purchase is enabled","example":true},"title":{"type":"string","description":"Single purchase option title","example":"Buy Now"},"description":{"type":"string","description":"Single purchase option description","example":"One-time purchase"},"discountCode":{"type":"string","description":"Applied discount code for single purchase","example":""}},"required":["enabled","title","description","discountCode"]}},"required":["id","vendorId","currency","version","settings","showLoginButton","subscriptions","features","footerPaymentMethods"]},"SupportSessionToken":{"type":"object","properties":{"token":{"type":"string","description":"A signed JWT for authenticating with the support messenger","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}},"required":["token"]}},"parameters":{}},"paths":{"/contracts":{"get":{"tags":["contracts"],"summary":"List all contracts","description":"Retrieves all contracts for the current user. Includes subscription plans and one-time purchases with active entitlements.","security":[{"OpenID":[]}],"responses":{"200":{"description":"A list of the user's contracts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Contract"}},"example":[{"id":"1d78271264b9c76d5842911dd70b4353","name":"Premium Subscription","userId":"user123","createdAt":"2023-01-01T12:00:00Z","updatedAt":"2023-03-15T09:30:00Z","price":99,"nextBillAt":"2023-04-01T12:00:00Z","willCancelAt":null,"cancelRequestedAt":null,"nextPrice":99,"currency":"SEK","manageUrl":"https://example.com/manage/contract/123","contractDuration":"RECURRING","items":[{"sku":"premium-monthly","purchaseOptionId":"monthly","purchaseOptionName":"Monthly plan","name":"Premium Subscription"}],"status":"ACTIVE","isActive":true,"recurringInterval":"MONTH","recurringTime":1,"appliedDiscounts":[]}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/contracts/{contract_id}":{"get":{"tags":["contracts"],"summary":"Get a contract by ID","description":"Retrieves a specific contract by its unique identifier.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the contract","name":"contract_id","in":"path"}],"responses":{"200":{"description":"The requested contract","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contract"},"example":{"id":"1d78271264b9c76d5842911dd70b4353","name":"Premium Subscription","userId":"user123","createdAt":"2023-01-01T12:00:00Z","updatedAt":"2023-03-15T09:30:00Z","price":99,"nextBillAt":"2023-04-01T12:00:00Z","willCancelAt":null,"cancelRequestedAt":null,"nextPrice":99,"currency":"SEK","manageUrl":"https://example.com/manage/contract/123","contractDuration":"RECURRING","items":[{"sku":"premium-monthly","purchaseOptionId":"monthly","purchaseOptionName":"Monthly plan","name":"Premium Subscription"}],"status":"ACTIVE","isActive":true,"recurringInterval":"MONTH","recurringTime":1,"appliedDiscounts":[]}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/contracts/{contract_id}/cancel":{"post":{"tags":["contracts"],"summary":"Cancel a contract","description":"Cancels a specific contract. For subscriptions, this typically means they will not renew at the end of the current billing period.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the contract","name":"contract_id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","enum":["TOO_EXPENSIVE","NOT_USING","SWITCHED_COMPETITOR","MISSING_FEATURES","TECHNICAL_ISSUES","DUPLICATE","OTHER"],"description":"Reason for cancellation"},"comment":{"type":"string","description":"Additional feedback about the cancellation"}},"required":["reason"]}}}},"responses":{"200":{"description":"Contract cancelled successfully","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"example":{"success":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/contracts/{contract_id}/amendments":{"post":{"tags":["contracts"],"summary":"Create an amendment","description":"Creates a new amendment for a contract, such as applying a discount code.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the contract","name":"contract_id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["DISCOUNT"],"description":"The type of amendment to create"},"discountCode":{"type":"string","description":"The discount code to apply"}},"required":["type","discountCode"]},"example":{"type":"DISCOUNT","discountCode":"SUMMER2023"}}}},"responses":{"200":{"description":"The created amendment","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Amendment"},"example":{"id":"amendment123","contractId":"1d78271264b9c76d5842911dd70b4353","status":"PENDING","appliedDiscounts":[{"code":"discount123","status":"ACTIVE","id":"1","name":"Black Friday Discount","description":"Get 20% off on Black Friday"}],"amendmentType":"UPGRADE"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/contracts/{contract_id}/amendments/{amendment_id}/confirm":{"post":{"tags":["contracts"],"summary":"Confirm an amendment","description":"Confirms a pending amendment for a contract.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the contract","name":"contract_id","in":"path"},{"schema":{"type":"string","example":"amendment123"},"required":true,"description":"The unique identifier of the amendment","name":"amendment_id","in":"path"}],"responses":{"200":{"description":"Amendment confirmed successfully","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"example":{"success":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/bills":{"get":{"tags":["bills"],"summary":"List all bills","description":"Retrieves all bills for the current user, excluding draft and expired bills. Results are sorted by creation date (newest first).","security":[{"OpenID":[]}],"responses":{"200":{"description":"A list of the user's bills","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Bill"}},"example":[{"id":"1d78271264b9c76d5842911dd70b4353","items":[{"sku":"premium-monthly","title":"Premium Subscription","purchaseOptionId":"monthly"}],"price":99,"currency":"SEK","receiptUrl":"https://example.com/receipts/123","paymentProvider":"stripe","paymentMethod":"card","status":"PAID","updatedAt":"2023-03-01T10:15:00Z","createdAt":"2023-03-01T10:00:00Z"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/bills/{id}":{"get":{"tags":["bills"],"summary":"Get a bill by ID","description":"Retrieves a specific bill by its unique identifier.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the bill","name":"id","in":"path"}],"responses":{"200":{"description":"The requested bill","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bill"},"example":{"id":"1d78271264b9c76d5842911dd70b4353","items":[{"sku":"premium-monthly","title":"Premium Subscription","purchaseOptionId":"monthly"}],"price":99,"currency":"SEK","receiptUrl":"https://example.com/receipts/123","paymentProvider":"stripe","paymentMethod":"card","status":"PAID","updatedAt":"2023-03-01T10:15:00Z","createdAt":"2023-03-01T10:00:00Z"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/entitlements":{"get":{"tags":["entitlements"],"summary":"List all entitlements","description":"Retrieves all entitlements for the current user with optional filtering by type, SKU, or purchase option ID.","security":[{"OpenID":[]}],"parameters":[{"schema":{"allOf":[{"$ref":"#/components/schemas/EntitlementType"},{"description":"Filter by entitlement type","example":"article"}]},"required":false,"name":"type","in":"query"},{"schema":{"type":"string","description":"Filter by SKU","example":"premium-article-123"},"required":false,"name":"sku","in":"query"},{"schema":{"type":"string","description":"Filter by purchase option ID","example":"one-time"},"required":false,"name":"purchase-option-id","in":"query"},{"schema":{"type":"string","description":"Wait for entitlements created after this timestamp","example":"2023-01-01T00:00:00Z"},"required":false,"description":"If specified the api will wait until an entitlement after this timestamp is available before it returns","name":"wait-for-entitlement-after","in":"query"}],"responses":{"200":{"description":"A list of the user's entitlements","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Entitlement"}},"example":[{"id":"1d78271264b9c76d5842911dd70b4353","sku":"premium-article-123","purchaseOption":"one-time","cover":"https://example.com/cover.jpg","title":"Premium Article","url":"https://example.com/article/123","presentationUrl":"https://example.com/view/article/123","type":"article","origin":{"type":"PAYMENTS","contractId":"contract123"},"hasAccess":true,"createdAt":"2023-01-15T14:30:00Z","updatedAt":"2023-01-15T14:30:00Z"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/entitlements/{id}":{"get":{"tags":["entitlements"],"summary":"Get an entitlement by ID","description":"Retrieves a specific entitlement by its unique identifier.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the entitlement","name":"id","in":"path"}],"responses":{"200":{"description":"The requested entitlement","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Entitlement"},"example":{"id":"1d78271264b9c76d5842911dd70b4353","sku":"premium-article-123","purchaseOption":"one-time","cover":"https://example.com/cover.jpg","title":"Premium Article","url":"https://example.com/article/123","presentationUrl":"https://example.com/view/article/123","type":"article","origin":{"type":"PAYMENTS","contractId":"contract123"},"hasAccess":true,"createdAt":"2023-01-15T14:30:00Z","updatedAt":"2023-01-15T14:30:00Z"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/entitlements/{id}/access":{"get":{"tags":["entitlements"],"summary":"Get access information for an entitlement","description":"Retrieves access information (URL and token) for a specific entitlement. The access type (URL or RSS) is determined based on the entitlement type.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the entitlement","name":"id","in":"path"}],"responses":{"200":{"description":"Access information for the entitlement","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"token":{"type":"string"},"title":{"type":"string"},"filename":{"type":"string"},"type":{"type":"string"}},"required":["id","url"]},"example":{"id":"access123","url":"https://example.com/access/article/123","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/transactions":{"get":{"tags":["transactions"],"summary":"List transactions","description":"Retrieves all transactions for the current user, with optional filtering by search query.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","description":"Search query to filter transactions","example":"premium"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"A list of the user's transactions","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}},"example":[{"id":"tr_123456789","amount":99,"currency":"SEK","contractId":"contract123","isRefund":false,"userId":"user123","billId":"bill123","updatedAt":"2023-03-01T10:00:00Z","createdAt":"2023-03-01T10:00:00Z"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/subscriptions":{"get":{"tags":["subscriptions"],"summary":"List subscriptions","description":"Retrieves all subscriptions for the current user. This includes both active and canceled subscriptions.","security":[{"OpenID":[]}],"headers":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"},"~standard":{"version":1,"vendor":"zod"}},"typeName":"ZodObject"},"~standard":{"version":1,"vendor":"zod"},"_cached":null},"responses":{"200":{"description":"A list of the user's subscriptions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}},"example":[{"id":"1d78271264b9c76d5842911dd70b4353","currency":"SEK","createdAt":"2023-01-01T12:00:00Z","status":"active","product":{"name":"Premium Magazine","description":"Monthly subscription to Premium Magazine","image":"https://example.com/magazine/premium.jpg","optionId":"monthly","sku":"magazine-premium"},"totalIssues":12,"remainingIssues":9,"price":99,"nextPrice":99,"nextPaymentAt":"2023-04-01T12:00:00Z","hasAccess":true,"manageUrl":"https://checkout.sesamy.com/manage/1d78271264b9c76d5842911dd70b4353","userId":"user123"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/subscriptions/{id}":{"get":{"tags":["subscriptions"],"summary":"Get a subscription by ID","description":"Retrieves a specific subscription by its unique identifier.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"1d78271264b9c76d5842911dd70b4353"},"required":true,"description":"The unique identifier of the subscription","name":"id","in":"path"}],"responses":{"200":{"description":"The requested subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"},"example":{"id":"1d78271264b9c76d5842911dd70b4353","currency":"SEK","createdAt":"2023-01-01T12:00:00Z","status":"active","product":{"name":"Premium Magazine","description":"Monthly subscription to Premium Magazine","image":"https://example.com/magazine/premium.jpg","optionId":"monthly","sku":"magazine-premium"},"totalIssues":12,"remainingIssues":9,"price":99,"nextPrice":99,"nextPaymentAt":"2023-04-01T12:00:00Z","hasAccess":true,"manageUrl":"https://checkout.sesamy.com/manage/1d78271264b9c76d5842911dd70b4353","userId":"user123"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/user-metadata":{"get":{"tags":["user-metadata"],"summary":"Get all user metadata","description":"Retrieves all metadata entries for the current user.","security":[{"OpenID":[]}],"responses":{"200":{"description":"Object with metadata key-value pairs","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/UserMetadata"}},"example":{"preferences":"dark-mode","last_visited":"2023-04-01T12:30:00Z","favorite_categories":"news,business,tech"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/user-metadata/{id}":{"put":{"tags":["user-metadata"],"summary":"Set user metadata value","description":"Sets a metadata value for the current user with the specified key.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"preferences"},"required":true,"description":"The key of the metadata entry","name":"id","in":"path"}],"requestBody":{"content":{"text/plain":{"schema":{"$ref":"#/components/schemas/UserMetadata"},"example":"dark-mode"}}},"responses":{"200":{"description":"Metadata value set successfully","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"example":{"success":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}},"delete":{"tags":["user-metadata"],"summary":"Delete user metadata value","description":"Deletes a metadata value for the current user with the specified key.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"preferences"},"required":true,"description":"The key of the metadata entry","name":"id","in":"path"}],"responses":{"200":{"description":"Metadata value deleted successfully","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"example":{"success":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/tallies":{"get":{"tags":["tallies"],"summary":"List all tallies","description":"Retrieve all tallies for the authenticated user.","security":[{"Basic":[],"OpenID":[]}],"headers":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"},"~standard":{"version":1,"vendor":"zod"}},"typeName":"ZodObject"},"~standard":{"version":1,"vendor":"zod"},"_cached":null},"responses":{"200":{"description":"A record of tallies where keys are tally IDs and values are the tally values","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TallyValue"}},"example":{"article_views":["article1","article2"],"product_views":[5,10,15],"login_count":[3]}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/tallies/{id}":{"get":{"tags":["tallies"],"summary":"Get a tally by ID","description":"Retrieve a specific tally by its ID for the authenticated user.","security":[{"Basic":[],"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"test"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The tally value for the specified ID","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"example":["article1","article2","article3"]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}},"put":{"tags":["tallies"],"summary":"Update a tally","description":"Set a tally to a new value for the authenticated user.","security":[{"Basic":[],"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"test"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"anyOf":[{"type":"string"},{"type":"number"}]},"policies":{"type":"object","properties":{"ttl":{"type":"number","description":"Time to live in seconds"},"maxItems":{"type":"number"},"unique":{"type":"boolean"},"overflow":{"type":"string","enum":["fifo","block"]},"ipSessionSharing":{"type":"boolean"}}}},"required":["value"]}}}},"responses":{"200":{"description":"The updated tally object","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tally"},"example":{"value":["article123"],"id":"article_views","createdAt":"2023-01-01T12:00:00Z","updatedAt":"2023-03-15T09:30:00Z"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/tallies/{id}/push":{"post":{"tags":["tallies"],"summary":"Push value to tally","description":"Add a new value to an existing tally list for the authenticated user.","security":[{"Basic":[],"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"test"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TallyInsert"}}}},"responses":{"200":{"description":"The updated tally value after pushing the new value","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"example":["article1","article2","article123"]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/fulfillments":{"get":{"tags":["fulfillments"],"summary":"List fulfillments","description":"Retrieves all fulfillments for a specific SKU. Useful for tracking delivery status of physical items.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","description":"The SKU of the publication which can be found by querying the entitlements of type bundle","example":"magazine-april-2023"},"required":true,"name":"sku","in":"query"}],"responses":{"200":{"description":"A list of user's fulfillments for the requested SKU","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserFulfillment"}},"example":[{"id":"fulfillment123","status":"DELIVERED","updatedAt":"2023-04-10T15:20:00Z","createdAt":"2023-04-10T15:00:00Z","deliversAt":"2023-04-15T10:00:00Z","sku":"magazine-april","title":"April Edition","cover":"https://example.com/magazine/april.jpg","numericId":123,"deliveryProvider":"postnord","itemId":"item123","copies":1}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/fulfillments/{id}/request-delivery":{"post":{"tags":["fulfillments"],"summary":"Request delivery for a fulfillment item","description":"Request a new delivery for a specific fulfillment item by ID and SKU.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"item123"},"required":true,"description":"The fulfillment item ID","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string","description":"The SKU of the item to request delivery for","example":"magazine-april-2023"}},"required":["sku"]},"example":{"sku":"magazine-april-2023"}}}},"responses":{"200":{"description":"Delivery request result","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]},"example":{"ok":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/tags":{"get":{"tags":["tags"],"summary":"List user tags","description":"Retrieve all tags associated with the authenticated user.","security":[{"OpenID":[]}],"responses":{"200":{"description":"Array of user tags","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}},"example":["premium","subscriber","newsletter"]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}},"post":{"tags":["tags"],"summary":"Add a tag","description":"Add a new tag to the authenticated user.","security":[{"OpenID":[]}],"requestBody":{"content":{"text/plain":{"schema":{"type":"string","description":"The tag value to add","example":"premium"}}}},"responses":{"200":{"description":"Confirmation that the tag was added","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"string"},"example":"OK"}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/tags/{tag}":{"delete":{"tags":["tags"],"summary":"Delete a tag","description":"Remove a tag from the authenticated user.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","description":"Tag value to delete","example":"premium"},"required":true,"name":"tag","in":"path"}],"responses":{"200":{"description":"Confirmation that the tag was deleted","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"string"},"example":"OK"}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/profile":{"get":{"tags":["profile"],"summary":"Get user profile","description":"Retrieves the authenticated user's profile information.","security":[{"OpenID":[]}],"responses":{"200":{"description":"The user's profile information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"},"example":{"userId":"user123","firstName":"John","lastName":"Doe","email":"john.doe@example.com","emailVerified":true,"nickname":"Johnny","picture":"https://example.com/profile.jpg","name":"John Doe","mobilePhone":"+1234567890","workPhone":"+1234567891","homePhone":"+1234567892","tags":["premium","subscriber"],"billingAddress":{"country":"SE","zip":"12345","city":"Stockholm","street":"Main Street 123","firstName":"John","lastName":"Doe"},"deliveryAddress":{"country":"SE","zip":"12345","city":"Stockholm","street":"Main Street 123","firstName":"John","lastName":"Doe"},"user_metadata":{"preferences":"dark-mode","favorite_categories":"news,business,tech"},"createdAt":"2023-01-01T12:00:00Z","updatedAt":"2023-03-15T09:30:00Z"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}},"patch":{"tags":["profile"],"summary":"Update user profile","description":"Updates the authenticated user's profile information with the provided data.","security":[{"OpenID":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","nullable":true,"description":"First name of the user","example":"John"},"lastName":{"type":"string","nullable":true,"description":"Last name of the user","example":"Doe"},"nickname":{"type":"string","nullable":true,"description":"Nickname of the user","example":"Johnny"},"mobilePhone":{"type":"string","nullable":true,"description":"Mobile phone number","example":"+1234567890"},"workPhone":{"type":"string","nullable":true,"description":"Work phone number","example":"+1234567891"},"homePhone":{"type":"string","nullable":true,"description":"Home phone number","example":"+1234567892"},"billingAddress":{"type":"object","nullable":true,"properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}},"description":"Billing address information"},"deliveryAddress":{"type":"object","nullable":true,"properties":{"country":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"},"city":{"type":"string"},"street":{"type":"string"},"co":{"type":"string"},"lastName":{"type":"string"},"firstName":{"type":"string"}},"description":"Delivery address information"},"user_metadata":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"nullable":true},{"nullable":true}]},"description":"User metadata key-value pairs. Set a value to null to delete that key."},"given_name":{"type":"string","description":"Deprecated: Use firstName instead","deprecated":true},"family_name":{"type":"string","description":"Deprecated: Use lastName instead","deprecated":true},"phone_number":{"type":"string","nullable":true,"description":"Deprecated: Use mobilePhone instead","deprecated":true}}},"example":{"firstName":"Jane","lastName":"Smith","nickname":"Janie","mobilePhone":"+9876543210","billingAddress":{"country":"NO","zip":"0150","city":"Oslo","street":"New Street 456"},"user_metadata":{"theme":"dark","preferred_language":"en"}}}}},"responses":{"200":{"description":"The updated user profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"},"example":{"userId":"user123","firstName":"John","lastName":"Doe","email":"john.doe@example.com","emailVerified":true,"nickname":"Johnny","picture":"https://example.com/profile.jpg","name":"John Doe","mobilePhone":"+1234567890","workPhone":"+1234567891","homePhone":"+1234567892","tags":["premium","subscriber"],"billingAddress":{"country":"SE","zip":"12345","city":"Stockholm","street":"Main Street 123","firstName":"John","lastName":"Doe"},"deliveryAddress":{"country":"SE","zip":"12345","city":"Stockholm","street":"Main Street 123","firstName":"John","lastName":"Doe"},"user_metadata":{"preferences":"dark-mode","favorite_categories":"news,business,tech"},"createdAt":"2023-01-01T12:00:00Z","updatedAt":"2023-03-15T09:30:00Z"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}},"delete":{"tags":["profile"],"summary":"Delete own profile","description":"Allows the authenticated user to delete their own account. This action is irreversible.","security":[{"OpenID":[]}],"responses":{"200":{"description":"Profile deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"example":{"success":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/profile/spotify-link":{"get":{"tags":["profile"],"summary":"Check Spotify link status","description":"Checks if the user has connected their Spotify account.","security":[{"OpenID":[]}],"responses":{"200":{"description":"Spotify link status","content":{"application/json":{"schema":{"type":"object","properties":{"isSpotifyLinked":{"type":"boolean"}},"required":["isSpotifyLinked"]},"example":{"isSpotifyLinked":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/profile/unlink-spotify":{"post":{"tags":["profile"],"summary":"Unlink Spotify account","description":"Unlinks the user's connected Spotify account from their profile.","security":[{"OpenID":[]}],"responses":{"200":{"description":"Spotify account unlinked successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"example":{"success":true}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/products/{sku}":{"get":{"tags":["products"],"summary":"Get a product by SKU","description":"Retrieves a specific product by its unique SKU identifier.","security":[{"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"sid:PRVc_h8FIgR2ntoZh9SNu"},"required":true,"description":"The unique stock keeping unit (SKU) identifier of the product","name":"sku","in":"path"}],"responses":{"200":{"description":"The requested product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"},"example":{"cover":"https://example.com/product/cover.jpg","language":"en","createdAt":"2023-01-15T08:00:00Z","updatedAt":"2023-03-20T14:30:00Z","sku":"sid:PRVc_h8FIgR2ntoZh9SNu","title":"Premium Subscription","productType":"subscription","publisherContentId":"pub-123"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/products/{sku}/auto-onboard":{"post":{"tags":["products"],"summary":"Auto-onboard a product","description":"Triggers the auto-onboarding process for a product. This typically grants additional entitlements based on external systems when supported by the product.","security":[{"OpenID":[]}],"headers":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"},"~standard":{"version":1,"vendor":"zod"}},"typeName":"ZodObject"},"~standard":{"version":1,"vendor":"zod"},"_cached":null},"parameters":[{"schema":{"type":"string","example":"sid:PRVc_h8FIgR2ntoZh9SNu"},"required":true,"description":"The unique stock keeping unit (SKU) identifier of the product","name":"sku","in":"path"}],"responses":{"200":{"description":"The entitlements returned from the auto-onboard process","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Entitlement"}},"example":[{"id":"1d78271264b9c76d5842911dd70b4353","sku":"premium-article-123","purchaseOption":"one-time","cover":"https://example.com/cover.jpg","title":"Premium Article","url":"https://example.com/article/123","presentationUrl":"https://example.com/view/article/123","type":"article","origin":{"type":"PAYMENTS","contractId":"contract123"},"hasAccess":true,"createdAt":"2023-01-15T14:30:00Z","updatedAt":"2023-01-15T14:30:00Z"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/payment-issues":{"get":{"tags":["payment-issues"],"summary":"List payment issues","description":"Retrieves all payment issues for the current user. This includes overdue payments and expired payment methods.","security":[{"OpenID":[]}],"responses":{"200":{"description":"A list of the user's payment issues","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PaymentIssue"}},"example":[{"contractId":"contract123","status":"OVERDUE","nextPaymentAt":"2023-04-15T10:00:00Z","manageUrl":"https://checkout.sesamy.com/manage/contract123","createdAt":"2023-03-15T10:00:00Z","updatedAt":"2023-03-15T10:00:00Z"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/proxy":{"get":{"tags":["content"],"summary":"Proxy content","description":"Proxies content from supported providers, optionally extracting specific elements.","headers":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"},"~standard":{"version":1,"vendor":"zod"}},"typeName":"ZodObject"},"~standard":{"version":1,"vendor":"zod"},"_cached":null},"parameters":[{"schema":{"type":"string","description":"The URL of the content to proxy","example":"https://www.example.com/article"},"required":true,"name":"url","in":"query"},{"schema":{"type":"string","description":"Optional CSS selector to extract specific element from the page","example":".article-content"},"required":false,"name":"selector","in":"query"},{"schema":{"type":"string","description":"Whether to use cache (set to \"false\" to bypass cache)","example":"true"},"required":false,"name":"cache","in":"query"}],"responses":{"200":{"description":"The unlocked content","content":{"text/html":{"schema":{"type":"string"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/checkouts":{"post":{"tags":["checkouts"],"summary":"Create a checkout","description":"Creates a new checkout session with the specified items and settings.","security":[{"Basic":[],"OpenID":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckoutRequest"},"example":{"items":[{"sku":"premium-monthly","purchaseOptionId":"monthly"}],"language":"en","redirectUrl":"https://example.com/success","email":"user@example.com","givenName":"John","familyName":"Doe","phoneNumber":"+1234567890","birthDate":"1990-01-15","referralEmail":"referrer@example.com","paymentMethodsFilter":[{"provider":"stripe","methods":["card","swish"]}],"attribution":{"utmSource":"newsletter","utmMedium":"email","utmCampaign":"spring2023","source":"PAYWALL","sourceId":"paywall123"}}}}},"responses":{"200":{"description":"The created checkout session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"},"example":{"id":"checkout123","checkoutUrl":"https://checkout.sesamy.com/checkouts/checkout123","status":"COMPLETED","type":"RECURRING","items":[{"sku":"premium-monthly","purchaseOptionId":"monthly"}],"email":"user@example.com","givenName":"John","familyName":"Doe","phoneNumber":"+1234567890","address":{"firstName":"John","lastName":"Doe","street":"Main Street 123","city":"Stockholm","zip":"12345","country":"SE"},"isBusiness":false,"price":99,"currency":"SEK","itemsOwned":[],"appliedDiscountCodes":[],"availablePaymentMethods":[{"provider":"stripe","methods":["card","swish"]}],"country":"SE","language":"en","redirectUrl":"https://example.com/success","createdAt":"2023-03-15T14:30:00Z","updatedAt":"2023-03-15T14:30:00Z","paymentData":{"provider":"stripe","method":"card"},"fieldSettings":{"name":{"enabled":true,"required":true},"phone":{"enabled":true,"required":false},"birthdate":{"enabled":false,"required":false},"referral":{"enabled":false}}}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/checkouts/{id}":{"get":{"tags":["checkouts"],"summary":"Get a checkout by ID","description":"Retrieves a specific checkout session by its ID.","security":[{"Basic":[],"OpenID":[]}],"headers":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"},"~standard":{"version":1,"vendor":"zod"}},"typeName":"ZodObject"},"~standard":{"version":1,"vendor":"zod"},"_cached":null},"parameters":[{"schema":{"type":"string","example":"checkout123"},"required":true,"description":"The unique identifier of the checkout","name":"id","in":"path"}],"responses":{"200":{"description":"The requested checkout session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"},"example":{"id":"checkout123","checkoutUrl":"https://checkout.sesamy.com/checkouts/checkout123","status":"COMPLETED","type":"RECURRING","items":[{"sku":"premium-monthly","purchaseOptionId":"monthly"}],"email":"user@example.com","givenName":"John","familyName":"Doe","phoneNumber":"+1234567890","address":{"firstName":"John","lastName":"Doe","street":"Main Street 123","city":"Stockholm","zip":"12345","country":"SE"},"isBusiness":false,"price":99,"currency":"SEK","itemsOwned":[],"appliedDiscountCodes":[],"availablePaymentMethods":[{"provider":"stripe","methods":["card","swish"]}],"country":"SE","language":"en","redirectUrl":"https://example.com/success","createdAt":"2023-03-15T14:30:00Z","updatedAt":"2023-03-15T14:30:00Z","paymentData":{"provider":"stripe","method":"card"},"fieldSettings":{"name":{"enabled":true,"required":true},"phone":{"enabled":true,"required":false},"birthdate":{"enabled":false,"required":false},"referral":{"enabled":false}}}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}},"patch":{"tags":["checkouts"],"summary":"Update a checkout","description":"Updates an existing checkout session with new customer information or payment method.","security":[{"Basic":[],"OpenID":[]}],"parameters":[{"schema":{"type":"string","example":"checkout123"},"required":true,"description":"The unique identifier of the checkout","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckoutRequest"},"example":{"email":"updated@example.com","payerEmail":"payer@example.com","givenName":"Jane","familyName":"Smith","phoneNumber":"+0987654321","birthDate":"1985-12-25","referralEmail":"new-referrer@example.com","country":"NO","address":{"street":"New Street 456","city":"Oslo","zip":"0150","country":"NO"},"paymentData":{"provider":"stripe","method":"card"}}}}},"responses":{"200":{"description":"The updated checkout session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"},"example":{"id":"checkout123","checkoutUrl":"https://checkout.sesamy.com/checkouts/checkout123","status":"COMPLETED","type":"RECURRING","items":[{"sku":"premium-monthly","purchaseOptionId":"monthly"}],"email":"user@example.com","givenName":"John","familyName":"Doe","phoneNumber":"+1234567890","address":{"firstName":"John","lastName":"Doe","street":"Main Street 123","city":"Stockholm","zip":"12345","country":"SE"},"isBusiness":false,"price":99,"currency":"SEK","itemsOwned":[],"appliedDiscountCodes":[],"availablePaymentMethods":[{"provider":"stripe","methods":["card","swish"]}],"country":"SE","language":"en","redirectUrl":"https://example.com/success","createdAt":"2023-03-15T14:30:00Z","updatedAt":"2023-03-15T14:30:00Z","paymentData":{"provider":"stripe","method":"card"},"fieldSettings":{"name":{"enabled":true,"required":true},"phone":{"enabled":true,"required":false},"birthdate":{"enabled":false,"required":false},"referral":{"enabled":false}}}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/vendor":{"get":{"tags":["vendor"],"summary":"Get vendor settings","description":"Retrieves the current vendor settings and configuration.","security":[{"OpenID":[]}],"responses":{"200":{"description":"The vendor settings and configuration","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the vendor","example":"vendor123"},"name":{"type":"string","description":"The display name of the vendor","example":"Sesamy Publisher"},"logo":{"type":"string","description":"URL to the vendor logo image","example":"https://example.com/logo.png"}},"required":["id","name"]},"example":{"id":"vendor123","name":"Sesamy Publisher","logo":"https://example.com/logo.png"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/vendors":{"get":{"tags":["vendor"],"summary":"List linked vendors","description":"Get the vendors a user with matching email is linked to. This endpoint is not available for publisher tokens.","security":[{"OpenID":[]}],"responses":{"200":{"description":"The vendors a user with matching email is linked to","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"The display name of the vendor","example":"Sesamy Publisher"},"id":{"type":"string","description":"Unique identifier for the vendor","example":"vendor123"},"logo":{"type":"string","description":"URL to the vendor logo image","example":"https://example.com/logo.png"}},"required":["name","id"]}},"example":[{"name":"Sesamy Publisher","id":"vendor123","logo":"https://example.com/logo.png"}]}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/paywalls/{paywallId}":{"get":{"tags":["paywalls"],"summary":"Get paywall by ID","description":"Retrieves the paywall configuration and settings for the specified paywall ID.","security":[{"OpenID":[]}],"headers":{"_def":{"unknownKeys":"strip","catchall":{"_def":{"typeName":"ZodNever"},"~standard":{"version":1,"vendor":"zod"}},"typeName":"ZodObject"},"~standard":{"version":1,"vendor":"zod"},"_cached":null},"parameters":[{"schema":{"type":"string","description":"Unique identifier of the paywall","example":"pw123456"},"required":true,"name":"paywallId","in":"path"}],"responses":{"200":{"description":"The paywall information and configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Paywall"},"example":{"id":"aM8o7LqpkGZJ-szyPwe_E","vendorId":"24victoria","currency":"DKK","version":2,"settings":{"template":"BOXES","useDefaultLogo":false,"useDefaultCurrency":true,"useDefaultColor":true,"styling":{"dropShadow":true,"backgroundColor":"#000000","showBackground":false}},"showLoginButton":true,"subscriptions":[{"id":"R4gX0YSbSU1WJA7bCrbQw","sku":"sid:fGb4GbMUclADQtBxoX1rl","poId":"VDuH_poxqIPKW638Ok43q","title":"Månedsabonnement","description":"","price":99,"discountPrice":75,"discountCode":"","periodText":"måned","tag":"","selected":true,"buttonText":"KØB ADGANG","readMoreText":"Læs mere","features":["Daglige nyheder om tech, startups og scaleups","Eksklusive interviews med founders","Viden, idéer og metoder til dit iværksætterliv","Invitationer til events og netværk","Gratis adgang til professionelle kurser","INGEN BINDING"],"preferBusiness":false}],"features":["Danmarks nyhedsmedie om techvirksomeder. startups & scaleups"],"mainColor":"#3377fe","footerPaymentMethods":["visa","mastercard","google-pay","apple-pay"]}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/paywalls/{paywallId}/access":{"post":{"tags":["paywalls"],"summary":"Check article access via leaky paywall","description":"Checks whether the user can access an article under the leaky paywall. Returns a signed link if allowed, or the paywall configuration if the free article limit has been reached.","security":[{"Basic":[],"OpenID":[]}],"parameters":[{"schema":{"type":"string","description":"Unique identifier of the paywall","example":"pw123456"},"required":true,"name":"paywallId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"publisherContentId":{"type":"string","description":"Unique identifier of the content being accessed","example":"article-2024-01-15-news"},"url":{"type":"string","format":"uri","description":"URL of the article being accessed","example":"https://example.com/articles/my-article"}},"required":["publisherContentId"]}}}},"responses":{"200":{"description":"Access check result — either allowed with a signed link or blocked with paywall config","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["allowed"],"description":"Access is allowed"},"signedLink":{"type":"string","description":"Signed URL granting temporary access to the article","example":"https://example.com/articles/my-article?sesamy_token=eyJhbGciOiJFZERTQSJ9..."},"remaining":{"type":"number","description":"Number of free articles remaining in the current window","example":2}},"required":["status","signedLink","remaining"]},{"type":"object","properties":{"status":{"type":"string","enum":["paywall"],"description":"Access is blocked — paywall should be shown"},"remaining":{"type":"number","enum":[0],"description":"No free articles remaining"},"paywall":{"$ref":"#/components/schemas/Paywall"}},"required":["status","remaining","paywall"]}]}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/diagnostics":{"post":{"tags":["diagnostics"],"summary":"Submit user diagnostics","description":"Submit diagnostic data for debugging purposes. Data is stored with user consent and can be retrieved by support staff.","security":[{"Basic":[],"OpenID":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","description":"The authenticated user ID (sub)"},"fallbackId":{"type":"string","description":"A fallback identifier for unauthenticated users"},"timestamp":{"type":"string","description":"ISO 8601 timestamp when diagnostics were collected"},"pageUrl":{"type":"string","description":"The page URL where diagnostics were collected"},"pageTitle":{"type":"string","description":"The page title where diagnostics were collected"},"profile":{"type":"object","additionalProperties":{"nullable":true},"description":"User profile data"},"entitlements":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}},"description":"User entitlements"},"contracts":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}},"description":"User contracts"},"tags":{"type":"array","items":{"type":"string"},"description":"User tags"},"tallies":{"type":"object","additionalProperties":{"nullable":true},"description":"User tallies"},"browser":{"type":"object","properties":{"userAgent":{"type":"string"},"platform":{"type":"string"},"language":{"type":"string"},"languages":{"type":"array","items":{"type":"string"}},"cookiesEnabled":{"type":"boolean"},"onLine":{"type":"boolean"},"hardwareConcurrency":{"type":"number"},"deviceMemory":{"type":"number"},"maxTouchPoints":{"type":"number"},"vendor":{"type":"string"},"viewportWidth":{"type":"number"},"viewportHeight":{"type":"number"},"screenWidth":{"type":"number"},"screenHeight":{"type":"number"},"pixelRatio":{"type":"number"},"colorDepth":{"type":"number"},"timezone":{"type":"string"},"timezoneOffset":{"type":"number"}},"description":"Browser and device information"},"detection":{"type":"object","properties":{"adBlockEnabled":{"type":"boolean"},"incognitoMode":{"type":"boolean"},"inAppBrowser":{"type":"boolean"}},"description":"Detection results (adblock, incognito, etc.)"},"localStorage":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"},"redacted":{"type":"boolean"}},"required":["key","value"]},"description":"Sesamy-related localStorage entries"},"sessionStorage":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"},"redacted":{"type":"boolean"}},"required":["key","value"]},"description":"Sesamy-related sessionStorage entries"},"sdkVersion":{"type":"string","description":"Sesamy-js SDK version"},"clientId":{"type":"string","description":"The client ID / vendor ID"},"errors":{"type":"array","items":{"type":"string"},"description":"Errors encountered during diagnostics collection"}},"required":["timestamp"]}}}},"responses":{"201":{"description":"Diagnostics stored successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string","description":"The identifier used for storing the diagnostics"},"timestamp":{"type":"string","description":"The timestamp of the stored diagnostics"}},"required":["success","id","timestamp"]}}}},"400":{"description":"Bad Request - Invalid payload or missing identifier","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/capsule/vendors/{vendorId}/.well-known/jwks.json":{"get":{"tags":["capsule"],"summary":"Get JWKS (JSON Web Key Set) for a vendor","description":"Returns the public keys used to verify Capsule token signatures for a specific vendor in JWKS format.","parameters":[{"schema":{"type":"string","example":"varldenom"},"required":true,"description":"The vendor identifier","name":"vendorId","in":"path"}],"responses":{"200":{"description":"JWKS containing public keys for token verification","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"Cache control header"}},"content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["keys"]}}}},"404":{"description":"Vendor not found or capsule not configured","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/capsule/vendors/{vendorId}/unlock":{"post":{"tags":["capsule"],"summary":"Unlock encrypted content","description":"Unlocks encrypted Capsule content using the DCA v2 unlock request format. Uses `contentKeys` with optional `contentKeyMap` for keyName-based access (pass-as-keyName). Supports authenticated users with entitlements and pre-signed share tokens.","security":[{"OpenID":[]},{}],"parameters":[{"schema":{"type":"string","example":"varldenom"},"required":true,"description":"The vendor identifier","name":"vendorId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"resourceJWT":{"type":"string"},"contentKeys":{"type":"object","additionalProperties":{"type":"object","properties":{"contentKey":{"type":"string"},"periodKeys":{"type":"object","additionalProperties":{"type":"string"}}}}},"clientPublicKey":{"type":"string"},"shareToken":{"type":"string"},"contentKeyMap":{"type":"object","additionalProperties":{"type":"string"}}},"required":["resourceJWT","contentKeys"]}}}},"responses":{"200":{"description":"Derived keys for decrypting content","headers":{"cache-control":{"schema":{"type":"string"},"required":false},"vary":{"schema":{"type":"string"},"required":false},"Last-Modified":{"schema":{"type":"string"},"required":false},"X-Request-Id":{"schema":{"type":"string"},"required":false}},"content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"object","additionalProperties":{"type":"object","properties":{"contentKey":{"type":"string"},"periodKeys":{"type":"object","additionalProperties":{"type":"string"}}}}},"transport":{"type":"string","enum":["direct","client-bound"]}},"required":["keys"]},"example":{"keys":{"bodytext":{"periodKeys":{"260326T10":"base64url-encoded-key..."}}}}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}},"/auth/:vendorId/login":{"get":{"tags":["auth"],"summary":"Initiate login","description":"Initiates the OAuth authorization code flow with PKCE. Redirects to the auth server.","parameters":[{"schema":{"type":"string","description":"Vendor ID","example":"my-vendor"},"required":true,"name":"vendorId","in":"path"},{"schema":{"type":"string","description":"URL to redirect to after successful login","example":"https://app.example.com/dashboard"},"required":false,"name":"return_to","in":"query"},{"schema":{"type":"string","description":"The API audience to request","example":"https://api.sesamy.com"},"required":false,"name":"audience","in":"query"},{"schema":{"type":"string","description":"Space-separated list of scopes","example":"openid profile email offline_access"},"required":false,"name":"scope","in":"query"}],"responses":{"302":{"description":"Redirect to authorization server","headers":{"Location":{"schema":{"type":"string"},"required":true}}},"500":{"description":"Token handler not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"]}}}}}}},"/auth/:vendorId/callback":{"get":{"tags":["auth"],"summary":"OAuth callback","description":"Handles the OAuth callback, exchanges code for tokens, and sets cookies.","parameters":[{"schema":{"type":"string","description":"Vendor ID","example":"my-vendor"},"required":true,"name":"vendorId","in":"path"},{"schema":{"type":"string","description":"Authorization code from auth server"},"required":false,"name":"code","in":"query"},{"schema":{"type":"string","description":"State parameter for CSRF protection"},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","description":"Error code if authorization failed"},"required":false,"name":"error","in":"query"},{"schema":{"type":"string","description":"Human-readable error description"},"required":false,"name":"error_description","in":"query"}],"responses":{"302":{"description":"Redirect to return URL or home","headers":{"Location":{"schema":{"type":"string"},"required":true}}},"400":{"description":"Invalid callback parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"]}}}},"500":{"description":"Token exchange failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"]}}}}}}},"/auth/logout":{"get":{"tags":["auth"],"summary":"Logout","description":"Clears auth cookies and optionally redirects to auth server logout.","parameters":[{"schema":{"type":"string","description":"URL to redirect to after logout","example":"https://app.example.com"},"required":false,"name":"return_to","in":"query"},{"schema":{"type":"string","description":"Set to \"true\" to only clear local cookies without redirecting to the auth server. By default the auth server session is also cleared.","example":"true"},"required":false,"name":"local_only","in":"query"}],"responses":{"302":{"description":"Redirect after logout","headers":{"Location":{"schema":{"type":"string"},"required":true}}}}}},"/auth/userinfo":{"get":{"tags":["auth"],"summary":"Get user info","description":"Returns information about the currently authenticated user from cookies.","responses":{"200":{"description":"User information","content":{"application/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"sub":{"type":"string"},"exp":{"type":"number"},"scope":{"type":"string"}},"required":["authenticated"]}}}}}}},"/support-session":{"get":{"tags":["support-session"],"summary":"Generate support session token","description":"Generates a short-lived signed JWT for authenticating the current user with the support messenger.","security":[{"OpenID":[]}],"responses":{"200":{"description":"A signed support session token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportSessionToken"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Unauthorized"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Forbidden"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"example":{"message":"Not Found"}}}},"503":{"description":"Service Unavailable - Failed to connect to upstream service"}}}}}}