Regenerate subscription widget scripts
Triggers regeneration and deployment of subscription widget JavaScript files for the authenticated shop. This endpoint rebuilds the widget scripts that power subscription functionality on your storefront and deploys them to CDN.
Full behavior, validation rules, and side effects
What Does This Endpoint Do? This endpoint initiates an asynchronous process to regenerate and update the JavaScript files that enable subscription widgets on your store’s theme. The widget scripts handle:
- Subscription product selection and display
- Subscription plan offerings on product pages
- Frequency and delivery interval selectors
- Subscription pricing display
- Add-to-cart subscription functionality
- Widget styling and customization
When to Use This Endpoint:
1. After Widget Settings Changes:
- Modified widget appearance or styling
- Changed subscription plan display options
- Updated widget text or labels
- Altered widget positioning or layout
- Changed frequency options display
2. After Theme Customization:
- Installed a new theme
- Updated existing theme
- Made CSS customizations affecting widgets
- Changed theme structure requiring widget updates
3. After Plan Configuration Changes:
- Added new subscription plans
- Modified existing plan details
- Changed plan pricing or discounts
- Updated plan availability rules
4. Troubleshooting:
- Widget not displaying correctly on storefront
- Subscription options showing outdated information
- Widget functionality broken after theme changes
- Script conflicts or errors on product pages
- Cache issues preventing updates from showing
5. After App Updates:
- Appstle subscription app has been upgraded
- New widget features have been released
- Bug fixes requiring script updates
How It Works:
- Initiation: API call triggers the script regeneration process
- Compilation: System compiles widget configuration, theme settings, and subscription plans into optimized JavaScript
- Deployment: Generated scripts are uploaded to CDN for fast global delivery
- Cache Invalidation: Old cached versions are invalidated
- Completion: Updated scripts become available to your storefront (typically within 1-2 minutes)
What Gets Regenerated:
- Widget JavaScript: Core widget functionality and UI components
- Configuration Data: Embedded shop-specific settings and plan information
- Styling Rules: Custom CSS and theme-specific styles
- Initialization Code: Auto-load and widget mounting logic
- Event Handlers: Customer interaction and analytics tracking
Process Details:
- Asynchronous: The regeneration happens in the background
- Non-blocking: Endpoint returns immediately (true on success)
- No downtime: Existing widgets continue working during regeneration
- Automatic deployment: Scripts are automatically deployed to CDN
- Versioning: New script versions don’t break existing functionality
Expected Behavior:
- Endpoint returns
trueimmediately to confirm process started - Script regeneration completes in background (typically 30-90 seconds)
- Updated scripts propagate to CDN (1-2 minutes)
- Browser cache may need clearing to see changes immediately
- Changes visible to customers after cache expiration (varies by browser)
Use Cases:
- Automated Deployments: Include in CI/CD pipeline after theme updates
- Widget Troubleshooting: Force refresh when widget issues occur
- Configuration Sync: Ensure widgets reflect latest settings after bulk changes
- Theme Migration: Update scripts after moving to new theme
- Testing: Regenerate scripts after making configuration changes in staging
- Maintenance: Periodic regeneration to ensure optimal performance
Important Notes:
- Safe to call multiple times (idempotent operation)
- No negative impact on existing subscriptions
- Does not modify theme files directly
- Scripts are hosted on CDN, not in your theme
- Changes apply to all store pages using subscription widgets
- Browser caching may delay visibility of changes to end users
Best Practices:
- Call this endpoint after making widget setting changes
- Wait 2-3 minutes before testing changes on storefront
- Clear browser cache when testing to see latest version
- Use in test/staging environment before production
- Avoid calling excessively (once per configuration change is sufficient)
- Monitor widget functionality after regeneration
Troubleshooting: If widgets still don’t reflect changes after regeneration:
- Wait 5 minutes for full CDN propagation
- Clear browser cache and hard refresh (Ctrl+Shift+R / Cmd+Shift+R)
- Check browser console for JavaScript errors
- Verify theme has widget embed code installed
- Confirm subscription plans are properly configured
- Test in incognito/private browsing mode
Integration Workflows:
Theme Update Workflow:
- Make theme changes
- Update widget settings if needed
- Call regenerate-scripts endpoint
- Wait 2-3 minutes
- Test widgets on storefront
- Deploy to production
Bulk Configuration Update:
- Update multiple subscription plans
- Modify widget appearance settings
- Call regenerate-scripts once (not after each change)
- Verify changes propagated correctly
Authentication: Requires valid API key via api_key parameter or X-API-Key header
Documentation Index
Fetch the complete documentation index at: https://appstleinc-aeca3e0a.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Headers
Query Parameters
API Key (Deprecated - Use Header X-API-Key instead)
Response
Script regeneration initiated successfully. Returns true to confirm the process has started. Scripts will be regenerated asynchronously in the background and deployed to CDN within 1-2 minutes.
The response is of type boolean.