Update Recovery Flow
POSThttps://accounts.<domain>/auth/self-service/recovery
Use this endpoint to update a recovery flow. This endpoint behaves differently for API and browser flows and has several states:
choose_method
expects flow
(in the URL query) and email
(in the body) to be sent
and works with API- and Browser-initiated flows.
For API clients and Browser clients with HTTP Header Accept: application/json
it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid.
and a HTTP 303 See Other redirect with a fresh recovery flow if the flow was otherwise invalid (e.g. expired).
For Browser clients without HTTP Header Accept
or with Accept: text/*
it returns a HTTP 303 See Other redirect to the Recovery UI URL with the Recovery Flow ID appended.
sent_email
is the success state after choose_method
for the link
method and allows the user to request another recovery email. It
works for both API and Browser-initiated flows and returns the same responses as the flow in choose_method
state.
passed_challenge
expects a token
to be sent in the URL query and given the nature of the flow ("sending a recovery link")
does not have any API capabilities. The server responds with a HTTP 303 See Other redirect either to the Settings UI URL
(if the link was valid) and instructs the user to update their password, or a redirect to the Recover UI URL with
a new Recovery Flow ID which contains an error message that the recovery link was invalid.
Request
Query Parameters
The Recovery Flow ID
The value for this parameter comes from flow
URL Query parameter sent to your
application (e.g. /recovery?flow=abcde
).
Recovery Token
The recovery token which completes the recovery request. If the token is invalid (e.g. expired) an error will be shown to the end-user.
This parameter is usually set in a link and not used by any direct API call.
Header Parameters
HTTP 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.
- application/json
- application/x-www-form-urlencoded
Body
required
- updateRecoveryFlowWithLinkMethod
- updateRecoveryFlowWithCodeMethod
Sending the anti-csrf token is only required for browser login flows.
Email to Recover
Needs to be set when initiating the flow. If the email is a registered recovery email, a recovery link will be sent. If the email is not known, a email with details on what happened will be sent instead.
format: email
Possible values: [link
, code
]
Method is the method that should be used for this recovery flow
Allowed values are link
and code
link RecoveryStrategyLink
code RecoveryStrategyCode
Code from the recovery email
If you want to submit a code, use this field, but make sure to not include the email field, as well.
Sending the anti-csrf token is only required for browser login flows.
The email address of the account to recover
If the email belongs to a valid account, a recovery email will be sent.
If you want to notify the email address if the account does not exist, see the notify_unknown_recipients flag
If a code was already sent, including this field in the payload will invalidate the sent code and re-send a new code.
format: email
Possible values: [link
, code
]
Method is the method that should be used for this recovery flow
Allowed values are link
and code
.
link RecoveryStrategyLink
code RecoveryStrategyCode
Body
required
- updateRecoveryFlowWithLinkMethod
- updateRecoveryFlowWithCodeMethod
Sending the anti-csrf token is only required for browser login flows.
Email to Recover
Needs to be set when initiating the flow. If the email is a registered recovery email, a recovery link will be sent. If the email is not known, a email with details on what happened will be sent instead.
format: email
Possible values: [link
, code
]
Method is the method that should be used for this recovery flow
Allowed values are link
and code
link RecoveryStrategyLink
code RecoveryStrategyCode
Code from the recovery email
If you want to submit a code, use this field, but make sure to not include the email field, as well.
Sending the anti-csrf token is only required for browser login flows.
The email address of the account to recover
If the email belongs to a valid account, a recovery email will be sent.
If you want to notify the email address if the account does not exist, see the notify_unknown_recipients flag
If a code was already sent, including this field in the payload will invalidate the sent code and re-send a new code.
format: email
Possible values: [link
, code
]
Method is the method that should be used for this recovery flow
Allowed values are link
and code
.
link RecoveryStrategyLink
code RecoveryStrategyCode
Responses
- 200
- 303
- 400
- 410
- 422
- default
recoveryFlow
- application/json
- Schema
- Example (from schema)
Schema
Active, if set, contains the recovery method that is being used. It is initially not set.
continue_with object[]
ExpiresAt is the time (UTC) when the request expires. If the user still wishes to update the setting, a new request has to be initiated.
ID represents the request's unique ID. When performing the recovery flow, this
represents the id in the recovery ui's query parameter: http://<selfservice.flows.recovery.ui_url>?request=
IssuedAt is the time (UTC) when the request occurred.
RequestURL is the initial URL that was requested. It can be used to forward information contained in the URL's path or query for example.
ReturnTo contains the requested return_to URL.
State represents the state of this request:
choose_method: ask the user to choose a method (e.g. recover account via email) sent_email: the email has been sent to the user passed_challenge: the request was successful and the recovery challenge was passed.
The flow type can either be api
or browser
.
ui objectrequired
{
"active": "string",
"continue_with": [
{},
{},
{},
{}
],
"expires_at": "2025-04-17T12:10:30.816Z",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"issued_at": "2025-04-17T12:10:30.816Z",
"request_url": "string",
"return_to": "string",
"type": "string",
"ui": {
"action": "string",
"messages": [
{
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
],
"method": "string",
"nodes": [
{
"attributes": {},
"group": "default",
"messages": [
{
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
],
"meta": {
"label": {
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
},
"type": "text"
}
]
}
}
Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201.
recoveryFlow
- application/json
- Schema
- Example (from schema)
Schema
Active, if set, contains the recovery method that is being used. It is initially not set.
continue_with object[]
ExpiresAt is the time (UTC) when the request expires. If the user still wishes to update the setting, a new request has to be initiated.
ID represents the request's unique ID. When performing the recovery flow, this
represents the id in the recovery ui's query parameter: http://<selfservice.flows.recovery.ui_url>?request=
IssuedAt is the time (UTC) when the request occurred.
RequestURL is the initial URL that was requested. It can be used to forward information contained in the URL's path or query for example.
ReturnTo contains the requested return_to URL.
State represents the state of this request:
choose_method: ask the user to choose a method (e.g. recover account via email) sent_email: the email has been sent to the user passed_challenge: the request was successful and the recovery challenge was passed.
The flow type can either be api
or browser
.
ui objectrequired
{
"active": "string",
"continue_with": [
{},
{},
{},
{}
],
"expires_at": "2025-04-17T12:10:30.817Z",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"issued_at": "2025-04-17T12:10:30.817Z",
"request_url": "string",
"return_to": "string",
"type": "string",
"ui": {
"action": "string",
"messages": [
{
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
],
"method": "string",
"nodes": [
{
"attributes": {},
"group": "default",
"messages": [
{
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
],
"meta": {
"label": {
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
},
"type": "text"
}
]
}
}
errorGeneric
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 404,
"debug": "SQL field \"foo\" is not a bool.",
"details": {},
"id": "string",
"message": "The resource could not be found",
"reason": "User with ID 1234 does not exist.",
"request": "d7ef54b1-ec15-46e6-bccb-524b82c035e6",
"status": "Not Found"
}
}
errorBrowserLocationChangeRequired
- application/json
- Schema
- Example (from schema)
Schema
error object
Points to where to redirect the user to next.
{
"error": {
"error": {
"code": 404,
"debug": "SQL field \"foo\" is not a bool.",
"details": {},
"id": "string",
"message": "The resource could not be found",
"reason": "User with ID 1234 does not exist.",
"request": "d7ef54b1-ec15-46e6-bccb-524b82c035e6",
"status": "Not Found"
}
},
"redirect_browser_to": "string"
}
errorGeneric
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 404,
"debug": "SQL field \"foo\" is not a bool.",
"details": {},
"id": "string",
"message": "The resource could not be found",
"reason": "User with ID 1234 does not exist.",
"request": "d7ef54b1-ec15-46e6-bccb-524b82c035e6",
"status": "Not Found"
}
}
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://accounts.<domain>/auth/self-service/recovery' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"csrf_token": "string",
"email": "string",
"method": "link"
}'