Skip to main content

Obtain your API key

The Email API client requires a single credential:
  • API key: a secret token that authenticates your requests
It is available in the Paubox dashboard under API Credentials.

Option 1: Constructor parameter

Pass your API key directly; useful for console apps or when managing secrets via environment variables:
Read from an environment variable:
Add your API key to appsettings.json:
Then inject IConfiguration and pass it to the constructor:
Or instantiate directly:
The SDK reads APIKey from the configuration and sets the Authorization header automatically on every request:

Forms client

GetForm and SubmitForm are public and need no credentials:
All other Forms methods need an API key with the forms scope, sent as Authorization: Bearer YOUR_API_KEY. Pass it to the constructor, or set FormsAPIKey (and optionally FormsBaseURL) in configuration:
Use IFormsLibrary in ASP.NET Core for dependency injection and testability:

Receiving and webhook clients

ReceivingLibrary and WebhookLibrary take the same API key as EmailLibrary, either as a constructor argument or from APIKey in configuration.

Security notes

  • Never hard-code credentials in source files. Use appsettings.json with user secrets or environment variables.
  • Use .NET user secrets during development to keep credentials out of source control.