Validate Session (Bridge)
POST
/auth/bridge/validate
Validate a session token for bridge integration. Requires X-Bridge-Secret header. Session ID can be provided in JSON body, query parameter, or X-Session-ID header.
Authorizations
BridgeSecret
Bridge secret for backend integration
Type
API Key (header: X-Bridge-Secret)
Parameters
Query Parameters
session_id
Session ID as query parameter (alternative to body)
Type
string
Request Body
application/json
JSON "session_id": "ses_xyz789abc123"
{
}
Responses
Session is valid - Returns user and session information
application/json
JSON "success": true, "user": { "id": "usr_123abc", "name": "John", "last_name": "Doe", "user_name": "johndoe", "user_type": "customer", "picture": "string", "phone": "string", "is_verified": true, "two_factor": false }, "session": { "id": "ses_xyz789", "userId": "usr_123abc", "expiresAt": "string", "ipAddress": "192.168.1.1", "userAgent": "string", "lastUsedAt": "string", "two_factor_verified": 1 }, "expires_at": "string", "cached": true, "cacheSource": "ultra", "timestamp": "string"
{
}
About This Endpoint
The Bridge Validate endpoint is a critical component for integrating your backend with Flowless. It provides:
Hybrid Cache Architecture
The endpoint uses a dual-layer caching system for optimal performance:
- Ultra/Redis (Distributed Cache) - First priority, shared across instances
- UnifiedSessionCache (LRU) - Fast local cache fallback
Cache Flow:
Request → Ultra/Redis Check → UnifiedCache Check → Database Query → Repopulate Both CachesPerformance Benefits
- Cache Hit (Ultra/Redis): ~5-10ms response time
- Cache Hit (UnifiedCache): ~2-5ms response time
- Cache Miss (Database): ~50-100ms, but automatically repopulates cache
- Subsequent Requests: Fast cache hits
Cache Invalidation
When you need to force fresh data (e.g., after direct database updates), use the Cache Invalidation endpoint:
http
POST /auth/invalidate/meThis clears both cache layers, ensuring the next validation request fetches fresh data from the database.
Invalidation Flow:
1. POST /auth/invalidate/me → Clears Ultra/Redis + UnifiedCache
2. POST /auth/bridge/validate → Cache MISS → Fetches from DB
3. System automatically repopulates both caches
4. Future requests → Cache HIT with fresh dataRelated Endpoints
- POST /auth/invalidate/me - Invalidate user cache to force fresh data
- GET /auth/me - Get current user information
- POST /auth/login - User login (creates session)