In the US, unemployed workers must satisfy two requirements to receive unemployment insurance (UI): a tenure requirement that stipulates the minimum qualifying work spell and a monetary requirement that determines a past minimum wage. This paper develops a heterogeneous agents model with history-dependent UI benefits in order to quantitatively obtain an optimal UI program design. We first conduct an empirical analysis using the discontinuity of UI rules at state borders and find that both the monetary and the tenure requirement reduce unemployment. The monetary requirement decreases the number of employers and the share of part-time workers, while the tenure requirement has the opposite effect. We then use a quantitative model to rationalize these results. When the tenure requirement is long, workers tend to accept more low paying jobs to become eligible for UI sooner and to protect themselves from risk, while the monetary requirement works conversely. We show that, because it mitigates moral hazard, the monetary requirement can generate higher welfare levels than an increase in the length of the tenure requirement.