ops (Updated: 2026-09-20) ✓ netcup.tips DevOps Team · G12.5 Verified

Netcup DNS API & Automated Let's Encrypt Wildcard Certificates: acme.sh & Certbot Practical Guide

Complete step-by-step guide to using the Netcup DNS API: Automatically issue, renew, and integrate free Let's Encrypt wildcard SSL certificates (*.yourdomain.com) via DNS-01 challenge with acme.sh and Certbot in Nginx/Docker.

#DNS API #acme.sh #Certbot #Let's Encrypt #Wildcard SSL #DevOps #Nginx

While single hostnames can be easily validated via the HTTP-01 challenge, wildcard certificates (*.example.com) strictly require the DNS-01 challenge.

Using the official Netcup DNS API, you can completely automate the creation and removal of temporary _acme-challenge TXT records.

In this guide, we walk through the setup using the two most popular ACME clients: the lightweight shell client acme.sh and the industry-standard Certbot, including automated reloads for Nginx and Docker.

Automated DNS-01 Challenge via Netcup API

acme.sh or Certbot
1. Request Wildcard Cert ➔
2. Receive Token 🡄
Let's Encrypt CA
Requests TXT Challenge
3. Set _acme-challenge TXT record via API ➔
Netcup DNS REST/JSON API
(customercontrolpanel.de ➔ API)
4. Zone update on nameservers (90-180s sync) ➔
Netcup Anycast Nameserver Pool
root-dns.netcup.net / second-dns...
🡄 Validation by Let's Encrypt
[Certificate Successfully Issued!]

1. Generate API Credentials in the Netcup CCP

Before running any commands on your server, you need your individual Netcup API credentials:

  1. Log in to the Customer Control Panel (CCP).
  2. In the left navigation bar, go to Master Data (Stammdaten) ➔ API.
  3. Click the Generate new API key (Neuen API-Schlüssel generieren) button.
  4. Securely store the following three values in your password manager:
    • Customer Number (NC_CID): Your 5- to 6-digit Netcup customer ID.
    • API Key (NC_Apikey): A 32-character alphanumeric key.
    • API Password (NC_ApiPw): The generated secret password used to authenticate API sessions.
  5. Make sure the API status is set to Active (Aktiv).

acme.sh is an ultra-lightweight, pure POSIX shell script client with zero heavy Python dependencies and built-in native support for the Netcup DNS API.

Step 1: Install acme.sh on your server

Run the following commands on your Netcup Root Server or VPS:

# Install acme.sh with your email address for Let's Encrypt expiry notifications
curl https://get.acme.sh | sh -s email=admin@example.de

# Reload shell environment
source ~/.bashrc

Step 2: Configure API credentials

Export your Netcup credentials as environment variables. After the first successful run, acme.sh automatically stores them in ~/.acme.sh/account.conf:

export NC_CID="123456"                          # Your Netcup Customer ID
export NC_Apikey="your_32_character_api_key"    # Your API Key
export NC_ApiPw="your_secret_api_password"      # Your API Password

Step 3: Request a wildcard certificate with DNS sleep

[!IMPORTANT] Because Netcup nameservers require a brief propagation window for global DNS zone synchronization, you must pass the --dnssleep 180 parameter to prevent premature validation failures.

~/.acme.sh/acme.sh --issue \
  --dns dns_netcup \
  -d example.de \
  -d '*.example.de' \
  --dnssleep 180

Step 4: Install certificates in Nginx & configure automatic reload hook

Never reference the internal files inside ~/.acme.sh directly in your web server configuration. Instead, use the install-cert command to copy them to their target production directory:

# Create target SSL directory
sudo mkdir -p /etc/nginx/ssl/example.de

# Install certificates and register the Nginx reload hook
~/.acme.sh/acme.sh --install-cert -d example.de \
  --key-file       /etc/nginx/ssl/example.de/privkey.pem \
  --fullchain-file /etc/nginx/ssl/example.de/fullchain.pem \
  --reloadcmd     "sudo systemctl reload nginx"

Whenever acme.sh renews the certificate every 60 days via its automated cron job, it will automatically execute reloadcmd — 100% maintenance-free.


3. Method B: Setup with Certbot & certbot-dns-netcup

If your infrastructure standardizes on Certbot (EFF), you can use the official community DNS plugin for Netcup.

Step 1: Install Certbot and the Netcup DNS plugin (Debian / Ubuntu)

sudo apt update
sudo apt install -y certbot python3-certbot python3-pip

# Install the Netcup DNS authenticator plugin
sudo pip3 install certbot-dns-netcup --break-system-packages

Step 2: Create a restricted credentials file

Create a protected configuration file at /etc/letsencrypt/netcup.ini:

# /etc/letsencrypt/netcup.ini
dns_netcup_customer_id = 123456
dns_netcup_api_key = your_32_character_api_key
dns_netcup_api_password = your_secret_api_password

Apply strict file permissions so unauthorized system users cannot read your API credentials:

sudo chmod 600 /etc/letsencrypt/netcup.ini

Step 3: Issue the wildcard certificate

sudo certbot certonly \
  --authenticator dns-netcup \
  --dns-netcup-credentials /etc/letsencrypt/netcup.ini \
  --dns-netcup-propagation-seconds 180 \
  -d example.de \
  -d '*.example.de' \
  --post-hook "systemctl reload nginx"

Certbot automatically configures a systemd timer (certbot.timer) that checks for due certificate renewals twice daily.


4. Common Errors & Netcup API Troubleshooting

1. Error: Status: 4013 (Invalid session ID)

  • Cause: The API password or key was copied incorrectly (e.g., a trailing whitespace character), or the server’s outbound IP address changed mid-session.
  • Solution: Generate a fresh API key pair in the CCP under Master Data -> API and update your environment variables or credentials file.

2. Error: DNS challenge failed: NXDOMAIN looking up TXT for _acme-challenge

  • Cause: Let’s Encrypt queried the authoritative nameservers before the new TXT record finished replicating across all Netcup Anycast nodes.
  • Solution: Increase the --dnssleep parameter in acme.sh (or --dns-netcup-propagation-seconds in Certbot) from 120 to 180 or 240 seconds.

3. Netcup API Rate Limits

  • To protect platform stability, Netcup enforces reasonable rate limits on API endpoints (approximately 20–30 requests per minute per account).
  • Avoid requesting dozens of domains in rapid parallel loops. Always test new automation setups against the Let’s Encrypt staging environment (--staging) to avoid hitting Let’s Encrypt’s weekly production issuance limits.

❓Frequently Asked Questions (FAQ)

Where do I get my Netcup API credentials and what permissions are required?▼
In the Customer Control Panel (CCP), navigate to 'Master Data' (Stammdaten) ➔ 'API'. There you can generate a new API key pair. You will receive an API key and a separate API password. For the DNS-01 challenge, the API user requires write access to your DNS zones.
Why does DNS-01 validation with Netcup sometimes fail due to timeouts?▼
After creating the TXT validation record, Netcup nameservers typically take between 90 and 180 seconds to synchronize the zone across all authoritative nameservers (root-dns.netcup.net, etc.). You must therefore configure a propagation wait time of at least 120 to 180 seconds in acme.sh or Certbot (e.g., using --dnssleep 180).
Does Netcup natively support acme.sh and Certbot?▼
Yes. acme.sh includes the built-in 'dns_netcup' DNS hook directly in its core distribution. For Certbot, the official open-source plugin 'certbot-dns-netcup' is available via pip or system package managers.

📚 Related Guides & Hardware Benchmarks

🛠️ Interactive Netcup Calculators & Network Tools