Create Settings Flow for Browsers

GET {{baseUrl}}/self-service/settings/browser?return_to=<string>

This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to selfservice.flows.settings.ui_url with the flow ID set as the query parameter ?flow=. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized.

If this endpoint is opened as a link in the browser, it will be redirected to selfservice.flows.settings.ui_url with the flow ID set as the query parameter ?flow=. If no valid user session was set, the browser will be redirected to the login endpoint.

If this endpoint is called via an AJAX request, the response contains the settings flow without any redirects or a 401 forbidden error if no valid session was set.

Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor (happens automatically for server-side browser flows) or change the configuration.

If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the error.id of the JSON response body can be one of:

security_csrf_violation: Unable to fetch the flow because a CSRF violation occurred. session_inactive: No Ory Session was found - sign in a user first. security_identity_mismatch: The requested ?return_to address is not allowed to be used. Adjust this in the configuration!

This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed.

More information can be found at Ory Kratos User Settings & Profile Management Documentation.

Request Params

KeyDatatypeRequiredDescription
return_tostringThe URL to return the browser to after the flow was completed.

HEADERS

KeyDatatypeRequiredDescription
CookiestringHTTP Cookies

When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. | | Accept | string | | |

RESPONSES

status: OK

{&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;type&quot;:&quot;\u003cstring\u003e&quot;,&quot;expires_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;issued_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;request_url&quot;:&quot;\u003cstring\u003e&quot;,&quot;ui&quot;:{&quot;action&quot;:&quot;\u003cstring\u003e&quot;,&quot;method&quot;:&quot;\u003cstring\u003e&quot;,&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;group&quot;:&quot;webauthn&quot;,&quot;attributes&quot;:{&quot;name&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;text&quot;,&quot;disabled&quot;:&quot;\u003cboolean\u003e&quot;,&quot;node_type&quot;:&quot;input&quot;,&quot;autocomplete&quot;:&quot;one-time-code&quot;,&quot;label&quot;:{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;success&quot;,&quot;context&quot;:{}},&quot;onclick&quot;:&quot;\u003cstring\u003e&quot;,&quot;onload&quot;:&quot;\u003cstring\u003e&quot;,&quot;pattern&quot;:&quot;\u003cstring\u003e&quot;,&quot;required&quot;:&quot;\u003cboolean\u003e&quot;,&quot;value&quot;:{&quot;description&quot;:&quot;The input&#39;s value.&quot;,&quot;nullable&quot;:true}},&quot;messages&quot;:[{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;success&quot;,&quot;context&quot;:{}},{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;error&quot;,&quot;context&quot;:{}}],&quot;meta&quot;:{&quot;label&quot;:{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;error&quot;,&quot;context&quot;:{}}}},{&quot;type&quot;:&quot;input&quot;,&quot;group&quot;:&quot;webauthn&quot;,&quot;attributes&quot;:{&quot;name&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;number&quot;,&quot;disabled&quot;:&quot;\u003cboolean\u003e&quot;,&quot;node_type&quot;:&quot;img&quot;,&quot;autocomplete&quot;:&quot;url&quot;,&quot;label&quot;:{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;info&quot;,&quot;context&quot;:{}},&quot;onclick&quot;:&quot;\u003cstring\u003e&quot;,&quot;onload&quot;:&quot;\u003cstring\u003e&quot;,&quot;pattern&quot;:&quot;\u003cstring\u003e&quot;,&quot;required&quot;:&quot;\u003cboolean\u003e&quot;,&quot;value&quot;:{&quot;description&quot;:&quot;The input&#39;s value.&quot;,&quot;nullable&quot;:true}},&quot;messages&quot;:[{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;info&quot;,&quot;context&quot;:{}},{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;success&quot;,&quot;context&quot;:{}}],&quot;meta&quot;:{&quot;label&quot;:{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;error&quot;,&quot;context&quot;:{}}}}],&quot;messages&quot;:[{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;success&quot;,&quot;context&quot;:{}},{&quot;id&quot;:&quot;\u003clong\u003e&quot;,&quot;text&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;success&quot;,&quot;context&quot;:{}}]},&quot;identity&quot;:{&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;schema_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;schema_url&quot;:&quot;\u003cstring\u003e&quot;,&quot;traits&quot;:{&quot;description&quot;:&quot;Traits represent an identity&#39;s traits. The identity is able to create, modify, and delete traits\nin a self-service manner. The input will always be validated against the JSON Schema defined\nin `schema_url`.&quot;},&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;credentials&quot;:{&quot;fugiat37a&quot;:{&quot;config&quot;:{},&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;identifiers&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],&quot;type&quot;:&quot;oidc&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;version&quot;:&quot;\u003clong\u003e&quot;},&quot;ut1&quot;:{&quot;config&quot;:{},&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;identifiers&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],&quot;type&quot;:&quot;totp&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;version&quot;:&quot;\u003clong\u003e&quot;}},&quot;metadata_admin&quot;:{&quot;description&quot;:&quot;NullJSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger and is NULLable-&quot;,&quot;nullable&quot;:true},&quot;metadata_public&quot;:{&quot;description&quot;:&quot;NullJSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger and is NULLable-&quot;,&quot;nullable&quot;:true},&quot;organization_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;recovery_addresses&quot;:[{&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;via&quot;:&quot;\u003cstring\u003e&quot;,&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;},{&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;via&quot;:&quot;\u003cstring\u003e&quot;,&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;}],&quot;state&quot;:&quot;active&quot;,&quot;state_changed_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;verifiable_addresses&quot;:[{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;verified&quot;:&quot;\u003cboolean\u003e&quot;,&quot;via&quot;:&quot;sms&quot;,&quot;status&quot;:&quot;\u003cstring\u003e&quot;,&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;verified_at&quot;:&quot;\u003cdateTime\u003e&quot;},{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;verified&quot;:&quot;\u003cboolean\u003e&quot;,&quot;via&quot;:&quot;email&quot;,&quot;status&quot;:&quot;\u003cstring\u003e&quot;,&quot;created_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;updated_at&quot;:&quot;\u003cdateTime\u003e&quot;,&quot;verified_at&quot;:&quot;\u003cdateTime\u003e&quot;}]},&quot;state&quot;:{&quot;description&quot;:&quot;State represents the state of this flow. It knows two states:\n\nshow_form: No user data has been collected, or it is invalid, and thus the form should be shown.\nsuccess: Indicates that the settings flow has been updated successfully with the provided data.\nDone will stay true when repeatedly checking. If set to true, done will revert back to false only\nwhen a flow with invalid (e.g. \&quot;please use a valid phone number\&quot;) data was sent.&quot;},&quot;active&quot;:&quot;\u003cstring\u003e&quot;,&quot;continue_with&quot;:[{&quot;action&quot;:&quot;show_verification_ui&quot;,&quot;flow&quot;:{&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;verifiable_address&quot;:&quot;\u003cstring\u003e&quot;,&quot;url&quot;:&quot;\u003cstring\u003e&quot;}},{&quot;action&quot;:&quot;show_verification_ui&quot;,&quot;flow&quot;:{&quot;id&quot;:&quot;\u003cuuid\u003e&quot;,&quot;verifiable_address&quot;:&quot;\u003cstring\u003e&quot;,&quot;url&quot;:&quot;\u003cstring\u003e&quot;}}],&quot;return_to&quot;:&quot;\u003cstring\u003e&quot;,&quot;transient_payload&quot;:{}}