Skip to content
Get started

Get best email addresses by GitHub node IDs

user_emails.best_email(UserEmailBestEmailParams**kwargs) -> UserEmailBestEmailResponse
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
github_ids: SequenceNotStr[str]

Array of GitHub node IDs (1-100)

signals: Optional[Signals]

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

email_body: Optional[str]

Email body content for tracking

email_subject: Optional[str]

Email subject for tracking

reason_for_email_natural_language: Optional[str]

Provide the reason for emailing the user in natural language

repo_reason_for_email: Optional[str]

Provide the repo ID for why you are emailing the user

sender: Optional[str]

Sender identifier for tracking

ReturnsExpand Collapse
class UserEmailBestEmailResponse:
count: float

Number of results returned

results: List[Result]

Array of best email results

best_email: Optional[str]

Best email address, or null if none available

github_id: str

GitHub node ID

login: str

GitHub username

other_candidates: List[str]

Other email addresses that were not selected as the best email

Get best email addresses by GitHub node IDs
import os
from bountylab import Bountylab

client = Bountylab(
    api_key=os.environ.get("BOUNTYLAB_API_KEY"),  # This is the default and can be omitted
)
response = client.user_emails.best_email(
    github_ids=["MDQ6VXNlcjU4MzIzMQ==", "MDQ6VXNlcjE="],
)
print(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"
      ]
    }
  ]
}