Retrieves the current subscription status directly from Stripe, including trial information if the subscription is in a trial period.
Authentication Required : This endpoint requires a Clerk JWT token with
organization context. The organization is determined from the org_id claim
in the token.
Bearer token with organization context: Bearer {clerk_jwt_token}
Response
Subscription status from Stripe: trialing, active, canceled, past_due, unpaid, incomplete, incomplete_expired, or none if no subscription exists.
Unix timestamp (seconds) when the trial ends. Only present if status is trialing.
Number of days remaining in the trial period. Only present if status is trialing.
curl -X GET https://searchcompany-main.up.railway.app/api/subscription-status \
-H "Authorization: Bearer YOUR_CLERK_JWT_TOKEN"
Trialing Response
Active Response
No Subscription
{
"status" : "trialing" ,
"trial_end" : 1736899200 ,
"days_remaining" : 7
}
Errors
Status Description 401 Missing or invalid authentication token 401 No organization context in token 404 Organization not found 500 Database not configured
Usage
// Get token with organization context
const token = await getToken ({ organizationId: organization . id });
const response = await fetch ( "/api/subscription-status" , {
headers: {
Authorization: `Bearer ${ token } ` ,
},
});
const { status , days_remaining } = await response . json ();
if ( status === "trialing" && days_remaining !== null ) {
console . log ( `Trial ends in ${ days_remaining } days` );
}