glamorous-crayon-34702
09/23/2025, 9:35 AMchilly-king-10285
09/23/2025, 9:35 AMchilly-king-10285
09/23/2025, 9:36 AM/self-service/settings/browser
) using the user's session cookie. - The response will be a redirect to your configured settings UI URL with a ?flow=<flow-id>
parameter, or, if you use AJAX, a JSON object with the flow data. - Use the flow data to render the settings form, including the CSRF token and any other required fields. 2. When the user submits the form: - The form should submit to the action URL provided in the flow data, including the flow
ID and CSRF token. - Your back-end can handle the submission by forwarding the data to the Ory Kratos /self-service/settings
endpoint, ensuring the session cookie and CSRF token are included. Do not create the flow only at submission time. The flow must exist before the form is rendered, as it provides the necessary context and security tokens for the update to succeed. #### Example - Initialize flow when user visits settings page: bash curl -s -i -X GET \ --cookie $cookieJar --cookie-jar $cookieJar \ -H "Accept: text/html" \ <https://playground.projects.oryapis.com/self-service/settings/browser>
This returns a redirect to your settings UI with the flow
parameter, or JSON if using AJAX. Use this to render the form with the correct CSRF token and action URL. - Submit the form using the flow data: The form posts to the action URL from the flow, including the CSRF token and updated settings fields. For more details and code examples, see the official documentation on [settings flows for server-side browser clients](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#user-and-profile-settings-for-server-side-browser-clients) and [custom UI integration basics](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration). > Summary: > Always initialize the settings flow when the user visits the settings page. Do not create the flow only at submission time. The flow provides the necessary context and security for the settings update to work correctly and securely [User and profile settings for server-side browser clients](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#user-and-profile-settings-for-server-side-browser-clients) [Integration basics](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration).glamorous-crayon-34702
09/23/2025, 9:38 AMchilly-king-10285
09/23/2025, 9:38 AMchilly-king-10285
09/23/2025, 9:38 AM/self-service/settings/browser
). This ensures that all necessary security measures, such as CSRF protection and session management, are correctly applied. The API flow (/self-service/settings/api
) is only for native clients and is not safe for browser contexts—even if your front-end is rendered on the server side, it is still a browser application from Ory's perspective. > Never use API flows to implement Browser applications! Using API flows in Single-Page-Apps as well as server-side apps opens up several potential attack vectors, including Login and other CSRF attacks. [User and profile settings updates for API clients and clients without browsers](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#user-and-profile-settings-updates-for-api-clients-and-clients-without-browsers) [Integration basics](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration)glamorous-crayon-34702
09/23/2025, 9:40 AMchilly-king-10285
09/23/2025, 9:40 AMchilly-king-10285
09/23/2025, 9:41 AMglamorous-crayon-34702
09/23/2025, 10:02 AMchilly-king-10285
09/23/2025, 10:02 AMchilly-king-10285
09/23/2025, 10:02 AMglamorous-crayon-34702
09/23/2025, 12:42 PMchilly-king-10285
09/23/2025, 12:42 PMchilly-king-10285
09/23/2025, 12:42 PMtraits
object with the updated identity traits. Regarding which traits to send: The API schemas and examples show that the traits
object is required in the request body when using the profile method. The documentation and API references do not clarify whether partial updates are supported (i.e., sending only the fields you want to update) or if you must send all traits every time. However, typical usage and examples suggest that you should send the full set of traits as defined by your identity schema, not just the ones you want to update. This is because the traits object is validated against your schema, and missing required fields may result in validation errors. Example request body: json { "method": "profile", "traits": { "email": "<mailto:user@example.com|user@example.com>", "name": "John Doe", "phone_number": "+123456789" } }
If your schema requires email
, name
, and phone_number
, you should include all three in the traits
object when updating the profile. Omitting required traits may cause validation errors. > The traits
field is required in the request body for the profile method, and it is described as "The identity's traits" in the API reference. The documentation does not specify support for partial updates, so you should send all required traits as per your identity schema [Ory API Reference – updateSettingsFlow](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json). If you need confirmation on partial updates, you may want to test with your schema or consult the latest Ory documentation or community discussions.