We first recall Bank-El Karoui's representation theorem for stochastic processes and then provide a mean-field extension of the theorem. We next study an exit contract optimization problem, where a principal provides a universal exit contract to (finitely or infinitely) many heterogeneous agents. With the same contract, the agents may have different optimal exit times. The problem consists in finding the optimal universal contract from the principal's point of view. Under some structural conditions, we show how the exit contract problem can be solved by Bank-El Karoui's representation theorem and its extensions.