Skip to content
Get started

Get best email addresses by GitHub node IDs

client.userEmails.bestEmail(UserEmailBestEmailParams { githubIds, signals } body, RequestOptionsoptions?): UserEmailBestEmailResponse { count, results }
POST/users/best-email

Fetch the best email address for GitHub users by their node IDs. Uses intelligent selection to prioritize personal emails over work emails and verifies domain validity. Returns the best email plus all other email candidates. Supports batch requests (1-100 IDs). Requires RAW service. Credits: 1 per result returned.

ParametersExpand Collapse
body: UserEmailBestEmailParams { githubIds, signals }
githubIds: Array<string>

Array of GitHub node IDs (1-100)

signals?: Signals

Optional signal data for tracking email context (body, subject, sender)

emailBody?: string

Email body content for tracking

emailSubject?: string

Email subject for tracking

reasonForEmailNaturalLanguage?: string

Provide the reason for emailing the user in natural language

repoReasonForEmail?: string

Provide the repo ID for why you are emailing the user

sender?: string

Sender identifier for tracking

ReturnsExpand Collapse
UserEmailBestEmailResponse { count, results }
count: number

Number of results returned

results: Array<Result>

Array of best email results

bestEmail: string | null

Best email address, or null if none available

githubId: string

GitHub node ID

login: string

GitHub username

otherCandidates: Array<string>

Other email addresses that were not selected as the best email

Get best email addresses by GitHub node IDs
import Bountylab from '@bountylab/bountylab';

const client = new Bountylab({
  apiKey: process.env['BOUNTYLAB_API_KEY'], // This is the default and can be omitted
});

const response = await client.userEmails.bestEmail({ githubIds: ['MDQ6VXNlcjU4MzIzMQ==', 'MDQ6VXNlcjE='] });

console.log(response.count);
{
  "count": 2,
  "results": [
    {
      "bestEmail": "octocat@gmail.com",
      "githubId": "MDQ6VXNlcjU4MzIzMQ==",
      "login": "octocat",
      "otherCandidates": [
        "octocat@github.com",
        "octocat@work.com"
      ]
    }
  ]
}
Returns Examples
{
  "count": 2,
  "results": [
    {
      "bestEmail": "octocat@gmail.com",
      "githubId": "MDQ6VXNlcjU4MzIzMQ==",
      "login": "octocat",
      "otherCandidates": [
        "octocat@github.com",
        "octocat@work.com"
      ]
    }
  ]
}