Address Verification Concepts
Verification goes beyond validation - it confirms an address is real and deliverable.
Validation vs Verification
| Aspect | Validation | Verification |
|---|---|---|
| Checks | Format correctness | Real-world existence |
| Speed | Instant (local) | Requires API call |
| Example | ZIP is 5 digits | ZIP 10001 exists in NYC |
| Cost | Free | May have API costs |
Verification Levels
Level 1: Format Valid
- Postal code matches country pattern
- Required fields present
Level 2: Components Valid
- Postal code exists in database
- State matches postal code region
Level 3: Address Verified
- Full address geocodes successfully
- High confidence match
Level 4: Deliverable
- Carrier confirms delivery possible
- No PO Box restrictions violated
Using Nominatim for Verification
Nominatim (OpenStreetMap) provides free geocoding:
javascript1async function verifyAddress(address) {2 const query = encodeURIComponent(3 `${address.street}, ${address.city}, ${address.state} ${address.zip}`4 );56 const response = await fetch(7 `https://nominatim.openstreetmap.org/search?q=${query}&format=json&addressdetails=1`8 );910 const results = await response.json();1112 if (results.length === 0) {13 return { verified: false, error: 'ADDRESS_NOT_FOUND' };14 }1516 return {17 verified: true,18 confidence: parseFloat(results[0].importance),19 coordinates: {20 lat: parseFloat(results[0].lat),21 lng: parseFloat(results[0].lon)22 }23 };24}
Confidence Scores
Geocoding APIs return confidence or importance scores:
| Score Range | Meaning |
|---|---|
| 0.9 - 1.0 | Exact match |
| 0.7 - 0.9 | Good match |
| 0.5 - 0.7 | Partial match |
| < 0.5 | Poor match, verify manually |
Best Practices
- Validate format first - Don't waste API calls on invalid formats
- Cache results - Addresses don't change often
- Use multiple providers - Fallback if primary fails
- Set confidence thresholds - Reject low-confidence matches
- Log verification failures - Track patterns for improvement