Obtain your API key
The Email API client requires one credential:- API key: a secret token that authenticates your requests
Create a .env file
Add your API key to a.env file at your project root:
PAUBOX_API_KEY with getenv() but does not load .env files. Load it with vlucas/phpdotenv (installed with the SDK) before creating the client; no constructor arguments are needed:
PAUBOX_API_KEY environment variable also works.
Paubox\Paubox sets this Authorization header on every request:
Paubox\PauboxReceiving takes the same key as a constructor argument, or reads PAUBOX_API_KEY when it is omitted. It sends it in the legacy Authorization: Token token=YOUR_API_KEY format, which the Email API also accepts.
Paubox\PauboxWebhooks needs a scoped API key, sent as Authorization: Bearer YOUR_API_KEY. Pass it to the constructor, or set PAUBOX_WEBHOOKS_API_KEY. See Webhook client.
Forms client
getForm and submitForm on Paubox\PauboxForms require no credentials. Form submissions are associated with the form ID, not an API key.
listForms, createForm, and listSubmissions) require a scoped API key with the forms scope. It can be the same key as PAUBOX_API_KEY if that key also has the forms scope. Pass it to the constructor or set PAUBOX_FORMS_API_KEY:
Security notes
- Never commit
.envfiles to source control. Add.envto your.gitignore. - The SDK does not expose credentials in error messages or logs.