> ## Documentation Index
> Fetch the complete documentation index at: https://developers.appstle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate customer portal magic link

> Generates a secure, time-limited magic link that allows customers to access and manage their subscriptions. This passwordless authentication link directs customers to the subscription management portal.

**Magic Link Features:**
- **Passwordless Access**: No login credentials required, link serves as authentication
- **Time-Limited**: Link expires after configured duration (typically 24-72 hours)
- **Single Customer**: Link is bound to specific customer ID, cannot be reused for others
- **Secure Token**: Uses cryptographically secure JWT tokens for authentication
- **Customer Portal**: Directs to full-featured self-service subscription portal

**Returned Information:**
- **Magic Link URL**: Full URL to customer portal with embedded authentication token
- **Token**: JWT token value (can be used separately if needed)
- **Expiration Time**: When the magic link will expire (ISO 8601 format)
- **Customer ID**: Shopify customer ID the link is generated for
- **Shop Domain**: Store domain where subscriptions are hosted

**Customer Portal Capabilities (via Magic Link):**
- View all active and paused subscription contracts
- Update shipping address for upcoming deliveries
- Change payment method for future billing
- Pause or resume subscription deliveries
- Skip upcoming delivery orders
- Modify delivery frequency (e.g., monthly to bi-monthly)
- Add or remove products from subscription
- Swap product variants (size, flavor, color)
- Cancel subscription with reason feedback
- View order history and upcoming deliveries
- Apply discount codes to subscription

**Common Use Cases:**
- Send magic link via email for customer self-service
- Include link in transactional emails (order confirmation, shipping notices)
- Customer support: provide link to customers over phone/chat
- Embed link in customer account page or dashboard
- Automated email campaigns for subscription management reminders
- Post-purchase flows to encourage subscription modifications
- Win-back campaigns: send magic link to cancelled/paused customers

**Security Notes:**
- Links are single-use per session (new token generated each time)
- Tokens include shop and customer validation to prevent tampering
- Expired links automatically redirect to token request page
- Links should be sent via secure channels (HTTPS, encrypted email)

