For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
        • AuthHandler
        • ConfigLoader
        • Environment Variables
        • Logging
        • PromptManager
        • SchemaUtils
        • ServerlessAdapter
        • SessionManager
          • cleanup
          • createSession
          • createToolToken
          • debugToken
          • deleteSessionMetadata
          • generateToken
          • getSessionMetadata
          • setSessionMetadata
          • validateToken
          • validateToolToken
        • SslConfig
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
AgentsConfigurationSessionManager

debugToken

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

deleteSessionMetadata

Next
Built with

Decode token components for inspection without validating the signature. Useful for debugging token contents and checking expiration.

debugToken returns diagnostic data only when debugMode is true. With debugMode: false (the default), it returns { valid_format: false, error: "debug mode not enabled" } — matching the Python SDK’s behavior. Enable debugMode at runtime only when you need to inspect tokens.

Parameters

token
stringRequired

The base64url-encoded token to decode.

Returns

DebugTokenResult — a nested object with the following optional fields:

valid_format
boolean

true when the token decoded into five dot-separated parts; false otherwise.

components
object

Present only when valid_format is true.

components.call_id
string

Call ID extracted from the token. Truncated to 8 characters followed by ... when longer than 8 characters.

components.function
string

Function name encoded in the token.

components.expiry
string

Token expiry as a Unix timestamp string.

components.expiry_date
string | null

ISO 8601 string representation of the expiry, or null when the expiry component did not parse as a number.

components.nonce
string

The random nonce component of the token.

components.signature
string

Token signature. Truncated to 8 characters followed by ... when longer than 8 characters.

status
object

Present only when valid_format is true.

status.current_time
number

Current Unix timestamp in seconds.

status.is_expired
boolean | null

true if expired, false if still valid, null if the expiry component did not parse.

status.expires_in_seconds
number | null

Seconds remaining until expiry, or 0 when expired, or null when expiry did not parse.

parts_count
number

Only populated when valid_format is false because the decoded token had an unexpected number of dot-separated parts.

token_length
number

Length of the raw token string. Populated when valid_format is false.

error
string

Set to "debug mode not enabled" when debugMode is false, or to the caught error message when decoding failed.

Example

1import { SessionManager } from '@signalwire/sdk';
2
3const sm = new SessionManager();
4sm.debugMode = true; // enable before calling debugToken
5const token = sm.generateToken('get_weather', 'call-abc123');
6const info = sm.debugToken(token);
7
8if (info.valid_format) {
9 console.log('Function:', info.components!.function);
10 console.log('Expired:', info.status!.is_expired);
11} else {
12 console.log('Error:', info.error);
13}