Phone Extension/Country Code (Optional)
The phone extension or country code associated with the phone number. This field provides additional context for the phone number and supports various use cases including country codes, internal extensions, and routing information.
Key Features:
Format : Numeric only (positive integer)
Auto-Default : Automatically set to 1 when phoneNumber is provided but phoneExt is missing
Smart Cleanup : Automatically removed when phoneNumber is not provided
Flexible Usage : Supports country codes, extensions, and routing numbers
Business Logic & Behavior:
Auto-Defaulting : When phoneNumber is provided but phoneExt is null/undefined phoneExt = 1
Preservation : When both phoneNumber and phoneExt are provided phoneExt is preserved as-is
Cleanup : When phoneNumber is not provided phoneExt is ignored and removed
Validation : Must be a positive integer when provided
Common Use Cases:
Country Codes:
US/Canada: 1 (default)
UK: 44
Australia: 61
Germany: 49
Internal Extensions:
Office extensions: 123, 456, 789
Department codes: 100, 200, 300
System routing: 1001, 2002, 3003
Special Values:
0: Valid edge case (some systems use 0 for specific routing)
1: Default value for US/Canada numbers
Large numbers: Support for complex routing systems
Integration Examples:
JSON
// US number (auto-default)
{ "phoneNumber": 5551234567 }
// Result: { "phoneNumber": 5551234567, "phoneExt": 1 }
// UK number (explicit country code)
{ "phoneNumber": 447123456789, "phoneExt": 44 }
// Result: { "phoneNumber": 447123456789, "phoneExt": 44 }
// Internal extension
{ "phoneNumber": 5551234567, "phoneExt": 123 }
// Result: { "phoneNumber": 5551234567, "phoneExt": 123 }
// No phone (cleanup)
{ "phoneExt": 1 }
// Result: {} (phoneExt removed)
Error Handling:
Invalid formats return HTTP 400 with specific error codes
Comprehensive validation prevents data corruption
Structured error responses aid in client-side handling
.