{"id":131383,"date":"2025-07-18T04:30:18","date_gmt":"2025-07-18T04:30:18","guid":{"rendered":"\/tutorials\/?p=131383"},"modified":"2026-03-09T19:16:20","modified_gmt":"2026-03-09T19:16:20","slug":"n8n-api","status":"publish","type":"post","link":"\/ng\/tutorials\/n8n-api","title":{"rendered":"How do I use an API with n8n on a self-hosted setup?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Integrating an application programming interface (API) with n8n can be complicated because every API provider has specific requirements for connecting their service. Nevertheless, n8n&rsquo;s code-minimal workflow can allow you to create a highly efficient yet easy-to-maintain data pipeline that will benefit a wide range of automation scenarios.<\/p><p>Integrating an API into your n8n workflow consists of ten steps:<\/p><ol class=\"wp-block-list\">\n<li>Set up self-hosted n8n on a private server<\/li>\n\n\n\n<li>Enable API access<\/li>\n\n\n\n<li>Authenticate the API call<\/li>\n\n\n\n<li>Test the API functionality<\/li>\n\n\n\n<li>Add your API endpoint to n8n<\/li>\n\n\n\n<li>Add a trigger method node into your n8n canvas<\/li>\n\n\n\n<li>Create a workflow using other nodes<\/li>\n\n\n\n<li>Configure the node settings and data logic<\/li>\n\n\n\n<li>Test your workflow<\/li>\n\n\n\n<li>Secure your workflow<\/li>\n<\/ol><p>Note that creating an efficient workflow goes beyond these steps and involves properly maintaining its security and scalability. To improve your workflow maintainability, consider using the OneSimpleAPI node, which offers pre-configured API endpoints for basic tasks that you can manage directly in n8n, unlike other third-party APIs.<\/p><p>Read on to learn about n8n-API integration in detail, explore tips for securing your workflow, and dive into some common usage scenarios.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-an-api-with-n8n-step-by-step\"><strong>How to use an API with n8n, step-by-step<\/strong><\/h2><p>In this section, we&rsquo;ll go into all the steps for integrating an API with your n8n instance.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-set-up-your-self-hosted-n8n-instance\"><strong>1. Set up your self-hosted n8n instance<\/strong><\/h3><p>Before creating a workflow and integrating an API, you&rsquo;ll need to set up your n8n instance. In this tutorial, we&rsquo;ll focus on the self-hosted version because it offers more control and is more affordable than the official plan.<\/p><p>Self-hosting n8n requires a virtual private server (VPS) hosting plan. You can use one from any provider as long as it offers sufficient hardware resources to ensure your workflow runs responsively and adequately.<\/p><p>Since we are creating a simple workflow, a server with<strong> 1 vCPU core <\/strong>and <strong>1 GB of RAM <\/strong>is enough, but you&rsquo;ll need more hardware resources if you plan to create multiple automation scenarios.<\/p><p>The steps to <a href=\"\/ng\/tutorials\/how-to-install-n8n\">install n8n<\/a> remain the same regardless of your VPS provider. However, we recommend Hostinger&rsquo;s n8n hosting plan if you want a straightforward, command-free configuration process.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ng\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>After purchasing <a href=\"\/ng\/self-hosted-n8n\">Hostinger&rsquo;s n8n hosting plan<\/a>, our system will automatically choose the n8n template for your server. Then all you need to do to install n8n is complete the VPS onboarding process, which involves basic tasks like setting up a hostname and root password.<\/p><p>If you already have a Hostinger VPS, you can install n8n anytime in one click using the <strong>OS template<\/strong>. Before following this procedure, <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583232-how-to-back-up-or-restore-a-vps\">back up your files<\/a> because any existing data will be wiped. Here&rsquo;s how to install n8n on your server:<\/p><ol class=\"wp-block-list\">\n<li>In <strong>hPanel<\/strong>, navigate the <strong>sidebar<\/strong> and click <strong>VPS<\/strong>.<\/li>\n\n\n\n<li>Hit <strong>Manage<\/strong> on the VPS you want to install n8n on.<\/li>\n\n\n\n<li>Go to the <strong>sidebar<\/strong> &rarr; <strong>OS &amp; Panel<\/strong> &rarr; <strong>Operating System<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e52563a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"406\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-operating-system-menu-on-hpanel-vps-sidebar.png\/public\" alt=\"The Operating System menu on hPanel's VPS page sidebar\" class=\"wp-image-131388\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-operating-system-menu-on-hpanel-vps-sidebar.png\/w=564,fit=scale-down 564w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-operating-system-menu-on-hpanel-vps-sidebar.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-operating-system-menu-on-hpanel-vps-sidebar.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Go to the <strong>Application<\/strong> tab and select <strong>n8n<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e526c33\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"429\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-n8n-template-on-hpanel-os-management-menu.png\/public\" alt=\"The n8n template on hPanel's OS management menu\" class=\"wp-image-131389\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-n8n-template-on-hpanel-os-management-menu.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-n8n-template-on-hpanel-os-management-menu.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-n8n-template-on-hpanel-os-management-menu.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-n8n-template-on-hpanel-os-management-menu.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-n8n-template-on-hpanel-os-management-menu.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Hit <strong>Change OS<\/strong>.<\/li>\n\n\n\n<li>Acknowledge the data deletion and hit <strong>Next<\/strong>. <\/li>\n\n\n\n<li>Enter a new root password and click <strong>Confirm<\/strong>. <\/li>\n<\/ol><p>After the installation process is complete, you can access n8n by clicking the <strong>Manage App<\/strong> button on the same screen. Create an account to finish the configuration.<\/p><h3 class=\"wp-block-heading\" id=\"h-2-find-a-public-api\"><strong>2. Find a public API<\/strong><\/h3><p>Find the API you want to integrate with n8n. You can look for one on an API marketplace like <strong>RapidAPI <\/strong>or a community-curated catalog like <a href=\"https:\/\/github.com\/public-api-lists\/public-api-lists\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub&rsquo;s Public API repository<\/a>.<\/p><p>For testing, we recommend using a <a href=\"\/ng\/tutorials\/what-is-a-public-api\">public API<\/a> because it is free and easy to sign up for. In this tutorial, we&rsquo;ll use<strong> <\/strong><a href=\"https:\/\/developers.hostinger.com\/\">Hostinger&rsquo;s public API<\/a> as an example.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e528423\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"584\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hostinger-api-documentation-page.png\/public\" alt=\"Hostinger API documentation page\" class=\"wp-image-131390\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hostinger-api-documentation-page.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hostinger-api-documentation-page.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hostinger-api-documentation-page.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hostinger-api-documentation-page.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hostinger-api-documentation-page.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>The ideal API should have comprehensive documentation covering its specification, requirements, and potential errors to help streamline the setup process. It must also come from a reputable company or developer to ensure its safety.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-get-the-api-endpoint-and-key\"><strong>3. Get the API endpoint and key<\/strong><\/h3><p>After deciding on the API, access the provider&rsquo;s website and obtain two essential pieces of information: its <strong>endpoint <\/strong>and<strong> authentication key<\/strong>.<\/p><p>An <strong>API endpoint<\/strong> is the URL n8n will use to interact with the API&rsquo;s server and to request specific data. Meanwhile, an <strong>authentication key <\/strong>is a unique token that validates the n8n&rsquo;s API request.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Using multiple endpoints<\/h4>\n                    <p>An endpoint is reserved for a specific function. If your workflow involves multiple actions or tasks, you may need to obtain multiple API endpoints, which can also come from several providers.<\/p>\n                <\/div>\n\n\n\n<\/p><p>Depending on the API provider, the steps to obtain the API endpoint and authentication key differ. For example, here&rsquo;s how to do so at Hostinger:<\/p><ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/auth.hostinger.com\/login\">Log in to <strong>hPanel<\/strong><\/a>. If you haven&rsquo;t got an account, create one.<\/li>\n\n\n\n<li>On hPanel, click your <strong>profile icon<\/strong> in the top right corner and select<strong> Account Information<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e528d0f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"1262\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hpanel-account-drop-down-menu-account-information-button.png\/public\" alt=\"hPanel's account drop-down menu with the Account Information button highlighted\" class=\"wp-image-130331\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hpanel-account-drop-down-menu-account-information-button.png\/w=710,fit=scale-down 710w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hpanel-account-drop-down-menu-account-information-button.png\/w=169,fit=scale-down 169w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hpanel-account-drop-down-menu-account-information-button.png\/w=576,fit=scale-down 576w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hpanel-account-drop-down-menu-account-information-button.png\/w=84,fit=scale-down 84w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Navigate to the <strong>sidebar <\/strong>and click <strong>API<\/strong>.<\/li>\n\n\n\n<li>Hit the <strong>API documentation<\/strong> button to open the Hostinger API reference developer page. Here, you can check all the endpoints and their specifications. <\/li>\n\n\n\n<li>Return to the <strong>API page <\/strong>and click<strong> New token <\/strong>to generate an API key. <\/li>\n\n\n\n<li>Add a <strong>name<\/strong> for your token and set an <strong>expiration date<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e52963d\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1310\" height=\"678\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hostinger-api-key-generation-window.png\/public\" alt=\"Hostinger API key generation window\" class=\"wp-image-130332\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hostinger-api-key-generation-window.png\/w=1310,fit=scale-down 1310w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hostinger-api-key-generation-window.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hostinger-api-key-generation-window.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hostinger-api-key-generation-window.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/hostinger-api-key-generation-window.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1310px) 100vw, 1310px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"7\" class=\"wp-block-list\">\n<li>Hit <strong>Generate<\/strong>. <\/li>\n\n\n\n<li>Scroll down to the bottom of the page to obtain the API token and the testing commands. Store them in a safe location.<\/li>\n<\/ol><p>For security reasons, you won&rsquo;t be able to see your token again after closing the API page, so be sure to save the key and testing commands before proceeding.<\/p><h3 class=\"wp-block-heading\" id=\"h-4-make-your-first-api-call\"><strong>4. Make your first API call<\/strong><\/h3><p>Testing your API endpoint is crucial to ensure it can take requests and send responses properly.<\/p><p>You can test an API using different methods, but the easiest way is to <a href=\"\/ng\/tutorials\/curl-command\">use the cURL command<\/a>, which is preinstalled in your computer&rsquo;s terminal.<\/p><p>To use cURL, simply open your system terminal and enter the following command. Replace <strong>API-endpoint <\/strong>and <strong>API-key <\/strong>with their actual values:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -X GET \"API-endpoint\"  -H \"Authorization: Bearer API-key\"<\/pre><p>Depending on the API, you may need to change the authorization method or add more information to the cURL request. If your API provider gives the testing commands, like Hostinger does, simply copy and paste them into your terminal. Otherwise, read its specification for more information.<\/p><p>If the API request is successful, your terminal will print data in JSON format. If you encounter an error, check the API documentation for a troubleshooting guide.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e529e7a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"185\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/the-curl-command-api-call-output.png\/public\" alt=\"The cURL command's API call output\" class=\"wp-image-130333\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/the-curl-command-api-call-output.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/the-curl-command-api-call-output.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/the-curl-command-api-call-output.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/the-curl-command-api-call-output.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/the-curl-command-api-call-output.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-5-configure-your-api-in-n8n\"><strong>5. Configure your API in n8n<\/strong><\/h3><p>Adding an API in n8n is straightforward, as you only need to add the node and fill out the required information. Here&rsquo;s how to do so:<\/p><ol class=\"wp-block-list\">\n<li>Open<strong> n8n<\/strong> and create a new workflow. <\/li>\n\n\n\n<li>Click the <strong>Plus<\/strong> icon on the top right of your n8n canvas.<\/li>\n\n\n\n<li>Select the <strong>HTTP Request <\/strong>node.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e52b540\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"626\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-http-request-node-in-n8n.png\/public\" alt=\"The HTTP request node in n8n\" class=\"wp-image-131391\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-http-request-node-in-n8n.png\/w=756,fit=scale-down 756w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-http-request-node-in-n8n.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/the-http-request-node-in-n8n.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Add the following information:\n<ul class=\"wp-block-list\">\n<li><strong>Method<\/strong>. The HTTP method n8n will use on the  API endpoint.<\/li>\n\n\n\n<li><strong>URL<\/strong>. Your API endpoint address.<\/li>\n\n\n\n<li><strong>Authentication<\/strong>. The authentication method for the API call, typically generic <strong>Bearer<\/strong> if you use a key.<\/li>\n\n\n\n<li><strong>Query params<\/strong>. Restrictions or rules that modify your API request, sometimes mandatory.<\/li>\n\n\n\n<li><strong>Send headers and body<\/strong>. Additional information to include in your API request for modifying the request. <\/li>\n<\/ul>\n<\/li>\n<\/ol><p>If you have trouble filling out the fields, refer to the API and n8n documentation. Depending on your API specification, you may not need to enter all of the information above.<\/p><p>Although your API will be integrated with n8n after this step, it still won&rsquo;t be functional because you&rsquo;ll need to enable your workflow to send the API request and fetch data.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-create-workflows-with-api-endpoints\"><strong>How to create workflows with API endpoints?<\/strong><\/h2><p>After integrating an API into your n8n instance, you&rsquo;ll need to create a workflow that utilizes its capabilities to transform and process data.<\/p><p>Since the workflow and nodes differ depending on what you want to automate, check out our tutorial on <a href=\"\/ng\/tutorials\/n8n-integrations\">n8n integration examples<\/a> for inspiration. For this tutorial, we&rsquo;ll create a simple alerting system that gives users notifications when their VPS resource usage exceeds certain thresholds.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-choose-a-trigger-method\"><strong>1. Choose a trigger method<\/strong><\/h3><p>Starting an n8n workflow requires a trigger node. There are various options for different workflow scenarios, which are classified into eight categories:<\/p><ul class=\"wp-block-list\">\n<li><strong>Trigger manually<\/strong>. Starts the workflow when a user deliberately clicks the trigger node on the n8n canvas.<\/li>\n\n\n\n<li><strong>On app event<\/strong>. Runs the workflow when an event takes place in an application, like <strong>Telegram<\/strong>, <strong>Notion<\/strong>, or <strong>Airtable<\/strong>.<\/li>\n\n\n\n<li><strong>On a schedule<\/strong>. Triggers the workflow at a specific interval, ideal for automating API calls.<\/li>\n\n\n\n<li><strong>On a webhook call<\/strong>. Initiates the workflow when the trigger node receives an HTTP request through the webhook URL. <\/li>\n\n\n\n<li><strong>On a form submission<\/strong>. Begins the workflow on a form submission, passing the input data into the workflow.<\/li>\n\n\n\n<li><strong>When executed by another workflow<\/strong>. Activates the workflow when another workflow calls for it. <\/li>\n\n\n\n<li><strong>On chat message<\/strong>. Commences the workflow when a user sends a message to n8n. <\/li>\n\n\n\n<li><strong>Others<\/strong>. Starts the workflow when a specific event happens, but not on a specific application, such as an error or a new email.<\/li>\n<\/ul><p>In this tutorial, we&rsquo;ll use n8n&rsquo;s<strong> Webhook<\/strong> node, one of the most flexible and easiest to configure. Because it uses a URL, you can start the node by simply opening the address in your web browser. You can also integrate the webhook into custom-coded applications without being restricted to specific platforms.<\/p><p>The webhook node works as is, but you can configure many settings to improve its security and usability. For example, you can set an authentication method to ensure only legitimate users can trigger it. We&rsquo;ll explain more about this in the next section.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> n8n&rsquo;s Webhook trigger node has two fields for URLs: <strong>test<\/strong> and <strong>production<\/strong>. Use them correctly based on their purposes to avoid security and functionality issues.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-2-create-a-workflow\"><strong>2. Create a workflow<\/strong><\/h3><p>Creating a workflow in n8n involves connecting nodes to determine data flow and handling. In our case, the workflow plan is as follows:<\/p><ol class=\"wp-block-list\">\n<li>When called, the <strong>webhook<\/strong> triggers the workflow, sending a request to the <strong>API<\/strong> in the <strong>HTTP request <\/strong>node. <\/li>\n\n\n\n<li>The API fetches the data, which will be stored in the <strong>HTTP request <\/strong>node.<\/li>\n\n\n\n<li>The <strong>HTTP request<\/strong> node then passes it to the <strong>Edit Fields<\/strong> node for processing.<\/li>\n\n\n\n<li>The <strong>Edit Fields<\/strong> node manipulates the raw data. In this case, it finds the average of each resource usage metric.<\/li>\n\n\n\n<li>The <strong>If <\/strong>node defines a logic that triggers a specific event based on the processed data. If the resource usage exceeds a particular threshold, it triggers the next node. Otherwise, it does nothing.<\/li>\n\n\n\n<li>The <strong>Discord<\/strong> node starts when the average resource usage exceeds the threshold, automatically notifying users.<\/li>\n<\/ol><p>The workflow diagram looks like the following on the n8n canvas:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e52cd8e\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"485\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-api-workflow-plan.png\/public\" alt=\"n8n's API workflow plan\" class=\"wp-image-131392\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-api-workflow-plan.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-api-workflow-plan.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-api-workflow-plan.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-api-workflow-plan.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-api-workflow-plan.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>You can expand this workflow further by connecting more nodes or workflows &ndash; it depends on the complexity of your automation goal.<\/p><p>For instance, you can integrate a workflow that automatically asks AI tools for performance optimization solutions, which is possible by <a href=\"\/ng\/tutorials\/how-to-use-n8n-with-mcp\">combining MCP with n8n<\/a>. Another example is that you can connect the spreadsheet node to log the history of hardware usage spikes.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-configure-the-workflow-logic\"><strong>3. Configure the workflow logic<\/strong><\/h3><p>Configuring logic in n8n defines how your workflow will select, manipulate, and use data to yield your desired results.<\/p><p>By default, raw API data contains information that might not be relevant or compatible with the subsequent node&rsquo;s processing capability. Reformatting and sorting this data ensures that each node can manipulate and forward it properly.<\/p><p><strong>Reading API raw data<\/strong><\/p><p>APIs typically send responses in the<strong> JSON<\/strong> format, which structures data in a key-value pair like so:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[\n   {\n      \"cpu_usage\": \n      {\n         \"unit\": \"%\",\n         \"usage\": {\n            \"1751494508\": 1.5 }\n      }\n   }\n]<\/pre><p>If we break it down, each data point is structured in a key-value pair called <strong>object<\/strong> like so:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\"key\": value}<\/pre><p>A <strong>key<\/strong> has to be a string written inside quotation marks. Meanwhile, a <strong>value<\/strong> can be a string, a number, or an object.<\/p><p>In addition to the JSON format, n8n provides a <strong>schema<\/strong> and <strong>table<\/strong> view of your API data. This helps you read and process the data more easily, as you can drag and drop it into other nodes.<\/p><p><strong>Manipulating API data using JavaScript<\/strong><\/p><p>n8n lets you pass data to nodes using two methods: <strong>Fixed<\/strong> or <strong>Expression<\/strong>. Fixed means the previous node forwards a value as is, while <strong>Expression <\/strong>enables you to manipulate it beforehand.<\/p><p>Because Expression passes data dynamically, it is typically used when working with a large amount of data or frequently changing values, such as hardware usage history.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Using n8n Expression<\/h4>\n                    <p>In addition to manipulating fetched data, <strong>Expression<\/strong> is also useful for sending a dynamic API request. For example, in the HTTP Request node, you can set a query parameter that automatically changes, like a date.<\/p>\n                <\/div>\n\n\n\n<\/p><p>Expression in n8n is written inside a pair of double curly brackets, mostly based on the <strong>Luxon<\/strong> and <strong>JMESPath<\/strong> libraries. Here&rsquo;s what it looks like:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{{ $json.object }}<\/pre><p>In our workflow, we want to set a dynamic value that takes the average of the VPS resource usage data. To do so, we add the <strong>Edit FIelds<\/strong> node and use the following expression:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{{ $json.cpu_usage.usage.values().average() }}<\/pre><p>Here&rsquo;s a breakdown of the expression:<\/p><ul class=\"wp-block-list\">\n<li><strong>$json<\/strong>. Takes the JSON value, which is the API&rsquo;s raw data.<\/li>\n\n\n\n<li><strong>cpu_usage.usage<\/strong>. Reads the<strong> usage <\/strong>object inside the <strong>cpu_usage<\/strong> field, which contains a list of timestamped CPU resource usage.<\/li>\n\n\n\n<li><strong>values()<\/strong>. Returns the values of the previous object as an array, in this case, the value of <strong>&ldquo;1751494508&rdquo;: 1.5 <\/strong>and so on.<\/li>\n\n\n\n<li><strong>average()<\/strong>. Takes the average value of the array. <\/li>\n<\/ul><p>If we want to perform the same operation for other hardware usage metrics, simply adjust the<strong> object<\/strong> accordingly. For example, here&rsquo;s an expression that takes the mean of RAM usage:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{{ $json.ram_usage.usage.values().average() }}<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e52e574\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"705\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-logic-taking-data-average.png\/public\" alt=\"n8n's logic for taking an average from data\" class=\"wp-image-131393\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-logic-taking-data-average.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-logic-taking-data-average.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-logic-taking-data-average.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-logic-taking-data-average.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-logic-taking-data-average.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-4-test-your-workflow\"><strong>4. Test your workflow<\/strong><\/h3><p>Testing your workflow is not only helpful for verifying your automation&rsquo;s functionality, but also lets you check the output from each node when developing the logic. Because your data may change after passing through a node and expression, testing helps you identify which data to work on next.<\/p><p>To test your n8n workflow, simply hit the <strong>Save<\/strong> button and click <strong>Execute Workflow<\/strong>. Then, start your workflow based on your chosen trigger node, which in our case is calling the webhook.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e52fccc\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"516\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-functional-api-workflow-test-results.png\/public\" alt=\"n8n's functional API workflow test results\" class=\"wp-image-131394\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-functional-api-workflow-test-results.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-functional-api-workflow-test-results.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-functional-api-workflow-test-results.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-functional-api-workflow-test-results.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-functional-api-workflow-test-results.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If your workflow runs, you should see checkmarks on nodes and green lines between them. Double-click a node to see its input and output values, which helps you determine how to set up the next node.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Using mock data<\/h4>\n                    <p>Checking the functionality of nodes in the middle of your workflow might be tricky because they commonly use altered data from the previous node. This means you must configure all the previous nodes before determining the data you are working with.<br>\nTo simplify the testing process, n8n lets you use mock data to simulate the input a node will take and process. You can create it by simply clicking <strong>Set mock data<\/strong> on a node&rsquo;s output field.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-5-secure-your-workflow\"><strong>5. Secure your workflow<\/strong><\/h3><p>Securing your n8n workflow is crucial, especially but not only if it contains private data or sensitive information. For example, if unauthorized parties know your webhook URL, they can overload it with requests, potentially causing downtime in your automation system.<\/p><p>Enabling authentication on the trigger node is the most essential way to secure your workflow. This ensures that only sources with valid credentials, like a key or login information, can start the workflow.<\/p><p>The steps to configure authentication are similar regardless of your trigger node. For instance, here&rsquo;s how to do so in the <strong>Webhook <\/strong>node:<\/p><ol class=\"wp-block-list\">\n<li>Double-click your <strong>Webhook <\/strong>node to open the configuration window.<\/li>\n\n\n\n<li>Click the<strong> Authentication <\/strong>drop-down menu and select a method. We&rsquo;ll choose<strong> Basic Auth<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e531153\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"932\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-authentication-method-configuration-in-n8n.png\/public\" alt=\"The Webhook node's authentication method configuration in n8n\" class=\"wp-image-131395\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-authentication-method-configuration-in-n8n.png\/w=744,fit=scale-down 744w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-authentication-method-configuration-in-n8n.png\/w=239,fit=scale-down 239w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-authentication-method-configuration-in-n8n.png\/w=120,fit=scale-down 120w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Expand the <strong>Credential for Basic Auth<\/strong> drop-down menu and click <strong>Create new credential<\/strong>. <\/li>\n\n\n\n<li>Enter a new <strong>username<\/strong> and <strong>password<\/strong>. <\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e5325b6\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"845\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-node-basic-auth-configuration-window.png\/public\" alt=\"The Webhook node's basic auth configuration window\" class=\"wp-image-131396\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-node-basic-auth-configuration-window.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-node-basic-auth-configuration-window.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-node-basic-auth-configuration-window.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-node-basic-auth-configuration-window.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/webhook-node-basic-auth-configuration-window.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Hit <strong>Save<\/strong>.<\/li>\n<\/ol><p>Now, you can only call the webhook with the correct username and password. To check whether the authentication works, open the URL in your web browser, and a pop-up asking for the login credentials should appear.<\/p><p>If you use another node and want to enable <strong>Bearer <\/strong>authentication, you must generate a token that meets n8n&rsquo;s security requirements using a separate tool. There are different methods and settings to create it. For example, here&rsquo;s how to make one in the<strong> Base64<\/strong> format:<\/p><ol class=\"wp-block-list\">\n<li>Open an online encoder tool. In this tutorial, we&rsquo;ll use <a href=\"https:\/\/www.base64encode.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Base64Encode<\/a>.<\/li>\n\n\n\n<li>Enter a username and password pair in the following format, which will be the authentication credentials:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">username:password<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Click <strong>Encode<\/strong>.<\/li>\n\n\n\n<li>Copy the encoded token and store it in a safe location.<\/li>\n<\/ol><p>In addition to securing the trigger node, there are other essential security practices to safeguard your n8n-API workflow. We&rsquo;ll discuss them in the following section.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-are-the-best-tips-for-securing-and-scaling-an-api-in-n8n\"><strong>What are the best tips for securing and scaling an API in n8n?<\/strong><\/h2><p>Securing your API integration in n8n involves various tasks beyond enabling authentication. In addition to maintaining its safety, the performance of your self-hosted n8n instance must remain optimal to ensure the responsiveness and smooth functionality of your automation.<\/p><p>Here are several best practices for securing and scaling your API-integrated n8n workflow.<\/p><ul class=\"wp-block-list\">\n<li><strong>Follow VPS security best practices<\/strong>. <a href=\"\/ng\/tutorials\/vps-security\">Secure your VPS<\/a> by implementing strategies like setting up the correct firewall rule and installing a malware scanner. If your server is compromised, cyber criminals can gain access to your n8n instance easily. <\/li>\n\n\n\n<li><strong>Limit URL usage<\/strong>. Reserve the production webhook URL for the live environment and avoid exposing it to the front end. Keeping this address safe prevents unauthorized parties from exploiting or controlling your workflow.<\/li>\n\n\n\n<li><strong>Update API keys regularly<\/strong>. Set a short expiration date for your API. The more frequently you update your authentication key, the less likely it is to be compromised. <\/li>\n\n\n\n<li><strong>Validate inputs and outputs. <\/strong>Validate data, especially that coming from and sent to external services like an API, to ensure its safety. Sometimes, cyber criminals inject malicious code into your data during transfer, which can present serious risks if unnoticed. <\/li>\n\n\n\n<li><strong>Use HTTPS<\/strong>. Only use HTTPS to exchange data with APIs and other external services. By default, most APIs already use the encrypted protocol, but you can also proxy the communication using an API gateway like <strong>NGINX<\/strong>.<\/li>\n\n\n\n<li><strong>Implement a monitoring system<\/strong>. Set up a monitoring system using tools like <strong>Prometheus <\/strong>and <strong>Grafana<\/strong> to track the performance of your n8n instance, including CPU, memory, and workflow execution times. This can help identify bottlenecks, areas for performance improvement, and the occurrence of cyber attacks like DDoS. <\/li>\n\n\n\n<li><strong>Consider the API rate limit<\/strong>. Public APIs commonly limit the number of requests within a specific time span to avoid overloading, downtime, and misuse. Set appropriate delays between requests in your n8n workflow to prevent exceeding the limit, which can result in service disruptions or blocked access.<\/li>\n\n\n\n<li><strong>Enable the n8n queue mode<\/strong>. <a href=\"\/ng\/tutorials\/n8n-queue-mode\">Activate n8n&rsquo;s queue mode<\/a> to offload tasks to multiple workers for asynchronous and distributed processing. This allows your workflows to handle large volumes of tasks without blocking and improves performance by processing tasks in the background.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-how-to-create-a-workflow-with-onesimpleapi\"><strong>How to create a workflow with OneSimpleAPI<\/strong><\/h2><p>Creating a workflow with OneSimpleAPI makes it easy to integrate APIs with various types of functionality, like generating QR codes or taking screenshots, into your automation system. With n8n&rsquo;s pre-configured OneSimpleAPI node, you can quickly connect different API features without configuring their endpoints individually.<\/p><p>To use OneSimpleAPI, you need to create an account and a token. Here&rsquo;s how to do so:<\/p><ol class=\"wp-block-list\">\n<li>Open the <a href=\"https:\/\/onesimpleapi.com\/register\" target=\"_blank\" rel=\"noreferrer noopener\">OneSimpleAPI user registration page<\/a> and create an account.<\/li>\n\n\n\n<li>Open the inbox of the email address you use for the registration.<\/li>\n\n\n\n<li>Check for an email from OneSimpleAPI and follow the instructions to validate your account.<\/li>\n\n\n\n<li>You should land on the API token creation page. From this menu, enter a <strong>name<\/strong> and select the<strong> permission<\/strong> to grant for your token. <\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e534073\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"806\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-token-configuration-menu.png\/public\" alt=\"OneSimpleAPI's token configuration menu\" class=\"wp-image-131397\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-token-configuration-menu.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-token-configuration-menu.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-token-configuration-menu.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-token-configuration-menu.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-token-configuration-menu.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Hit <strong>Create<\/strong>.<\/li>\n\n\n\n<li>A pop-up window will appear. Copy the API token and store it in a safe location. <\/li>\n<\/ol><p>Next, let&rsquo;s add the OneSimpleAPI node to your workflow:<\/p><ol class=\"wp-block-list\">\n<li>Click the <strong>plus<\/strong> icon on your n8n canvas and select <strong>OneSimpleAPI<\/strong>.<\/li>\n\n\n\n<li>Select the action that OneSimpleAPI will do. We&rsquo;ll choose <strong>Get details about a Spotify artist<\/strong>, but note that configuration steps will slightly differ depending on the action. <\/li>\n\n\n\n<li>Expand the <strong>Credential to connect with<\/strong> drop-down menu and choose <strong>Create new credential<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e535551\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"596\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-node-authentication-configuration-setting.png\/public\" alt=\"The OneSimpleAPI node authentication configuration setting\" class=\"wp-image-131398\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-node-authentication-configuration-setting.png\/w=772,fit=scale-down 772w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-node-authentication-configuration-setting.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-node-authentication-configuration-setting.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleapi-node-authentication-configuration-setting.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Enter the<strong> API token<\/strong> you created previously. Hit <strong>Save<\/strong>.<\/li>\n<\/ol><p>That&rsquo;s it. Next, test your workflow to ensure the OneSimpleAPI node can receive and process data.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197e536c0a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"625\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleai-output-example-fetching-data-using-spotify-api.png\/public\" alt=\"OneSimpleAPI's output example where it fetches data using Spotify's API\" class=\"wp-image-131399\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleai-output-example-fetching-data-using-spotify-api.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleai-output-example-fetching-data-using-spotify-api.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleai-output-example-fetching-data-using-spotify-api.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleai-output-example-fetching-data-using-spotify-api.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/onesimpleai-output-example-fetching-data-using-spotify-api.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-alternatives-and-common-api-use\"><strong>Alternatives and common API use<\/strong><\/h2><p>Integrating an API into n8n enables you to create an automation workflow for various use cases. Here are some of the most common ones:<\/p><ul class=\"wp-block-list\">\n<li><strong>Connecting proprietary or niche applications<\/strong>. When working with internal tools or custom services, the HTTP Request node allows you to make API calls to these services. For example, you can integrate your in-house CRM system to fetch or update customer data.<\/li>\n<\/ul><ul class=\"wp-block-list\">\n<li><strong>Implementing custom API operations<\/strong>. Some APIs offer functionalities not available through n8n&rsquo;s built-in nodes. For example, complex queries on a database might not be possible using n8n&rsquo;s default node and expression library, meaning you&rsquo;ll have to do this using an API.<\/li>\n\n\n\n<li><strong>Integrating multiple API endpoints<\/strong>. You can create a workflow with several API endpoints that can be triggered from a single URL, streamlining the integration of multiple service providers. For instance, you can connect Hostinger and Jira APIs to create a system that automatically creates a Jira ticket when your VPS experiences downtime. <\/li>\n\n\n\n<li><strong>Handling complex data transformations. <\/strong>Since APIs typically return nested or complex data structures, n8n&rsquo;s data transformation nodes help process and format this data as needed. n8n&rsquo;s pre-configured tools and libraries make the process more efficient. <\/li>\n\n\n\n<li><strong>Creating microservices with n8n. <\/strong>By combining multiple webhooks and workflows, you can build microservices within n8n, enabling modular and scalable automation solutions. For instance, you can integrate the <strong>WooCommerce API<\/strong> to handle the inventory of your online store, the<strong> Stripe API<\/strong> for its payment, and the <strong>Shippo API<\/strong> for its shipping mechanism. <\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-key-takeaways-using-an-api-with-n8n\"><strong>Key takeaways: using an API with n8n<\/strong><\/h2><p>Integrating an API into your n8n workflow enables the automation of a wide range of tasks involving data exchange with various services, including proprietary tools or software.<\/p><p>With API-based functionality, you can utilize complex features or data processing capabilities beyond what n8n supports. You can also combine multiple APIs in a workflow, allowing other services to use them through a single endpoint.<\/p><p>In addition to public APIs from external providers, you can also easily integrate various API capabilities with n8n&rsquo;s built-in OneSimpleAPI node.<\/p><p>Given the extensive API capabilities and n8n nodes, combining these tools makes it possible to automate various tasks. We recommend checking our <a href=\"\/ng\/tutorials\/n8n-workflow-examples\">n8n workflow examples<\/a> to learn more about what you can automate using this tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Integrating an application programming interface (API) with n8n can be complicated because every API provider has specific requirements for connecting their service. Nevertheless, n8n&rsquo;s code-minimal workflow can allow you to create a highly efficient yet easy-to-maintain data pipeline that will benefit a wide range of automation scenarios. Integrating an API into your n8n workflow consists [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/n8n-api\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to use API with n8n on a self-hosted setup","rank_math_description":"Learn how to use an API with n8n on a self-hosted setup: 1. Set up the n8n instance; 2. Find a public API; 3. Get the endpoint and key + more.","rank_math_focus_keyword":"n8n api","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-131383","post","type-post","status-publish","format-standard","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/n8n-api","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/n8n-api","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/n8n-api","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/n8n-api","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/n8n-api","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/n8n-api","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/n8n-api","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/n8n-api","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/n8n-api","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/n8n-api","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/131383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=131383"}],"version-history":[{"count":6,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/131383\/revisions"}],"predecessor-version":[{"id":143135,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/131383\/revisions\/143135"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=131383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=131383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=131383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}