refined-helicopter-87799
09/21/2025, 12:17 PMchilly-king-10285
09/21/2025, 12:17 PMchilly-king-10285
09/21/2025, 12:17 PMrefined-helicopter-87799
09/21/2025, 12:25 PMchilly-king-10285
09/21/2025, 12:25 PMchilly-king-10285
09/21/2025, 12:25 PMchilly-king-10285
09/21/2025, 12:25 PMyaml selfservice: methods: code: passwordless_enabled: true config: lifespan: 15m # How long the one-time code is valid
Then apply the config with: ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml
[[One-time-code](https://www.ory.sh/docs/kratos/passwordless/one-time-code)]chilly-king-10285
09/21/2025, 12:25 PMory patch identity-config --project <your-project-id> \ --add '/selfservice/methods/code/passwordless_enabled=true' \ --add '/selfservice/methods/code/config/lifespan="15m"'
The same lifespan knob is used for “code” flows in general (it’s documented for recovery/verification as well), where you set selfservice.methods.code.config.lifespan to your desired duration (e.g., 5m, 15m, 1h). [[Address verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#configuration); [Set up account recovery](https://www.ory.sh/docs/identities/get-started/account-recovery#edit-recovery-configuration)] Tip: Your email template exposes ExpiresInMinutes, which will reflect this configured value for login_code.valid emails. [[Available variables](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#available-variables)]chilly-king-10285
09/21/2025, 12:26 PMchilly-king-10285
09/21/2025, 12:26 PMory patch identity-config --project <project-id> \ --add '/selfservice/methods/code/passwordless_enabled=true' \ --add '/selfservice/methods/code/config/lifespan="15m"'
Or edit a file and apply: selfservice: methods: code: passwordless_enabled: true config: lifespan: 15m
Then: ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml
[[Email/SMS one-time-code](https://www.ory.sh/docs/kratos/passwordless/one-time-code)] Note: The same lifespan knob is documented for code-based verification/recovery as well (selfservice.methods.code.config.lifespan). [[Address verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#configuration); [Account recovery setup](https://www.ory.sh/docs/identities/get-started/account-recovery#edit-recovery-configuration)]