<@U04UQ68083H> is there an admin API endpoint in K...
# ory-copilot
g
@chilly-king-10285 is there an admin API endpoint in Kratos to mark an email as verified for an identity?
b
A message from kapa.ai
Yes, there is an admin API endpoint in Ory Kratos to mark an email as verified for an identity. You can use the
PATCH /identities/{id}
endpoint to update an identity. When importing identities, you can provide the
credentials
field and use the
verifiable_addresses
field to import a verified address like an email address. Here is a sample payload for importing an identity with a verified address:
Copy code
json {     "schema_id": "<preset://email>",     "traits": {       "email": "[email protected]"     },     "verifiable_addresses": [       {         "value": "[email protected]",         "verified": true,         "via": "email",         "status": "completed"       }     ]   }
You can test the above example with a cURL command:
Copy code
bash curl --request POST -sL \     --header "Authorization: Bearer ory_pat_xRKLsFEOUFQFVBjd6o3FQDifaLYhabGd" \     --header "Content-Type: application/json" \     --data '{     "schema_id": "<preset://email>",     "traits": {       "email": "[email protected]"     },     "verifiable_addresses": [       {         "value": "[email protected]",         "verified": true,         "via": "email",         "status": "completed"       }     ]   }' https://$<http://PROJECT_SLUG.projects.oryapis.com/admin/identities|PROJECT_SLUG.projects.oryapis.com/admin/identities>
Please note that you must ensure that address verification is enabled and that the
verifiable_address
is present in the identity's traits. If the identity traits do not have the address set as the "verified address" type, the imported values will be deleted on the next identity update. For more information, you can refer to the [Ory Kratos documentation](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities).
g
The payloads are not correct, but it seems I can achieve my goal by using this payload
Copy code
[
    {
        "path": "/verifiable_addresses/0/verified",
        "op": "replace",
        "value": true
    },
    {
        "path": "/verifiable_addresses/0/status",
        "op": "replace",
        "value": "completed"
    }
]