{
  "info": {
    "name": "SMS Web API",
    "description": "Self-hosted multi-user SMS gateway. Set base_url and api_key (your personal key from the Account page). device_code is only needed for the device endpoints used by the Android app.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "http://localhost/smsweb" },
    { "key": "api_key", "value": "PUT_YOUR_PERSONAL_API_KEY_HERE" },
    { "key": "webhook_url", "value": "https://your-site.com/sms-webhook" },
    { "key": "device_code", "value": "PUT_A_DEVICE_CODE_HERE" }
  ],
  "item": [
    {
      "name": "Send SMS (client)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-Api-Key", "value": "{{api_key}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": {
          "raw": "{{base_url}}/api.php?action=send",
          "host": ["{{base_url}}"],
          "path": ["api.php"],
          "query": [{ "key": "action", "value": "send" }]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"to\": \"01700000000\",\n  \"message\": \"Hello from SMS Web\",\n  \"webhook_url\": \"{{webhook_url}}\"\n}"
        },
        "description": "Queues an SMS. The SIM is chosen in the gateway app, not here. webhook_url is optional — remove it for no callback; we POST the final status (sent/failed) to it once a phone reports back."
      }
    },
    {
      "name": "Device login (app)",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": {
          "raw": "{{base_url}}/api.php?action=device/login",
          "host": ["{{base_url}}"],
          "path": ["api.php"],
          "query": [{ "key": "action", "value": "device/login" }]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"code\": \"{{device_code}}\"\n}"
        }
      }
    },
    {
      "name": "Device poll (app)",
      "request": {
        "method": "GET",
        "header": [{ "key": "X-Device-Token", "value": "{{device_code}}" }],
        "url": {
          "raw": "{{base_url}}/api.php?action=device/poll",
          "host": ["{{base_url}}"],
          "path": ["api.php"],
          "query": [{ "key": "action", "value": "device/poll" }]
        }
      }
    },
    {
      "name": "Device ack (app)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-Device-Token", "value": "{{device_code}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": {
          "raw": "{{base_url}}/api.php?action=device/ack",
          "host": ["{{base_url}}"],
          "path": ["api.php"],
          "query": [{ "key": "action", "value": "device/ack" }]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"id\": 12,\n  \"status\": \"sent\",\n  \"sim\": 1,\n  \"error\": null\n}"
        }
      }
    }
  ]
}
