You don't have to be any age to drink coffee or energy drinks, but none of them are recommended for younger people. Energy drinks are also very bad in many ways.
Both drinks interfere with sleep and can make sleep harder, affecting a child's growth, mood, performance in school, concentration, and even metabolism. It forces you to get less sleep at night due to the caffeine, and this is bad for children because they are still growing and need the sleep to function properly.
Energy drinks also have about the caffeine amount of 4 cups of coffee, so many people abuse these. Coffee is much better for you. When can you have them? Anytime in your life (maybe except when you are a very young child). When should you have it? Probably not until around above the age of 18, as another person mentioned, when you are almost done growing generally speaking.
Hope I helped!
experience drinking coffee since shortly after I turned 18 for the past several years