## Create session `client_sessions.create_session(**kwargs) -> ClientSessionCreateSessionResponse` **post** `/v1/sessions` Create a SafetyKit identity session from server-side code before rendering pages that load the browser SDK. The request must be authenticated with a valid Bearer token. ### Parameters - `customer_session_id: String` Customer session identifier to bind to this identity session. - `duration_in_minutes: Integer` Token validity duration in minutes (1-180). Defaults to 60 if omitted. - `user_id: String` Customer user identifier to bind to this identity session. ### Returns - `class ClientSessionCreateSessionResponse` Response containing the session token and expiration details - `token: String` Short-lived session token to use as Bearer token for API calls - `account_id: String` Public account identifier to pass to the browser SDK - `client_token: String` Client session token to pass to the browser SDK - `expires_at: String` ISO 8601 timestamp when the token expires - `expires_in: Float` Seconds until the token expires ### Example ```ruby require "safety_kit" safetykit = SafetyKit::Client.new(api_key: "My API Key") response = safetykit.client_sessions.create_session puts(response) ``` #### Response ```json { "token": "sk_session_abc123...", "account_id": "acct_abc123", "client_token": "sk_session_abc123...", "expires_at": "2025-05-15T14:30:00.000Z", "expires_in": 3600 } ```