This guide covers all configuration options for the Namecheap provider, including authentication methods, API access setup, and provider settings.
Provider Configuration#
The Namecheap provider requires API credentials to interact with the Namecheap API. You can configure the provider using one of several methods.
Provider Block#
Environment Variables#
Set environment variables to configure the provider without hardcoding credentials:
Pulumi Configuration#
Store credentials securely using Pulumi config:
Then reference in your code:
Configuration Reference#
Required Arguments#
userName(string): Your Namecheap usernameapiUser(string): API username (typically the same as userName)apiKey(string): Your Namecheap API keyclientIp(string): Your whitelisted IP address
Optional Arguments#
useSandbox(boolean): Use the Namecheap sandbox environment. Default:false
Getting API Credentials#
Enable API Access#
- Log in to your Namecheap account
- Navigate to Profile → Tools → Business & Dev Tools → API Access
- Enable API Access
- Whitelist your IP address
- Copy your API key
Sandbox Environment#
For testing, you can use the Namecheap sandbox:
- Create a sandbox account at Namecheap Sandbox
- Enable API access in the sandbox
- Set
useSandbox: truein your provider configuration
IP Whitelisting#
Namecheap requires you to whitelist the IP address that will make API calls:
- Go to Profile → Tools → API Access
- Click Whitelist IP
- Add your public IP address
Important: If your IP changes, you must update the whitelist.
Finding Your Public IP#
Authentication Methods Comparison#
| Method | Security | Ease of Use | CI/CD Friendly | Best For |
|---|---|---|---|---|
| Provider Block | Low | Easy | No | Local Development |
| Environment Variables | Medium | Medium | Yes | CI/CD Pipelines |
| Pulumi Config | High | Easy | Yes | Production |
Production Best Practices#
Secret Management#
Provider Aliasing#
Create multiple provider instances for different accounts:
Troubleshooting#
Common Configuration Errors#
Error: IP not whitelisted
Solution: Add your IP to the whitelist in Namecheap dashboard
Error: Invalid API credentials
Solution: Verify your apiKey, userName, and apiUser are correct
Error: Sandbox mode mismatch
Solution: Ensure useSandbox matches where your domain is registered (production vs sandbox)
Testing Configuration#
Test your configuration with a simple program:
Next Steps#
- Domain Records Resource - Manage DNS records
- DNS Management Guide - Best practices for DNS
- Migration Guide - Migrate existing domains