Obtain your API key
The Email API client requires a single credential:- API key: a secret token that authenticates your requests
Option 1: Constructor parameter
Pass your API key directly; useful for console apps or when managing secrets via environment variables:Option 2: IConfiguration (recommended for ASP.NET Core)
Add your API key toappsettings.json:
IConfiguration and pass it to the constructor:
APIKey from the configuration and sets the Authorization header automatically on every request:
Forms client
GetForm and SubmitForm are public and need no credentials:
forms scope, sent as Authorization: Bearer YOUR_API_KEY. Pass it to the constructor, or set FormsAPIKey (and optionally FormsBaseURL) in configuration:
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.jsonwith user secrets or environment variables. - Use .NET user secrets during development to keep credentials out of source control.