Initialize login flow for browsers
Endpoint
Query parameters
Refresh an existing login session by asking the user to sign in again. Resets the
authenticated_at time.Request a specific Authenticator Assurance Level. Use
aal2 to upgrade a session’s security by requiring multi-factor authentication.URL to redirect the browser to after successful login.
Hydra login challenge when using Kratos as an OAuth2 identity provider.
Organization ID for logging in this user (Ory Network only).
Response
The flow ID, used to fetch and submit the flow.
The flow type:
browser or api.Time when this flow expires (RFC3339 format).
Time when this flow was issued (RFC3339 format).
The original request URL.
UI container with form fields and messages.
When this flow was created.
When this flow was last updated.
Whether this is a refresh login request.
The requested Authenticator Assurance Level.
Status codes
| Status | Description |
|---|---|
| 200 | Login flow created (AJAX requests) |
| 303 | Redirect to login UI with flow ID |
| 400 | Session already available or other error |
Initialize login flow for native apps
Endpoint
Query parameters
Refresh an existing login session.
Request a specific Authenticator Assurance Level (
aal1, aal2, aal3).URL to return to after login completion.
Include a code that can retrieve the session token after login completes.
Organization ID (Ory Network only).
Headers
Session token of the identity performing the login (for AAL2 upgrades).
Response
Returns the same login flow object as the browser endpoint.Status codes
| Status | Description |
|---|---|
| 200 | Login flow created successfully |
| 400 | Session already available or invalid request |
Get login flow
Endpoint
Query parameters
The login flow ID from the
flow URL query parameter.Headers
HTTP Cookie header for browser flows. Required for CSRF validation.
Response
Returns the login flow object.Status codes
| Status | Description |
|---|---|
| 200 | Login flow found |
| 403 | Forbidden (CSRF violation) |
| 404 | Flow not found |
| 410 | Flow expired |
Submit login flow
Endpoint
Query parameters
The login flow ID.
Headers
HTTP Cookie header for browser flows.
Session token for API flows (AAL2 upgrades).
Request body
The request body varies by authentication method:Authentication method:
password, oidc, webauthn, code, totp, or lookup_secret.CSRF token from the flow (required for browser flows).
User’s identifier (email, username, etc.).
User’s password.
OIDC provider ID (e.g.,
google, github).The one-time code sent to the user.
Response (API flows)
The created session object.
Session token for API clients (store securely).
Response (browser flows)
Browser flows return:- 303 redirect to the
return_toURL or configured post-login URL on success - 303 redirect to the login UI with validation errors on failure
- 200 with JSON if
Accept: application/jsonheader is set
Status codes
| Status | Description |
|---|---|
| 200 | Successful login (API flows or AJAX) |
| 303 | Redirect (browser flows) |
| 400 | Form validation errors |
| 410 | Flow expired |
| 422 | Browser location change required (e.g., OIDC redirect) |
Error responses
Common error IDs in the response:session_already_available- User is already signed insecurity_csrf_violation- CSRF token validation failedsecurity_identity_mismatch- Thereturn_toURL is not allowedbrowser_location_change_required- Browser needs to navigate (OIDC flows)session_aal1_required- Multi-factor auth requested but no session exists