add validateAPI middleware