We consider a contract manufacturer that serves a limited number of outsourcers (customers) on a single capacitated production line. The outsourcers have different levels of demand uncertainty and the contract manufacturer faces the question how to allocate the contractual capacity flexibility in an optimal way. The contractual capacity flexibility is a contract parameter that sets the amount of demand the contract manufacturer is obliged to accept from the outsourcers. We develop a hierarchical model that consists of two decision levels. At the tactical level, the contract manufacturer allocates the capacity flexibility to the different outsourcers by maximizing the expected profit. Offering more flexibility to the more uncertain outsourcer generates higher expected revenue, but also increases the expected penalty costs. The allocated capacity flexibilities (determined at the tactical level) are input parameters to the lower decision level, where the operational planning decisions are made and actual demands are observed. We perform a numerical study by solving the two-level hierarchical planning problem iteratively. We first solve the higher level problem, which has been formulated as an integer program, and then perform a simulation study, where we solve a mathematical programming model in a rolling horizon setting to measure the operational performance of the system. The simulation results reveal that when the acceptance decision is made (given the allocated capacity flexibility decision), priority is given to the less uncertain outsourcer, whereas when the orders are placed, priority is given to the most uncertain outsourcer. Our insights are helpful for contract manufacturers when having contract negotiations with the outsourcers. Moreover, we show that hierarchical integration and anticipation are required, especially for cases with high penalty cost and tight capacities.