Overview
These API endpoints provide access to subscription information including user data, expiration status, payment history, and access restrictions.Authentication
All subscription data endpoints use thecheck.expiry middleware which requires a valid saas_key parameter.
See Authentication for details on SaaS Key authentication.
Get User Subscription Data
Retrieve complete subscription details for a user.Request Parameters
SaaS authentication key matching the environment variable
SAAS_KEYCustomer domain to retrieve subscription data for
Response
Unique identifier for the user
Current subscription ID
Subscribed package identifier
Name of the subscription package
Subscription status (active, expired, suspended)
Subscription start date (ISO 8601 format)
Subscription expiration date (ISO 8601 format)
Total email credits available
Total SMS credits available
Remaining call credits in currency
Example Request
Get Subscription Expiration Date
Calculate days remaining until subscription expiration.Request Parameters
SaaS authentication key
Customer domain
Response
Number of days until subscription expires
Subscription end date (ISO 8601 format)
Whether the subscription has already expired
Example Request
Get Payment History
Retrieve payment transaction history for a user.Request Parameters
SaaS authentication key
Customer domain
Number of records to return (default: 10, max: 100)
Pagination offset (default: 0)
Response
Returns an array of payment history objects:Payment record ID
User who made the payment
Package purchased
Payment amount
Payment currency code (USD, EUR, etc.)
Gateway used (stripe, paypal, razorpay, etc.)
Gateway transaction identifier
Payment status (completed, pending, failed)
Payment timestamp (ISO 8601 format)
Example Request
Check User Restrictions
Verify if a user has any access restrictions due to subscription status.Request Parameters
SaaS authentication key
Customer domain
Response
Whether the user has restrictions
Restriction reason (expired, suspended, payment_failed, etc.)
Human-readable restriction message
List of features the user cannot access
Example Request
Error Responses
All endpoints return standard error responses:Error message
Error code (INVALID_SAAS_KEY, USER_NOT_FOUND, etc.)
Common Error Codes
| Code | Description |
|---|---|
| INVALID_SAAS_KEY | The provided SaaS key is invalid |
| USER_NOT_FOUND | No user found for the specified domain |
| SUBSCRIPTION_NOT_FOUND | User has no active subscription |
| INVALID_DOMAIN | Domain format is invalid |
Usage Example
Here’s a complete workflow for checking subscription status:Next Steps
Usage Limits
Check and manage email/SMS usage
Check Expiry
Verify subscription expiration
Subscription Packages
Learn about available packages
Payment Gateways
Configure payment methods