api.jl: added query dict + cleanup