Pi-hole icon

Pi-hole

Get information from Pi-hole API

Actions10

Overview

This n8n node interacts with the Pi-hole API to retrieve information about recently blocked domains. Specifically, when configured with Resource: RecentBlocked and Operation: Get, it fetches the most recent domain that was blocked by your Pi-hole instance.

Common scenarios:

  • Monitoring which domains are being actively blocked in real-time.
  • Integrating Pi-hole block data into dashboards or alerting systems.
  • Auditing network activity for security or parental control purposes.

Practical example:
You could use this node in an automation workflow to send a notification (e.g., via email or Slack) whenever a new domain is blocked by Pi-hole.

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 to connect to your Pi-hole instance.

Output

The node returns a JSON object containing information about the most recently blocked domain. The exact structure depends on the Pi-hole API response, but typically includes:

{
  "recentBlocked": "example-blocked-domain.com"
}
  • recentBlocked: The domain name that was most recently blocked by Pi-hole.

Note: This node does not output binary data.

Dependencies

  • Pi-hole API: You must have a running Pi-hole instance with its API accessible at the specified API Url.
  • API Url: Ensure the provided URL is correct and reachable from the n8n environment.
  • Credentials: No authentication is required for this specific operation, but other operations may require credentials.

Troubleshooting

  • Common Issues:

    • Incorrect API Url: If the API Url is wrong or unreachable, you will receive connection errors.
    • CORS/Network Restrictions: If n8n cannot reach your Pi-hole server due to firewall or network restrictions, requests will fail.
    • Empty Response: If no domains have been blocked recently, the response may be empty or missing the recentBlocked field.
  • Error Messages & Resolutions:

    • "ECONNREFUSED" or "ENOTFOUND": Check that the API Url is correct and that the Pi-hole server is running and accessible.
    • "Unexpected token" or JSON parse errors: Ensure the Pi-hole API is returning valid JSON. Check for misconfiguration or outdated Pi-hole versions.

Links and References

Discussion