Query API setup