Yes, you can, providing you pick similar-sized barbs. For example, it would be unwise to house fully grown tinfoil barbs with a dwarf variety of barbs such as the Golden dwarf barbs (Puntius gelius) or the Jae Barb (Enteromius jae).
It is also worth bearing in mind some types of barbs are considered fin nippers so it would not be advisable to maintain for instance; tiger barbs with barbs that have been artificially bred for long-fins. As an example the long-finned variety of the rosy barb or indeed the extended finned version of the newer tiger barb itself.