Aims.We study small open star clusters, using Strömgren photometry to investigate a possible dependence between age and metallicity in the Magellanic Clouds (MCs). Our goals are to trace evidence of an age metallicity relation (AMR) and correlate it with the mutual interactions of the two MCs and to correlate the AMR with the spatial distribution of the clusters. In the Large Magellanic Cloud (LMC), the majority of the selected clusters are young (up to 1 Gyr), and we search for an AMR at this epoch, which has not been much studied. Methods. We report results for 15 LMC and 8 Small Magellanic Cloud (SMC) clusters, scattered all over the area of these galaxies, to cover a wide spatial distribution and metallicity range. The selected LMC clusters were observed with the 1.54 m Danish Telescope in Chile, using the Danish Faint Object Spectrograph and Camera (DFOSC) with a single 2k × 2k CCD. The SMC clusters were observed with the ESO 3.6 m Telescope, also in Chile, using the ESO Faint Object Spectrograph and Camera (EFOSC). The obtained frames were analysed with the conventional DAOPHOT and IRAF software. We used Strömgren filters in order to achieve reliable metallicities from photometry. Isochrone fitting was used to determine the ages and metallicities. Results. The AMR for the LMC displays a metallicity gradient, with higher metallicities for the younger ages. The AMR for LMC-SMC star clusters shows a possible jump in metallicity and a considerable increase at about 6 × 10 8 yr. It is possible that this is connected to the latest LMC-SMC interaction. The AMR for the LMC also displays a metallicity gradient with distance from the centre. The metallicities in SMC are lower, as expected for a metal-poor host galaxy.