From 16b3fe27e27d1ebcfa85376d87e153d3c6e131bc Mon Sep 17 00:00:00 2001 From: Pierrci Date: Fri, 4 Sep 2026 20:19:09 -0400 Subject: [PATCH 1/4] Document the audit log export API endpoint Co-Authored-By: Claude Code (GLM-5.3-Flash) --- docs/hub/audit-logs.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/hub/audit-logs.md b/docs/hub/audit-logs.md index 08be6bcc10..d80efa1363 100644 --- a/docs/hub/audit-logs.md +++ b/docs/hub/audit-logs.md @@ -30,6 +30,16 @@ Audit Logs are accessible through your organization settings. Each log entry inc You can also download the complete audit log as a JSON file for further analysis. +### Export via API + +Programmatic export is available at: + +``` +GET https://huggingface.co/api/organizations/{org}/audit-log/export +``` + +Authenticate with a user access token or service-account token that has the **Export the audit log** permission (`org.auditLog.write`) for the organization. The response is a JSON array of log entries, identical to the file downloaded from the settings page. Like the manual export, the API call is recorded as `org.audit_log.export`. + ## What Events Are Tracked? Each action has an **event name** in `scope.action` format (e.g. `repo.create`, `collection.delete`). This is the `type` field in each log entry and in the exported JSON—use it when searching or filtering logs. From 650e5255da0452dd4f9061b4c8114b0127a2cde4 Mon Sep 17 00:00:00 2001 From: Pierrci Date: Fri, 4 Sep 2026 20:23:17 -0400 Subject: [PATCH 2/4] Link to OpenAPI reference from audit log export docs Co-Authored-By: Claude Code (GLM-5.3-Flash) --- docs/hub/audit-logs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/hub/audit-logs.md b/docs/hub/audit-logs.md index d80efa1363..0aba363ab6 100644 --- a/docs/hub/audit-logs.md +++ b/docs/hub/audit-logs.md @@ -40,6 +40,8 @@ GET https://huggingface.co/api/organizations/{org}/audit-log/export Authenticate with a user access token or service-account token that has the **Export the audit log** permission (`org.auditLog.write`) for the organization. The response is a JSON array of log entries, identical to the file downloaded from the settings page. Like the manual export, the API call is recorded as `org.audit_log.export`. +The endpoint is also documented in the [OpenAPI reference](https://huggingface.co/openapi/) (source: [`.well-known/openapi.json`](https://huggingface.co/.well-known/openapi.json)). + ## What Events Are Tracked? Each action has an **event name** in `scope.action` format (e.g. `repo.create`, `collection.delete`). This is the `type` field in each log entry and in the exported JSON—use it when searching or filtering logs. From 15d147573fd07d8a885ad27c40d4adadc6173493 Mon Sep 17 00:00:00 2001 From: Pierrci Date: Fri, 4 Sep 2026 20:25:46 -0400 Subject: [PATCH 3/4] Use full deep link to OpenAPI endpoint reference Co-Authored-By: Claude Code (GLM-5.3-Flash) --- docs/hub/audit-logs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/audit-logs.md b/docs/hub/audit-logs.md index 0aba363ab6..54e9ea555b 100644 --- a/docs/hub/audit-logs.md +++ b/docs/hub/audit-logs.md @@ -40,7 +40,7 @@ GET https://huggingface.co/api/organizations/{org}/audit-log/export Authenticate with a user access token or service-account token that has the **Export the audit log** permission (`org.auditLog.write`) for the organization. The response is a JSON array of log entries, identical to the file downloaded from the settings page. Like the manual export, the API call is recorded as `org.audit_log.export`. -The endpoint is also documented in the [OpenAPI reference](https://huggingface.co/openapi/) (source: [`.well-known/openapi.json`](https://huggingface.co/.well-known/openapi.json)). +The endpoint is also documented in the [OpenAPI reference](https://huggingface.co/spaces/huggingface/openapi#tag/orgs/GET/api/organizations/%7Bname%7D/audit-log/export). ## What Events Are Tracked? From b98f7598291a57e6f15df79d712d20c9653df634 Mon Sep 17 00:00:00 2001 From: Alexandre Nicolas Date: Mon, 7 Sep 2026 15:01:47 +0200 Subject: [PATCH 4/4] Fix: replace markdown link with HTML anchor --- docs/hub/audit-logs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/audit-logs.md b/docs/hub/audit-logs.md index 54e9ea555b..a022f677a5 100644 --- a/docs/hub/audit-logs.md +++ b/docs/hub/audit-logs.md @@ -40,7 +40,7 @@ GET https://huggingface.co/api/organizations/{org}/audit-log/export Authenticate with a user access token or service-account token that has the **Export the audit log** permission (`org.auditLog.write`) for the organization. The response is a JSON array of log entries, identical to the file downloaded from the settings page. Like the manual export, the API call is recorded as `org.audit_log.export`. -The endpoint is also documented in the [OpenAPI reference](https://huggingface.co/spaces/huggingface/openapi#tag/orgs/GET/api/organizations/%7Bname%7D/audit-log/export). +The endpoint is also documented in the OpenAPI reference. ## What Events Are Tracked?