RealTimeX
Start For Free

RealTimeX

API Documentation

IntroductionAuthenticationBase URLHeadersError codes
RegisterLoginIs logged inRefresh tokenLogout client
Sample requestsSample responsesStatus codesAppendixChangelog

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

HeaderValueDescription
AuthorizationBearer <access_token>The Access Token to be validated.
is-tenanttrueTargets 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
http
Authorization: Bearer <access_token>
is-tenant: true
x-client-id: <client_id>
GET{baseUrl}/api/{apiVersion}/auth/jwt/client/is-logged-in

Authentication

Required (Bearer token)

Request Headers

HeaderValueDescription
is-tenantfalseTargets 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.

json
{
  "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
json
{
  "success": false,
  "message": "Session expired",
  "data": null,
  "error": null
}
CodeReason
400 Bad RequestRequired headers are missing or invalid.
401 UnauthorizedAccess Token is missing, invalid, or expired.
403 ForbiddenClient does not have permission to access the resource.
500 Internal Server ErrorAn 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. 1

    Obtain an Access Token

    Authenticate the client using Register Client or Login Client. Store the returned Access Token securely.

  2. 2

    Call Is Logged In

    Send a request to the Is Logged In endpoint with the Authorization header and tenant headers when required.

    http
    Authorization: Bearer <access_token>
  3. 3

    Token Validation

    RealtimeX validates the Access Token and verifies that the client session is active.

  4. 4

    Receive the Response

    If the token is valid, the API returns the current authentication status. Otherwise, an authentication error is returned.

  5. 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.
PreviousLoginNextRefresh token

On this page

Check Login StatusWhen to use this endpoint?Request HeadersRequest ParametersSuccess ResponseError ResponsesWorkflowBest Practices