Skip to main content
Smart Routing is the orchestration engine behind every NearNode scan. Instead of a static redirect, each node evaluates a priority-ordered rule stack at the edge and routes the user to the first matching destination. If no rule matches, the node’s base payload is used as a fallback.
Ops Tip: You can manage routing rules visually in the Dashboard under each node’s “Rules” tab — no API calls required.

Rule Types

Route based on time of day and day of week. Deploy time-sensitive destinations without touching your infrastructure.
{
  "rule_type": "time_based",
  "conditions": {
    "timezone": "Europe/Zurich",
    "windows": [
      {
        "days": [1, 2, 3, 4, 5],
        "start_time": "08:00",
        "end_time": "18:00"
      }
    ]
  },
  "function_type": "redirect",
  "payload": { "url": "https://acme.com/open" }
}
Use case: A restaurant QR code routes to the lunch menu from 11:00–14:00 and the dinner menu from 18:00–22:00.

Priority & Evaluation

Rules are evaluated in ascending priority order (lower number = higher priority). The first matching rule wins — remaining rules are skipped.
Priority 0: Time-based → Office hours redirect
Priority 1: Geo → DACH region redirect
Priority 2: Device → Mobile app redirect
Priority 3: Default → Base payload (fallback)
Performance: Rule evaluation adds less than 150ms to the edge response. Total TTFB with routing rules stays under 350ms globally.

Creating Rules via API

curl -X POST https://nearnode.io/api/v1/nodes/k9m2xp4q/rules \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Office Hours",
    "priority": 0,
    "rule_type": "time_based",
    "conditions": {
      "timezone": "Europe/Zurich",
      "windows": [{ "days": [1,2,3,4,5], "start_time": "08:00", "end_time": "18:00" }]
    },
    "function_type": "redirect",
    "payload": { "url": "https://acme.com/welcome" }
  }'

Payload Types

Each routing rule can target any supported payload type:
TypeDescription
redirectHTTP 307 redirect to a URL
vcardGenerate and serve a vCard download
wifiWiFi provisioning page (SSID, password, encryption)
actionDirect-to-action: WhatsApp, Calendly, email, phone
micrositeHosted microsite with custom content