Generates a secure, time-limited authentication token that grants access to the customer portal. Supports lookup by either Shopify customer ID or customer email address, making it flexible for various integration patterns.
What This Endpoint Returns: An encrypted JWT-like token that authenticates a customer for the subscription management portal, along with token metadata. Unlike the manage-subscription-link endpoint which returns a complete URL, this returns only the token itself.
Response Components:
token (string):
customerId (long):
Customer Lookup Methods:
Option 1: By Customer ID (Recommended)
GET /api/external/v2/customer-portal-token?customerId=12345
Option 2: By Email Address
GET /api/external/v2/customer-portal-token?email=customer@example.com
Parameter Validation:
customerId or email must be providedToken Security:
Encryption:
Expiration:
Scope:
Use Cases:
1. Custom Portal Implementations:
2. API-First Architectures:
3. Single Sign-On (SSO):
4. Email/SMS Campaigns:
5. Customer Support Tools:
Response Format:
{
"customerId": 12345,
"token": "eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcklkIjoxMjM0NSwic2hvcCI6Im15c3RvcmUubXlzaG9waWZ5LmNvbSIsInRpbWVzdGFtcCI6MTcwOTU2MjAwMH0.abc123xyz789"
}
Using the Token:
Append to Portal URL:
const { token } = await getCustomerPortalToken(customerId);
const portalUrl = `https://mystore.com/tools/recurring/customer_portal?token=${token}`;
window.location.href = portalUrl;
Store in Session:
// Store for authenticated API calls
sessionStorage.setItem('portalToken', response.token);
sessionStorage.setItem('customerId', response.customerId);
// Use in subsequent requests
fetch('/api/subscription-data', {
headers: { 'Authorization': `Bearer ${sessionStorage.getItem('portalToken')}` }
});
Mobile App Authentication:
// Generate token server-side
const tokenData = await generateToken(email);
// Send to mobile app
return {
authToken: tokenData.token,
customerId: tokenData.customerId,
expiresIn: 7200 // 2 hours in seconds
};
Important Considerations:
Token vs. Full URL:
/manage-subscription-link endpoint: Returns complete URLEmail Lookup Limitations:
Customer ID Formats:
12345gid://shopify/Customer/12345Best Practices:
Security Notes:
Comparison with Other Endpoints:
vs. /manage-subscription-link:
vs. /subscription-contracts-email-magic-link:
Authentication: Requires valid X-API-Key header
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/customer-portal-token{
"customerId": 12345,
"token": "eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcklkIjoxMjM0NSwic2hvcCI6Im15c3RvcmUubXlzaG9waWZ5LmNvbSIsInRpbWVzdGFtcCI6MTcwOTU2MjAwMH0.abc123xyz789"
}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.
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/customer-portal-token{
"customerId": 12345,
"token": "eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcklkIjoxMjM0NSwic2hvcCI6Im15c3RvcmUubXlzaG9waWZ5LmNvbSIsInRpbWVzdGFtcCI6MTcwOTU2MjAwMH0.abc123xyz789"
}