Generate and save an Enhance API key
Generate this token in Enhance when you want to use ApiMachine website bulk tools. Ordinary cPFence protection does not require it.
Create the token
Section titled “Create the token”- Sign in to your Enhance control panel.
- Open Settings → Access tokens → Create Token.
- Choose Super admin and create the token. Keep it private.
Restrict the token by IP (optional)
Section titled “Restrict the token by IP (optional)”To accept the token only from your server, turn on IP restricted. Then add each of these addresses to Allowed IPs and select Add after each one:
| Address | What to enter |
|---|---|
| The server itself | 127.0.0.1/32 |
| Main control panel server’s public IPv4 | Its IPv4 address with /32, for example 203.0.113.10/32 |
| Main control panel server’s public IPv6 | Its IPv6 address with /128, for example 2001:db8::1/128. Skip this if the server has no IPv6. |
Include 127.0.0.1/32 even though it is not a public address. cPFence sends its requests to your panel’s own address from the main control panel server, so Enhance can see them as coming from the server itself (127.0.0.1) or from its public address, depending on how that address resolves on the server. If the key does not validate while IP restricted is on, check these entries first.
Save it in cPFence
Section titled “Save it in cPFence”- On the main control panel server’s WebUI, open Tools & Utilities → ApiMachine Bulk Tools → API key.
- Select Set a new key if a key is already saved, then enter the token privately.
- Select Save new API key, then check the validation result before running a bulk action.
CLI alternative, from root on the main control panel server:
cpfence --set-enhance-api-keyEnter the key at the private prompt. cPFence validates it and stores the encrypted value locally. Keep the server’s configuration and your original token private. See how cPFence protects your Enhance API key for where it is stored and where it is sent.
Test the saved key
Section titled “Test the saved key”In the WebUI, open Tools & Utilities → ApiMachine Bulk Tools → API key and select Test saved key. The result shows whether the key works and which control panel address cPFence uses.
CLI alternative:
cpfence --check-enhance-api-keycPFence normally uses your control panel’s domain. If that domain does not resolve on the server, cannot be reached, or has no valid SSL certificate, cPFence uses the main control panel server’s local control panel API instead and says so. A main control panel server without a control panel domain uses the local API directly.
If the key is not accepted
Section titled “If the key is not accepted”| Message | What to do |
|---|---|
| Invalid API key. Please check and try again. | The token was mistyped, cut short or deleted. Copy the whole token again, or create a new one. |
| Invalid API key. Please check and try again. The token needs the Super admin role. | Enhance also answers this way for a wrong or deleted token. Copy the whole token again and make sure it has the Super admin role. If IP restricted is on, add the addresses from the table above. |
| Could not check the API key: the control panel address … has no valid SSL certificate. | Fix the control panel domain’s certificate in Enhance. |
| Could not check the API key: the control panel address … does not resolve on this server. | Make the control panel domain resolve on the main control panel server (DNS or /etc/hosts). |
| Could not check the API key: the control panel address … is not reachable from this server. | Allow the main control panel server to reach its own control panel on port 443. |
| Enhance refused the API key check (HTTP …) at … | Enhance gave another reason, shown in the message. Contact support with the full message. |
| Sorry, this can only be run on your Main CP server | Run the command on the main control panel server. |
The three “Could not check” messages appear only when the local control panel API cannot be used either.
Next, follow website selection and bulk-action steps. If validation fails, check the token role, IP restriction, Enhance API access, and cPFence license before contacting support.


