Obtain your API key
The Email API service requires one credential:- API key: a secret token that authenticates your requests
Create config.properties
Create aconfig.properties file in your project directory:
EmailService sends messages and checks delivery status through https://api.paubox.net/v1/APIUSER/, so set APIUSER to your Paubox API username. ReceivingService uses only APIKEY. FormsService uses FORMSAPIKEY instead (see FormsService). WebhookService uses a scoped API key from WEBHOOKSAPIKEY (see Webhook client).
Load credentials at startup
CallConfigurationManager.getProperties once before creating an EmailService; the service reads APIUSER when it is constructed. Pass the file path relative to your working directory or as an absolute path:
getProperties prints a stack trace and returns without throwing, and later requests go out without your credentials.
The SDK reads APIKEY from the loaded properties and sets the Authorization header automatically on every request:
FormsService
getForm and submitForm are public and need no credentials. All other FormsService methods need an API key with the forms scope, sent as Authorization: Bearer YOUR_API_KEY. Set it as FORMSAPIKEY in config.properties and load the file before creating the service, or pass it to the constructor:
Security notes
- Do not commit
config.propertiesto source control. Add it to.gitignore. - In production environments, consider reading credentials from system environment variables and writing them to the properties file at startup rather than storing them statically on disk.