{
  "info": {
    "_postman_id": "a5f2d3b4-6b75-4f46-9f46-0d87982c7c5a",
    "name": "WaitTime Intelligence API",
    "description": "Ready-to-import Postman collection for local development. Start the API at {{base_url}}, run Register User to create an API key, then call protected endpoints with the stored {{api_key}} collection variable.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.termigpt.tech/waittime",
      "type": "string"
    },
    {
      "key": "api_key",
      "value": "YOUR_API_KEY",
      "type": "string"
    },
    {
      "key": "registered_email",
      "value": "customer@example.com",
      "type": "string"
    },
    {
      "key": "registered_name",
      "value": "Example Customer",
      "type": "string"
    },
    {
      "key": "company",
      "value": "Example AB",
      "type": "string"
    },
    {
      "key": "recovery_token",
      "value": "YOUR_RECOVERY_TOKEN",
      "type": "string"
    },
    {
      "key": "place_id",
      "value": "se-gbg-max-kungsportsavenyn",
      "type": "string"
    },
    {
      "key": "category",
      "value": "restaurant",
      "type": "string"
    },
    {
      "key": "latitude",
      "value": "57.7009",
      "type": "string"
    },
    {
      "key": "longitude",
      "value": "11.9746",
      "type": "string"
    },
    {
      "key": "custom_category",
      "value": "restaurant",
      "type": "string"
    },
    {
      "key": "custom_latitude",
      "value": "59.3293",
      "type": "string"
    },
    {
      "key": "custom_longitude",
      "value": "18.0686",
      "type": "string"
    },
    {
      "key": "custom_place_name",
      "value": "Demo Restaurant",
      "type": "string"
    },
    {
      "key": "timezone",
      "value": "Europe/Stockholm",
      "type": "string"
    },
    {
      "key": "target_time",
      "value": "2026-05-02T12:00:00+02:00",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Public",
      "item": [
        {
          "name": "Health",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/health",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "health"
              ]
            }
          }
        },
        {
          "name": "OpenAPI JSON",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/openapi.json",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "openapi.json"
              ]
            }
          }
        },
        {
          "name": "Register User",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.collectionVariables.set('registered_email', `customer+${Date.now()}@example.com`);"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('registration created an API key', function () {",
                  "  pm.response.to.have.status(201);",
                  "  const json = pm.response.json();",
                  "  pm.expect(json.api_key).to.be.a('string');",
                  "  pm.collectionVariables.set('api_key', json.api_key);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{registered_email}}\",\n  \"name\": \"{{registered_name}}\",\n  \"company\": \"{{company}}\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/v1/register",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "register"
              ]
            }
          }
        },
        {
          "name": "Request API Key Recovery",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('recovery request accepted', function () {",
                  "  pm.response.to.have.status(202);",
                  "  const json = pm.response.json();",
                  "  if (json.recovery_token) {",
                  "    pm.collectionVariables.set('recovery_token', json.recovery_token);",
                  "  }",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{registered_email}}\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/v1/api-key/recovery/request",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "api-key",
                "recovery",
                "request"
              ]
            }
          }
        },
        {
          "name": "Confirm API Key Recovery",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('recovery returned a new API key', function () {",
                  "  pm.response.to.have.status(200);",
                  "  const json = pm.response.json();",
                  "  pm.expect(json.api_key).to.be.a('string');",
                  "  pm.collectionVariables.set('api_key', json.api_key);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{registered_email}}\",\n  \"recovery_token\": \"{{recovery_token}}\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/v1/api-key/recovery/confirm",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "api-key",
                "recovery",
                "confirm"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Protected",
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{api_key}}",
            "type": "string"
          }
        ]
      },
      "item": [
        {
          "name": "Usage",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/usage",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "usage"
              ]
            }
          }
        },
        {
          "name": "Billing Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/billing/status",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "billing",
                "status"
              ]
            }
          }
        },
        {
          "name": "Create Checkout Session",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('checkout session created when Stripe is configured', function () {",
                  "  pm.expect(pm.response.code).to.be.oneOf([200, 503]);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"plan\": \"starter\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/v1/billing/checkout",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "billing",
                "checkout"
              ]
            }
          }
        },
        {
          "name": "List Places",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/places?category={{category}}&limit=50",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "places"
              ],
              "query": [
                {
                  "key": "category",
                  "value": "{{category}}"
                },
                {
                  "key": "limit",
                  "value": "50"
                }
              ]
            }
          }
        },
        {
          "name": "Get Place",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/places/{{place_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "places",
                "{{place_id}}"
              ]
            }
          }
        },
        {
          "name": "Categories",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/categories",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "categories"
              ]
            }
          }
        },
        {
          "name": "Wait Time by Place",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/wait-time?place_id={{place_id}}&target_time={{target_time}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "wait-time"
              ],
              "query": [
                {
                  "key": "place_id",
                  "value": "{{place_id}}"
                },
                {
                  "key": "target_time",
                  "value": "{{target_time}}"
                }
              ]
            }
          }
        },
        {
          "name": "Wait Time by Customer Location",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/wait-time?category={{custom_category}}&latitude={{custom_latitude}}&longitude={{custom_longitude}}&place_name={{custom_place_name}}&timezone={{timezone}}&radius_km=5",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "wait-time"
              ],
              "query": [
                {
                  "key": "category",
                  "value": "{{custom_category}}"
                },
                {
                  "key": "latitude",
                  "value": "{{custom_latitude}}"
                },
                {
                  "key": "longitude",
                  "value": "{{custom_longitude}}"
                },
                {
                  "key": "place_name",
                  "value": "{{custom_place_name}}"
                },
                {
                  "key": "timezone",
                  "value": "{{timezone}}"
                },
                {
                  "key": "radius_km",
                  "value": "5"
                }
              ]
            }
          }
        },
        {
          "name": "Batch Wait Time",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"requests\": [\n    {\n      \"place_id\": \"{{place_id}}\",\n      \"target_time\": \"{{target_time}}\"\n    },\n    {\n      \"category\": \"{{custom_category}}\",\n      \"latitude\": {{custom_latitude}},\n      \"longitude\": {{custom_longitude}},\n      \"place_name\": \"{{custom_place_name}}\",\n      \"timezone\": \"{{timezone}}\"\n    }\n  ]\n}"
            },
            "url": {
              "raw": "{{base_url}}/v1/wait-time/batch",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "wait-time",
                "batch"
              ]
            }
          }
        },
        {
          "name": "Forecast",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/forecast?category={{custom_category}}&latitude={{custom_latitude}}&longitude={{custom_longitude}}&place_name={{custom_place_name}}&timezone={{timezone}}&start_time={{target_time}}&hours=6&interval_minutes=60",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "forecast"
              ],
              "query": [
                {
                  "key": "category",
                  "value": "{{custom_category}}"
                },
                {
                  "key": "latitude",
                  "value": "{{custom_latitude}}"
                },
                {
                  "key": "longitude",
                  "value": "{{custom_longitude}}"
                },
                {
                  "key": "place_name",
                  "value": "{{custom_place_name}}"
                },
                {
                  "key": "timezone",
                  "value": "{{timezone}}"
                },
                {
                  "key": "start_time",
                  "value": "{{target_time}}"
                },
                {
                  "key": "hours",
                  "value": "6"
                },
                {
                  "key": "interval_minutes",
                  "value": "60"
                }
              ]
            }
          }
        },
        {
          "name": "Alternatives",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/alternatives?latitude={{latitude}}&longitude={{longitude}}&category={{category}}&max_wait_minutes=20&radius_km=5",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "alternatives"
              ],
              "query": [
                {
                  "key": "latitude",
                  "value": "{{latitude}}"
                },
                {
                  "key": "longitude",
                  "value": "{{longitude}}"
                },
                {
                  "key": "category",
                  "value": "{{category}}"
                },
                {
                  "key": "max_wait_minutes",
                  "value": "20"
                },
                {
                  "key": "radius_km",
                  "value": "5"
                }
              ]
            }
          }
        },
        {
          "name": "Insights Summary",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/insights/summary",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "insights",
                "summary"
              ]
            }
          }
        },
        {
          "name": "Submit Report",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"place_id\": \"{{place_id}}\",\n  \"wait_minutes\": 12,\n  \"crowd_level\": \"medium\",\n  \"source\": \"postman\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/v1/report",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "report"
              ]
            }
          }
        },
        {
          "name": "Regenerate API Key",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('regeneration returned a new API key', function () {",
                  "  pm.response.to.have.status(200);",
                  "  const json = pm.response.json();",
                  "  pm.expect(json.api_key).to.be.a('string');",
                  "  pm.collectionVariables.set('api_key', json.api_key);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/api-key/regenerate",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "api-key",
                "regenerate"
              ]
            }
          }
        },
        {
          "name": "Revoke API Key",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/api-key/revoke",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "api-key",
                "revoke"
              ]
            }
          }
        }
      ]
    }
  ]
}
