apihub

Package Information

Released: 5/30/2025
Downloads: 209 weeklyĀ /Ā 209 monthly
Latest Version: 1.0.3
Author: 2fd

Documentation

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

  1. Clone or download this repository to your local machine:

    git clone <repository-url>
    cd n8n-nodes-apihub
    
  2. Install n8n globally if you haven't already:

    npm install n8n -g
    
  3. Run n8n with the custom node:

    N8N_CUSTOM_EXTENSIONS=$(pwd) n8n start
    
  4. Access n8n at http://localhost:5678

Configuration

Credentials Setup

Before using the API Hub node, you need to configure your credentials:

  1. In n8n, go to Settings → Credentials
  2. Click Create New Credential
  3. Select API Hub API from the list
  4. 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 Authorization header 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

  1. Authentication Failed

    • Verify your API key is correct
    • Check that the base URL is configured properly
    • Ensure your API key has the necessary permissions
  2. API Not Found

    • Verify the API ID is correct
    • Check that the endpoint path is valid
  3. 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

  1. Install dependencies:

    npm install
    
  2. Start 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 file

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Support

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

Discussion