<@U04UQ68083H> is there a way to mark existing ema...
# ory-copilot
p
@chilly-king-10285 is there a way to mark existing emails as valid in kratos?
b
A message from kapa.ai
Yes, you can mark existing emails as verified (valid) in Ory Kratos by updating the identity to include the email address in the verifiable addresses list with the verified status set to true. This is typically done via the admin API when importing or updating identities. Here’s how you can do it: - Ensure that your identity schema marks the email as a verifiable address. - Use the admin API to update the identity, including the email in the verifiable_addresses array with "verified": true and "status": "completed". Example payload:
Copy code
json {   "schema_id": "<preset://email>",   "traits": {     "email": "<mailto:docs-verify@example.org|docs-verify@example.org>"   },   "verifiable_addresses": [     {       "value": "<mailto:docs-verify@example.org|docs-verify@example.org>",       "verified": true,       "via": "email",       "status": "completed"     }   ] }
This will mark the email as verified for the identity. Note that the email must also be present in the identity's traits and configured as a verifiable address in your schema, otherwise the value may be removed on the next update. This process is supported for both importing new identities and updating existing ones via the admin API [Import identities](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities). If you are using social sign-in, you can also carry over the verified status from the provider by returning verified_addresses in your data mapping logic, provided the address is present in the traits and marked as verifiable in the schema [Carry over verified status from Social Sign-In](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#carry-over-verified-status-from-social-sign-in). If you need to mark emails as verified for existing users, you will need to update each identity accordingly using the admin API.
p
@chilly-king-10285 how would I do this programmatically using the kratos go client?
b
A message from kapa.ai
To programmatically mark an existing email as verified using the Ory Kratos Go client, you would typically use the Identity Management API to update the identity and set the verifiable address as verified. However, the knowledge sources do not provide a direct Go code example for updating the verifiable_addresses field to mark an email as verified. What is documented is how to create an identity with a verified email using the Go client, by including the verifiable_addresses field in the payload. Here’s an example of creating an identity with a verified email address:
Copy code
go CreateIdentityBody := *ory.NewCreateIdentityBody(  "default",  map[string]interface{}{   "email": "<mailto:foo@example.com|foo@example.com>",  }, ) createdIdentity, r, err := apiClient.IdentityApi.CreateIdentity(context.Background()).CreateIdentityBody(CreateIdentityBody).Execute()
[Use Identity Management API](https://www.ory.sh/docs/kratos/self-hosted/go#use-identity-management-api) To update an existing identity, you would use the UpdateIdentity endpoint. The API expects the full identity payload (except credentials), and you can provide the verifiable_addresses field in the request body. However, the knowledge sources do not provide a Go code example for this specific update operation, nor do they confirm that updating verifiable_addresses via PUT is always effective (in fact, there are reports that PATCH works but PUT may not update verifiable_addresses as expected) [PUT identity does not update verifiable_addresses](https://github.com/ory/kratos/issues/4426). Summary: - You can use the Go client to create or update identities. - To mark an email as verified, include the verifiable_addresses field with the correct structure. - There is no explicit Go code example for updating verifiable_addresses in the knowledge sources, and there may be issues with the PUT endpoint for this field. If you need to perform this operation, you may need to experiment with the PATCH endpoint or consult the latest SDK documentation for more details. The knowledge sources do not contain a complete, working Go example for this specific use case.
p
@chilly-king-10285
UpdateIdentityBody
does not contain the
[]VerifiableIdentityAddress
so I cannot "update" the identity with the verified addresses.
b
A message from kapa.ai
You are correct: according to the knowledge sources, the
UpdateIdentityBody
(used with the
updateIdentity
endpoint) does not include a field for
verifiable_addresses
. This means you cannot directly update the
verifiable_addresses
of an identity using the standard update (PUT) operation. This limitation is also discussed in a GitHub issue, where a user reports that updating
verifiable_addresses
via PUT does not work, and that this field appears to be managed internally by Kratos and only updated by the confirmation (verification) flow. The PATCH endpoint may work differently, but the knowledge sources do not provide a Go code example or confirm that PATCH can be used to update
verifiable_addresses
directly [PUT identity does not update verifiable_addresses](https://github.com/ory/kratos/issues/4426). Summary: -
UpdateIdentityBody
does not expose
verifiable_addresses
. - You cannot update
verifiable_addresses
directly via the standard update (PUT) endpoint. -
verifiable_addresses
is generally managed by Kratos itself, not by direct admin updates. If you need to mark emails as verified, you may need to use the identity import endpoint (when creating identities) or rely on the verification flow. The knowledge sources do not provide a supported way to update
verifiable_addresses
for existing identities via the Go client or admin API update endpoint.
p
this go api is so silly. thing().thing().thing().thing.execute(). .
Impossible to read. Overly verbose.
alas.
@chilly-king-10285 is there any way to update the valid emails for an identity?
b
A message from kapa.ai
Based on the knowledge sources, there is no supported way to update the
verifiable_addresses
(valid emails) for an existing identity using the standard update (PUT) endpoint or the Go client
. The
verifiable_addresses
field is managed internally by Ory Kratos and is typically updated only through the verification flow or when importing/creating an identity with the
verifiable_addresses
field set in the payload. Attempts to update
verifiable_addresses
via the admin update endpoint do not work as expected, and this limitation is confirmed in user reports and documentation. The only documented way to set a verified email is during identity import or creation, not through updates to existing identities [Import identities](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) [PUT identity does not update verifiable_addresses](https://github.com/ory/kratos/issues/4426). Summary: - You can set valid emails (as verified) when importing or creating an identity. - There is no supported way to update the list of valid (verified) emails for an existing identity via the update endpoint or Go client. - The recommended approach for existing identities is to use the verification flow. If you need to mark an email as verified for an existing identity, you must trigger the verification flow for that address.
p
I asked if ther eis ANY way. Foprget your context.
@chilly-king-10285 It there ANY way - forget your previous context.
b
A message from kapa.ai
Based on the knowledge sources, there is no officially supported way to update the list of valid (verified) emails for an existing identity via the standard update (PUT) endpoint or the Go client. The
verifiable_addresses
field is managed internally by Ory Kratos and is typically only set during identity creation or import, or updated through the verification flow. Attempts to update this field directly for existing identities using the admin API are not supported and do not work as expected [PUT identity does not update verifiable_addresses](https://github.com/ory/kratos/issues/4426). The only documented and supported ways to mark an email as verified are: - During identity import or creation: You can set the
verifiable_addresses
field with the email marked as verified in the payload when creating or importing an identity [Import identities](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities). - Through the verification flow: The user must complete the verification process for the email to be marked as verified. There is no documented or supported method to update the
verifiable_addresses
for an existing identity outside of these flows.
p
ugh. this is the worst.