n8n-nodes-apihub
v1.0.4
Published
API Hub node for n8n
Readme
n8n API Hub Node
A custom n8n node that enables seamless integration with API Hub, allowing you to access and manage APIs directly within your n8n workflows.
Overview
The API Hub node provides a unified interface to call various APIs through an API key-based authentication system. It handles authentication, request formatting, and response processing, making it easy to integrate third-party APIs into your n8n automation workflows.
Features
- 🔐 Secure API key authentication
- 🌐 Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH)
- 📝 Custom headers and query parameters
- 🔄 JSON request body support
- 📊 Automatic response parsing
- 🛡️ Error handling with optional continue-on-fail
- 📋 Array response handling (each item becomes a separate row)
Installation
Prerequisites
- n8n installed globally or locally
- Node.js (version 16 or higher)
- An API key for the APIs you want to access
Setup
Clone or download this repository to your local machine:
git clone <repository-url> cd n8n-nodes-apihubInstall n8n globally if you haven't already:
npm install n8n -gRun n8n with the custom node:
N8N_CUSTOM_EXTENSIONS=$(pwd) n8n startAccess n8n at
http://localhost:5678
Configuration
Credentials Setup
Before using the API Hub node, you need to configure your credentials:
- In n8n, go to Settings → Credentials
- Click Create New Credential
- Select API Hub API from the list
- Fill in the required fields:
- Base URL: Your API base URL
- API Key: Your API key
Node Configuration
The API Hub node supports the following parameters:
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | API ID | String | Yes | The unique identifier of the API you want to call | | HTTP Method | Options | Yes | The HTTP method (GET, POST, PUT, DELETE, PATCH) | | Endpoint Path | String | No | The specific endpoint path to call | | Request Body | JSON | No | JSON request body (for POST, PUT, PATCH methods) | | Query Parameters | Collection | No | URL query parameters as key-value pairs | | Custom Headers | Collection | No | Custom HTTP headers as key-value pairs |
Authentication
The node uses Bearer token authentication:
- API Access: Your API key is automatically added to requests in the
Authorizationheader as a Bearer token (Authorization: Bearer your-api-key)
Response Handling
Single Object Response
When the API returns a single object, it's passed through as-is to the next node.
Array Response
When the API returns an array, each item in the array becomes a separate output item, allowing for easy processing in subsequent nodes.
Error Handling
- Failed requests throw errors by default
- Enable "Continue on Fail" to capture errors as output data
- Error outputs include the error message and timestamp
Troubleshooting
Common Issues
Authentication Failed
- Verify your API key is correct
- Check that the base URL is configured properly
- Ensure your API key has the necessary permissions
API Not Found
- Verify the API ID is correct
- Check that the endpoint path is valid
Request Failed
- Check the endpoint path is correct
- Verify required parameters are provided
- Review the API documentation for specific requirements
Debug Tips
- Enable "Continue on Fail" to capture error details
- Use the n8n execution logs to see full request/response data
- Test API calls directly using tools like Postman first
Development
Local Development Setup
Install dependencies:
npm installStart n8n in development mode:
N8N_CUSTOM_EXTENSIONS=$(pwd) n8n start
File Structure
n8n-nodes-apihub/
├── nodes/
│ └── APIHub/
│ ├── APIHub.node.js # Main node implementation
│ └── APIHubApi.credentials.js # Credentials definition
├── package.json # Node package configuration
├── README.md # This documentation
├── DEVELOPMENT.md # Development setup guide
└── LICENSE # License fileContributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Support
- n8n Community: n8n Community Forum
- Issues: Report issues in this repository
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
Version 1.0.0
- Initial release
- Support for all HTTP methods
- Custom headers and query parameters
- JSON request body support
- Array response handling
- Error handling with continue-on-fail option
