> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nearnode.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create your first node in 5 minutes.

## Prerequisites

<Check>A NearNode account — [sign up free](https://nearnode.io/signup)</Check>
<Check>An API key from **Developers → API Keys** in the dashboard</Check>

## 1. Get Your API Key

Navigate to the [NearNode Console](https://nearnode.io) → **Developers** → **API Keys** → **Generate**.

Copy the key immediately — it's shown only once.

```
sk_live_a1b2c3d4e5f6g7h8i9j0...
```

<Warning>
  Store your API key securely. Never commit it to version control or expose it in client-side code.
</Warning>

## 2. Create Your First Node

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://nearnode.io/api/v1/nodes \
    -H "Authorization: Bearer sk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "label": "Office Front Door",
      "function_type": "redirect",
      "payload": {
        "url": "https://yourcompany.com/welcome"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://nearnode.io/api/v1/nodes', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_live_...',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      label: 'Office Front Door',
      function_type: 'redirect',
      payload: {
        url: 'https://yourcompany.com/welcome',
      },
    }),
  });

  const { data } = await response.json();
  console.log(data.url);
  // → https://nearnode.io/v/k9m2xp4q
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://nearnode.io/api/v1/nodes",
      headers={"Authorization": "Bearer sk_live_..."},
      json={
          "label": "Office Front Door",
          "function_type": "redirect",
          "payload": {
              "url": "https://yourcompany.com/welcome",
          },
      },
  )

  data = response.json()["data"]
  print(data["url"])
  # → https://nearnode.io/v/k9m2xp4q
  ```
</CodeGroup>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "data": {
      "id": "node_abc123...",
      "slug": "k9m2xp4q",
      "url": "https://nearnode.io/v/k9m2xp4q",
      "function_type": "redirect",
      "status": "active"
    }
  }
  ```
</ResponseExample>

## 3. Generate a QR Code

Use any QR library to encode the scan URL. The URL is **permanent** — only the destination behind it changes.

<Tabs>
  <Tab title="CLI (qrencode)">
    ```bash theme={null}
    qrencode -o office-door.png "https://nearnode.io/v/k9m2xp4q"
    ```
  </Tab>

  <Tab title="Node.js (qrcode)">
    ```javascript theme={null}
    import QRCode from 'qrcode';

    await QRCode.toFile('office-door.png', 'https://nearnode.io/v/k9m2xp4q');
    ```
  </Tab>

  <Tab title="Python (qrcode)">
    ```python theme={null}
    import qrcode

    img = qrcode.make("https://nearnode.io/v/k9m2xp4q")
    img.save("office-door.png")
    ```
  </Tab>
</Tabs>

## 4. Update the Destination

Change where the QR code points — without reprinting:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://nearnode.io/api/v1/nodes/k9m2xp4q \
    -H "Authorization: Bearer sk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "payload": {
        "url": "https://yourcompany.com/new-page"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  await fetch('https://nearnode.io/api/v1/nodes/k9m2xp4q', {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer sk_live_...',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      payload: {
        url: 'https://yourcompany.com/new-page',
      },
    }),
  });
  ```

  ```python Python theme={null}
  import requests

  requests.patch(
      "https://nearnode.io/api/v1/nodes/k9m2xp4q",
      headers={"Authorization": "Bearer sk_live_..."},
      json={
          "payload": {
              "url": "https://yourcompany.com/new-page",
          },
      },
  )
  ```
</CodeGroup>

## 5. Try Other Payload Types

The same node API supports multiple function types. Swap `function_type` and `payload` to serve different content:

<Tabs>
  <Tab title="vCard" icon="address-card">
    ```json theme={null}
    {
      "label": "James Page",
      "function_type": "vcard",
      "payload": {
        "first_name": "James",
        "last_name": "Page",
        "organization": "VidiAI",
        "phone": "+41791234567",
        "email": "james@vidiai.ch"
      }
    }
    ```
  </Tab>

  <Tab title="WiFi" icon="wifi">
    ```json theme={null}
    {
      "label": "Guest WiFi",
      "function_type": "wifi",
      "payload": {
        "ssid": "Office-Guest",
        "password": "welcome2026",
        "security": "WPA2"
      }
    }
    ```
  </Tab>

  <Tab title="Action" icon="bolt">
    ```json theme={null}
    {
      "label": "WhatsApp Support",
      "function_type": "action",
      "payload": {
        "action_type": "whatsapp",
        "phone": "+41791234567",
        "message": "Hi, I scanned your tag!"
      }
    }
    ```
  </Tab>
</Tabs>

## 6. Track Scans

Every scan is logged with device type, location, and timestamp. You can:

<CardGroup cols={2}>
  <Card title="View in Dashboard" icon="chart-line">
    Real-time scan analytics with geo breakdown and device stats.
  </Card>

  <Card title="Receive via Webhook" icon="webhook">
    Push scan events to your server in real time. [Set up webhooks →](/concepts/webhooks)
  </Card>
</CardGroup>

## What's Next?

<CardGroup cols={3}>
  <Card title="Node Types" icon="layers" href="/concepts/nodes">
    vCard, WiFi, Microsite, Actions — not just redirects.
  </Card>

  <Card title="Routing Rules" icon="route" href="/concepts/routing-rules">
    A/B tests, time-based, geo-targeting, device routing.
  </Card>

  <Card title="Batch API" icon="boxes-stacked" href="/concepts/batches">
    Generate thousands of nodes at once for fleet operations.
  </Card>
</CardGroup>
