FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
stevekrouse

stevekrouse

github-user-email

Get the email address for GitHub username
Public
Like
5
github-user-email
Home
Code
4
README.md
H
commits.ts
events.ts
examples.ts
Branches
3
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
8/1/2025
Viewing readonly version of main branch: v205
View latest version
README.md

Get the email address for GitHub username

TypeScript function to get a GitHub user's email from their public event commit history via the GitHub API.

emailsFromGitHubEvents(username: string)

This function pulls the user's recent public events.

Create val
import { emailsFromGitHubEvents } from "https://esm.town/v/stevekrouse/github-user-email/events.ts"; const emails = await emailsFromGitHubEvents("stevekrouse"); console.log(emails); // [ "steveykrouse@gmail.com" ]

The limitation is that this endpoint only gets events from the last 30 days, so if the user hasn't committed in the last month, you won't get any results from this method. (Coming soon: an additional method that gets around this limitation.)

Rate limits

The GitHub API rate limits unauthenticated requests to 60 per hour per IP address. As a quick workaround, Val Town provides an IP-randomizer fetch proxy that makes it easy to get around these limits. These functions use that proxy by default. However, if you're using these functions at scale, please use a GITHUB_TOKEN to be a good GitHub citizen.

Get a Github Access Token

  1. Go to https://github.com/settings/personal-access-tokens/new
  2. Give it a name like Get user emails
  3. Set the expiration appropriately (I recommend No expiration)
  4. Click Generate token
  5. Copy the token into your val's env variables (in the left sidebar) as GITHUB_TOKEN
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.