AddressValidation
AddressValidation is a .NET library with the goal of providing a simple and streamlined process of validating physical addresses.
Note
AddressValidation supports trimming and native AOT deployments.
Integrations
AddressValidation comes with several service integrations pre-built and ready to use. Reference the table below for details on available integrations.
| Service | Integration | Coverage | Status |
|---|---|---|---|
| FedEx® Address Validation API | FedEx | 46 countries | Complete |
| Google Address Validation API | 39 countries | Complete | |
| Pitney Bowes Address Validation API | Pitney Bowes | United States | Complete |
| UPS® Address Validation API | UPS | United States | Complete |
| USPS® Address Validation API | United States | Planned |
If there is no integration for a service you wish to you use, you can either open a feature request or you can read on how to develop a custom integration.
Caching
To provide maximum performance all integrations within AddressValidation require HybridCache to cache authentication tokens. Register it at application startup:
builder.Services.AddHybridCache();
By default, HybridCache uses an in-process (L1) cache, which is sufficient for single-server deployments, local development, and testing environments. For multi-server deployments, also register an IDistributedCache provider to serve as the distributed (L2) cache layer. Refer to the documentation for available providers.
Note
Currently only access tokens are cached. Caching of requests and responses is not natively supported for two reasons:
- Privacy regulations — Address data constitutes personally identifiable information (PII) subject to GDPR and CCPA.
- Provider Terms of Service — Google, Pitney Bowes, and UPS all restrict caching of API responses. Google and Pitney Bowes both permit temporary caching for up to 30 days under specific conditions (user consent, secure storage, no cross-user reuse); UPS prohibits all uses of response data not explicitly permitted by their agreement.
Security
Important
AddressValidation does not (and will not) provide a facility for encrypting or decrypting sensitive information so please read this section carefully.
The pre-built integrations provided by AddressValidation all make use of an IConfiguration instance to read their respective configuration values.
As a result, many of the configuration values will contain sensitive information such as client secrets and will need to be secured properly.
Fortunately, there are several options available to ensure that this information is stored securely:
- Azure AppConfig with Azure KeyVault
- Custom Configuration Provider with AWS Secrets Manager
- Custom Configuration Provider with Google Secrets Manager
For any other implementation a custom configuration provider will be required.