Account Status API
Query the authenticated SJinn API account's balance and current subscription status.
Account Status API Overview
The Account Status API returns the account identity, current credit balance, and current subscription summary for the API key owner.
Use this endpoint before creating tasks when you need to show available credits or check whether the account currently has a membership. This endpoint is read-only, does not consume credits, and does not require an active membership.
Query Account Status
Supports both GET and POST methods. No request body or query parameters are required.
Request
GET Method:
GET /api/un-api/query_account_status
Authorization: Bearer YOUR_API_KEY
POST Method:
POST /api/un-api/query_account_status
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
Example Request
curl -X GET https://sjinn.ai/api/un-api/query_account_status \
-H "Authorization: Bearer YOUR_API_KEY"
JavaScript Example
const API_KEY = 'YOUR_API_KEY';
async function getAccountStatus() {
const response = await fetch('https://sjinn.ai/api/un-api/query_account_status', {
headers: {
'Authorization': `Bearer ${API_KEY}`,
},
});
const result = await response.json();
if (!result.success) {
throw new Error(result.errorMsg);
}
return result.data;
}
Success Response
For an account with an active direct Stripe subscription:
{
"success": true,
"errorMsg": "",
"error_code": 0,
"data": {
"email": "user@example.com",
"name": "Alice",
"balances": 12000,
"subscription": {
"tier": "Ultra",
"status": "active",
"current_period_start": "2026-05-15T00:00:00.000Z",
"current_period_end": "2026-06-15T00:00:00.000Z"
}
}
}
For a non-member account:
{
"success": true,
"errorMsg": "",
"error_code": 0,
"data": {
"email": "user@example.com",
"name": "Alice",
"balances": 12000,
"subscription": null
}
}
Response Fields
data.email(string or null) - Email address for the API key owner.data.name(string or null) - Account display name.data.balances(number) - Current credit balance. If no balance record exists, this value is0.data.subscription(object or null) - Current membership summary.nullmeans the account is not currently a member.data.subscription.tier(string) - Current membership tier, including team-inherited membership.data.subscription.status(string or null) - Direct Stripe subscription status, usually"active"or"canceled". This can benullfor inherited membership without a direct Stripe subscription.data.subscription.current_period_start(string or null) - Direct Stripe subscription period start time in ISO format.data.subscription.current_period_end(string or null) - Direct Stripe subscription period end time in ISO format.
Subscription Semantics
subscription: null is the membership check. If subscription is not null, the account currently has membership access.
For direct Stripe subscriptions, subscription.status and the current period fields describe the account's own Stripe billing period.
For team-inherited membership, subscription.tier is still returned, but status, current_period_start, and current_period_end are null because there is no direct Stripe billing period on the member account.
Valid direct subscriptions take precedence over team inheritance. If an account has its own valid Lite subscription and also belongs to an Enterprise team, this endpoint returns tier: "Lite" for the direct subscription. Team-inherited membership is used only when the account has no valid direct subscription.
Canceled subscriptions remain active until current_period_end; during that period the endpoint returns status: "canceled" with the period dates.
Error Response
{
"success": false,
"errorMsg": "Invalid access token",
"error_code": 0
}
Common error cases:
- Missing API key returns HTTP
401withMissing access token. - Invalid API key returns HTTP
401withInvalid access token. - Unsupported methods return HTTP
405withMethod not allowed. - Database query failures return HTTP
200withsuccess: false.
Notes
- This endpoint does not consume credits.
- This endpoint does not require an active membership.
- Keep API keys on the server side. Do not expose them in browser code or public repositories.
