Preheat the air fryer to 400°F (200°C) for about 5 minutes.
In a mixing bowl, combine the olive oil, garlic powder, onion powder, smoked paprika, salt, black pepper, and cayenne pepper (if using).
Pat the chicken drumsticks dry with a paper towel to ensure they crisp up nicely. Add the drumsticks to the bowl with the seasoning mixture.
Toss the drumsticks in the marinade until evenly coated.
Lightly spray the air fryer basket with cooking spray to prevent sticking. Arrange the drumsticks in a single layer in the air fryer basket, making sure they are not touching.
Cook the drumsticks at 400°F (200°C) for 25 minutes, turning halfway through to ensure even cooking. The internal temperature should reach 165°F (75°C).
Once cooked, remove the drumsticks from the air fryer and let them rest for a few minutes before serving.
For extra flavor, marinate the chicken in the seasoning mixture for a few hours or overnight.
Serve with your choice of sides, such as roasted vegetables, a salad, or mashed potatoes.