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 the type of backend used by the API (either PHP or FTL). Specifically, when configured with Resource: Type and Operation: Get, it sends a request to the specified Pi-hole instance and returns the backend type. This is useful for system administrators or automation workflows that need to verify or log which backend is currently serving the Pi-hole API.

Practical Example:
You might use this node in an automation workflow to check if your Pi-hole server is running on the expected backend before performing further administrative tasks or updates.

Properties

Name Type Meaning
API Url String The base URL of your Pi-hole API endpoint (e.g., http://localhost/admin/api.php). This is required and tells the node where to send requests.

Output

The output will be a JSON object containing the result from the Pi-hole API's /api.php?type query. The structure typically includes a field indicating the backend type, such as:

{
  "type": "FTL"
}

or

{
  "type": "PHP"
}
  • type: A string specifying the backend used by the Pi-hole API.

Dependencies

  • Pi-hole Instance: You must have access to a running Pi-hole server.
  • API Endpoint: The provided API URL must be reachable from the n8n instance.
  • No authentication required for this operation, but network/firewall rules must allow access.

Troubleshooting

  • Common Issues:

    • Incorrect API URL: If the API URL is wrong or unreachable, you may receive connection errors or timeouts.
    • Non-Pi-hole Endpoint: If the URL does not point to a valid Pi-hole API, the response may not contain the expected type field.
    • Network Restrictions: Firewalls or network policies may block access to the Pi-hole server.
  • Error Messages & Resolutions:

    • "ECONNREFUSED" or "ENOTFOUND": Check that the API URL is correct and the Pi-hole server is running and accessible.
    • Unexpected Response Structure: Ensure the endpoint is a valid Pi-hole API and that the version supports the type query.

Links and References

Discussion