Documentation Index
Fetch the complete documentation index at: https://docs.prudra.dev/llms.txt
Use this file to discover all available pages before exploring further.
Session expiry and renewal
Every payment session has a TTL (time-to-live). When the TTL elapses, the session is expired and the next request with that session ID triggers a fresh 402 payment requirement — as if the session ID was never sent.Default TTL
The default session TTL is 24 hours from creation. This means an agent can make session requests for up to 24 hours after the initial payment.Custom TTL
To set a custom TTL, configure thesessionTtl option (in seconds) when creating the session on the server side. This is passed through payMiddleware configuration.
| Option | Default | Minimum | Maximum |
|---|---|---|---|
sessionTtl | 86400 (24h) | 60 (1 min) | 604800 (7 days) |
What happens on expiry
When a request arrives with an expired session ID:- Prudra looks up the session and finds
expiresAt < now() payMiddlewaretreats it as an unauthenticated request- A fresh 402 is returned with new x402 and MPP challenges
- The agent must pay again to create a new session
Preventing expiry with persist
If a session vault needs to survive beyond the plan’s vault TTL, callvault.persist() before the session ends:
Extending a session
There is no session extension endpoint in the current version. To continue work after a session expires:- The agent receives a fresh 402 on the next request
- The agent pays again to create a new session
- The new session gets a new vault (the old session vault is unchanged)
vaultId in the metadata of the new vault (via payMiddleware context or by calling vault.addDocument() with a reference).
Related
- Add session payments — configure sessions and TTL
- Handle multi-step workflows — the full session workflow
- How sessions work — session creation and scoping
- Vault lifecycle — how vault TTL and session TTL interact

