Pi-hole icon

Pi-hole

Get information from Pi-hole API

Actions10

Overview

This n8n node interacts with the Pi-hole API to manage its status. Specifically, when using the Status resource and the Disable operation, the node disables the Pi-hole system, either indefinitely or for a specified number of seconds. This is useful in scenarios where you need to temporarily allow all DNS queries (e.g., troubleshooting network issues, allowing access to blocked domains for a short period).

Practical examples:

  • Temporarily disable Pi-hole during software updates or device onboarding.
  • Allow users to programmatically pause ad-blocking for a set time via an automation workflow.

Properties

Name Type Meaning
API Url String The base URL of your Pi-hole API (e.g., http://localhost/admin/api.php).
Additional Fields Collection Optional fields for the operation.
Seconds Number (Within "Additional Fields") Number of seconds to disable Pi-hole. If omitted, disables indefinitely.

Output

The output will be a JSON object reflecting the response from the Pi-hole API after attempting to disable the system. Typical fields may include:

{
  "status": "disabled",
  "message": "Pi-hole disabled",
  "time_remaining": 60
}
  • status: Indicates the new state of Pi-hole (e.g., "disabled").
  • message: Human-readable message about the action taken.
  • time_remaining: (If applicable) Number of seconds until Pi-hole is re-enabled.

Note: The exact structure depends on the Pi-hole API version and configuration.

Dependencies

  • External Service: Requires access to a running Pi-hole instance with its API enabled.
  • API URL: You must provide the correct API endpoint (API Url property).
  • Credentials: If your Pi-hole API requires authentication, ensure credentials are configured in n8n (though this node does not require them by default).

Troubleshooting

Common Issues:

  • Incorrect API URL: Ensure the API Url points to your Pi-hole's API endpoint.
  • Network Errors: Node cannot reach the Pi-hole server (check connectivity and firewall settings).
  • Authentication Required: If your Pi-hole API is protected, you may need to configure credentials.
  • Invalid Seconds Value: Providing a negative or non-numeric value for "Seconds" may result in errors.

Error Messages & Resolutions:

  • "404 Not Found": Check that the API URL is correct and Pi-hole is running.
  • "401 Unauthorized": Authentication is required; check if the API needs a token or password.
  • "Invalid value for 'disable'": Ensure the "Seconds" field is a positive integer or left blank for indefinite disable.

Links and References

Discussion