Manage App Users and Sessions
Each app has a user
model that represents users that can enroll in the application. Whenever a user
object is created, additional metadata is stored to facilitate enrollment and session management.
A single user may have one or more sessions. A session represents a single device that is (or was) signed in.
To allow a user to have more than one session, the "Multiple devices per user" feature flag must be enabled for the application.
Parameters
To retrieve, create, update or delete mobile users, follow the instructions in these sections of the documentation for your mobile user object type (e.g. user):
Deleting the user object will lock the user and wipe all app data from the user's enrolled devices. This operation is irreversible.
Version compatibility
The
sync_status
field withlast_full_sync
is only available for devices with version 4.36.0 or greater of the JourneyApps Container.Before managed runtime versions (i.e. before version 4.70), only the installed container version was reported to the backend. Since version 4.70 the runtime version was reported, though it was still erroneously called the "container version" on the backend. As of version 4.82, both the runtime and container versions are reported correctly to the JourneyApps backend.
User and Sessions API
/api/v4/
backend-deployment-id
/users/
user-id
/sessions/
session-id
/re-authenticate
POST
BASE-URL
The below examples contain a BASE-URL
placeholder. Please refer to the HTTP Endpoints section to get the base URL relevant to your deployment.
List all users
API:
Sample request:
Sample response:
Get single user
API:
Sample request:
Sample response:
Get single session
API:
Sample request:
Sample response:
Fields:
state
ENROLLED
: Currently enrolled.
LOCKED
: Locked via backend, API, or from the device. Will direct user to the login screen on next connect.
RESET
: Like locked, but will force a data wipe the next time the device connects.
NEVER_ENROLLED
: Only for legacy data.
last_connected_at
Updated every time the device connects via an API call, such as sync or data upload.
created_at
First enrollment date for this session.
last_authenticated_at
Date of the last enrollment call. Should be close to created_at
if this is the first enrollment (may not match exactly).
signed_out_at
Date of last sign out (when the state changed to LOCKED
or RESET
). Stays present when the session enrolls again.
Apart from last_connected_at
, these values only change when the user enrolls or the session is "locked". Note that in typical cases, the same session is used over multiple enrollments if the same device is used, but a new session is created if the user enrolls using a different device.
Lock user
Locking the user will automatically disable the application on all of their devices, as well as prevent them from logging in again.
Note: A user can be unlocked, in which case they will be able to log in again.
If wipe
is true, all application data on the device will be permanently deleted. This can include any data or attachments that have not uploaded to the JourneyApps Backend yet. This action cannot be undone.
API:
Or use the batch operation:
Note: the wipe parameter is required.
The response code is 204 if successful.
Unlock user
Allow a locked user to log in again.
API:
Or use the batch operation:
The response code is 204 if successful.
Wipe session
This will permanently delete all application data from the specific device. This can include any data or attachments that have not uploaded to the JourneyApps Backend yet. This action cannot be undone.
This does not affect any other sessions, and the user will still be able to log in.
API:
Or use the batch operation:
The response code is 204 if successful.
Re-authenticate session
This disables the session, requiring the user to log in again. No data is deleted on the device.
API:
Or use the batch operation:
The response code is 204 if successful.
Generate Authentication Token
Generate a temporary token that can be used for enrollment.
Authentication tokens expire 5 minutes after being created.
If the "multiple devices per user" flag is not enabled for the application, this can only be used to enroll one user at a time.
API:
Or use the batch operation:
Sample Response:
Last updated