{"openapi":"3.1.0","info":{"title":"Swipefast API","version":"1.0.0","description":"Sell, read your numbers, and automate your funnels. Authenticate every request with your key from Settings: `Authorization: Bearer sf_live_…`"},"servers":[{"url":"https://swipefast.jacob-98c.workers.dev"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key from Settings"}}},"paths":{"/api/v1/products":{"get":{"operationId":"list-products","summary":"List your products","description":"Every product on your account, with its price, address and status.\n\n`pricing_type` is `onetime` or `subscription`; subscriptions also carry `billing_interval` (`month` or `year`).","tags":["Products"],"security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":[{"id":"prd_a1b2c3","name":"The Launch Playbook","slug":"launch-playbook","price_cents":9900,"currency":"usd","pricing_type":"onetime","billing_interval":null,"status":"live"}]}}}},"401":{"description":"Missing or invalid API key"}}}},"/api/products/{productId}/funnel":{"get":{"operationId":"product-funnel","summary":"Get a product's whole funnel","description":"The add-ons, upsells and every post-purchase email attached to one product.\n\nWorks with your key or a signed-in dashboard session.","tags":["Products"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"productId","in":"path","required":true,"description":"The product's id, from List your products.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"bumps":[{"id":"bmp_1","headline":"Add the Swipe File Vault — $27","price_cents":2700,"active":1}],"upsells":[{"id":"ups_1","headline":"Upgrade to the full implementation call","price_cents":20000,"active":1}],"downsells":[],"emails":[{"position":1,"send_day":0,"subject":"You're in — here's your access","body":"…"}]}}}},"401":{"description":"Missing or invalid API key"}}}},"/api/v1/orders":{"get":{"operationId":"list-orders","summary":"List your orders","description":"Your latest 100 orders, newest first, each with its line items. Test orders are never included.\n\n`status` is `paid`, `refunded`, or `authorized` (card held while the buyer decides on an upsell).\n`items[].kind` is `main`, `bump`, `upsell`, or `discount` (discounts are negative). `downsell` appears only on orders taken before downsells were retired.\nOrders carry the campaign that produced them: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`.","tags":["Orders"],"security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":[{"id":"ord_x1y2z3","product_id":"prd_a1b2c3","customer_email":"buyer@example.com","customer_name":"Alex Buyer","total_cents":12600,"currency":"usd","status":"paid","utm_source":"newsletter","utm_campaign":"july-launch","created_at":"2026-07-20T14:03:22.181Z","items":[{"kind":"main","label":"The Launch Playbook","amount_cents":9900},{"kind":"bump","label":"Add the Swipe File Vault — $27","amount_cents":2700}]}]}}}},"401":{"description":"Missing or invalid API key"}}},"post":{"operationId":"create-order","summary":"Record an order","description":"Create an order from your own code — an external checkout, an import, an automation. It settles immediately.\n\nFires the `order.paid` webhook and any matching automations, exactly like a checkout sale.","tags":["Orders"],"security":[{"bearerAuth":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["productSlug","email"],"properties":{"productSlug":{"type":"string","description":"The product's slug, from List your products."},"email":{"type":"string","description":"The buyer's email."},"name":{"type":"string","description":"The buyer's name."},"bumpIds":{"type":"array","description":"Ids of add-ons to include.","items":{"type":"string"}},"affiliateCode":{"type":"string","description":"Credit this partner with the sale."}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"ok":true,"orderId":"ord_x1y2z3","totalCents":9900}}}},"401":{"description":"Missing or invalid API key"}}}},"/api/metrics/{productId}":{"get":{"operationId":"product-metrics","summary":"Get a product's numbers","description":"Revenue, orders, average order, add-on and upsell rates, refunds — plus monthly series for charts.\n\n`mrrByMonth` and `churnByMonth` are filled for subscription products only.\nTest orders never count.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"productId","in":"path","required":true,"description":"The product's id.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"product":{"id":"prd_a1b2c3","name":"The Launch Playbook","pricingType":"onetime"},"summary":{"revenueCents":2313900,"orders":230,"aovCents":100600,"bumpTakeRate":21,"upsellTakeRate":8,"activeSubscriptions":0,"mrrCents":0,"refunds":3,"refundedCents":29900,"refundRate":1.3,"views":4100,"conversionRate":5.6,"customers":224},"revenueByMonth":[{"month":"2026-06","value":412300}],"mrrByMonth":[],"churnByMonth":[]}}}},"401":{"description":"Missing or invalid API key"}}}},"/api/cron/daily":{"post":{"operationId":"run-daily","summary":"Run the daily collections job","description":"Charges subscription renewals that have come due, retries declined cards, nudges checkouts that stalled, and settles payment holds a buyer never finalised. Point a once-a-day schedule at this — nothing else calls it.\n\nSafe to run more than once a day — nothing is charged twice and a buyer is only ever nudged once.","tags":["Scheduled"],"security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"ok":true,"rebills":{"charged":12,"chargedCents":58800,"retried":1,"canceled":0},"recovery":{"sent":3,"recovered":1},"holdsSettled":2}}}},"401":{"description":"Missing or invalid API key"}}}}},"webhooks":{"order.paid":{"post":{"summary":"Sale completed","description":"A checkout settles — including held orders once the buyer decides on the upsell.","requestBody":{"content":{"application/json":{"example":{"event":"order.paid","orderId":"ord_x1y2z3","product":"The Launch Playbook","productId":"prd_a1b2c3","email":"buyer@example.com","totalCents":12600,"affiliate":"ryanh","accessUrl":"https://your-course.com/access","supportEmail":"help@you.com","sentAt":"2026-07-20T14:03:24.001Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"order.refunded":{"post":{"summary":"Order refunded","description":"You refund an order. Any subscription born from it is cancelled, and its commission is voided.","requestBody":{"content":{"application/json":{"example":{"event":"order.refunded","orderId":"ord_x1y2z3","product":"The Launch Playbook","email":"buyer@example.com","totalCents":12600,"sentAt":"2026-07-21T09:12:00.410Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"upsell.accepted":{"post":{"summary":"Upsell taken","description":"A buyer says yes to the post-purchase upsell.","requestBody":{"content":{"application/json":{"example":{"event":"upsell.accepted","orderId":"ord_x1y2z3","upsell":"Upgrade to the full implementation call","amountCents":20000,"email":"buyer@example.com","sentAt":"2026-07-20T14:04:01.812Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"subscription.rebilled":{"post":{"summary":"Renewal collected","description":"A subscription's renewal charge went through.","requestBody":{"content":{"application/json":{"example":{"event":"subscription.rebilled","subscriptionId":"sub_m4k3r","product":"Maker Club Membership","email":"member@example.com","amountCents":4900,"sentAt":"2026-08-21T09:00:04.120Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"subscription.payment_failed":{"post":{"summary":"Renewal failed","description":"A renewal charge was declined. Swipefast retries in 3 days; after 4 failed tries the subscription cancels.","requestBody":{"content":{"application/json":{"example":{"event":"subscription.payment_failed","subscriptionId":"sub_m4k3r","product":"Maker Club Membership","email":"member@example.com","amountCents":4900,"attempt":1,"nextTryDays":3,"sentAt":"2026-08-21T09:00:04.560Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"subscription.canceled":{"post":{"summary":"Subscription cancelled","description":"You cancel a subscription. `subscription.paused` and `subscription.resumed` fire the same shape for those actions.","requestBody":{"content":{"application/json":{"example":{"event":"subscription.canceled","subscriptionId":"sub_m4k3r","product":"Maker Club Membership","email":"member@example.com","mrrCents":4900,"sentAt":"2026-07-21T10:00:12.230Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"affiliate.paid":{"post":{"summary":"Partner paid","description":"You record a commission payout to a partner.","requestBody":{"content":{"application/json":{"example":{"event":"affiliate.paid","affiliate":"ryanh","name":"Ryan H","email":"ryan@example.com","amountCents":12000,"commissionCount":3,"payoutId":"pay_9f8e7d","sentAt":"2026-07-21T11:30:00.000Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}},"funnel.email.sync":{"post":{"summary":"Email handed over","description":"A seller pushes their post-purchase emails to your tool — one event per email.","requestBody":{"content":{"application/json":{"example":{"event":"funnel.email.sync","productId":"prd_a1b2c3","productSlug":"launch-playbook","product":"The Launch Playbook","position":1,"sendDay":0,"subject":"You're in — here's your access","body":"…full email body…","sentAt":"2026-07-19T16:21:00.551Z"}}}},"responses":{"200":{"description":"Return any 2xx to acknowledge."}}}}}}