API tweaks

Initial work on API and looking at indexes for query patterns.
Ah cool. Didn't see where this was being used.