Preshipment inspection programs are implemented in many developing countries to fight customs corruption. They consist in delegating the inspection of imports to a private firm that operates in the exporting country. To study those PSI programs, we develop a hierarchical agency model where the government authority can rely on two supervisors, namely the private inspection firm and the customs administration, to control importers' declarations. The government's optimal program is fully characterized. We devote some attention to the optimal inspection policy and its comparative statics properties. In particular, we identify the situations in which PSI programs are optimal. Our results highlight the fact that implementing PSI programs both to fight corruption and to modernize customs is inconsistent. We also discuss the optimal reconciliation policy, i.e. what to do in case of conflicting inspection reports by the private firm and the customs administration. In the optimal mechanism, mutual supervision between the private firm and the customs administration is used to provide adequate incentives to all parties.