---
title: "Create a Recovery Code"
method: POST
path: "/admin/recovery/code"
tags: ["identity"]
---

# Create a Recovery Code

`POST /admin/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

- CreateRecoveryCodeForIdentityBody — Create Recovery Code for Identity Request Body
  - `expires_in` string — 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`.
  - `flow_type` string — The flow type can either be `api` or `browser`.
  - `identity_id` string, uuid, required — Identity to Recover The identity's ID you wish to recover.

## Response `201`

recoveryCodeForIdentity

- RecoveryCodeForIdentity — Used when an administrator creates a recovery code for an identity.
  - `expires_at` string, date-time — Expires At is the timestamp of when the recovery flow expires The timestamp when the recovery code expires.
  - `recovery_code` string, required — RecoveryCode is the code that can be used to recover the account
  - `recovery_link` string, required — RecoveryLink with flow This link opens the recovery UI with an empty `code` field.

## Other responses

- `400` — errorGeneric
- `404` — errorGeneric
- `default` — errorGeneric

---

[API](https://skmtc.net/ory/apis/ory-identities-api.md) · [All operations](https://skmtc.net/ory/apis/ory-identities-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ory/ory-identities-api/versions/7a0df90e2f13/schema)
