Skip to main content

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

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

recoveryCodeForIdentity

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.

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());
Request Collapse all
Body
{
  "expires_in": "string",
  "identity_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}