An alternative approach is presented for centralised algorithms that design optimal sequences and powers under quality of service constraints in the uplink of a code division multiple access systems. The authors propose a distributed algorithm, where each user designs its optimal codeword in such a way to transmit minimum power, based on certain feedback information sent from the base station. The authors define the user cost function, which is the user power written as a convex function of user codewords for a defined signal-to-interference plus noise ratio target. For the constrained optimisation problem, optimal codewords are designed based on feasible direction method and the optimal user powers are the minimum values of the user cost functions. For the optimal configuration, the matched filter employed at receiver will have the same performance as the minimum mean squared error filter. Even if the optimal user powers are unique, the optimal codewords do not correspond to a unique allocation, but rather to an entire class of codewords that can be related by unitary transformations. The algorithm works properly in the presence of multiple access interference with white or coloured additive noise and requires no ordering. The proposed algorithm is analysed and illustrated with numerical examples obtained from simulations.