---
title: "Sessions"
icon : "api"
description: "List a user's active sessions, shut them down, and push in-game toast messages."
---

# Sessions

A session represents one running instance of your script. The bulk shutdown and message endpoints wait up to **25 seconds** for running clients to acknowledge before they return, so the caller always knows the real outcome.

## List a user's sessions

<Endpoint
  method="GET"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/users/:identifier/sessions"
/>

Active sessions for the resolved user.

### Response

<CodeGroup tabs={[
  {
    title: '200 OK',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "user_id": "uuid",\n    "sessions": [\n      {\n        "session_id":      "uuid",\n        "place_id":        "606849621",\n        "place_name":      "Adopt Me!",\n        "executor":        "Synapse X",\n        "script_id":       "uuid",\n        "script_name":     "main",\n        "script_version":  "1.4.2",\n        "roblox_uid":      "12345",\n        "roblox_username": "PlayerName",\n        "started":         true,\n        "executions":      1,\n        "expires_at":      1748430000,\n        "created_at":      "2026-05-24T16:14:46.000Z"\n      }\n    ]\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "No user matches this identifier in this project",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />

The same data is also reachable via a query-string alias:

<Endpoint
  method="GET"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/users/get_sessions?discord_id=…"
/>

The alias accepts either `?discord_id=` or `?identifier=` and resolves the same three identifier shapes.

## Shut down every session for a user

<Endpoint
  method="POST"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/users/:identifier/shutdown"
/>

Force-expire every active session for the resolved user. Optional `?message=...` query string enqueues an in-game toast before the disconnect so the user sees a reason. The call blocks for up to 25 seconds while the server waits for each session to acknowledge.

### Response

<CodeGroup tabs={[
  {
    title: '200 OK · Terminated',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "success":      true,\n    "message":      "All sessions terminated",\n    "terminated":   2,\n    "pending":      0,\n    "elapsed_time": 412\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '200 OK · Partial',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "success":      false,\n    "message":      "1 terminated, 1 still pending after timeout",\n    "terminated":   1,\n    "pending":      1,\n    "elapsed_time": 25000\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '200 OK · No sessions',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "success":      true,\n    "message":      "No active sessions",\n    "terminated":   0,\n    "pending":      0,\n    "elapsed_time": 0\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "No user matches this identifier in this project",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />

`elapsed_time` is in milliseconds. When the 25-second window passes before every session acknowledges, `pending` is non-zero; those sessions will still terminate on their next heartbeat because the server has already marked them expired.

## Message every session for a user

<Endpoint
  method="POST"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/users/:identifier/message"
/>

Push the same in-game toast to every active session for the resolved user.

Query parameters:

| Name | Required | Notes |
|---|---|---|
| `message` | yes | Toast body. |
| `title` | no | Optional title rendered as `"{title}\n{message}"`. Combined text is truncated to 256 characters. |

### Response

<CodeGroup tabs={[
  {
    title: '200 OK · Delivered',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "success":      true,\n    "message":      "All toasts delivered",\n    "delivered":    2,\n    "pending":      0,\n    "elapsed_time": 314\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '200 OK · No sessions',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "success":      true,\n    "message":      "No active sessions to message",\n    "delivered":    0,\n    "pending":      0,\n    "elapsed_time": 0\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '422 Validation',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "`message` query parameter is required",\n  "code":  "VALIDATION",\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "No user matches this identifier in this project",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />

## Shut down one specific session

<Endpoint
  method="POST"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/sessions/:session_id/shutdown"
/>

Force-expire a single session by its ID. Use this when you already have a `session_id` from a `GET /sessions` call and want to kick exactly that one. No body required.

### Response

<CodeGroup tabs={[
  {
    title: '200 OK',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "shutdown":     true,\n    "transport":    "websocket",\n    "delivered":    true,\n    "elapsed_time": 87\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "Session not found",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />

## Message one specific session

<Endpoint
  method="POST"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/sessions/:session_id/message"
/>

Push a single in-game toast to one session. Same `?title=&message=` query parameters as the user-level message endpoint, scoped to one session.

### Response

<CodeGroup tabs={[
  {
    title: '200 OK',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "queued":       true,\n    "transport":    "websocket",\n    "delivered":    true,\n    "elapsed_time": 92\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '422 Validation',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "`message` query parameter is required",\n  "code":  "VALIDATION",\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "Session not found",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />
