{
  "id": "Par95oXOKSCFaZJE",
  "name": "Generate HTTP requests from natural language",
  "tags": [],
  "nodes": [
    {
      "id": "0d4d7c15-1dcd-47a7-aec0-2b246cd20f36",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 480,
        "height": 816,
        "content": "## Generate HTTP requests from natural language\n\n### How it works\n\nThis workflow lets a user describe an HTTP/API request in natural language and uses an AI agent to plan and execute it. A manual trigger starts the flow, a Set node provides the user request text, and the AI agent uses GPT-4.1 Mini plus an HTTP Request tool to generate and run the appropriate request. The final pass-through node exposes the resulting API response for inspection or downstream use.\n\n### Setup steps\n\n- Configure OpenAI credentials for the GPT-4.1 Mini chat model used by the AI agent.\n- Review the HTTP Request Executor tool settings and ensure it is allowed to call the APIs you intend to use, including any required authentication headers or credentials.\n- Edit the User Request node to set the desired natural-language API request in the user_request field.\n- Run the workflow manually from the Start Workflow node and inspect the API Response node output.\n\n### Customization\n\nChange the user_request value to target different APIs or request formats, swap the chat model if needed, or add validation/guardrails before the HTTP Request Executor for safer API calls."
      },
      "typeVersion": 1
    },
    {
      "id": "d76d434a-7b2a-4282-975c-d0dcf99b5703",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 336,
        "content": "## Start and request input\n\nManual workflow entry point and Set node that defines the natural-language user_request passed into the AI planner. These nodes form the left-side input cluster."
      },
      "typeVersion": 1
    },
    {
      "id": "6064f317-7a55-409a-b0ec-111e9597499a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 608,
        "content": "## AI request planning\n\nCentral AI agent cluster that interprets the user's request, uses GPT-4.1 Mini for reasoning, and invokes the HTTP Request Executor tool to perform the generated API call."
      },
      "typeVersion": 1
    },
    {
      "id": "0c07fc50-cc88-45f8-bcff-bd3e51d8a5c4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        0
      ],
      "parameters": {
        "color": 7,
        "height": 384,
        "content": "## Return API response\n\nRight-side output node that receives the AI agent's result and passes through the final API response for viewing or later workflow steps."
      },
      "typeVersion": 1
    },
    {
      "id": "66b59fcb-1c23-4688-8d41-eef2bbc47a7f",
      "name": "Manual Trigger Start",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        608,
        224
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5cbb69e6-1822-4f0f-9e99-f22e63a3d6ee",
      "name": "AI Request Planning Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1056,
        224
      ],
      "parameters": {
        "text": "={{ $json.user_request }}",
        "options": {
          "systemMessage": "You never output JSON yourself. You always call the HTTP Request tool to perform the request.\n\nFor any request that describes an API call with enough information to build it (URL/service + method + necessary params), you MUST call the HTTP Request tool immediately. Do not ask clarifying questions unless the request is genuinely ambiguous about which API or endpoint to use.\n\nInfer the HTTP method (GET, POST, PUT, PATCH, DELETE) from the user's request.\n\nOnly include headers, query parameters, and body fields that can be determined from the user's request.\n\nNever invent API keys, access tokens, bearer tokens, secrets, passwords, database IDs, account IDs, or other credentials, and never use placeholder values like YOUR_API_KEY.\n\nIf the request requires authentication and none was provided, ask the user for the missing credential instead of guessing or calling the tool with a fake value.\n\nAfter the tool returns a result, summarize what happened in plain language for the user."
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "e372a573-bc93-434d-b6cc-c56b194f545f",
      "name": "OpenAI GPT-4.1 Mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1072,
        448
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {},
        "responsesApiEnabled": false
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "36021320-f51f-4e64-bf25-b3c6cc2f691a",
      "name": "Execute HTTP Request",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1200,
        448
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `The complete URL of the REST API endpoint.`, 'string') }}",
        "method": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Method', 'HTTP method: GET, POST, PUT, PATCH, or DELETE', 'string') }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "fullResponse": true
            }
          }
        },
        "jsonBody": "={{ JSON.stringify($fromAI('Body', 'Return a JSON object. For GET requests return {}. Never return text or null.', 'json')) }}",
        "sendBody": true,
        "jsonQuery": "={{ JSON.stringify($fromAI('Query', 'Return a JSON object. If there are no query parameters return {}. Never return null, empty string or text.', 'json')) }}",
        "sendQuery": true,
        "jsonHeaders": "={{ JSON.stringify($fromAI('Headers', 'Return a JSON object containing request headers. If no headers are needed return {}.', 'json')) }}",
        "sendHeaders": true,
        "specifyBody": "json",
        "specifyQuery": "json",
        "specifyHeaders": "json",
        "toolDescription": "Execute any HTTP request to any REST API."
      },
      "typeVersion": 4.4
    },
    {
      "id": "392bc993-7edc-4113-bcdc-97c225fa743f",
      "name": "Await API Response",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1408,
        224
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e94751bf-82ba-4c6d-8ee3-bd3853be61e5",
      "name": "Set User Request Field",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "51f3cd6e-67ab-4fbd-a787-59cf77bd907e",
              "name": "user_request",
              "type": "string",
              "value": "Describe your API request here.  Example: Create a GitHub issue or Get weather for London or Create a Notion page  Credentials, IDs and request details can be included in this request when required."
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "7eb54210-e4ae-47ce-8058-3d45c206f630",
  "nodeGroups": [],
  "connections": {
    "OpenAI GPT-4.1 Mini": {
      "ai_languageModel": [
        [
          {
            "node": "AI Request Planning Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Execute HTTP Request": {
      "ai_tool": [
        [
          {
            "node": "AI Request Planning Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger Start": {
      "main": [
        [
          {
            "node": "Set User Request Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set User Request Field": {
      "main": [
        [
          {
            "node": "AI Request Planning Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Request Planning Agent": {
      "main": [
        [
          {
            "node": "Await API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}