Using sessions in scan requests
Pass asession_id in the body of any scan or analyze request to associate it with a session:
POST /v1/sessions
Create a new session explicitly to set a custom TTL or pre-register a session ID before your first scan.Request
A unique identifier for the session. Use any string that maps to the user’s conversation in your application.
Session lifetime in seconds. The session is deleted automatically after this period of inactivity. Defaults to
1800 (30 minutes).Response
Returns the created session object.Example
GET /v1/sessions/
Retrieve the current state of a session by its ID.Path parameters
The session ID to retrieve.
Example
DELETE /v1/sessions/
Delete a session and clear its stored context. Use this when a conversation ends or when you want to reset the context for a user.Path parameters
The session ID to delete.
Example
Session TTL
Sessions expire automatically afterttl_secs seconds of inactivity (default: 1800 seconds / 30 minutes). You do not need to delete sessions manually — they are cleaned up automatically when they expire.
Distributed sessions with Redis
By default, sessions are stored in memory. In multi-instance deployments, this means a request routed to a different instance won’t see the session state created by another instance. To share sessions across instances, configure a Redis backend by setting theIW_REDIS_URL environment variable: