> ## 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 link

> Generates a secure, time-limited link that allows customers to access their subscription management portal. This link provides customers with self-service capabilities to manage their subscriptions without requiring login credentials.

**Key Features:**
- Generates unique encrypted token for customer authentication
- Token expires after 2 hours for security
- Direct access to subscription management without password
- Uses store's custom domain when available
- Supports white-label customer portals

**Token Security:**
- Token contains encrypted customer ID, shop, and timestamp
- Cannot be reused after expiration
- Unique token generated for each request
- Cryptographically secure encryption

**Customer Portal Access:**
Once customers click the link, they can:
- View all active subscriptions
- Update payment methods
- Change delivery addresses
- Modify product quantities
- Pause or cancel subscriptions
- Update delivery schedules
- Apply discount codes
- View order history

**Use Cases:**
- Email campaigns with 'Manage Subscription' CTAs
- Customer service providing quick access
- Post-purchase email flows
- Account management integrations
- Reducing support ticket volume

**URL Structure:**
The generated URL follows this pattern:
`https://[store-domain]/[manage-subscription-path]?token=[encrypted-token]`

**Important Notes:**
- Links are single-use and expire after 2 hours
- New link must be generated after expiration
- Customer ID must be valid and active
- Store must have customer portal configured

**Authentication:** Requires valid X-API-Key header



## OpenAPI

````yaml /subscription/admin-api-swagger.json get /api/external/v2/manage-subscription-link/{customerId}
openapi: 3.0.1
info:
  description: >-
    Comprehensive API documentation for managing subscriptions, payments, and
    related operations. These APIs allow you to programmatically manage
    subscription lifecycles, handle payments, configure products, and integrate
    subscription functionality into your applications.
  title: Admin APIs
  version: 0.0.1
servers:
  - url: https://subscription-admin.appstle.com
security: []
tags:
  - description: >-
      Core APIs for managing the complete subscription lifecycle including
      creation, updates, pausing, resuming, and cancellation of subscriptions.
    name: Subscription Management
  - description: >-
      APIs for managing subscription payment methods, processing payments,
      handling payment retries, and updating billing information.
    name: Subscription Payments
  - description: >-
      APIs for managing subscription contracts including delivery schedules,
      pricing, order notes, billing cycles, and shipping addresses.
    name: Subscription Contracts
  - description: >-
      APIs for managing products within subscriptions including adding,
      removing, updating quantities, and swapping products.
    name: Subscription Products
  - description: >-
      APIs for handling billing operations, payment processing, and financial
      transactions related to subscriptions.
    name: Billing & Payments
  - description: >-
      APIs for managing discounts and promotional codes applied to
      subscriptions.
    name: Subscription Discounts
  - description: >-
      APIs for managing one-time add-on products that can be purchased alongside
      recurring subscription items.
    name: Subscription One-Time Products
  - description: >-
      APIs for managing subscription plans, pricing tiers, and plan
      configurations.
    name: Subscription Plans
  - description: >-
      APIs for managing customizable product boxes and bundles where customers
      can select multiple items.
    name: Build-a-Box & Bundles
  - description: >-
      APIs for managing the product catalog including product information,
      variants, and inventory.
    name: Product Catalog
  - description: >-
      APIs for managing operational settings, configurations, and administrative
      functions.
    name: Operations & Settings
  - description: >-
      APIs powering the customer-facing portal where subscribers can manage
      their own subscriptions.
    name: Customer Portal
  - description: APIs for managing customer information, profiles, and account details.
    name: Customers
  - description: >-
      APIs for retrieving aggregated subscription data, customer subscription
      history, and account-level subscription information.
    name: Subscription Data
  - description: >-
      APIs for managing delivery profiles, shipping rates, free shipping
      configuration, and delivery method options on subscriptions.
    name: Delivery & Shipping
  - description: >-
      APIs for managing storefront customization including custom CSS, theme
      settings, label translations, and merchant-defined widget configuration.
    name: Customization
  - description: >-
      APIs for configuring cancellation flows, retention offers, cancellation
      reason management, and win-back automation.
    name: Customer Retention
