Bulk add of custom addresses?

I’m switching my email routing from another provider to cloudflare. I have ~1700 forwarding accounts that go to various destination addresses that I need to set up in cloudflare. I would prefer to not have to manually enter all 1700 and am wondering if there is a bulk add option for custom addresses? Possibly through an API? Or should I consider using a worker for each destination address and have the list of “to” addresses as an array to check against?

For now I’ve enabled the catch-all feature but would like to disable this as soon as possible as there are a considerable number of spam messages sent to non-existing addresses.

I would note that by default, Email Routing only supports 200 Rules (forwarding addreses) and 200 verified destinations. Each destination you forward to has to be verified. If you have less then 200 destinations, you could use a Worker with some logic to forward to verified addresses to get around the rules limit. Or try to apply for an increase: Limits · Cloudflare Email Routing docs

There is also an API for destinations and routing rules: Cloudflare API Documentation

thanks for the response. I did not know about the 200 rules limit.

definitely less than 200 destination addresses, and the ones I do have, have all been verified. Will try to go down the worker path but so far, messages routed to the worker are bounced back with a 521 5.3.0 Upstream error error message.

Sounds like your worker is throwing an exception, tail it, send an email, and wait until you see the event. You can click on an exception event and see its details.

To tail:
You can use Wrangler tail from the CLI or go to Workers & Pages → click on your Worker → Logs → start log stream.