Document query endpoint

idem, in a separate file