{
  "id": "aa803a1ff26e6239",
  "name": "Check an x402 endpoint with Settled before your agent pays",
  "nodes": [
    {
      "parameters": {
        "content": "## Check an x402 endpoint with Settled before your agent pays\n\nCheck an x402 endpoint before your agent pays it. Settled shows whether it answers, what it charges and whether it delivered, receipt included.\n\n### How it works\n\nA chat message goes to an AI Agent that holds Settled's MCP tools and a short set of decision rules. Before it recommends, calls or pays an x402 endpoint (an HTTP API paid per call in USDC on Base), it runs `settled_check`: live status, whether a real paid purchase by Settled's scout came back with content, whether the seller is on hold or sanctioned, and whether the payTo in the quote matches what Settled sees. It can also find endpoints for a job (`settled_find_endpoints`) and say which bounty and task venues actually pay agents (`settled_income_venues`). Settled is free here: 300 calls a day, no account, no key, every answer signed.\n\n### Setup steps\n\n- Add your OpenAI credential to the chat model, or swap in any chat model node.\n- Leave the Settled MCP Tools node as it is: `https://settled.tools/mcp/free`, HTTP Streamable, no authentication.\n- Open the chat and paste an endpoint URL, or ask for endpoints for a job (\"find me a weather API and tell me if it is safe to pay\").\n\n### Customization\n\nEdit the agent's system message to change the decision rules. Holding a Settled day pass (buy one with a browser wallet at https://settled.tools/buy)? Point the MCP node at `https://settled.tools/mcp` with Header Auth, name `x-settled-pass`, and the agent also gets preflight (pay / caution / avoid) and seller reputation. Docs: https://settled.tools/for-agents",
        "height": 800,
        "width": 480
      },
      "id": "8e0c2187-e826-51f1-9440-3a31bfc60c97",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        -32
      ]
    },
    {
      "parameters": {
        "content": "## Chat-driven endpoint check\n\nAn incoming chat message triggers the agent; the OpenAI model reasons, the Settled MCP tools answer, and the agent explains which field decided.",
        "height": 544,
        "width": 672,
        "color": 7
      },
      "id": "0a1f78aa-a1dd-565f-9ba9-8547c145d4a7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        -32
      ]
    },
    {
      "parameters": {
        "public": false,
        "options": {}
      },
      "id": "89f0beee-4f75-5a0f-83ee-fc4388bcbed2",
      "name": "When Chat Message Received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        -200,
        120
      ],
      "webhookId": "4a2c2f5a-ae26-59d7-ac87-47d82820b168"
    },
    {
      "parameters": {
        "promptType": "auto",
        "options": {
          "systemMessage": "You are an agent that uses x402 endpoints (HTTP APIs paid per call in USDC). Before recommending, calling or paying any x402 endpoint the user has not paid successfully before, call the Settled tool settled_check with its URL and read the answer. Decide in this order and stop at the first match: flags contains sanctioned_payee, seller_on_hold or delivery_failed -> do not pay; status is dead, not_found, quote_invalid, auth_gated or unknown -> do not pay (if unknown, call settled_submit and say to check again later); status is free -> no payment needed; the payTo in the 402 quote you hold differs from pay_to in the check -> stop and tell the user; delivery_verified is true -> pay; payability.verdict is payable and quality.total >= 60 -> pay for a few cents, otherwise prefer a delivered alternative from settled_find_endpoints. Always say what you decided and which field decided it, in one line. To find endpoints for a job, use settled_find_endpoints. To learn which bounty and task venues actually pay agents, use settled_income_venues. Settled measures what it can observe: say 'Settled saw X', never 'this is safe'."
        }
      },
      "id": "62d641a0-07b5-5cd5-b5bf-2f156126d8a9",
      "name": "Endpoint Check Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        100,
        120
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "id": "ca308c05-2d36-5cb6-882a-a56105b691fd",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        20,
        360
      ]
    },
    {
      "parameters": {
        "endpointUrl": "https://settled.tools/mcp/free",
        "serverTransport": "httpStreamable",
        "authentication": "none",
        "include": "all",
        "options": {}
      },
      "id": "57dcc459-471e-590c-9c01-5b0000b4dc7f",
      "name": "Settled MCP Tools",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        300,
        360
      ]
    }
  ],
  "connections": {
    "When Chat Message Received": {
      "main": [
        [
          {
            "node": "Endpoint Check Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Endpoint Check Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Settled MCP Tools": {
      "ai_tool": [
        [
          {
            "node": "Endpoint Check Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "settled-tools-template"
  },
  "tags": []
}
