From 5cb06129c5b6013c1f6961b1bad113b6b255d714 Mon Sep 17 00:00:00 2001
From: mattc <buffless-matt@users.noreply.github.com>
Date: Thu, 10 Mar 2022 16:30:24 +1100
Subject: [PATCH] Document - Add entry briefly describing admin users' usage
 statistics endpoint.

---
 docs/admin.md | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/docs/admin.md b/docs/admin.md
index c6902c1b..aaf70a7a 100644
--- a/docs/admin.md
+++ b/docs/admin.md
@@ -230,6 +230,38 @@ The response is how much data the server is using:
 
 Use the same endpoint as above, but specifying one or more `?user_id=@alice:example.org` query parameters. Note that encoding the values may be required (not shown here). Users that are unknown to the media repo will not be returned.
 
+#### All known users' usage statistics
+
+Similar to [Per-user usage (all known users)](#per-user-usage-all-known-users), but with a focus on statistics, and with
+parameterized querying ability.
+
+This end-point attempts to be a loose equivalent to
+[this](https://matrix-org.github.io/synapse/develop/admin_api/statistics.html#users-media-usage-statistics) Synapse
+endpoint, with the main difference being the absence of "displayname".
+
+URL: `GET /_matrix/media/unstable/admin/usage/<server name>/users-stats?access_token=your_access_token`
+
+Example response:
+```json
+{
+  "next_token" : 100,
+  "total" : 105,
+  "users" : [
+    {
+      "media_count" : 12,
+      "media_length" : 39546,
+      "user_id" : "@alice:example.com"
+    },
+    {
+      "media_count" : 46,
+      "media_length" : 5935234,
+      "user_id" : "@bob:example.com"
+    },
+    ...
+  ]
+}
+```
+
 #### Per-upload usage (all uploads)
 
 URL: `GET /_matrix/media/unstable/admin/usage/<server name>/uploads?access_token=your_access_token`
-- 
GitLab