Senegal Phone Number Format: +221 Country Code & Validation Guide
Complete guide to Senegal phone numbers with +221 country code: 9-digit format validation, mobile operators (Orange, Yas, Expresso), regex examples, number portability, and ARTP regulations for developers.
Senegal uses the +221 country code with a consistent 9-digit phone number format. This comprehensive guide covers everything developers need to integrate Senegalese phone numbers into applications: validation techniques, operator prefixes, number portability (MNP), and ARTP (Autorité de Régulation des Télécommunications et des Postes) regulations.
Who needs this guide: Developers implementing SMS APIs, payment verification systems, CRM platforms, authentication flows (OTP/2FA), call routing systems, and any application requiring phone number validation for Senegalese users.
Emergency Numbers: Police (17), Fire (18), Ambulance (15)
Mobile Pattern:/^7[0-9]\d{7}$/
Landline Pattern:/^3[03269]\d{7}$/
Understanding Senegal's Telecommunications System
Senegal's telecommunications sector has grown significantly since liberalization in the 1990s. The ARTP oversees the sector, which contributes almost 10% of national GDP. Mobile services drive this growth, with penetration rates exceeding 100% – more mobile subscriptions exist than people.
Market Share and Operators
Three main operators and several MVNOs serve this market. As of 2024, market share distribution is:
Yas Senegal: 20-25% market share – formerly Free Senegal, rebranded November 2024 and 80% owned by Axian Group with prefixes 76X (legacy), operating on 77X, 78X
Expresso Senegal: 15-17% market share – operates with prefix 75X
These MVNOs use the 75X range reserved for virtual operators. Ensure your application supports numbering plans from all major operators.
Senegal Phone Number Format Explained
Core Structure
All Senegalese phone numbers follow a consistent 9-digit structure: NXX XXX XXX.
N: Service category – 3 for landlines or 7 for mobile numbers
X: Any digit from 0 to 9
Service Categories
1. Landline Numbers (Geographic)
Landline numbers follow the format 3XX XXX XXX. Example: 338 219 903 (Dakar). The first three digits indicate the geographic zone:
338, 339: Dakar and surrounding metropolitan area (Sonatel/Orange)
30X: Non-geographic fixed (Expresso Senegal)
32X: Non-geographic fixed (legacy Sentel/Free, now Yas Senegal)
36X: Non-geographic fixed (CSU/Hayo)
39X: VoIP and government services (ADIE)
Note: Operator-specific allocations have superseded the original geographic zone coding (33X for Dakar, 34X Northern, 35X Central, 36X Southern). Dakar now uses 338 and 339 specifically, while other regions use the same prefixes with different middle digits. For location-based services, verify specific prefix allocations with ARTP's official numbering plan.
2. Mobile Numbers
Mobile numbers follow the format 7XX XXX XXX. Example: 778 688 219. The first three digits after the 7 identify the mobile operator:
70X: Orange Senegal and Expresso Senegal (shared range)
72X: CSU/Hayo mobile services
75X: Expresso Senegal and MVNO range (754-757)
76X: Yas Senegal (formerly Free/Sentel, some Orange allocations)
77X: Orange Senegal (Sonatel Mobiles)
78X: Orange Senegal (Sonatel Mobiles)
79X: Government/ADIE mobile services
Legacy Free Senegal Numbers: Following the November 2024 rebranding to Yas Senegal, all existing Free Senegal numbers with 76X, 77X, and 78X prefixes remain valid and operational. No number changes are required for existing subscribers. The rebranding is organizational only—technical infrastructure and number allocations continue unchanged.
Operator prefixes help route calls and SMS messages correctly. However, mobile number portability (MNP) means the prefix may not reflect the current serving operator.
3. Special Service Numbers
Senegal also uses special service numbers:
Toll-Free:800 XXX XXX
Premium:88X XXX XXX
Shared Cost:81X XXX XXX
These numbers have specific routing and billing requirements. Account for them in your application.
4. Short Codes and Emergency Numbers
Emergency Services (2-3 digits):
Police: 17 (national), also 800-002-020
Fire/Sapeurs Pompiers: 18
Ambulance/SAMU: 15, also 33 824 2418
Military Police: 123 (more responsive in countryside areas)
Tourist Police: +221 33 971 1017 (callable from outside Senegal)
Operator Services:
Directory Assistance: 13
International Operator: 16
USSD Short Codes: Senegal uses USSD codes in the format *#XXXX# or *XXX# for value-added services. Common examples include *123# for balance checks and *145# for mobile service management. ARTP allocates 2XXX format USSD codes to registered value-added service providers.
Important: You cannot call emergency numbers from outside Senegal (except Tourist Police). Implement restrictions in auto-dialer applications to prevent accidental emergency calls during testing.
How to Validate Senegal Phone Numbers
Number Validation
Use regular expressions (regex) to validate Senegalese phone numbers efficiently. Here are examples in multiple languages:
These regex patterns defend against invalid number formats but don't check for number portability. Test your validation logic with various inputs, including edge cases and invalid formats.
Number Portability Integration
Number portability (NP) lets users switch operators while keeping their existing number. Senegal implemented mobile number portability (MNP) in September 2015 under ARTP oversight. Over 40% of numbers in many markets have been ported, making MNP lookup critical for accurate routing.
MNP Lookup Service Providers:
Since ARTP does not provide a public MNP lookup API, you must integrate with commercial providers:
Data Accuracy: The accuracy and timeliness of the MNP database are critical. Ensure you're using a reliable data source.
Cache TTL: Recommended cache duration is 24-48 hours for MNP data. Balance cost savings with data freshness.
Error Handling: Implement robust error handling in case the MNP lookup service is unavailable. Consider a fallback mechanism, such as routing based on the original operator prefix.
Rate Limits: Most providers impose rate limits (e.g., 100-1000 queries/second). Implement request queuing for high-volume scenarios.
Batch vs. Single Lookup: For bulk operations (e.g., validating customer databases), use batch lookup APIs which offer better performance and lower per-query costs.
Porting Timeframes: Number porting in Senegal typically takes 1-3 business days. During this period, routing may be unreliable.
Format Handling
Store numbers in international E.164 format (+221NXXXXXXXX), which includes the country code and full 9-digit number. The ITU (International Telecommunication Union) recommends this format for global consistency. Display numbers in different formats depending on context.
SMS and API Payload Format: Most SMS APIs expect numbers in E.164 format without spaces: +221778688219. Check your API documentation for exact requirements.
Adapt these functions to meet your specific display requirements.
Best Practices
Follow these best practices when working with Senegalese phone numbers:
Number Storage: Store numbers in E.164 format (+221NXXXXXXXX). Include metadata for number type (landline, mobile, special service) and portability status to simplify data management and system integration.
Validation Rules: Implement strict format checking using regex. Validate operator prefixes and geographic codes to prevent invalid data from entering your system.
Error Handling: Log and handle number format errors gracefully. Include the invalid number, timestamp, and detected number type in error logs.
JavaScript
functionhandleNumberError(number, error) {
console.error(`Invalid number format: ${number}`, {
error: error,
timestamp: newDate(),
numberType: determineNumberType(number),
cleanedNumber: cleanNumber(number)
});
// Notify the user or retry the operation.
}
Consent: Obtain explicit user consent before processing phone numbers, especially for marketing purposes.
Data Security: Implement technical measures to prevent unauthorized access, alteration, or disclosure. Data controllers must ensure confidentiality and integrity.
User Rights: Users have rights to access, rectify, and delete their data. They can object to processing for marketing purposes.
Notification to CDP: Processing personal data requires notification or authorization from the Commission de Données Personnelles (CDP), Senegal's data protection authority.
Data Transfers: International transfers require CDP authorization unless the recipient country provides adequate protection. EU countries and members of the Association Francophone des Autorités de Protection des Données Personnelles are considered adequate.
Marketing Opt-Out: Users must be able to opt out of marketing communications at no charge. Messages must include clear opt-out instructions.
Retention Limits: Only retain phone numbers as long as necessary for the stated purpose.
Violations result in fines of XOF 1-100 million and imprisonment of 1-7 years. Consult ARTP regulations and CDP guidelines for current requirements.
Number Allocation and Management (For Advanced Implementations)
If your application involves number allocation or management, understand the different number categories and allocation workflow.
Premium Number Categories
Senegal offers different categories of premium numbers:
Standard Numbers: Basic service numbers with standard annual fees and typical processing times of 5-10 business days.
Premium Numbers: Memorable number sequences (e.g., repeating digits like 777 7777, sequential patterns like 123 4567, or easy-to-remember combinations) with enhanced routing capabilities and higher allocation fees.
Golden Numbers: Ultra-premium, highly sought-after numbers with competitive bidding and special routing requirements. These numbers can command prices up to 10 times higher than standard numbers.
The number allocation process typically involves three phases:
Application Phase (2-3 weeks): Submit an initial request with required documentation (business registration, technical specifications, compliance history), undergo technical capability and financial viability assessments.
Technical Evaluation (2-4 weeks): Network compatibility checks, routing capability verification, resource availability assessment, and integration planning with existing ARTP infrastructure.
Implementation (1-2 weeks): Network configuration, routing table updates, testing and verification, and service activation.
Total Duration: 5-9 weeks from application to activation for standard numbers. Premium and golden numbers may require additional time for bidding processes.
For detailed information about number allocation procedures, required documentation, and current pricing, consult the ARTP Official Guidelines.
Future-Proofing Your Implementation
The telecommunications landscape evolves constantly. Consider these future-proofing initiatives to ensure your application remains compatible and efficient:
Digital Transformation: Integrate with emerging technologies, support IoT numbering requirements (prefix 79X reserved for IoT/M2M), and enhance routing capabilities for digital service enablement.
Capacity Planning: Conduct regular demand forecasting, implement resource optimization strategies, accommodate technology evolution, and align with international standards. ARTP regularly updates number allocations—subscribe to ARTP announcements for updates.
5G and Network Evolution: As Senegal's operators roll out 5G services, ensure your systems support VoLTE, RCS (Rich Communication Services), and eSIM provisioning. The unified Yas brand signals ongoing infrastructure modernization across the region.
eSIM Impact: eSIM adoption will affect number provisioning and management workflows. Plan for remote SIM provisioning (RSP) capabilities and digital-first number allocation processes.
Frequently Asked Questions About Senegal Phone Numbers
What is Senegal's country code?
Senegal's country code is +221. This code is required when dialing Senegalese phone numbers from outside the country. The complete international format is +221 followed by the 9-digit national number (e.g., +221 77 123 4567).
How many digits are in a Senegal phone number?
All Senegalese phone numbers contain exactly 9 digits (excluding the +221 country code). The first digit identifies the service type: 3 for landlines and 7 for mobile numbers. This creates a consistent NXX XXX XXX format across all phone numbers in Senegal.
Which mobile operators serve Senegal?
Senegal has three main mobile operators: Orange Senegal (56-59% market share, prefixes 70X, 76X, 77X, 78X), Yas Senegal formerly Free Senegal (20-25% market share, prefixes 76X, 77X, 78X), and Expresso Senegal (15-17% market share, prefix 75X). Yas Senegal was rebranded in November 2024 and is 80% owned by Axian Group. MVNOs operate on the 75X range.
Does Senegal support mobile number portability?
Yes. Senegal implemented mobile number portability (MNP) in September 2015, allowing users to switch operators while keeping their existing phone numbers. ARTP oversees the MNP system to ensure fair implementation across all operators. Porting typically takes 1-3 business days.
How do you validate a Senegal phone number?
Validate Senegalese numbers using regex patterns: landlines match /^3[03269]\d{7}$/, mobile numbers match /^7[0-9]\d{7}$/, and toll-free numbers match /^800\d{6}$/. Store numbers in E.164 format (+221NXXXXXXXX) for international compatibility. See code examples in JavaScript, Python, and PHP above.
What is ARTP in Senegal?
ARTP (Autorité de Régulation des Télécommunications et des Postes) is Senegal's telecommunications and postal regulatory authority. ARTP manages numbering plans, enforces compliance, oversees number portability, and maintains technical standards for the sector.
What are SMS character limits and encoding for Senegal?
SMS in Senegal follows standard GSM specifications: 160 characters for GSM-7 encoding (standard Latin alphabet) and 70 characters for UCS-2 encoding (Unicode, needed for special characters and emojis). For optimal delivery, use GSM-7 encoding when possible.
What are typical SMS costs for Senegal?
International A2P SMS: $0.03-0.08 per message depending on provider and volume. Domestic SMS: Lower rates available through local operator agreements. Prices vary by operator and sender ID registration status.
How do I prevent rate limiting issues?
Implement exponential backoff for API calls, respect operator-specific throughput limits (typically 10-100 messages/second), use message queuing for high-volume sends, and monitor delivery reports to detect blocking. Register sender IDs with operators to improve delivery rates and throughput limits.
Conclusion
You now have a solid foundation for working with Senegalese phone numbers. Follow the guidelines and best practices in this guide to integrate seamlessly with Senegal's telecommunications infrastructure. Stay informed about the latest ARTP regulations and adapt your systems accordingly to build robust applications that serve the Senegalese market effectively.
Senegalese phone numbers have a 9-digit structure, represented as NXX XXX XXX, where 'N' indicates the service type (3 for landlines, 7 for mobile) and 'X' is any digit from 0 to 9. Landlines follow the format 3XX XXX XXX, while mobile numbers are 7XX XXX XXX. For example, a Dakar landline might be 338 219 903, and a mobile number could be 778 688 219.
Use regular expressions (regex) to validate Senegalese phone numbers. For example, in JavaScript, the regex /^3[3-6]\d{7}$/ validates landlines, and /^7[0567-8]\d{7}$/ validates mobile numbers. Remember to clean the number by removing spaces and special characters before validating.
The country code for Senegal is +221. When calling Senegal from another country, you must dial +221 followed by the 9-digit phone number. For example, to call the number 778 688 219 from internationally, you would dial +221 778 688 219.
The E.164 format for Senegalese numbers is +221NXXXXXXXX, where N is the service category digit (3 or 7) and X represents the remaining 8 digits. This international standard ensures consistent formatting for global interoperability. For example, the number 778 688 219 becomes +221778688219 in E.164 format.
Senegal's mobile penetration rate exceeds 100% due to significant growth and modernization in the telecommunications sector, primarily driven by the mobile segment. Many individuals have multiple SIM cards or subscriptions. This vibrant mobile market is served by three main operators: Orange Senegal, Free Senegal, and Expresso Senegal.
Each mobile operator in Senegal has specific prefixes within the 7XX XXX XXX format. Orange Senegal uses 70X and 76X, Free Senegal uses 77X and 78X, and Expresso Senegal uses 75X. Knowing these prefixes can be crucial for routing calls and SMS messages correctly.
Number portability in Senegal allows users to switch operators while keeping their number. To handle this, integrate with a number portability database or lookup service to determine the current operator of a number. Implement robust error handling for cases where the lookup service is unavailable. Consider caching lookup results to reduce latency.
The first three digits of a landline number (3XX) represent the geographic zone. 33X corresponds to the Dakar Metropolitan Area, 34X to Northern Regions, 35X to Central Regions, and 36X to Southern Regions. This information can be useful for location-based services.
ARTP (Autorité de Régulation des Télécommunications et des Postes) is the regulatory authority for Senegal's telecommunications sector. They oversee regulations, technical specifications, and number allocation procedures. Staying updated on ARTP guidelines is essential for regulatory compliance.
Allocating premium numbers involves an application phase with technical and financial assessments, a technical evaluation phase for network compatibility, and an implementation phase for network configuration and activation. Contact ARTP for detailed procedures and pricing.
Consider integrating number portability functionality if your application involves routing calls or SMS messages, identifying the correct operator, or any operation where knowing the current operator of a number is essential. While it adds complexity, it ensures accurate routing and operator identification.
Golden numbers are ultra-premium, highly sought-after numbers in Senegal available through a competitive bidding process. They often command significantly higher prices than standard numbers due to their memorability and exclusivity. Contact ARTP for details about acquiring golden numbers.
Toll-free numbers in Senegal follow the format 800 XXX XXX. You can identify them using a regular expression like /^800\d{6}$/. These numbers have specific routing and billing requirements that your application must handle.
Introduction
Senegal uses the +221 country code with a consistent 9-digit phone number format. This comprehensive guide covers everything developers need to integrate Senegalese phone numbers into applications: validation techniques, operator prefixes, number portability (MNP), and ARTP (Autorité de Régulation des Télécommunications et des Postes) regulations.
Who needs this guide: Developers implementing SMS APIs, payment verification systems, CRM platforms, authentication flows (OTP/2FA), call routing systems, and any application requiring phone number validation for Senegalese users.
Quick Reference
/^7[0-9]\d{7}$//^3[03269]\d{7}$/Understanding Senegal's Telecommunications System
Senegal's telecommunications sector has grown significantly since liberalization in the 1990s. The ARTP oversees the sector, which contributes almost 10% of national GDP. Mobile services drive this growth, with penetration rates exceeding 100% – more mobile subscriptions exist than people.
Market Share and Operators
Three main operators and several MVNOs serve this market. As of 2024, market share distribution is:
70X,76X,77X,78X76X(legacy), operating on77X,78X75XMVNOs (Mobile Virtual Network Operators):
754X,755X,756X757XThese MVNOs use the
75Xrange reserved for virtual operators. Ensure your application supports numbering plans from all major operators.Senegal Phone Number Format Explained
Core Structure
All Senegalese phone numbers follow a consistent 9-digit structure:
NXX XXX XXX.N: Service category –3for landlines or7for mobile numbersX: Any digit from 0 to 9Service Categories
1. Landline Numbers (Geographic)
Landline numbers follow the format
3XX XXX XXX. Example:338 219 903(Dakar). The first three digits indicate the geographic zone:338,339: Dakar and surrounding metropolitan area (Sonatel/Orange)30X: Non-geographic fixed (Expresso Senegal)32X: Non-geographic fixed (legacy Sentel/Free, now Yas Senegal)36X: Non-geographic fixed (CSU/Hayo)39X: VoIP and government services (ADIE)Note: Operator-specific allocations have superseded the original geographic zone coding (
33Xfor Dakar,34XNorthern,35XCentral,36XSouthern). Dakar now uses338and339specifically, while other regions use the same prefixes with different middle digits. For location-based services, verify specific prefix allocations with ARTP's official numbering plan.2. Mobile Numbers
Mobile numbers follow the format
7XX XXX XXX. Example:778 688 219. The first three digits after the7identify the mobile operator:70X: Orange Senegal and Expresso Senegal (shared range)72X: CSU/Hayo mobile services75X: Expresso Senegal and MVNO range (754-757)76X: Yas Senegal (formerly Free/Sentel, some Orange allocations)77X: Orange Senegal (Sonatel Mobiles)78X: Orange Senegal (Sonatel Mobiles)79X: Government/ADIE mobile servicesLegacy Free Senegal Numbers: Following the November 2024 rebranding to Yas Senegal, all existing Free Senegal numbers with
76X,77X, and78Xprefixes remain valid and operational. No number changes are required for existing subscribers. The rebranding is organizational only—technical infrastructure and number allocations continue unchanged.Operator prefixes help route calls and SMS messages correctly. However, mobile number portability (MNP) means the prefix may not reflect the current serving operator.
3. Special Service Numbers
Senegal also uses special service numbers:
800 XXX XXX88X XXX XXX81X XXX XXXThese numbers have specific routing and billing requirements. Account for them in your application.
4. Short Codes and Emergency Numbers
Emergency Services (2-3 digits):
Operator Services:
USSD Short Codes: Senegal uses USSD codes in the format
*#XXXX#or*XXX#for value-added services. Common examples include*123#for balance checks and*145#for mobile service management. ARTP allocates 2XXX format USSD codes to registered value-added service providers.Important: You cannot call emergency numbers from outside Senegal (except Tourist Police). Implement restrictions in auto-dialer applications to prevent accidental emergency calls during testing.
How to Validate Senegal Phone Numbers
Number Validation
Use regular expressions (regex) to validate Senegalese phone numbers efficiently. Here are examples in multiple languages:
JavaScript:
// Landline validation const landlinePattern = /^3[03269]\d{7}$/; // Mobile validation (includes all operator ranges) const mobilePattern = /^7[0-9]\d{7}$/; // Toll-free validation const tollfreePattern = /^800\d{6}$/; // Emergency numbers const emergencyPattern = /^(1[578]|123)$/; // International format validation const internationalPattern = /^\+221[37]\d{8}$/; // Example usage: function validateSenegalNumber(number) { // Remove spaces, dashes, and formatting const cleanNumber = number.replace(/[\s\-\(\)\.]/g, ''); // Handle international format if (cleanNumber.startsWith('+221') || cleanNumber.startsWith('00221')) { const national = cleanNumber.replace(/^(\+221|00221)/, ''); return validateSenegalNumber(national); } // Check number type and validate if (emergencyPattern.test(cleanNumber)) { return { valid: true, type: 'emergency' }; } else if (landlinePattern.test(cleanNumber)) { return { valid: true, type: 'landline' }; } else if (mobilePattern.test(cleanNumber)) { return { valid: true, type: 'mobile' }; } else if (tollfreePattern.test(cleanNumber)) { return { valid: true, type: 'tollfree' }; } return { valid: false, type: 'unknown' }; } // Example test cases console.log(validateSenegalNumber("338 219 903")); // Valid Landline console.log(validateSenegalNumber("+221 77 868 8219")); // Valid Mobile console.log(validateSenegalNumber("800123456")); // Valid Toll-free console.log(validateSenegalNumber("17")); // Valid Emergency console.log(validateSenegalNumber("123456789")); // InvalidPython:
import re class SenegalPhoneValidator: LANDLINE_PATTERN = r'^3[03269]\d{7}$' MOBILE_PATTERN = r'^7[0-9]\d{7}$' TOLLFREE_PATTERN = r'^800\d{6}$' EMERGENCY_PATTERN = r'^(1[578]|123)$' INTERNATIONAL_PATTERN = r'^\+221[37]\d{8}$' @staticmethod def clean_number(number): """Remove formatting characters""" cleaned = re.sub(r'[\s\-\(\)\.]', '', number) # Handle international format cleaned = re.sub(r'^(\+221|00221)', '', cleaned) return cleaned @classmethod def validate(cls, number): """Validate Senegalese phone number""" clean = cls.clean_number(number) if re.match(cls.EMERGENCY_PATTERN, clean): return {'valid': True, 'type': 'emergency'} elif re.match(cls.LANDLINE_PATTERN, clean): return {'valid': True, 'type': 'landline'} elif re.match(cls.MOBILE_PATTERN, clean): return {'valid': True, 'type': 'mobile'} elif re.match(cls.TOLLFREE_PATTERN, clean): return {'valid': True, 'type': 'tollfree'} else: return {'valid': False, 'type': 'unknown'} # Usage print(SenegalPhoneValidator.validate("338 219 903")) print(SenegalPhoneValidator.validate("+221 77 868 8219"))PHP:
<?php class SenegalPhoneValidator { const LANDLINE_PATTERN = '/^3[03269]\d{7}$/'; const MOBILE_PATTERN = '/^7[0-9]\d{7}$/'; const TOLLFREE_PATTERN = '/^800\d{6}$/'; const EMERGENCY_PATTERN = '/^(1[578]|123)$/'; public static function cleanNumber($number) { $cleaned = preg_replace('/[\s\-\(\)\.]/', '', $number); $cleaned = preg_replace('/^(\+221|00221)/', '', $cleaned); return $cleaned; } public static function validate($number) { $clean = self::cleanNumber($number); if (preg_match(self::EMERGENCY_PATTERN, $clean)) { return ['valid' => true, 'type' => 'emergency']; } elseif (preg_match(self::LANDLINE_PATTERN, $clean)) { return ['valid' => true, 'type' => 'landline']; } elseif (preg_match(self::MOBILE_PATTERN, $clean)) { return ['valid' => true, 'type' => 'mobile']; } elseif (preg_match(self::TOLLFREE_PATTERN, $clean)) { return ['valid' => true, 'type' => 'tollfree']; } else { return ['valid' => false, 'type' => 'unknown']; } } } // Usage var_dump(SenegalPhoneValidator::validate("338 219 903")); var_dump(SenegalPhoneValidator::validate("+221 77 868 8219")); ?>These regex patterns defend against invalid number formats but don't check for number portability. Test your validation logic with various inputs, including edge cases and invalid formats.
Number Portability Integration
Number portability (NP) lets users switch operators while keeping their existing number. Senegal implemented mobile number portability (MNP) in September 2015 under ARTP oversight. Over 40% of numbers in many markets have been ported, making MNP lookup critical for accurate routing.
MNP Lookup Service Providers:
Since ARTP does not provide a public MNP lookup API, you must integrate with commercial providers:
Typical Pricing: $0.002-0.005 per lookup query. Batch lookups and database downloads offer volume discounts.
Implementation Example:
// Production-ready MNP Lookup Integration const MNP_API_URL = 'https://api.hlr-lookups.com/lookup'; const MNP_API_KEY = process.env.MNP_API_KEY; const CACHE_TTL = 86400; // 24 hours // Simple cache implementation const mnpCache = new Map(); async function checkPortedNumber(msisdn) { // Check cache first const cacheKey = `mnp:${msisdn}`; if (mnpCache.has(cacheKey)) { const cached = mnpCache.get(cacheKey); if (Date.now() - cached.timestamp < CACHE_TTL * 1000) { return cached.data; } } try { const response = await fetch( `${MNP_API_URL}?msisdn=${msisdn}`, { headers: { 'Authorization': `Bearer ${MNP_API_KEY}`, 'Content-Type': 'application/json' }, timeout: 2000 // 2 second timeout } ); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); // Cache the result mnpCache.set(cacheKey, { data: data, timestamp: Date.now() }); return data; } catch (error) { console.error("Error checking ported number:", error); // Fallback to prefix-based routing return fallbackToPrefix(msisdn); } } function fallbackToPrefix(msisdn) { // Extract prefix and return best guess operator const prefix = msisdn.substring(0, 3); const operatorMap = { '70': 'Orange/Expresso', '75': 'Expresso', '76': 'Yas', '77': 'Orange', '78': 'Orange', '79': 'ADIE' }; return { operator: operatorMap[prefix.substring(0, 2)] || 'unknown', ported: false, source: 'fallback' }; } // Batch lookup for high-volume applications async function batchCheckPortedNumbers(msisdns) { const response = await fetch( `${MNP_API_URL}/batch`, { method: 'POST', headers: { 'Authorization': `Bearer ${MNP_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ numbers: msisdns }) } ); return await response.json(); }Key Considerations for Number Portability:
Format Handling
Store numbers in international E.164 format (
+221NXXXXXXXX), which includes the country code and full 9-digit number. The ITU (International Telecommunication Union) recommends this format for global consistency. Display numbers in different formats depending on context.// International Format function formatInternational(number) { const clean = number.replace(/\D/g, ''); return `+221 ${clean.slice(0,2)} ${clean.slice(2,5)} ${clean.slice(5)}`; } // National Format function formatNational(number) { const clean = number.replace(/\D/g, ''); return `${clean.slice(0,2)} ${clean.slice(2,5)} ${clean.slice(5)}`; } // RFC 3966 tel: URI for click-to-call function formatTelURI(number) { const clean = number.replace(/\D/g, ''); return `tel:+221-${clean.slice(0,2)}-${clean.slice(2,5)}-${clean.slice(5)}`; } // Example Usage console.log(formatInternational("338219903")); // Output: +221 33 821 9903 console.log(formatNational("778688219")); // Output: 77 868 8219 console.log(formatTelURI("778688219")); // Output: tel:+221-77-868-8219SMS and API Payload Format: Most SMS APIs expect numbers in E.164 format without spaces:
+221778688219. Check your API documentation for exact requirements.Adapt these functions to meet your specific display requirements.
Best Practices
Follow these best practices when working with Senegalese phone numbers:
+221NXXXXXXXX). Include metadata for number type (landline, mobile, special service) and portability status to simplify data management and system integration.Recommended Database Schema:
CREATE TABLE phone_numbers ( id BIGINT PRIMARY KEY, number_e164 VARCHAR(15) NOT NULL, -- +221XXXXXXXXX number_national VARCHAR(12), -- NXX XXX XXX country_code VARCHAR(3) DEFAULT 'SN', number_type VARCHAR(20), -- mobile, landline, tollfree operator VARCHAR(50), -- Orange, Yas, Expresso is_ported BOOLEAN DEFAULT FALSE, last_mnp_check TIMESTAMP, consent_marketing BOOLEAN DEFAULT FALSE, consent_date TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, INDEX idx_number_e164 (number_e164), INDEX idx_operator (operator) );Validation Rules: Implement strict format checking using regex. Validate operator prefixes and geographic codes to prevent invalid data from entering your system.
Error Handling: Log and handle number format errors gracefully. Include the invalid number, timestamp, and detected number type in error logs.
function handleNumberError(number, error) { console.error(`Invalid number format: ${number}`, { error: error, timestamp: new Date(), numberType: determineNumberType(number), cleanedNumber: cleanNumber(number) }); // Notify the user or retry the operation. }Data Privacy and Regulatory Compliance: Phone numbers are personal data under Senegal's Act No. 2008-12 of 25 January 2008 Concerning Personal Data Protection. Key requirements:
Violations result in fines of XOF 1-100 million and imprisonment of 1-7 years. Consult ARTP regulations and CDP guidelines for current requirements.
Number Allocation and Management (For Advanced Implementations)
If your application involves number allocation or management, understand the different number categories and allocation workflow.
Premium Number Categories
Senegal offers different categories of premium numbers:
For current pricing information and eligibility requirements, consult the ARTP Official Fee Schedules.
Allocation Workflow
The number allocation process typically involves three phases:
Application Phase (2-3 weeks): Submit an initial request with required documentation (business registration, technical specifications, compliance history), undergo technical capability and financial viability assessments.
Technical Evaluation (2-4 weeks): Network compatibility checks, routing capability verification, resource availability assessment, and integration planning with existing ARTP infrastructure.
Implementation (1-2 weeks): Network configuration, routing table updates, testing and verification, and service activation.
Total Duration: 5-9 weeks from application to activation for standard numbers. Premium and golden numbers may require additional time for bidding processes.
For detailed information about number allocation procedures, required documentation, and current pricing, consult the ARTP Official Guidelines.
Future-Proofing Your Implementation
The telecommunications landscape evolves constantly. Consider these future-proofing initiatives to ensure your application remains compatible and efficient:
Digital Transformation: Integrate with emerging technologies, support IoT numbering requirements (prefix
79Xreserved for IoT/M2M), and enhance routing capabilities for digital service enablement.Capacity Planning: Conduct regular demand forecasting, implement resource optimization strategies, accommodate technology evolution, and align with international standards. ARTP regularly updates number allocations—subscribe to ARTP announcements for updates.
5G and Network Evolution: As Senegal's operators roll out 5G services, ensure your systems support VoLTE, RCS (Rich Communication Services), and eSIM provisioning. The unified Yas brand signals ongoing infrastructure modernization across the region.
eSIM Impact: eSIM adoption will affect number provisioning and management workflows. Plan for remote SIM provisioning (RSP) capabilities and digital-first number allocation processes.
Frequently Asked Questions About Senegal Phone Numbers
What is Senegal's country code?
Senegal's country code is +221. This code is required when dialing Senegalese phone numbers from outside the country. The complete international format is +221 followed by the 9-digit national number (e.g., +221 77 123 4567).
How many digits are in a Senegal phone number?
All Senegalese phone numbers contain exactly 9 digits (excluding the +221 country code). The first digit identifies the service type: 3 for landlines and 7 for mobile numbers. This creates a consistent NXX XXX XXX format across all phone numbers in Senegal.
Which mobile operators serve Senegal?
Senegal has three main mobile operators: Orange Senegal (56-59% market share, prefixes 70X, 76X, 77X, 78X), Yas Senegal formerly Free Senegal (20-25% market share, prefixes 76X, 77X, 78X), and Expresso Senegal (15-17% market share, prefix 75X). Yas Senegal was rebranded in November 2024 and is 80% owned by Axian Group. MVNOs operate on the 75X range.
Does Senegal support mobile number portability?
Yes. Senegal implemented mobile number portability (MNP) in September 2015, allowing users to switch operators while keeping their existing phone numbers. ARTP oversees the MNP system to ensure fair implementation across all operators. Porting typically takes 1-3 business days.
How do you validate a Senegal phone number?
Validate Senegalese numbers using regex patterns: landlines match
/^3[03269]\d{7}$/, mobile numbers match/^7[0-9]\d{7}$/, and toll-free numbers match/^800\d{6}$/. Store numbers in E.164 format (+221NXXXXXXXX) for international compatibility. See code examples in JavaScript, Python, and PHP above.What is ARTP in Senegal?
ARTP (Autorité de Régulation des Télécommunications et des Postes) is Senegal's telecommunications and postal regulatory authority. ARTP manages numbering plans, enforces compliance, oversees number portability, and maintains technical standards for the sector.
What are SMS character limits and encoding for Senegal?
SMS in Senegal follows standard GSM specifications: 160 characters for GSM-7 encoding (standard Latin alphabet) and 70 characters for UCS-2 encoding (Unicode, needed for special characters and emojis). For optimal delivery, use GSM-7 encoding when possible.
What are typical SMS costs for Senegal?
International A2P SMS: $0.03-0.08 per message depending on provider and volume. Domestic SMS: Lower rates available through local operator agreements. Prices vary by operator and sender ID registration status.
How do I prevent rate limiting issues?
Implement exponential backoff for API calls, respect operator-specific throughput limits (typically 10-100 messages/second), use message queuing for high-volume sends, and monitor delivery reports to detect blocking. Register sender IDs with operators to improve delivery rates and throughput limits.
Conclusion
You now have a solid foundation for working with Senegalese phone numbers. Follow the guidelines and best practices in this guide to integrate seamlessly with Senegal's telecommunications infrastructure. Stay informed about the latest ARTP regulations and adapt your systems accordingly to build robust applications that serve the Senegalese market effectively.
Next Steps:
Related Resources: