Skip to main content

Configuration

Configure the Namecheap provider for managing domains and DNS records
2 min read

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 username
  • apiUser (string): API username (typically the same as userName)
  • apiKey (string): Your Namecheap API key
  • clientIp (string): Your whitelisted IP address

Optional Arguments#

  • useSandbox (boolean): Use the Namecheap sandbox environment. Default: false

Getting API Credentials#

Enable API Access#

  1. Log in to your Namecheap account
  2. Navigate to Profile → Tools → Business & Dev Tools → API Access
  3. Enable API Access
  4. Whitelist your IP address
  5. Copy your API key

Sandbox Environment#

For testing, you can use the Namecheap sandbox:

  1. Create a sandbox account at Namecheap Sandbox
  2. Enable API access in the sandbox
  3. Set useSandbox: true in your provider configuration

IP Whitelisting#

Namecheap requires you to whitelist the IP address that will make API calls:

  1. Go to Profile → Tools → API Access
  2. Click Whitelist IP
  3. Add your public IP address

Important: If your IP changes, you must update the whitelist.

Finding Your Public IP#

Authentication Methods Comparison#

MethodSecurityEase of UseCI/CD FriendlyBest For
Provider BlockLowEasyNoLocal Development
Environment VariablesMediumMediumYesCI/CD Pipelines
Pulumi ConfigHighEasyYesProduction

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#