GitHub Audit Logs via API
Overview
This document will guide you on how to create a PAT in GitHub for audit logs.
Prerequisites
Create a dedicated GitHub user account with appropriate privileges:
Organization Admin → for organization-level audit logs
Enterprise Admin → for enterprise-level audit logs
Steps to Create a PAT (Classic)
Log in to GitHub with the required user account
Ensure the email address is verified
In the top-right corner, click your profile icon → Settings
In the left sidebar, click Developer settings
Navigate to:
Personal access tokens → Tokens (classic)
Click:
Generate new token (classic)
Provide the following details:
Note: Add a descriptive name
Expiration: Select an appropriate validity period (recommended: avoid “No expiration”)
Under Scopes, select:
✔ read:audit_log
Click Generate token
Copy the token and store it securely
Select the scopes you'd like to grant this token. In this case select read:audit_log
Click Generate token and copy it.
Screenshot of the "Personal access tokens" page. Next to a blurred-out token, an icon of two overlapping squares is outlined in orange.
To use your token to access resources owned by an organization that uses SAML single sign-on, authorize the token. For more information, see Authorizing a personal access token for use with single sign-on.
Once PAT is created, please share the token with blusapphire.