- Session management and authentication
- Self-service flows (login, registration, recovery, verification, settings)
- Error handling
Base URL
The Frontend API is available at your Ory Kratos public URL:Authentication
The Frontend API uses session-based authentication with two methods:Cookie-based authentication
For browser applications, Ory Kratos automatically manages sessions using HTTP cookies. After a successful login, Kratos sets a session cookie that’s automatically sent with subsequent requests.Token-based authentication
For native mobile apps and non-browser clients, use session tokens in theX-Session-Token header:
session_token field when completing API flows (non-browser flows).
Cookie handling
When integrating Ory Kratos with your application:Browser applications
- Kratos automatically sets and manages session cookies
- Ensure your application’s domain allows cookies from the Kratos domain
- Configure CORS properly to allow credentials
Server-side proxies
If you’re calling Kratos from a backend server on behalf of users:- Forward the
Cookieheader from the client’s request to Kratos - Return the
Set-Cookieheader from Kratos back to the client
Integration patterns
Single-page applications (SPA)
For React, Vue, Angular, or other SPAs:- Use cookie-based authentication
- Configure CORS to allow credentials from your SPA domain
- Use
credentials: 'include'in fetch requests
Mobile applications
For iOS, Android, or other native apps:- Use token-based authentication
- Store the session token securely (keychain/keystore)
- Include the token in the
X-Session-Tokenheader
Server-side applications
For traditional server-rendered apps:- Use cookie-based authentication
- Forward cookies between your server and Kratos
- Implement middleware to check session status
Rate limiting
Frontend API endpoints are rate-limited based on different buckets:kratos-public-low: Sensitive operations (1000 requests/minute)kratos-public-medium: Regular operations (2000 requests/minute)kratos-public-high: High-frequency operations (5000 requests/minute)
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Time when the limit resets
Error handling
The Frontend API returns errors in a consistent JSON format:Next steps
Session management
Manage user sessions and authentication
Error handling
Retrieve and display flow errors