Skip to main content

Obtain your credentials

The Email API service requires two credentials:
  • API key: a secret token that authenticates your requests
  • Username: your Paubox API endpoint username (not your login email)
Both are available in the Paubox dashboard under API Credentials. Create a .env file in your project root:
The SDK loads these automatically via dotenv. Call the factory with no arguments:

Option 2: Direct configuration

Pass credentials explicitly to the factory:
The service factory throws immediately if either credential is missing, so errors surface at startup rather than at send time. The SDK sets the Authorization header automatically on every request:

Forms service

formService requires no credentials:

Security notes

  • Add .env to your .gitignore; never commit credentials to source control.
  • In production, prefer your platform’s secret management (environment variables injected by your hosting provider) over .env files.