swagger-api

n8n node for integrating with REST APIs using Swagger/OpenAPI specifications with service discovery and auto-generated inputs

Package Information

Released: 11/5/2025
Downloads: 20 weeklyĀ /Ā 65 monthly
Latest Version: 1.2.4
Author: warnyin

Documentation

šŸ”Œ @warnyin/n8n-nodes-swagger-api

Seamlessly integrate with REST APIs using Swagger/OpenAPI specifications in n8n

npm version
License: MIT
n8n
GitHub stars

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)

  1. Open your n8n instance
  2. Navigate to Settings → Community Nodes
  3. Click Install
  4. Enter: @warnyin/n8n-nodes-swagger-api
  5. 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 n8n

Option 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

Click to expand credential setup
  1. In n8n, go to Credentials → New
  2. Search for Swagger API
  3. Configure the following:

Swagger Source

Choose how to provide your API specification:

  • From URL: Enter the URL to your swagger.json or openapi.json
    https://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/v1

Authentication

Select your authentication method:

API Key

  • Location: Header or Query Parameter
  • Name: X-API-Key or 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

  1. Add Swagger API node to your workflow
  2. Select your credentials
  3. 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": "john@example.com"
}

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: 12345

Result:

{
  "id": 12345,
  "name": "John Doe",
  "email": "john@example.com",
  "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_asc

Result:

{
  "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": "jane@example.com"
      }

Example 5: Delete Resource

Scenario: Delete a resource by ID

Endpoint: /resources/{resourceId}
Method: DELETE
Path Parameters:
  - resourceId: abc-123

Result:

{
  "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 build

Available 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Contribution Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation as needed
  • Make sure npm run lint passes
  • 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

Q: Does this work with OpenAPI 3.x? Yes! This node supports both Swagger 2.x and OpenAPI 3.x specifications.
Q: Can I use this with private/internal APIs? Absolutely! You can paste the Swagger JSON directly or use a URL accessible from your n8n instance.
Q: What if my API doesn't have a Swagger spec? Consider using the standard HTTP Request node instead, or create a Swagger specification for your API.
Q: How do I handle API rate limits? Use n8n's built-in "Wait" node between requests or implement custom retry logic in your workflow.

šŸ› Bug Reports & Feature Requests

Found a bug or have an idea? Please open an issue!

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

šŸ‘¤ Author

warnyin

🌟 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

⬆ Back to Top

Discussion