Skip to main content
← All documentationContents ↓

API Reference: Session Tokens

Create and manage short-lived, scoped session tokens (s360_sess_*) for browsers, AI agents, and partner access.

Overview

Session tokens are short-lived, scoped credentials that you mint from your server using an API key. They are designed for client-side use, AI agents, and temporary partner access — scenarios where exposing a long-lived API key would be a security risk. Every session token value starts with s360_sess_; its identifier (returned as id) starts with sess_.

Key Concepts

  • Short-lived — Maximum lifetime is 24 hours (1440 minutes); the default is 60 minutes. Tokens cannot be renewed; mint a new one when they expire.
  • Scoped — Each token carries a subset of the creator's feature permissions plus a set of API scopes. Scopes default to read-only: schema:read and records:read.
  • Inherited ceiling — A token can never exceed the permissions or scopes of the API key (or user) that created it. If you omit featurePermissions, the token inherits all of the creator's feature permissions — pass an explicit subset for least privilege.
  • View stays view — Each feature permission keeps the level the creator holds it at. The token can change things only through the permissions listed in featureEditPermissions, the ones the creator holds with edit access when the token is minted; the rest are view-only on the token. Every feature permission an API key lists carries edit access, so a token minted with an API key can change things through all of its permissions.
  • Never admin — Session tokens never carry sysadmin or team-admin status, and full data access is only retained when the creator has it and DATA_FULL_ACCESS is included in the token's feature permissions.
  • Never your sign-in — A token minted by a signed-in Team User does not act as that user's own Simply360 session. These routes, which act on the user's own account, return 403 to a session token and to an API key: approving OAuth authorizations, listing or revoking the user's connected and authorized apps, completing a Simply Login sign-in to a Website or hosted Wizard, and linking the user's own provider account.

Endpoints

MethodPathPurpose
POST/v1/session-tokensCreate a session token (value returned once).
GET/v1/session-tokens/{sessionTokenId}Get token metadata (never the token value).
DELETE/v1/session-tokens/{sessionTokenId}Revoke a token before its natural expiry.

Who Can Inspect or Revoke a Token

A token belongs to the API key or user that minted it. Reading or revoking it by its sess_ identifier is limited to:

  • The minting credential — the same API key, or the same user signed in without an API key. Session tokens minted by that API key or user count as the same credential.
  • API key administrators — callers on the token's Team with the TEAM_ADMIN_API_KEYS feature permission (Integrations → API Keys) can read any of the Team's session tokens; revoking one minted by someone else needs edit access to that permission. Team Admins have it whenever the Team does.

Any other caller, including another member or API key of the same Team, gets 404 NOT_FOUND, exactly as if the token did not exist or had expired, so identifiers cannot be probed. An API key administrator with view-only access who tries to revoke another credential's token gets 403 FEATURE_EDIT_PERMISSION_DENIED.

Create a Session Token

Generate a scoped session token from your server using an API key, then send the token to your client. The request body accepts expiresInMinutes (1–1440, default 60), featurePermissions, oauthScopes, and free-form metadata. The response lists the token's featurePermissions and, within them, its featureEditPermissions, plus its expiresAt and actual expiresInMinutes. When the caller is itself a session token, the child token expires no later than that parent token; its returned expiresInMinutes is the remaining duration after that cap and can be fractional. API-key and Cognito callers retain the existing expiry behavior.

Revoking a parent token does not revoke child tokens it already minted. Each child remains valid independently until its own expiry, which is at or before the parent's natural expiry. There is no endpoint to list session tokens.

TypeScript SDK

const session = await s360.sessionTokens.create({
  expiresInMinutes: 60,
  featurePermissions: ['RECORD_COMMENTS'], // subset of the caller's permissions
  oauthScopes: ['schema:read', 'records:read'],
});

// session.data.token is the s360_sess_... value to send to the client (returned once).
// session.data.id is the sess_... identifier for later inspection/revocation.
console.log(`Token: ${session.data.token}`);
console.log(`Expires at: ${session.data.expiresAt}`);
console.log(`Actual lifetime in minutes: ${session.data.expiresInMinutes}`);

