An answer based on British English:
There are several components to this: number of storeys; sole-use versus shared-use buildings; and the target market.
As the OALD says, flats tend to be flat - i.e. on just one floor of a building. And they imply that they don't have sole use of the building - that there are other units in the same building; either other dwellings, a shop, offices, whatever.
If it's got more than one storey, but does not have sole use of the building, then it's a maisonette.
If a flat or maisonette is being sold/rented to an international market, it tends to get called an apartment, as that's better understood in International English.
If it's the sole use of a one-storey building (i.e. if the dwelling occupies the entire building), it's not a flat, it's a bungalow.
If it's the sole use of a building with more than one storey, then it's not a maisonette, it's a house. Bungalows are sometimes considered to be a subset of houses.