Preheat the air fryer to 400°F (200°C).
In a mixing bowl, combine olive oil, garlic powder, onion powder, smoked paprika, salt, black pepper, dried thyme, and cayenne pepper (if using). Mix well to form a marinade.
Pat the chicken drumsticks dry with paper towels to help the skin get crispy.
Add the drumsticks to the bowl with the marinade and toss until each drumstick is thoroughly coated.
Arrange the drumsticks in a single layer in the air fryer basket, ensuring they are not overcrowded for even cooking.
Cook in the air fryer for 25 minutes, flipping the drumsticks halfway through the cooking time.
Use a meat thermometer to check that the internal temperature of the drumsticks reaches 165°F (75°C).
Once done, remove the chicken drumsticks from the air fryer and let them rest for a few minutes before serving.