db api design