{
  "info": {
    "name": "Enqre — QR code API v1",
    "description": "Dynamic QR codes: create them from your backend, change where a printed code points, read its scans. Set the apiKey variable to a key from Enqre → API & webhooks (Business plan). Docs: https://enqre.com/api-docs",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://enqre.com/api/v1", "type": "string" },
    { "key": "apiKey", "value": "", "type": "string" },
    { "key": "codeId", "value": "", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{apiKey}}", "type": "string" }]
  },
  "item": [
    {
      "name": "List codes",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/qrcodes?limit=50",
          "host": ["{{baseUrl}}"],
          "path": ["qrcodes"],
          "query": [
            { "key": "limit", "value": "50", "description": "1-100, default 50" },
            { "key": "cursor", "value": "", "description": "nextCursor from the previous page", "disabled": true }
          ]
        },
        "description": "Newest first, cursor-paginated. Pass the returned nextCursor to walk the list."
      }
    },
    {
      "name": "Create a code",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// Remember the new id so the other requests can be run as they are.",
              "if (pm.response.code === 201) {",
              "  pm.collectionVariables.set('codeId', pm.response.json().data.id);",
              "}"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"Table tent\",\n  \"url\": \"https://example.com/menu\"\n}"
        },
        "url": { "raw": "{{baseUrl}}/qrcodes", "host": ["{{baseUrl}}"], "path": ["qrcodes"] },
        "description": "Creates a dynamic URL code. The response carries shortUrl — that is what goes on the print."
      }
    },
    {
      "name": "Read one code",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/qrcodes/{{codeId}}",
          "host": ["{{baseUrl}}"],
          "path": ["qrcodes", "{{codeId}}"]
        }
      }
    },
    {
      "name": "Change a code",
      "request": {
        "method": "PATCH",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"url\": \"https://example.com/autumn-menu\",\n  \"name\": \"Autumn menu\",\n  \"active\": true\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/qrcodes/{{codeId}}",
          "host": ["{{baseUrl}}"],
          "path": ["qrcodes", "{{codeId}}"]
        },
        "description": "Every field is optional. Changing url re-points every printed copy within seconds; active:false pauses the code without deleting it."
      }
    },
    {
      "name": "Scans of one code",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/qrcodes/{{codeId}}/scans",
          "host": ["{{baseUrl}}"],
          "path": ["qrcodes", "{{codeId}}", "scans"]
        },
        "description": "The last 1,000 scans plus the lifetime total. No location data is collected, so none is returned."
      }
    },
    {
      "name": "Delete a code",
      "request": {
        "method": "DELETE",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/qrcodes/{{codeId}}",
          "host": ["{{baseUrl}}"],
          "path": ["qrcodes", "{{codeId}}"]
        },
        "description": "Printed copies stop resolving. To pause a campaign, PATCH active:false instead."
      }
    }
  ]
}
