@gautric/node-red-ipinfo
v1.1.0
Published
Node-RED node for IP geolocation using the IPInfo.io API — retrieve city, region, country, coordinates, ISP, and more for any IP address.
Maintainers
Readme
@gautric/node-red-ipinfo
A Node-RED node that retrieves geolocation, network, and organization data for any IP address using the IPInfo.io API. Powered by the official node-ipinfo client library (v4.3.0).
Features
- IPv4 & IPv6 lookups with input validation
- Configurable caching (LRU) to reduce API calls and improve latency
- Customizable input/output message properties
- Internationalized status and error messages (i18n)
- Includes example flow importable from the Node-RED editor
- Built on node-ipinfo 4.3.0 — the latest official IPInfo.io Node.js client
Prerequisites
| Requirement | Version | |-------------|---------| | Node.js | ≥ 18 | | Node-RED | ≥ 4.0.8 | | node-ipinfo | ≥ 4.3.0 (installed automatically) | | IPInfo.io account | Free tier available at ipinfo.io/signup |
Installation
Node-RED Palette Manager
- Open Node-RED → Menu → Manage palette
- Search for
@gautric/node-red-ipinfo - Click Install
Command Line
cd ~/.node-red
npm install @gautric/node-red-ipinfoQuick Start
- Drag an ipinfo node onto your flow.
- Double-click it and create a new IPInfo Config node.
- Paste your API token into the config.
- Wire an inject node (payload =
8.8.8.8) → ipinfo → debug. - Deploy and click inject.
Node Reference
ipinfo
Looks up geolocation data for the IP address found in the incoming message.
| Property | Default | Description |
|----------|-----------|-------------|
| Input | msg.payload | Message property containing the IP address (string) |
| Output | msg.payload | Message property where the result object is stored |
| Config | — | IPInfo Config node to use |
Accepted input values
- Valid IPv4 address, e.g.
8.8.8.8 - Valid IPv6 address, e.g.
2001:4860:4860::8888 - The string
me(returns info for the calling machine's public IP)
Output object
{
"ip": "8.8.8.8",
"hostname": "dns.google",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4056,-122.0775",
"org": "AS15169 Google LLC",
"postal": "94043",
"timezone": "America/Los_Angeles"
// additional fields depend on your IPInfo.io plan
}Status indicators
| Color / Shape | Meaning | |---------------|---------| | 🔵 dot | Lookup in progress | | 🟡 ring | Invalid IP address (skipped) | | 🔴 ring | Configuration or input error | | 🔴 dot | API / network error | | (none) | Last lookup succeeded |
ipinfo-config
Shared configuration node holding your API credentials and cache settings.
| Property | Default | Description |
|--------------|---------------|-------------|
| Name | IPInfo Config | Display name |
| Token | — | Your IPInfo.io API token (stored as credential) |
| Timeout | 1000 ms | HTTP request timeout |
| Cache | false | Enable LRU caching |
| Max Items | 5000 | Maximum cached entries |
| TTL | 86400000 ms (24 h) | Time-to-live per cache entry |
Example Flow
An example flow is bundled with the node. Import it from:
Menu → Import → Examples → @gautric/node-red-ipinfo

API Rate Limits
| Plan | Requests / month | |----------|-----------------| | Free | 50,000 | | Basic | 250,000 | | Standard | 500,000 | | Business | Custom |
Enable caching in the config node to stay within limits.
Troubleshooting
| Symptom | Likely cause | Fix |
|---------|-------------|-----|
| Red "Missing configuration" status | Config node not linked | Double-click the ipinfo node and select a config |
| Red "Error" status after deploy | Invalid or missing API token | Check your token at ipinfo.io/account/token |
| Yellow "Invalid IP" status | Input is not a valid IP string | Ensure msg.payload contains a valid IPv4/IPv6 address |
| Timeout errors | Slow network or low timeout | Increase the timeout value in the config node |
| Rate limit errors (HTTP 429) | Too many requests | Enable caching or upgrade your IPInfo.io plan |
Dependencies
| Package | Version | Purpose | |---------|---------|---------| | node-ipinfo | ^4.3.0 | Official IPInfo.io Node.js client |
Development
# Clone the repo
git clone https://github.com/gautric/node-red-ipinfo.git
cd node-red-ipinfo
# Install dependencies
npm install
# Run tests
npm test
# Run tests with coverage
npm run test:coverageContributing
Contributions are welcome. Please:
- Fork the repository
- Create a feature branch
- Add or update tests for your changes
- Submit a pull request
Open an issue for bugs or feature requests.
Changelog
1.1.0
- Updated
node-ipinfodependency from 4.0.1 to 4.3.0 - Improved IPv6 validation (supports compressed and mixed notation)
- Added input validation for empty strings and missing token warnings
- Added
nodeDoneguard checks for backward compatibility with older Node-RED - Added
filesfield topackage.jsonfor leaner npm package - Raised minimum Node.js version to ≥ 18 (12.x is EOL)
- Added unit tests
- Improved README with troubleshooting guide, API reference, and dependency docs
- Added i18n keys for all config labels
1.0.0
- Initial release
License
Support
If this project helps you, consider buying the developer a coffee. ☕
