Completed functionality for document API.