Email Account Management
Add OAuth Email Account
Connect Gmail or Outlook account using OAuth 2.0 with automatic token refresh
POST
Adds an OAuth-authenticated email account (Gmail or Outlook). SmartLead manages token refresh automatically. Use this endpoint after obtaining OAuth tokens from the respective provider.
Query Parameters
string
required
Your SmartLead API key
Request Body
string
required
Display name for outgoing emails
string
required
Email address (must match OAuth account)
string
required
Email username (typically same as from_email)
string
required
Provider type. Valid values:
GMAIL, OUTLOOKobject
required
OAuth token object obtained from provider
boolean
required
Whether to enable email warmup for this account
boolean
required
Whether to use whitelabel OAuth credentials. Must be
true or falsenumber
Email account ID (only for updates, null for new accounts)
number
Maximum emails allowed per day (including warmup and campaigns)
string
Custom domain for tracking links
string
BCC email address for all outgoing emails
number
Minimum time to wait between emails in minutes
string
Email signature HTML
number
Number of warmup emails per day (if warmup_enabled is true)
number
Daily increase in warmup email count
number
Target reply rate percentage for warmup
number
Client ID for multi-tenant accounts
Response Codes
Success
OAuth email account added successfully
Bad Request
Invalid OAuth token or connection validation failed
Unauthorized
Invalid or missing API key
Validation Error
Missing required fields or invalid type value
Internal Server Error
Server error occurred
OAuth Flow
1
Obtain OAuth tokens from provider
Use Google or Microsoft OAuth flow to obtain access and refresh tokens with appropriate mail scopes.
Gmail Scope Required:
https://mail.google.com/Outlook Scope Required: https://outlook.office.com/.default or https://outlook.office.com/SMTP.Send https://outlook.office.com/IMAP.AccessAsUser.All2
Call this endpoint with tokens
Send the OAuth tokens and account information to this endpoint. SmartLead will validate the connection.
3
Enable warmup if needed
Set
warmup_enabled: true and configure warmup parameters to gradually build sender reputation.Usage Notes
SmartLead automatically refreshes expired OAuth tokens using the refresh_token. Ensure the refresh_token is included in the token object.
Related Endpoints
- Add SMTP Email Account - For non-OAuth accounts
- Update Email Account
- Get All Email Accounts
