Navigation

Email Discovery

Connect a user's Gmail account to automatically discover bills from their inbox. BillerAPI scans incoming emails, identifies billers, and extracts bill data.

Related guide: Link a Biller Account

The Email Message object

Attributes

FieldTypeDescription
id*stringUnique message identifier
user_id*stringThe user who owns this message
from*stringSender email address
subjectstringEmail subject line
biller_idstringMatched biller ID (if identified)
biller_namestringMatched biller name (if identified)
bill_amountnumberExtracted bill amount (if found)
due_datestringExtracted due date (if found)
received_atstringISO 8601 timestamp when the email was received
Example Email Message object
JSON
{
  "id": "msg_abc123",
  "user_id": "user_456",
  "from": "billing@electric-company.com",
  "subject": "Your April bill is ready",
  "biller_id": "test_electric_company",
  "biller_name": "Test Electric Company",
  "bill_amount": 142.50,
  "due_date": "2026-04-15",
  "received_at": "2026-04-01T08:30:00Z"
}
POST/emails/gmail/oauth-url

Generate a Gmail OAuth URL to initiate the email connection flow. No authentication required. Redirect the user to the returned URL to begin Gmail authorization.

Request Body

FieldTypeDescription
user_id*stringYour internal user identifier
client_id*stringYour BillerAPI client ID
redirect_uristringURL to redirect after OAuth (defaults to your configured redirect URI)
Response
{
  "oauth_url": "https://accounts.google.com/o/oauth2/v2/auth?..."
}
curl -X POST https://sandbox.api.billerapi.com/emails/gmail/oauth-url \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user_456",
    "client_id": "client_xyz",
    "redirect_uri": "https://your-app.com/callback"
  }'
POST/emails/gmail/connect

Complete the Gmail connection after the user has authorized via OAuth. Call this endpoint after receiving the OAuth callback.

Request Body

FieldTypeDescription
user_id*stringYour internal user identifier
client_id*stringYour BillerAPI client ID
Response
{
  "connected": true,
  "email": "user@gmail.com",
  "user_id": "user_456"
}
curl -X POST https://sandbox.api.billerapi.com/emails/gmail/connect \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user_456",
    "client_id": "client_xyz"
  }'
GET/emails/messages

List discovered email messages for a user. Returns emails that have been scanned and matched to billers, with extracted bill data when available.

Query Parameters

FieldTypeDescription
userId*stringFilter by user ID
startDatestringISO 8601 start date filter
endDatestringISO 8601 end date filter
limitintegerMaximum results to return (default: 20, max: 100)
cursorstringPagination cursor from previous response
Response
{
  "messages": [EmailMessage],
  "cursor": "eyJsYXN0X2lkIjoibXNnXzEyMyJ9"
}
curl "https://sandbox.api.billerapi.com/emails/messages?userId=user_456&limit=20" \
  -H "X-Client-ID: your_client_id" \
  -H "X-Client-Secret: your_client_secret"