Skip to content

Retrieve session data

The Admin Portal provides dashboards that present Agent Intelligence session data for analysts and security teams (see Explore sessions). To get a machine-readable result, query the visibility endpoint as described in this guide. Your backend receives the current session as data: who is in the session, which agent is acting, and the session context. The endpoint returns data only–it does not allow, deny, or challenge the request.

Note

To have Mosaic evaluate a policy and return an outcome your application enforces, see Integrate Governance with Agent Intelligence.

How it works

  1. An agent loads the page. The SDK initializes with agenticCollect: true and enableSessionToken: true, and writes the session token to a cookie on your domain.
  2. The agent browses pages and performs actions while Agent Intelligence monitors this activity and writes it to the session.
  3. When your backend needs the session, such as at login, payment, or another sensitive request, it calls the visibility endpoint with the session token.
  4. The endpoint maps the token to the device's current Agent Intelligence session and returns the actor, context, and risk signals.
  5. Your backend uses that data in its own logic.
Agent IntelligenceYour backendPlatform SDKBrowserAgent IntelligenceYour backendPlatform SDKBrowserLoad the pageInitialize with agenticCollectand enableSessionTokenSet the session token cookieBrowse pages and perform actionsStream activitySensitive request, with the cookieSession token and request contextActor, context, and risk signalsUse the session data
Agent IntelligenceYour backendPlatform SDKBrowserAgent IntelligenceYour backendPlatform SDKBrowserLoad the pageInitialize with agenticCollectand enableSessionTokenSet the session token cookieBrowse pages and perform actionsStream activitySensitive request, with the cookieSession token and request contextActor, context, and risk signalsUse the session data

Before you start

  • A Mosaic application with client credentials. Create an application in the Admin Portal if you do not already have one.
  • Agent Intelligence integration. If you already use Mosaic Fraud Prevention, keep the same clientId and the same region in serverPath.

Step 1: Obtain session token

Client

Modify your Agent Intelligence integration to enable session token generation. Set enableSessionToken: true in the same SDK configuration that enables Agent Intelligence. The SDK then writes the session token to the ts_asc cookie on your site's parent domain, so a backend on another subdomain of that site receives the cookie with the request.

Add the flag inside drs, next to agenticCollect:

drs: {
  agenticCollect: true, // Enables Agent Intelligence detection
  enableSessionToken: true, // Writes the session token cookie for your backend
  serverPath: 'https://api.transmitsecurity.io/risk-collect/', // Set serverPath based on your region or custom domain
}
Note

If your API is on a different site, the browser does not send the cookie. Read the token in the page and pass it to your backend in a header or field your API accepts. With the Platform SDK in your application code, you can read it with getSessionToken().

Step 2: Query the session

Backend

Call the visibility endpoint from your backend when you want the session data. Authorize the call with a client access token generated from your client credentials.

On each sensitive request, read ts_asc and send POST /risk/v1/agent-intelligence/session with session_token. The token identifies the device, and Mosaic maps it to that device's current Agent Intelligence session. The context fields are optional. They come back in the response. Send claimed_user_id hashed. Do not send an email address, phone number, or other plain-text personal data.

// Update the API host to match your region or custom domain
const resp = await fetch(
  'https://api.transmitsecurity.io/risk/v1/agent-intelligence/session',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: 'Bearer [ACCESS_TOKEN]', // Generated with your client ID and secret
    },
    body: JSON.stringify({
      session_token: '[SESSION_TOKEN]', // Value of the ts_asc cookie
      action_type: 'transaction',
      correlation_id: '[CORRELATION_ID]',
      claimed_user_id: '[HASHED_USER_ID]',
      claimed_user_id_type: 'account_id',
      auth_context: {
        user_id: '[USER_ID]',
        auth_method: 'webauthn',
        failed_attempts: 0,
      },
    }),
  }
);

The response includes the following fields. For the full response schema, see the API reference.

FieldWhat it tells you
actor.classification_statusCLASSIFIED once an agent or bot has been detected. PENDING until then. Pending is not human.
actor.session_actorsEvery actor seen in the session, such as HUMAN, AGENT, or BOT.
actor.initiated_byWho started the session.
actor.current_actorWho is acting at the time of the call.
actor.current_platform_idThe agent platform acting now, when the current actor is an agent.
actor.detectedEach platform seen in the session, including its type and origin.
contextSession details, such as the session ID, entry page, current page, and the context fields you sent. Device, browser, and IP data are included when available.
risk_signalsDevice and network signals for the session, such as tampering or an anonymizing network.

Errors:

  • 401 means the token is missing or invalid.
  • 403 means the token belongs to another tenant.
  • 404 means there is no current session for the device, the visibility endpoint is not enabled for the tenant, or the session ended from inactivity.
  • 410 means the session reached its maximum duration.
  • 429 means the tenant exceeded its rate limit.
  • 503 means the session could not be read.

404, 410, and 503 should be treated as unknown. Do not treat them as a human session or as an allow.

A token can cover more than one session on the same device. Each response is about the device's current session, and context.session_id identifies that session.