{
  "info": {
    "_postman_id": "b3e2b1a0-1c1f-4b7a-9b1a-witnio-v1",
    "name": "Witnio API",
    "description": "Real-device Android testing and OTP/SMS delivery API: Monitor, OTP/SMS, QA, Devices, Compliance, and self-service API keys. See docs/API_QUICKSTART.md in the repo for a walkthrough. Every request here (besides sign up/login and the public folder) uses the collection-level X-API-Key auth — set {{api_key}} once and go.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-API-Key" },
      { "key": "value", "value": "{{api_key}}" },
      { "key": "in", "value": "header" }
    ]
  },
  "variable": [
    { "key": "base_url", "value": "http://localhost:8000/api/v1" },
    { "key": "api_key", "value": "" },
    { "key": "access_token", "value": "" },
    { "key": "check_id", "value": "" },
    { "key": "plan_id", "value": "" },
    { "key": "run_id", "value": "" },
    { "key": "slot_id", "value": "" },
    { "key": "report_id", "value": "" },
    { "key": "key_id", "value": "" }
  ],
  "item": [
    {
      "name": "Monitor",
      "item": [
        {
          "name": "Create check (app_launch / url_load / consent_banner)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/monitor/checks",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Store checkout - CR\",\n  \"check_type\": \"url_load\",\n  \"target\": \"https://store.example.com\",\n  \"country_code\": \"CR\",\n  \"frequency_minutes\": 15,\n  \"alert_email\": \"ops@yourcompany.com\"\n}"
            }
          }
        },
        {
          "name": "List checks",
          "request": { "method": "GET", "url": "{{base_url}}/monitor/checks" }
        },
        {
          "name": "Get check",
          "request": { "method": "GET", "url": "{{base_url}}/monitor/checks/{{check_id}}" }
        },
        {
          "name": "Update check",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/monitor/checks/{{check_id}}",
            "body": { "mode": "raw", "raw": "{\n  \"is_active\": false\n}" }
          }
        },
        {
          "name": "Delete check",
          "request": { "method": "DELETE", "url": "{{base_url}}/monitor/checks/{{check_id}}" }
        },
        {
          "name": "List runs for a check",
          "request": { "method": "GET", "url": "{{base_url}}/monitor/checks/{{check_id}}/runs" }
        },
        {
          "name": "Summary (dashboard cards)",
          "request": { "method": "GET", "url": "{{base_url}}/monitor/summary" }
        },
        {
          "name": "Open alerts",
          "request": { "method": "GET", "url": "{{base_url}}/monitor/alerts" }
        }
      ]
    },
    {
      "name": "OTP/SMS",
      "item": [
        {
          "name": "Create OTP-SMS check with forwarding (Number for QA)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/monitor/checks",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Signup OTP - CR\",\n  \"check_type\": \"otp_sms\",\n  \"target\": \"+50688990011\",\n  \"country_code\": \"CR\",\n  \"frequency_minutes\": 15,\n  \"authorized_senders_json\": [\"YourApp\", \"+18445551234\"],\n  \"forward_webhook_url\": \"https://yourapp.com/hooks/otp\",\n  \"forward_slack_webhook_url\": \"https://hooks.slack.com/services/...\"\n}"
            }
          }
        },
        {
          "name": "Public delivery stats by country",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/public/delivery-stats?country=CR",
              "host": ["{{base_url}}"],
              "path": ["public", "delivery-stats"],
              "query": [{ "key": "country", "value": "CR" }]
            }
          }
        },
        {
          "name": "Public countries with data",
          "request": { "method": "GET", "url": "{{base_url}}/public/delivery-stats/countries" }
        }
      ]
    },
    {
      "name": "QA",
      "item": [
        {
          "name": "Create plan",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/qa/plans",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Checkout flow\",\n  \"app_package\": \"com.yourapp.android\",\n  \"steps\": [\n    { \"action\": \"launch_app\", \"params\": {}, \"label\": \"Launch app\" },\n    { \"action\": \"tap_text\", \"params\": { \"text\": \"Buy now\" }, \"label\": \"Tap buy now\" },\n    { \"action\": \"assert_text\", \"params\": { \"text\": \"Order confirmed\" }, \"label\": \"Confirm receipt\" }\n  ],\n  \"device_count\": 3\n}"
            }
          }
        },
        {
          "name": "List plans",
          "request": { "method": "GET", "url": "{{base_url}}/qa/plans" }
        },
        {
          "name": "Get plan",
          "request": { "method": "GET", "url": "{{base_url}}/qa/plans/{{plan_id}}" }
        },
        {
          "name": "Delete plan",
          "request": { "method": "DELETE", "url": "{{base_url}}/qa/plans/{{plan_id}}" }
        },
        {
          "name": "Start a run",
          "request": { "method": "POST", "url": "{{base_url}}/qa/plans/{{plan_id}}/runs" }
        },
        {
          "name": "List runs",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/qa/runs?limit=5",
              "host": ["{{base_url}}"],
              "path": ["qa", "runs"],
              "query": [{ "key": "limit", "value": "5" }]
            }
          }
        },
        {
          "name": "Get run",
          "request": { "method": "GET", "url": "{{base_url}}/qa/runs/{{run_id}}" }
        },
        {
          "name": "Get run report (Markdown)",
          "request": { "method": "GET", "url": "{{base_url}}/qa/runs/{{run_id}}/report" }
        },
        {
          "name": "Create schedule (Weekly on all phones)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/qa/schedules",
            "description": "Contract for DEC-025 item 5; may not be live on every deployment yet.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"plan_id\": \"{{plan_id}}\",\n  \"name\": \"Weekly on all phones\",\n  \"cadence\": \"weekly\",\n  \"weekday\": 1,\n  \"hour_utc\": 9,\n  \"device_policy\": \"all_physical\"\n}"
            }
          }
        },
        {
          "name": "List schedules",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/qa/schedules",
            "description": "Contract for DEC-025 item 5; may not be live on every deployment yet."
          }
        }
      ]
    },
    {
      "name": "Devices",
      "item": [
        {
          "name": "List fleet inventory",
          "request": { "method": "GET", "url": "{{base_url}}/devices/" }
        },
        {
          "name": "Create rental slot",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/device-rental/slots",
            "body": { "mode": "raw", "raw": "{\n  \"country_code\": \"CR\",\n  \"duration_hours\": 720\n}" }
          }
        },
        {
          "name": "List rental slots",
          "request": { "method": "GET", "url": "{{base_url}}/device-rental/slots" }
        },
        {
          "name": "Release slot",
          "request": { "method": "DELETE", "url": "{{base_url}}/device-rental/slots/{{slot_id}}" }
        },
        {
          "name": "Start remote session",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/device-rental/slots/{{slot_id}}/sessions",
            "body": { "mode": "raw", "raw": "{\n  \"ttl_minutes\": 60\n}" }
          }
        },
        {
          "name": "List sessions for a slot",
          "request": { "method": "GET", "url": "{{base_url}}/device-rental/slots/{{slot_id}}/sessions" }
        }
      ]
    },
    {
      "name": "Compliance",
      "item": [
        {
          "name": "List reports",
          "request": { "method": "GET", "url": "{{base_url}}/compliance/reports" }
        },
        {
          "name": "Get report metadata",
          "request": { "method": "GET", "url": "{{base_url}}/compliance/reports/{{report_id}}" }
        },
        {
          "name": "Open report (HTML)",
          "request": { "method": "GET", "url": "{{base_url}}/compliance/reports/{{report_id}}/html" }
        },
        {
          "name": "Generate report for a period",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{base_url}}/compliance/reports/generate",
            "body": { "mode": "raw", "raw": "{\n  \"check_id\": \"{{check_id}}\",\n  \"period\": \"2026-09\"\n}" }
          }
        }
      ]
    },
    {
      "name": "API keys",
      "item": [
        {
          "name": "Create key",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{access_token}}" }] },
            "url": "{{base_url}}/api-keys",
            "description": "The one call in this collection that still needs a bearer token from /auth/login: you cannot create your first API key with an API key you do not have yet.",
            "body": { "mode": "raw", "raw": "{\n  \"name\": \"CI pipeline\"\n}" }
          }
        },
        {
          "name": "List keys",
          "request": { "method": "GET", "url": "{{base_url}}/api-keys" }
        },
        {
          "name": "Revoke key",
          "request": { "method": "DELETE", "url": "{{base_url}}/api-keys/{{key_id}}" }
        }
      ]
    }
  ]
}
