We propose and test a theory of corporate liquidity management in which credit lines provided by banks to firms are a form of monitored liquidity insurance. Bank monitoring and resulting credit line revocations help control illiquidity-seeking behavior by firms. Firms with high liquidity risk are likely to use cash rather than credit lines for liquidity management because the cost of monitored liquidity insurance increases with liquidity risk. We exploit a quasi-experiment around the downgrade of General Motors (GM) and Ford in 2005 and find that firms that experienced an exogenous increase in liquidity risk (specifically, firms that relied on bonds for financing in the pre-downgrade period) moved out of credit lines and into cash holdings in the aftermath of the downgrade. We observe a similar effect for firms whose ability to raise equity financing is compromised by pricing pressure caused by mutual fund redemptions. Finally, we find support for the model's other novel empirical implication that firms with low hedging needs (high correlation between cash flows and investment opportunities) are more likely to use credit lines relative to cash, and are also less likely to face covenants and revocations when using credit lines.