Skip to content

Sessions

Sessions are immutable objects created from online specifications and other distinctive values initiated during the login process.

These objects receive dynamic updates through the outcomes of various processes. As online specifications evolve or application resources are modified, all affected sessions are updated in real-time.

How it works

Sessions are provided by the API upon request.

sh
GET /v1/app/session

We recommend storing the session object on the browser itself, and updating it based on your applications use load and functionality (e.g. every n minutes). The API monitors and caches environmental changes, so you can efficiently update it on every request.

The Session object

json
// session object
{
  "auth": true,
  "demo": false,
  "app": {
    "id": "app_1234567890",
    "title": "My App",
    "created":"",
    "login_url":"https://acmecorp.com/login",
    "reset_url":"https://acmecorp.com/reset-password",
    "signup_url":"https://acmecorp.com/signup",
    "network_url":"https://acmecorp.com/network",
    "stripe_pub_key":"pk_1234567890",
    "stripe_key_exists":true,
    "allow_signup": true
  }
  "account": {
    "id": "acc_1234567890",
    "domain_id": "dom_1234567890",
    "version_id": "ver_1234567890",
    "title": "Acme Corp",
    "address": "123 Any Street",
    "city": "New Orleans",
    "state": "LA",
    "zip": "12345",
    "phone": "555-555-5555",
    "contact_name": "James Doe",
    "contact_email": "jamesdoe@acmecorp.com",
    "country_id": "US",
    "url": "https://www.acmecorp.com",
    "is_app_account": 0,
    "timezone_id": "America\/Adak",
    "utc_offset": -32400,
    "counters": {
      "charges": 21,
      ...
    },
    "optional_features": [
      "payment-processing",
      ...
    ],
    "stats": {
      "user_count": 15,
      "children_count": 4,
      "role_count": 12
    }
  },
  "user": {
    "id": "usr_1234567890",
    "username": "jamesdoe",
    "name": "James Doe",
    "email": "jamesdoe@acmecorp.com",
    "avatar": "https://cdn.bckstack.com/avatars/hs737jfgc637e.jpg",
    "roles": [
      "rol_1234567890",
      ...
    ]
  },
  "access": {
    "account-users": "crud",
    ...
  },
  "access_signature": "8923jfcmo734vmpqnc49qfymIYGikU6fu6ewoufh2ou",
  "alerts": {
     ...    
  }
}
PropertyTypeDescription
authMixedA boolean indication whether the session has been fully authenticated, or an array of values provided to complete the authentication process. See the log-in workflow for more information.
demoBooleanWhether or not the session is in demo mode.
app.idStringThe app ID.
app.titleStringThe app ID.
app.createdStringThe app ID.
app.login_urlStringThe URL for logging in.
app.reset_urlStringThe URL for resetting passwords.
app.signup_urlStringThe URL for signing up new accounts.
app.network_urlStringThe URL for network invitations.
app.stripe_pub_keyStringThe Stripe public key for te app.
app.stripe_key_existsStringWhether or not the app has provided its Stripe restricted key.
app.allow_signupBooleanWhether or not the app has domains that allow for signing up new accounts.
account.idStringThe account ID.
account.domain_idStringThe domain ID for which the account was created under.
account.version_idStringThe current version of application functionality the account is subscribed.
account.titleStringThe title of the account.
account.addressStringThe street address of the account.
account.cityStringThe address city.
account.stateStringThe address state.
account.zipStringThe address zip code.
account.phoneStringThe phone number for the account.
account.contact_nameStringThe contact name for the account.
account.contact_emailStringThe contact persons email address.
account.country_idStringThe account country ID.
account.urlStringThe URL for the account website.
account.is_app_accountBooleanWhether the account created the app.
account.timezone_idStringThe account timezone ID.
account.utc_offsetIntegerThe accounts UTC timezone offset in seconds. Add this integer to any timestamped API data for converting to the accounts' timezone.
account.countersArrayAn array of aggregated values for the current account counters.
account.optional_featuresArrayAn array of optional features for which the account has subscribed.
account.statsArrayAn array of system-generated values you can use for managing resource usage.
account.stats.user_countIntegerThe count of account users.
account.stats.children_countIntegerThe child accounts networked under the account.
account.stats.role_countIntegerThe count of roles the account has active.
user.idStringThe users ID.
user.usernameStringThe users login name.
user.nameStringThe users real name.
user.emailStringThe users email address.
user.avatarStringURL for the avatar image the user has provided for their profile.
user.rolesArrayRole IDs the user has been assigned.
accessArrayAn array of access control for the current user. Array keys are feature IDs and values are CRUD permissions granted. See the access control page for more information.
access_signatureStringA signature of the current access control values. Use this value to check if cached access control has changed. See caching access for additional information.
alertsArraySystem and application alerts for display to the user. Array keys ate the alert IDs and the values are the texts to display. You can map the keys to routes for creating hyperlinks to pages.