@warnyin/n8n-nodes-swagger-api
v1.2.4
Published
n8n node for integrating with REST APIs using Swagger/OpenAPI specifications with service discovery and auto-generated inputs
Readme
🔌 @warnyin/n8n-nodes-swagger-api
Seamlessly integrate with REST APIs using Swagger/OpenAPI specifications in n8n
Features • Installation • Usage • Examples • Development
📖 About
This n8n community node enables you to connect to any REST API that provides a Swagger/OpenAPI specification. Simply point to your API's Swagger JSON, configure authentication, and start making requests with full type safety and documentation at your fingertips.
Perfect for integrating with enterprise APIs, microservices, and third-party platforms that expose their endpoints through OpenAPI specifications.
✨ Features
📝 Swagger/OpenAPI Support
- 🔗 Load specs from URL or paste directly
- 📊 Supports OpenAPI 3.x and Swagger 2.x
- 🎯 Automatic base URL detection
- 🔄 Dynamic endpoint configuration
🔐 Authentication
- 🔑 API Key (Header or Query)
- 🎫 Bearer Token
- 👤 Basic Authentication
- 🔓 OAuth2 Support
- ⚙️ No Authentication option
🌐 HTTP Methods
- ✅ GET
- ✅ POST
- ✅ PUT
- ✅ PATCH
- ✅ DELETE
- ✅ HEAD
- ✅ OPTIONS
⚡ Advanced Features
- 🔀 Path parameter replacement
- 🔍 Query parameter support
- 📤 Custom headers
- 📦 JSON request bodies
- 🚦 Response format options
- ⏱️ Configurable timeout
- 🔒 SSL certificate control
📦 Installation
Option 1: Community Nodes (Recommended)
- Open your n8n instance
- Navigate to Settings → Community Nodes
- Click Install
- Enter:
@warnyin/n8n-nodes-swagger-api - Agree to the risks and click Install
Option 2: Manual Installation
# Navigate to your n8n installation directory
cd ~/.n8n/custom
# Clone the repository
git clone https://github.com/warnyin/n8n-nodes-swagger-api.git
# Install dependencies
cd n8n-nodes-swagger-api
npm install
# Build the node
npm run build
# Restart n8nOption 3: Local Development
# Clone and install
git clone https://github.com/warnyin/n8n-nodes-swagger-api.git
cd n8n-nodes-swagger-api
npm install
npm run build
# Link to n8n
npm link
cd ~/.n8n
npm link @warnyin/n8n-nodes-swagger-api
# Restart n8n🚀 Usage
Step 1: Create Credentials
- In n8n, go to Credentials → New
- Search for Swagger API
- Configure the following:
Swagger Source
Choose how to provide your API specification:
- From URL: Enter the URL to your
swagger.jsonoropenapi.jsonhttps://api.example.com/v1/swagger.json - From JSON: Paste your entire Swagger/OpenAPI specification
Base URL (Optional)
Override the base URL from the spec:
https://api.example.com/v1Authentication
Select your authentication method:
API Key
- Location: Header or Query Parameter
- Name:
X-API-Keyor your custom header/param name - Value: Your API key
Bearer Token
- Token: Your bearer token
Basic Auth
- Username: Your username
- Password: Your password
OAuth2
- Access Token: Your OAuth2 access token
Optional Settings
- Ignore SSL Issues: Enable for self-signed certificates
- Timeout: Request timeout in milliseconds (default: 10000)
Step 2: Use the Node
- Add Swagger API node to your workflow
- Select your credentials
- Configure your request:
Basic Configuration
| Field | Description | Example |
|-------|-------------|---------|
| Endpoint | API path (supports placeholders) | /users/{id} |
| Method | HTTP method | GET, POST, etc. |
Path Parameters
Replace placeholders in your endpoint:
- Name:
id - Value:
12345
Result: /users/{id} → /users/12345
Query Parameters
Add query strings to your request:
- Name:
page - Value:
1 - Name:
limit - Value:
50
Result: ?page=1&limit=50
Headers
Add custom headers:
- Name:
Content-Type - Value:
application/json
Request Body
For POST/PUT/PATCH requests, add JSON body:
{
"name": "John Doe",
"email": "[email protected]"
}Options
- Response Format: JSON, Text, or Auto-Detect
- Full Response: Include headers and status code
- Follow Redirects: Enable/disable redirect following
- Ignore Response Code: Don't fail on HTTP errors
💡 Examples
Example 1: Get User Profile
Scenario: Fetch a user's profile from a REST API
Endpoint: /users/{userId}
Method: GET
Path Parameters:
- userId: 12345Result:
{
"id": 12345,
"name": "John Doe",
"email": "[email protected]",
"role": "admin"
}Example 2: Create a Blog Post
Scenario: Create a new blog post with title and content
Endpoint: /posts
Method: POST
Request Body:
{
"title": "My First Post",
"content": "This is the content of my blog post",
"author": "John Doe",
"tags": ["n8n", "automation", "api"]
}Result:
{
"id": 789,
"title": "My First Post",
"status": "published",
"createdAt": "2025-01-15T10:30:00Z"
}Example 3: Search Products with Filters
Scenario: Search for products with pagination and filters
Endpoint: /products/search
Method: GET
Query Parameters:
- q: laptop
- category: electronics
- minPrice: 500
- maxPrice: 2000
- page: 1
- limit: 20
- sort: price_ascResult:
{
"results": [
{
"id": 101,
"name": "Gaming Laptop XYZ",
"price": 1499,
"category": "electronics"
}
],
"total": 45,
"page": 1,
"totalPages": 3
}Example 4: Update User with Authentication
Scenario: Update user details with Bearer token auth
Credentials:
- Authentication: Bearer Token
- Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Node Configuration:
- Endpoint: /users/{id}
- Method: PATCH
- Path Parameters:
- id: 12345
- Request Body:
{
"name": "Jane Doe",
"email": "[email protected]"
}Example 5: Delete Resource
Scenario: Delete a resource by ID
Endpoint: /resources/{resourceId}
Method: DELETE
Path Parameters:
- resourceId: abc-123Result:
{
"message": "Resource deleted successfully",
"resourceId": "abc-123"
}🔧 Use Cases
1. Microservices Integration
Connect multiple microservices in your architecture using their OpenAPI specs.
2. Third-Party API Integration
Integrate with SaaS platforms that provide Swagger documentation (Stripe, Shopify, etc.).
3. Internal API Automation
Automate workflows with your company's internal REST APIs.
4. API Testing & Monitoring
Build automated tests and health checks for your APIs.
5. Data Synchronization
Sync data between different systems using standardized API calls.
🛠️ Development
Prerequisites
- Node.js 18+
- npm or yarn
- n8n installed (for testing)
Setup Development Environment
# Clone the repository
git clone https://github.com/warnyin/n8n-nodes-swagger-api.git
cd n8n-nodes-swagger-api
# Install dependencies
npm install
# Build the project
npm run buildAvailable Scripts
| Script | Description |
|--------|-------------|
| npm run build | Compile TypeScript and copy assets |
| npm run dev | Watch mode for development |
| npm run lint | Run ESLint |
| npm run lintfix | Fix ESLint errors automatically |
| npm run format | Format code with Prettier |
Project Structure
@warnyin/n8n-nodes-swagger-api/
├── credentials/
│ └── SwaggerApiCredentials.credentials.ts # Credential type definition
├── nodes/
│ └── SwaggerApi/
│ ├── SwaggerApi.node.ts # Main node implementation
│ └── swagger-api.svg # Node icon
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file🤝 Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Contribution Guidelines
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Make sure
npm run lintpasses - Keep commits clean and descriptive
📝 Roadmap
- [ ] Auto-generate node parameters from Swagger spec
- [ ] Support for file uploads/downloads
- [ ] Batch request support
- [ ] Request/Response transformation
- [ ] Built-in retry logic
- [ ] Rate limiting support
- [ ] WebSocket support for compatible specs
❓ FAQ
🐛 Bug Reports & Feature Requests
Found a bug or have an idea? Please open an issue!
- Bug Reports: Create a bug report
- Feature Requests: Request a feature
📄 License
This project is licensed under the MIT License - see the LICENSE.md file for details.
👤 Author
warnyin
- GitHub: @warnyin
- Repository: n8n-nodes-swagger-api
🌟 Show Your Support
Give a ⭐️ if this project helped you!
🙏 Acknowledgments
- n8n - Workflow automation platform
- Swagger/OpenAPI - API specification standard
- The n8n community for inspiration and support
Made with ❤️ for the n8n community
