Count Endpoint for documents/ tasks

Is there a best way to get a count of all documents/task etc . Like is there a URL endpoint we can just call that's like documents/count?