Bulk removing devices via API / websockets

I stupidly left my rftrx433 integration with ‘auto add new devices’ turned on for a couple of weeks - needless to say i’ve ended up with 631 devices I do not care about. It’s a good few clicks in the UI to remove a device and i’m not about the clickops (automation, amirite?) so want to avoid that.

I’ve cobbled together some python to list devices whose names match strings I know of, but when it comes to making a call to /api/devices/{device_id} with a known device ID via websocket, I get {"code":"unknown_command","message":"Unknown command."}

Via the API I just get a 404, assuming i’ve got that code from some archived docs.

Can someone ELI5 how I can do this? Can I just not do this? Thank you for any pointers!

That doesn’t exist indeed, as far as documented in

Where did you get that from?

I honestly can’t remember; could even have been some chatgpt magic I tried out of frustration.

I ended up writing another script which removed the devices in question form the core.device_registry and core.entity_registry files, though after a reboot they all reappeared.

I can’t believe there isn’t a native way of doing this, but I shall persist!