Pi-hole icon

Pi-hole

Get information from Pi-hole API

Actions10

Overview

This n8n node interacts with the Pi-hole API to manage and retrieve information about your Pi-hole instance. Specifically, for the Status resource and the Enable operation, the node enables (unblocks) the Pi-hole system, allowing DNS queries to be processed as normal.

Common scenarios:

  • Remotely re-enabling Pi-hole after it has been disabled (e.g., after maintenance or troubleshooting).
  • Integrating Pi-hole control into automated workflows, such as scheduled enabling/disabling or responding to external triggers.
  • Providing a user interface in n8n for non-technical users to control Pi-hole status.

Practical example:
You could use this node in an automation that temporarily disables Pi-hole for a set period and then automatically re-enables it, or as part of a dashboard to toggle Pi-hole's blocking functionality.


Properties

Name Type Meaning
API Url String The base URL of your Pi-hole API endpoint. Example: http://localhost/admin/api.php. This is required for the node to connect to your Pi-hole instance.

Output

The output will be the JSON response from the Pi-hole API when enabling the system. Typically, this includes a field indicating the new status of Pi-hole. For example:

{
  "status": "enabled"
}
  • The exact structure may vary depending on the Pi-hole version, but you can expect at least a status indicator confirming that Pi-hole is now enabled.

Dependencies

  • Pi-hole Instance: You must have a running Pi-hole server accessible from where n8n is running.
  • API Endpoint: The API URL must be correct and reachable.
  • Credentials: No API key is required for the enable operation by default, but if your Pi-hole is secured, you may need to provide credentials via the optional piHoleApi credential in n8n.

Troubleshooting

Common issues:

  • Incorrect API URL: If the API URL is wrong or unreachable, you'll receive connection errors.
  • Authentication Required: If your Pi-hole requires authentication and credentials are not provided, the request may fail.
  • Network Issues: Firewalls or network restrictions may block access to the Pi-hole API.

Common error messages:

  • "ECONNREFUSED" or "ENOTFOUND": The API URL is incorrect or Pi-hole is not reachable.
  • "401 Unauthorized": Authentication is required; check your Pi-hole settings and n8n credentials.
  • "status": "disabled": The operation did not succeed; check Pi-hole logs for more details.

How to resolve:

  • Double-check the API URL.
  • Ensure Pi-hole is running and accessible from the n8n host.
  • Provide necessary credentials if required by your Pi-hole setup.

Links and References

Discussion