cURL

curl -s -X POST "https://api.simply360.app/v1/session-tokens" \
  -H "Authorization: Bearer $S360_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expiresInMinutes": 60,
    "oauthScopes": ["schema:read", "records:read"]
  }'

Valid oauthScopes values are schema:read, records:read, records:write, websites:read, websites:write, conversations:read, conversations:write, files:write, wizards:run, and admin:read. Unknown scopes are rejected with 400 INVALID_OAUTH_SCOPES; requested scopes the creator does not hold are silently dropped. Request write scopes only for the capability the token needs: records:write for record mutation and files:write for the quarantined file-upload flow.

Using a Session Token

Use a session token in the same way as an API key — pass it in the Authorization: Bearer header.

// In a browser or other client environment
import { Simply360 } from '@simply360/sdk';

const s360 = new Simply360({
  apiKey: tokenFromServer, // s360_sess_...
});

// Operations are limited to the token's scope
const records = await s360.dataRecords.list({ dataCollectionSimplyId: 'XXXX-XXXX-XXXX' });
curl -s "https://api.simply360.app/v1/data-records?dataCollectionSimplyId=XXXX-XXXX-XXXX" \
  -H "Authorization: Bearer s360_sess_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Inspect a Session Token

Fetch metadata for a token you minted — useful for checking that it is still live and which permissions it carries. A token that has expired or been revoked is deleted and returns 404. The token value itself is never returned.

const { data } = await s360.sessionTokens.get('sess_1f2e3d4c5b6a7890');
curl -s "https://api.simply360.app/v1/session-tokens/sess_1f2e3d4c5b6a7890" \
  -H "Authorization: Bearer $S360_API_KEY"
{
  "data": {
    "id": "sess_1f2e3d4c5b6a7890",
    "expiresAt": "2026-07-07T15:00:00.000Z",
    "expired": false,
    "featurePermissions": ["RECORD_COMMENTS"],
    "featureEditPermissions": ["RECORD_COMMENTS"],
    "oauthScopes": ["schema:read", "records:read"],
    "metadata": null,
    "createdAt": "2026-07-07T14:00:00.000Z"
  }
}

Revoke a Session Token

Use revoke when you need to immediately invalidate a token before its natural expiry. Pass the sess_... identifier (not the token value).

await s360.sessionTokens.revoke('sess_1f2e3d4c5b6a7890');
curl -s -X DELETE "https://api.simply360.app/v1/session-tokens/sess_1f2e3d4c5b6a7890" \
  -H "Authorization: Bearer $S360_API_KEY"

Use Cases

  • Browser proxying — Issue a short-lived, read-only token to a single-page app so it can fetch data directly without exposing your API key.
  • AI agents — Give an LLM-driven workflow tightly scoped credentials it cannot exceed, even if its prompt is compromised.
  • Third-party access — Grant a partner temporary, scoped access without giving them a permanent API key.
  • Mobile apps — Pair a backend authentication step with on-device session tokens that expire automatically.

Usage Notes

  • Tokens cannot have broader feature permissions or scopes than the credential used to create them — requested extras are dropped.
  • A feature permission the creator can only view is view-only on the token. Where the token needs edit access it does not have, the API returns 403. Tokens minted before this change was released carry no feature edit access; mint a new token instead.
  • Omitting featurePermissions inherits every feature permission the creator holds. Always pass an explicit subset for client-facing tokens.
  • Tokens default to schema:read and records:read. Include records:write explicitly for write-capable clients.
  • Expired or revoked tokens return 401 INVALID_SESSION_TOKEN. Your client should handle this by requesting a new token from your server.
  • Maximum lifetime is 1440 minutes (24 hours). Shorter durations are recommended for better security.
  • There is no list endpoint — store the id returned at creation if you need to inspect or revoke tokens later.
↑