{
  "id": "1d2b8f44a66494c1",
  "name": "Daily Settled check of your own x402 endpoints",
  "nodes": [
    {
      "parameters": {
        "content": "## Daily Settled check of your own x402 endpoints\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\nOnce a day, every endpoint you list is run through Settled's free check (`GET https://settled.tools/v1/free/check?url=...`): live status, payability, risk flags, and the result of the last real purchase Settled's scout made from it. Endpoints that need attention are gathered into one digest and posted to a Discord or Slack webhook; when everything is fine, nothing is posted. The digest ends with how to get alerted within minutes instead of daily (Seller Watch).\n\n### Setup steps\n\n- In the Endpoints and Webhook node, list your x402 endpoint URLs and paste a Discord or Slack incoming-webhook URL.\n- Activate the workflow. The free check allows 300 calls a day per client, so up to a few hundred endpoints fit.\n\n### Customization\n\nChange the hour in the trigger, or edit the Flag Problems node to decide what counts as a problem (by default: a status other than live, an unpayable verdict, the flags seller_on_hold, delivery_failed, clone_farm, quote_only, price_changed, verb_mismatch or sanctioned_payee, and a last purchase that was not as advertised). Sellers can claim their wallet at https://settled.tools/claim for alerts the moment a purchase fails.",
        "height": 760,
        "width": 480
      },
      "id": "8e0c2187-e826-51f1-9440-3a31bfc60c97",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        -32
      ]
    },
    {
      "parameters": {
        "content": "## Check each endpoint, post a digest\n\nThe daily trigger fires, the settings node lists the endpoints, each one is checked, problems are collected into one message, and the digest is posted only when there is one.",
        "height": 300,
        "width": 1200,
        "color": 7
      },
      "id": "0a1f78aa-a1dd-565f-9ba9-8547c145d4a7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        -32
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "daysInterval": 1,
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "193cf9da-d80b-5774-8f4b-146f1cbc76df",
      "name": "Every Day at 8:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -200,
        100
      ]
    },
    {
      "parameters": {
        "jsCode": "// Edit these two things.\nconst WEBHOOK_URL = 'https://discord.com/api/webhooks/REPLACE-ME'; // Discord or Slack incoming webhook\nconst ENDPOINTS = [\n  'https://api.example.com/search',\n  'https://api.example.com/weather',\n];\nreturn ENDPOINTS.map(url => ({ json: { url, webhook: WEBHOOK_URL } }));"
      },
      "id": "a5fdfc29-f770-5948-9d1b-96cf788eef45",
      "name": "Endpoints and Webhook",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        40,
        100
      ]
    },
    {
      "parameters": {
        "url": "=https://settled.tools/v1/free/check?url={{ encodeURIComponent($json.url) }}",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          }
        }
      },
      "id": "93620060-679f-5610-b128-03d180980e33",
      "name": "Settled Free Check",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        280,
        100
      ]
    },
    {
      "parameters": {
        "jsCode": "// One digest line per endpoint that needs attention; nothing is posted when all is well.\nconst cfg = $('Endpoints and Webhook').all();\nconst webhook = cfg[0].json.webhook;\nconst problems = [];\nfor (const item of $input.all()) {\n  const r = item.json;\n  const url = r.url ?? '(unknown url)';\n  const why = [];\n  if (r.error) why.push(r.error === 'not_indexed' ? 'not in Settled\\'s index yet (POST /v1/submit)' : `check failed: ${r.error}`);\n  if (r.status && r.status !== 'live') why.push(`status ${r.status}`);\n  const pv = r.payability && r.payability.verdict;\n  if (pv && !['delivered', 'payable', 'free'].includes(pv)) why.push(`payability ${pv}`);\n  for (const f of r.flags ?? []) if (['seller_on_hold', 'delivery_failed', 'clone_farm', 'quote_only', 'price_changed', 'verb_mismatch', 'sanctioned_payee'].includes(f)) why.push(`flag ${f}`);\n  if (r.delivery_receipt && r.delivery_receipt.checks && r.delivery_receipt.checks.verdict === 'not_as_advertised') why.push('last paid purchase was not as advertised');\n  if (why.length) problems.push(`\u2022 ${url}: ${why.join(', ')} \u2014 https://settled.tools/v1/free/check?url=${encodeURIComponent(url)}`);\n}\nif (!problems.length) return [];\nconst text = `Settled daily check: ${problems.length} endpoint(s) need attention\\n${problems.join('\\n')}\\nSettled can watch these every 15 minutes and alert you the moment a paid purchase fails: claim your wallet at https://settled.tools/claim (Seller Watch, 10 days free, then $3 per 10 days).`;\nconst isSlack = webhook.includes('hooks.slack.com');\nreturn [{ json: { webhook, payload: isSlack ? { text } : { content: text } } }];"
      },
      "id": "fa005aa6-0ef9-5948-9b53-12f55250791e",
      "name": "Flag Problems",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $json.webhook }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.payload) }}",
        "options": {}
      },
      "id": "6899d55b-b71c-5741-996f-853b214253ae",
      "name": "Post Digest to Discord or Slack",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        760,
        100
      ]
    }
  ],
  "connections": {
    "Every Day at 8:00": {
      "main": [
        [
          {
            "node": "Endpoints and Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Endpoints and Webhook": {
      "main": [
        [
          {
            "node": "Settled Free Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Settled Free Check": {
      "main": [
        [
          {
            "node": "Flag Problems",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flag Problems": {
      "main": [
        [
          {
            "node": "Post Digest to Discord or Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "settled-tools-template"
  },
  "tags": []
}
