query for categories and keys