Loop
How it worksThe loopWhy LoopPricingDocs
guide n8n · HTTP Request · AI Agent

Use Loop with n8n.

Call Loop's REST API from an HTTP Request node for deterministic pipelines, or wire it as an HTTP Request Tool sub-node for an AI Agent node that decides when to search and report autonomously. No key required in the free tier.

option 1 HTTP Request + Code node (deterministic pipeline)

The simplest pattern: a trigger fires, an HTTP Request node fetches results from Loop, and a Code node (JavaScript) reshapes the output for downstream nodes. Use this when the query and location are known at workflow design time or come from a fixed upstream node.

Workflow: Manual Trigger → HTTP Request (GET /v1/search) → Code (process results) → downstream nodes
HTTP Request + Code node config
// HTTP Request node — GET /v1/search
// Method:   GET
// URL:      https://api.stayinloop.dev/v1/search
// Send Query Parameters: ON
//   q        = {{ $json.query }}   ← expression, or a literal like "vegan pizza"
//   location = Kreuzberg, Berlin
//   limit    = 5

// Code node — process results
const data = $input.first().json;
const results = data.results ?? [];

return results.map(r => ({
  json: {
    id:         r.result_id,
    name:       r.name,
    address:    r.address,
    confidence: r.confidence,
    vegan:      r.restaurant?.vegan,
    outdoor:    r.restaurant?.outdoor_seating,
    observed:   r.observed_at,
  }
}));

To report an outcome, add a second HTTP Request node with Method POST and body from a previous node that holds the result_token and outcome:

HTTP Request node — POST /v1/report
// HTTP Request node — POST /v1/report
// Method:       POST
// URL:          https://api.stayinloop.dev/v1/report
// Send Body:    ON
// Content Type: JSON
// Body (JSON):
{
  "result_token": "{{ $json.result_token }}",
  "outcome":      "{{ $json.outcome }}"
}

// outcome must be one of:
//   correct · wrong · booked · closed · other
option 2 AI Agent + HTTP Request Tool sub-nodes (autonomous)

For autonomous search, add an AI Agent node and connect HTTP Request Tool sub-nodes to its ai_tool input. The agent decides when to call Loop based on user input. Use $fromAI() expressions so the LLM fills in the search query and parameters at runtime.

Note: HTTP Request Tool (n8n-nodes-langchain.toolhttprequest) connects to the agent's ai_toolconnector — not the main connector. It's a different node from the regular HTTP Request node.
AI Agent + HTTP Request Tool — $fromAI() config
// HTTP Request Tool sub-node wired to an AI Agent node
// Tool description (shown to the LLM — keep it specific):
//   "Search Loop for real local businesses in Kreuzberg, Berlin.
//    Use this when the user wants to find a restaurant, café, or bar.
//    Returns name, address, cuisine, vegan flag, outdoor seating, and confidence."

// Send Query Parameters: ON
//   q        = {{ $fromAI("query", "What the user is looking for, e.g. vegan outdoor seating", "string") }}
//   location = {{ $fromAI("location", "Neighborhood, default Kreuzberg Berlin", "string", "Kreuzberg, Berlin") }}
//   limit    = {{ $fromAI("limit", "Number of results, 1-10", "number", 5) }}

// Method: GET
// URL:    https://api.stayinloop.dev/v1/search

// Add a second HTTP Request Tool sub-node for report():
// Tool description:
//   "Report the outcome after acting on a Loop result.
//    Call this after the user confirms a booking or visits the place.
//    outcome must be: correct, wrong, booked, closed, or other."
// Method: POST
// URL:    https://api.stayinloop.dev/v1/report
// Body:   { "result_token": "{{ $fromAI('result_token', 'token from get_details', 'string') }}", "outcome": "{{ $fromAI('outcome', 'correct wrong booked closed or other', 'string') }}" }
API key (optional): Free tier — 30 reads/min, no key required. To get 60 reads/min and appear named on the signals board, add an Authorization header with value Bearer sk_live_…in the HTTP Request node's Headers section.
Prefer MCP? n8n has a built-in MCP Client Tool node (n8n-nodes-langchain.toolmcp). Connect it to an AI Agent node and set the server URL to https://stayinloop.dev/mcp — the agent gets all four Loop tools in one sub-node with no per-tool HTTP wiring. For MCP-native clients outside n8n (Claude, Cursor, VS Code), see the Claude guide.
← Full API referenceWatch your calls on the signals board →