smart-links

Replace a code's smart rules

Replaces the code's rule set (max 5 rules). On every scan the rules are evaluated in order and the FIRST match wins; if nothing matches — or the stored set is ever unreadable — the redirect falls back to the code's primary destination, so a bad rule can never break a printed code. rules: [] or rules: null clears the set.

Conditions: {"kind":"device","in":["ios","android","desktop","other"]}, {"kind":"lang","in":["ru","ky"]}, {"kind":"hours","tz":"Asia/Bishkek","from":"09:00","to":"18:00","days":[1,2,3,4,5]} (to exclusive; from > to crosses midnight; days are ISO 1=Mon..7=Sun). Evaluation uses coarse classified signals only — raw IP, user-agent and Accept-Language are never stored. Smart rules require a paid plan (402 otherwise).

put/api/v1/codes/{id}/smart-rules

Request

  • Base URL: https://app.qrtap.kg
  • URL: https://app.qrtap.kg/api/v1/codes/{id}/smart-rules
  • Auth: HTTP bearer

Path parameters

idstring uuid required

Code id (UUID) as returned at creation.

Request body

Example request

{
  "rules": [
    {
      "if": {
        "kind": "device",
        "in": [
          "ios"
        ]
      },
      "to": "https://apps.apple.com/app/id1"
    },
    {
      "if": {
        "kind": "device",
        "in": [
          "android"
        ]
      },
      "to": "https://play.google.com/store/apps/details?id=kg.qrtap"
    },
    {
      "if": {
        "kind": "hours",
        "tz": "Asia/Bishkek",
        "from": "22:00",
        "to": "09:00",
        "days": [
          1,
          2,
          3,
          4,
          5
        ]
      },
      "to": "https://example.com/night-menu"
    }
  ]
}

Response

The stored (normalised) rule set.

code_idstring uuid required
version1 required

Rule-set schema version (currently always 1).

Example response

{
  "code_id": "b6a4a1de-46a5-4f0e-a2af-3f5d6a2e9b10",
  "version": 1,
  "rules": [
    {
      "if": {
        "kind": "device",
        "in": [
          "ios"
        ]
      },
      "to": "https://apps.apple.com/app/id1"
    },
    {
      "if": {
        "kind": "device",
        "in": [
          "android"
        ]
      },
      "to": "https://play.google.com/store/apps/details?id=kg.qrtap"
    },
    {
      "if": {
        "kind": "hours",
        "tz": "Asia/Bishkek",
        "from": "22:00",
        "to": "09:00",
        "days": [
          1,
          2,
          3,
          4,
          5
        ]
      },
      "to": "https://example.com/night-menu"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.