**Integration Best Practices:**
- Always send magic links via email or SMS (don't display on public pages)
- Set appropriate expiration time based on use case
- Include clear call-to-action in emails ("Manage Your Subscription")
- Handle expired tokens gracefully with re-send functionality
- Track magic link generation for security audit logs

**Authentication:** Requires API key authentication via X-API-Key header or api_key parameter



## OpenAPI

````yaml /memberships/admin-api-swagger.json get /api/external/v2/manage-subscription-link/{customerId}
openapi: 3.0.1
info:
  description: >-
    Comprehensive API documentation for managing memberships, payments, and
    related operations. These APIs allow you to programmatically manage
    membership lifecycles, handle payments, configure products, and integrate
    membership functionality into your applications.
  title: Admin APIs
  version: 0.0.1
servers:
  - url: https://membership-admin.appstle.com
security: []
tags:
  - description: >-
      APIs for managing Shopify delivery profiles, shipping rates, zones, and
      free shipping configuration for subscription memberships
    name: Shipping & Delivery Profiles
  - description: >-
      APIs for retrieving historical discount code usage and redemption
      information for membership contracts
    name: Customer Discount History
  - description: >-
      APIs for managing membership cancellation flow settings including
      retention offers, survey questions, and cancel confirmation screens
    name: Cancellation Flow Configuration
  - description: >-
      APIs for managing membership billing attempts, recurring orders, payment
      retries, order history, and order skipping
    name: Billing & Orders
  - description: >-
      APIs for managing one-time product additions to upcoming subscription
      orders, including adding, retrieving, and removing one-off items
    name: One-Time Add-Ons
  - description: >-
      APIs for managing membership/subscription plan groups, including creating
      plans, configuring discounts, billing intervals, and assigning products to
      plans
    name: Membership Plans
  - description: >-
      APIs for managing subscription product bundles, bundle configurations,
      item grouping, and bundle-specific discount codes
    name: Product Bundles
  - description: >-
      APIs for retrieving custom CSS styles applied to subscription widgets and
      customer portal for theme customization
    name: Custom CSS Styling
  - description: >-
      APIs for managing customer portal settings including UI customization,
      text labels, feature toggles, and branding options for the member
      self-service portal
    name: Customer Portal Configuration
  - description: >-
      APIs for managing membership/subscription contracts including creation,
      updates, status changes, line items, discounts, and billing operations
    name: Membership Contracts
  - description: >-
      APIs for managing subscription bundle configuration settings including
      bundle behavior, pricing rules, and display options
    name: Bundle Settings
  - description: >-
      APIs for managing customer payment methods, payment tokens, and payment
      method retrieval for subscriptions
    name: Customer Payment Methods
  - description: >-
      APIs for retrieving product swap/substitution options allowing members to
      exchange subscription items based on configured swap rules and variant
      groups
    name: Product Swap Rules
  - description: >-
      APIs for retrieving product catalog, variants, pricing, and inventory
      information for subscription memberships.
    name: Product & Inventory Data
  - description: >-
      APIs for managing shop-level membership settings, configuration, and
      general store information.
    name: Shop Settings
  - description: >-
      APIs for performing bulk/mass operations on multiple membership contracts
      including status updates, product replacements, and billing date changes.
    name: Bulk Operations
paths:
  /api/external/v2/manage-subscription-link/{customerId}:
    get:
      tags:
        - Membership Contracts
      summary: Generate customer portal magic link
      description: >-
        Generates a secure, time-limited magic link that allows customers to
        access and manage their subscriptions. This passwordless authentication
        link directs customers to the subscription management portal.


        **Magic Link Features:**

        - **Passwordless Access**: No login credentials required, link serves as
        authentication

        - **Time-Limited**: Link expires after configured duration (typically
        24-72 hours)

        - **Single Customer**: Link is bound to specific customer ID, cannot be
        reused for others

        - **Secure Token**: Uses cryptographically secure JWT tokens for
        authentication

        - **Customer Portal**: Directs to full-featured self-service
        subscription portal


        **Returned Information:**

        - **Magic Link URL**: Full URL to customer portal with embedded
        authentication token

        - **Token**: JWT token value (can be used separately if needed)

        - **Expiration Time**: When the magic link will expire (ISO 8601 format)

        - **Customer ID**: Shopify customer ID the link is generated for

        - **Shop Domain**: Store domain where subscriptions are hosted


        **Customer Portal Capabilities (via Magic Link):**

        - View all active and paused subscription contracts

        - Update shipping address for upcoming deliveries

        - Change payment method for future billing

        - Pause or resume subscription deliveries

        - Skip upcoming delivery orders

        - Modify delivery frequency (e.g., monthly to bi-monthly)

        - Add or remove products from subscription

        - Swap product variants (size, flavor, color)

        - Cancel subscription with reason feedback

        - View order history and upcoming deliveries

        - Apply discount codes to subscription


        **Common Use Cases:**

        - Send magic link via email for customer self-service

        - Include link in transactional emails (order confirmation, shipping
        notices)

        - Customer support: provide link to customers over phone/chat

        - Embed link in customer account page or dashboard

        - Automated email campaigns for subscription management reminders

        - Post-purchase flows to encourage subscription modifications

        - Win-back campaigns: send magic link to cancelled/paused customers


        **Security Notes:**

        - Links are single-use per session (new token generated each time)

        - Tokens include shop and customer validation to prevent tampering

        - Expired links automatically redirect to token request page

        - Links should be sent via secure channels (HTTPS, encrypted email)


        **Integration Best Practices:**

        - Always send magic links via email or SMS (don't display on public
        pages)

        - Set appropriate expiration time based on use case

        - Include clear call-to-action in emails ("Manage Your Subscription")

        - Handle expired tokens gracefully with re-send functionality

        - Track magic link generation for security audit logs


        **Authentication:** Requires API key authentication via X-API-Key header
        or api_key parameter
      operationId: getManageSubscriptionLink
      parameters:
        - description: API Key (Deprecated - Use Header X-API-Key instead)
          in: query
          name: api_key
          required: false
          schema:
            type: string
        - in: header
          name: X-API-Key
          required: false
          schema:
            type: string
        - description: Shopify customer ID
          example: 6789012345
          in: path
          name: customerId
          required: true
          schema:
            format: int64
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenDetails'
          description: >-
            Magic link generated successfully, returns link URL and expiration
            time
        '400':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/TokenDetails'
          description: Invalid customer ID format
        '401':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/TokenDetails'
          description: Authentication required - invalid or missing API key
        '404':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/TokenDetails'
          description: Customer not found
components:
  schemas:
    TokenDetails:
      properties:
        manageSubscriptionLink:
          description: URL link for customers to manage their subscription
          example: https://myshop.com/apps/memberships/cp/manage?token=abc123
          type: string
        tokenExpirationTime:
          description: Expiration timestamp of the management token
          format: date-time
          type: string
      type: object

````