Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paubox.com/llms.txt

Use this file to discover all available pages before exploring further.

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:
API_KEY=YOUR_API_KEY
API_USERNAME=YOUR_USERNAME
The SDK loads these automatically via dotenv. Call the factory with no arguments:
const pbMail  = require('paubox-node');
const service = pbMail.emailService();

Option 2: Direct configuration

Pass credentials explicitly to the factory:
const service = pbMail.emailService({
  apiKey:      'YOUR_API_KEY',
  apiUsername: 'YOUR_USERNAME'
});
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:
Authorization: Token token=YOUR_API_KEY

Forms service

formService requires no credentials:
const formsService = pbMail.formService();

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.