Create a Recovery Code
POST/iam/recovery/code
This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account.
Request
- application/json
Body
expires_instring
Code Expires In
The recovery code will expire after that amount of time has passed. Defaults to the configuration value of
selfservice.methods.code.config.lifespan.
Possible values: Value must match regular expression ^([0-9]+(ns|us|ms|s|m|h))*$
identity_idstring<uuid>required
Identity to Recover
The identity's ID you wish to recover.
Responses
- 201
- 400
- 404
- default
recoveryCodeForIdentity
- application/json
- Schema
- Example (auto)
Schema
expires_atstring<date-time>
Expires At is the timestamp of when the recovery flow expires
The timestamp when the recovery code expires.
recovery_codestringrequired
RecoveryCode is the code that can be used to recover the account
recovery_linkstringrequired
RecoveryLink with flow
This link opens the recovery UI with an empty code field.
{
"expires_at": "2024-07-29T15:51:28.071Z",
"recovery_code": "string",
"recovery_link": "string"
}
errorGeneric
- application/json
- Schema
- Example (auto)
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"
}
}
errorGeneric
- application/json
- Schema
- Example (auto)
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"
}
}
errorGeneric
- application/json
- Schema
- Example (auto)
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"
}
}
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://connhex.com/iam/recovery/code");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"expires_in\": \"string\",\n \"identity_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());