paths:
  /api/external/v2/manage-subscription-link/{customerId}:
    get:
      tags:
        - Customers
        - Subscription Contracts
      summary: Generate customer portal link
      description: >-
        Generates a secure, time-limited link that allows customers to access
        their subscription management portal. This link provides customers with
        self-service capabilities to manage their subscriptions without
        requiring login credentials.


        **Key Features:**

        - Generates unique encrypted token for customer authentication

        - Token expires after 2 hours for security

        - Direct access to subscription management without password

        - Uses store's custom domain when available

        - Supports white-label customer portals


        **Token Security:**

        - Token contains encrypted customer ID, shop, and timestamp

        - Cannot be reused after expiration

        - Unique token generated for each request

        - Cryptographically secure encryption


        **Customer Portal Access:**

        Once customers click the link, they can:

        - View all active subscriptions

        - Update payment methods

        - Change delivery addresses

        - Modify product quantities

        - Pause or cancel subscriptions

        - Update delivery schedules

        - Apply discount codes

        - View order history


        **Use Cases:**

        - Email campaigns with 'Manage Subscription' CTAs

        - Customer service providing quick access

        - Post-purchase email flows

        - Account management integrations

        - Reducing support ticket volume


        **URL Structure:**

        The generated URL follows this pattern:

        `https://[store-domain]/[manage-subscription-path]?token=[encrypted-token]`


        **Important Notes:**

        - Links are single-use and expire after 2 hours

        - New link must be generated after expiration

        - Customer ID must be valid and active

        - Store must have customer portal configured


        **Authentication:** Requires valid X-API-Key header
      operationId: getManageSubscriptionLink
      parameters:
        - deprecated: true
          description: API Key (Deprecated - Use X-API-Key header instead)
          in: query
          name: api_key
          required: false
          schema:
            type: string
        - description: API Key for authentication
          example: sk_live_1234567890abcdef
          in: header
          name: X-API-Key
          required: true
          schema:
            type: string
        - description: >-
            Customer ID to generate portal link for. Provide the numeric ID
            without the gid:// prefix
          example: 987654321
          in: path
          name: customerId
          required: true
          schema:
            format: int64
            minimum: 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              examples:
                Success Response:
                  description: Success Response
                  value:
                    customerId: 987654321
                    expiresInMinutes: 120
                    manageSubscriptionLink: >-
                      https://store.example.com/pages/manage-subscriptions?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaG9wIjoic3RvcmUuZXhhbXBsZS5jb20iLCJjdXN0b21lcklkIjo5ODc2NTQzMjEsImNyZWF0ZWRBdCI6MTcxMDUxMjQwMDAwMH0.dGhpcyBpcyBhIHNhbXBsZSB0b2tlbiBmb3IgZG9jdW1lbnRhdGlvbg
                    portalUrl: https://store.example.com/pages/manage-subscriptions
                    tokenExpirationTime: '2024-03-15T16:30:00.000Z'
              schema:
                $ref: '#/components/schemas/TokenDetails'
          description: Manage subscription link successfully generated
        '400':
          content:
            application/json:
              examples:
                Invalid Customer ID:
                  description: Invalid Customer ID
                  value:
                    detail: Customer ID must be a positive number
                    status: 400
                    title: Invalid customer ID
                    type: https://example.com/errors/bad-request
                Portal Not Configured:
                  description: Portal Not Configured
                  value:
                    detail: Store has not configured a manage subscriptions URL
                    status: 400
                    title: Customer portal not configured
                    type: https://example.com/errors/bad-request
          description: Invalid request parameters
        '401':
          content:
            application/json:
              example:
                detail: Valid API key is required to access this endpoint
                status: 401
                title: Authentication required
                type: https://example.com/errors/unauthorized
          description: Authentication required - missing or invalid API key
        '403':
          content:
            application/json:
              example:
                detail: >-
                  API key does not have permission to generate customer portal
                  links
                status: 403
                title: Insufficient permissions
                type: https://example.com/errors/forbidden
          description: Insufficient permissions
        '404':
          content:
            application/json:
              example:
                detail: No customer found with ID 987654321
                status: 404
                title: Customer not found
                type: https://example.com/errors/not-found
          description: Customer not found
        '500':
          content:
            application/json:
              example:
                detail: An error occurred while generating the secure token
                status: 500
                title: Token generation failed
                type: https://example.com/errors/internal-error
          description: Internal server error
components:
  schemas:
    TokenDetails:
      properties:
        manageSubscriptionLink:
          type: string
        tokenExpirationTime:
          format: date-time
          type: string
      type: object

````