In a large bowl, combine the buttermilk, garlic powder, onion powder, paprika, salt, and black pepper. Add the chicken pieces, ensuring they are fully submerged. Cover and refrigerate for at least 1 hour, or overnight for best results.
In another bowl, mix the flour, baking powder, and cayenne pepper (if using). Remove the chicken from the buttermilk, allowing excess to drip off, then dredge each piece in the flour mixture, pressing lightly to adhere.
Preheat the air fryer to 380°F (193°C) for about 5 minutes. Lightly spray the air fryer basket with cooking spray.
Place the coated chicken pieces in a single layer in the air fryer basket. Spray the tops of the chicken with cooking spray or olive oil spray.
Cook the chicken at 380°F (193°C) for 25-30 minutes, flipping halfway through, until the chicken is golden brown and reaches an internal temperature of 165°F (74°C).
Once cooked, remove the chicken from the air fryer and let it rest for 5 minutes before serving.