{
  "info": {
    "name": "Packly Event Tracker",
    "description": "Ingest + read APIs for the packly-ecommerce event tracker (view_item, add_to_wishlist, search), plus the SDK, dashboard, and health check. Import into Postman/Insomnia and set the collection variables to match your .env.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "http://localhost:8090", "type": "string" },
    { "key": "site_key", "value": "pk_live_packly", "type": "string" },
    { "key": "read_api_key", "value": "", "type": "string" },
    { "key": "event_id", "value": "", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{read_api_key}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Ingest",
      "item": [
        {
          "name": "POST /v1/events - view_item",
          "request": {
            "method": "POST",
            "auth": { "type": "noauth" },
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/v1/events",
              "host": ["{{base_url}}"],
              "path": ["v1", "events"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site_key\": \"{{site_key}}\",\n  \"events\": [\n    {\n      \"event_name\": \"view_item\",\n      \"event_timestamp\": 1784462189000,\n      \"user_id\": \"user_98765\",\n      \"user_pseudo_id\": \"device_xyz_12345\",\n      \"area\": \"Downtown\",\n      \"city\": \"Dhaka\",\n      \"country\": \"Bangladesh\",\n      \"platform\": \"Android\",\n      \"traffic_source\": \"Google-Organic\",\n      \"entry_source_page\": \"Home page\",\n      \"entry_source_section\": \"just for you\",\n      \"image_viewed_count\": 4,\n      \"total_price\": 15000,\n      \"items\": [\n        {\n          \"item_id\": \"product-123\",\n          \"item_name\": \"Smartphone Model X\",\n          \"item_brand\": \"Brand\",\n          \"item_category\": \"electronics\",\n          \"item_category2\": \"smartphones\",\n          \"item_category3\": \"android-phones\",\n          \"price\": 15000,\n          \"discount\": 2000,\n          \"item_variant_id\": \"\",\n          \"available_stock\": 12,\n          \"shop_id\": \"\",\n          \"seller_name\": \"\",\n          \"quantity\": 1,\n          \"coupon\": \"\"\n        }\n      ]\n    }\n  ]\n}"
            }
          }
        },
        {
          "name": "POST /v1/events - add_to_wishlist",
          "request": {
            "method": "POST",
            "auth": { "type": "noauth" },
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/v1/events",
              "host": ["{{base_url}}"],
              "path": ["v1", "events"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site_key\": \"{{site_key}}\",\n  \"events\": [\n    {\n      \"event_name\": \"add_to_wishlist\",\n      \"event_timestamp\": 1784462200000,\n      \"user_id\": \"user_98765\",\n      \"user_pseudo_id\": \"device_xyz_12345\",\n      \"area\": \"Downtown\",\n      \"city\": \"Dhaka\",\n      \"country\": \"Bangladesh\",\n      \"platform\": \"Android\",\n      \"traffic_source\": \"Google-Organic\",\n      \"entry_source_page\": \"Home page\",\n      \"entry_source_section\": \"just for you\",\n      \"total_price\": 15000,\n      \"items\": [\n        {\n          \"item_id\": \"product-123\",\n          \"item_name\": \"Smartphone Model X\",\n          \"item_brand\": \"Brand\",\n          \"item_category\": \"electronics\",\n          \"item_category2\": \"smartphones\",\n          \"item_category3\": \"android-phones\",\n          \"price\": 15000,\n          \"discount\": 2000,\n          \"item_variant_id\": \"\",\n          \"available_stock\": 12,\n          \"shop_id\": \"\",\n          \"seller_name\": \"\",\n          \"quantity\": 1,\n          \"coupon\": \"\"\n        }\n      ]\n    }\n  ]\n}"
            }
          }
        },
        {
          "name": "POST /v1/events - search",
          "request": {
            "method": "POST",
            "auth": { "type": "noauth" },
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/v1/events",
              "host": ["{{base_url}}"],
              "path": ["v1", "events"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site_key\": \"{{site_key}}\",\n  \"events\": [\n    {\n      \"event_name\": \"search\",\n      \"event_timestamp\": 1784462210000,\n      \"user_id\": \"user_98765\",\n      \"user_pseudo_id\": \"device_xyz_12345\",\n      \"area\": \"Downtown\",\n      \"city\": \"Dhaka\",\n      \"country\": \"Bangladesh\",\n      \"platform\": \"Android\",\n      \"traffic_source\": \"Google-Organic\",\n      \"entry_source_page\": \"Home page\",\n      \"entry_source_section\": \"just for you\",\n      \"search_query\": \"iPhone\",\n      \"search_page\": \"home page\"\n    }\n  ]\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Read",
      "item": [
        {
          "name": "GET /v1/events",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/v1/events?limit=50&order=desc",
              "host": ["{{base_url}}"],
              "path": ["v1", "events"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "order", "value": "desc" },
                { "key": "event_name", "value": "view_item", "disabled": true },
                { "key": "user_id", "value": "", "disabled": true },
                { "key": "user_pseudo_id", "value": "", "disabled": true },
                { "key": "search_query", "value": "", "disabled": true },
                { "key": "item_id", "value": "", "disabled": true },
                { "key": "from", "value": "", "disabled": true },
                { "key": "to", "value": "", "disabled": true },
                { "key": "cursor", "value": "", "disabled": true }
              ]
            }
          }
        },
        {
          "name": "GET /v1/events/{id}",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/v1/events/{{event_id}}",
              "host": ["{{base_url}}"],
              "path": ["v1", "events", "{{event_id}}"]
            }
          }
        },
        {
          "name": "GET /v1/events/stats",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/v1/events/stats",
              "host": ["{{base_url}}"],
              "path": ["v1", "events", "stats"],
              "query": [
                { "key": "from", "value": "", "disabled": true },
                { "key": "to", "value": "", "disabled": true }
              ]
            }
          }
        },
        {
          "name": "GET /v1/events/export (csv)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/v1/events/export?format=csv",
              "host": ["{{base_url}}"],
              "path": ["v1", "events", "export"],
              "query": [
                { "key": "format", "value": "csv" },
                { "key": "event_name", "value": "", "disabled": true },
                { "key": "user_id", "value": "", "disabled": true },
                { "key": "user_pseudo_id", "value": "", "disabled": true },
                { "key": "search_query", "value": "", "disabled": true },
                { "key": "item_id", "value": "", "disabled": true },
                { "key": "from", "value": "", "disabled": true },
                { "key": "to", "value": "", "disabled": true }
              ]
            }
          }
        },
        {
          "name": "GET /v1/events/export (json)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/v1/events/export?format=json",
              "host": ["{{base_url}}"],
              "path": ["v1", "events", "export"],
              "query": [{ "key": "format", "value": "json" }]
            }
          }
        }
      ]
    },
    {
      "name": "SDK & Dashboard",
      "item": [
        {
          "name": "GET /sdk.js",
          "request": {
            "method": "GET",
            "auth": { "type": "noauth" },
            "url": {
              "raw": "{{base_url}}/sdk.js?key={{site_key}}",
              "host": ["{{base_url}}"],
              "path": ["sdk.js"],
              "query": [{ "key": "key", "value": "{{site_key}}" }]
            }
          }
        },
        {
          "name": "GET / (dashboard)",
          "request": {
            "method": "GET",
            "auth": { "type": "noauth" },
            "url": { "raw": "{{base_url}}/", "host": ["{{base_url}}"], "path": [""] }
          }
        },
        {
          "name": "GET /healthz",
          "request": {
            "method": "GET",
            "auth": { "type": "noauth" },
            "url": { "raw": "{{base_url}}/healthz", "host": ["{{base_url}}"], "path": ["healthz"] }
          }
        }
      ]
    }
  ]
}
