API Reference
Is Logged In
Check Login Status
Use this endpoint to verify whether the current client session is still authenticated and the provided Access Token is valid.
This endpoint is commonly used during application startup, page refreshes, or before accessing protected resources to determine whether the client should remain signed in or be redirected to the login screen.
When to use this endpoint?
Call Is Logged In when you need to:
- Verify that the current Access Token is still valid.
- Restore an authenticated session after a page refresh.
- Check whether a client is currently signed in.
- Validate authentication before loading protected resources.
- Confirm the client's identity without performing a new login.
Request Headers
| Header | Value | Description |
|---|---|---|
| Authorization | Bearer <access_token> | The Access Token to be validated. |
| is-tenant | true | Targets the tenant DB ("true", needs x-client-id) or the root DB ("false", e.g. client register/create). |
| x-client-id | <client_id> | The Client ID to be validated. |
Example Request
Authorization: Bearer <access_token>
is-tenant: true
x-client-id: <client_id>{baseUrl}/api/{apiVersion}/auth/jwt/client/is-logged-inAuthentication
Required (Bearer token)
Request Headers
| Header | Value | Description |
|---|---|---|
| is-tenant | false | Targets the tenant DB ("true", needs x-client-id) or the root DB ("false", e.g. client register/create). |
Request Parameters
This endpoint does not require a request body.
Success Response (HTTP 200 OK)
If the Access Token is valid, the API confirms that the client is authenticated and returns the current session information.
{
"success": true,
"message": "You are logged in",
"data": {
"client": {
"_id": "699fe1377846dcfb775c645c",
"name": "client pro 1",
"email": "cilentpro1@yoopmail.com",
"slug": "client-pro-1",
"isActive": true,
"createdAt": "2026-02-26T05:59:19.339Z",
"updatedAt": "2026-02-26T05:59:20.031Z"
},
"refreshToken": "<refresh_token>"
},
"error": null
}Error Responses
If the Access Token is missing, invalid, or has expired, authentication fails.
HTTP 401 Unauthorized
{
"success": false,
"message": "Session expired",
"data": null,
"error": null
}| Code | Reason |
|---|---|
| 400 Bad Request | Required headers are missing or invalid. |
| 401 Unauthorized | Access Token is missing, invalid, or expired. |
| 403 Forbidden | Client does not have permission to access the resource. |
| 500 Internal Server Error | An unexpected error occurred while processing the request. |
Workflow
Follow this flow to validate a client session and decide whether to continue, refresh the token, or send the user back to login.
- 1
Obtain an Access Token
Authenticate the client using Register Client or Login Client. Store the returned Access Token securely.
- 2
Call Is Logged In
Send a request to the Is Logged In endpoint with the Authorization header and tenant headers when required.
httpAuthorization: Bearer <access_token> - 3
Token Validation
RealtimeX validates the Access Token and verifies that the client session is active.
- 4
Receive the Response
If the token is valid, the API returns the current authentication status. Otherwise, an authentication error is returned.
- 5
Continue or Refresh
Proceed with protected APIs, refresh the token if it has expired, or redirect the user to the login flow.
Best Practices
- Call this endpoint when your application initializes or after a page refresh.
- Always include the latest Access Token in the Authorization header.
- If the request returns 401 Unauthorized, use the Refresh Token endpoint to obtain a new Access Token before requiring the client to sign in again.
- Do not repeatedly call this endpoint before every API request. Instead, cache the authentication state and validate it only when necessary.
- Always communicate with the API over HTTPS to protect authentication credentials.