API endpoint for resending validation email for email destination?

Is there an API endpoint that I can use to trigger the resend of a validation email for an email destination? I can do this manually using the Web UI:

  • Select Email → Email Routing on the toolbar.
  • Select the Routes tab.
  • Scroll down to “Destination Addresses”.
  • Click on the “Resend Email” link for the affected address.

Can I do this with the API?

If this can’t be done through the API, I will try the workaround of using the API to delete and then re-add the destination email. I think the verification email is sent automatically when the email is added.

I don’t see it officially supported in the API, but you can use devtools to figure out what the dashboard does for the API then you can copy it.

1 Like

I was able to do that. Thank you, kind person! I’ll add a reply with details.

1 Like

Warning: Documentation of undocumented API feature follows. It’s always risky to use an undocumented feature, as it could go away or change without warning. Caveat caller.

As suggested by Cyb3r-Jak3, I spied on the web UI to see how it resends a verification email. The answer is that it uses an undocumented use of the documented API endpoint for creating verification emails. The documented endpoint is:

https://developers.cloudflare.com/api/operations/email-routing-destination-addresses-create-a-destination-address

What’s documented is that if the payload contains an email address, then the destination address will be added. What’s undocumented (and therefore use-at-your-own-risk) is that if the payload contains a complete destination email, with the identifying tag, and with the “verified” set to NULL, then the verification email will be resent, providing it has not been sent too recently. If the API responds with a 429 error, then the error message in the JSON response body will probably indicate “Verification email has been sent too recently”.

Here’s an example payload from resending a validation email:

{“created”:“2023-07-27T22:26:12.996488Z”,“email”:“[email protected]”,“modified”:“2023-07-28T16:31:53.646827Z”,“tag”:“7a3b59d34f1e82c6887b64fbefcda302”,“verified”:null}

This was a POST to URL:

https://api.cloudflare.com/client/v4/accounts/b4c2856e5130469c86f3c5e24db6791e/email/routing/addresses

1 Like