Stu Eggerton

Clear GitHub Notifications

GitHub notifications

Sometimes you need to clear all GitHub notifications. This is the process....

The curl command below will mark all of your notifications as read, and clear the notification indicators.

A few things to note:

  1. Create a PAT token with notifications scope.

  2. Get the current date and time in bash by running: echo $(date +%Y-%m-%dT%H:%M:%SZ)

  3. Use the PAT token and timestamp to call the GitHub API - example call:

curl -L \
  -X PUT \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \ \
  -d '{"last_read_at":"2022-06-10T00:00:00Z","read":true}'