Preheat your air fryer to 400°F (200°C) for about 5 minutes.
In a large bowl, combine the olive oil, garlic powder, onion powder, smoked paprika, salt, black pepper, and cayenne pepper (if using). Mix well to form a marinade.
Add the chicken drumsticks to the bowl and toss until they are evenly coated with the marinade. Let them sit for about 10 minutes to absorb the flavors.
Arrange the drumsticks in a single layer in the air fryer basket, making sure they are not overcrowded. You may need to cook them in batches.
Cook the drumsticks for 25-30 minutes, flipping them halfway through, until they are golden brown and the internal temperature reaches 165°F (74°C).
Once cooked, remove the drumsticks from the air fryer and let them rest for 5 minutes before serving.