I had a gastric bypass 2 years ago. Is it safe to perform a 10 day cleanse?

Clean is good. If you mean a 10 day meal replacement with a balanced low sugar shake like medifast or glucose-controlled boost (plus all vitamins) it should be ok. However, the best diet to work with a bypass is a solid meal (protein and veggies) with no sipping, fewer slider foods, no sweets and no bad snacks. Might be good to check with your surgeon and program.
10 day cleanse. You can do it, and having had a bypass doesn't change anything. However, the whole idea of a 10 day cleanse and whether or not that is beneficially to anyone is a whole different topic to debate.