Retrieves the user's current premium tier, available categories, bandwidth limits, and subscription status. Creates a FREE tier subscription if the user doesn't have one.
GET https://premium.regardingwork.com/api/premium/user/{user_id}/status
Authorization: Bearer <jwt_token>
user_id
(integer) - The Hub User ID to check premium status forAuthorization: Bearer your_jwt_token
{
"user_id": 7,
"tier": "PREMIUM_PLUS",
"tier_name": "Premium Plus",
"is_active": true,
"available_categories": [1, 2, 3, 4, 5],
"bandwidth_limit_mb": 500,
"expires_at": "2024-12-31T23:59:59Z"
}
available_categories
contains category IDs the user can access based on their tier.
async function getUserPremiumStatus(userId, token) {
const response = await fetch(`https://premium.regardingwork.com/api/premium/user/${userId}/status`, {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + token
}
});
if (response.ok) {
const status = await response.json();
console.log(`User tier: ${status.tier_name}`);
console.log(`Available categories: ${status.available_categories.length}`);
return status;
} else {
throw new Error('Failed to get premium status');
}
}
func getUserPremiumStatus(userId: Int, token: String) async throws -> PremiumStatus {
let url = URL(string: "https://premium.regardingwork.com/api/premium/user/\(userId)/status")!
var request = URLRequest(url: url)
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
let (data, response) = try await URLSession.shared.data(for: request)
guard let httpResponse = response as? HTTPURLResponse,
httpResponse.statusCode == 200 else {
throw APIError.requestFailed
}
return try JSONDecoder().decode(PremiumStatus.self, from: data)
}