{
  "info": {
    "name": "Sendoka SMS",
    "_postman_id": "sendoka-sms-collection",
    "description": "Sendoka SMS API — single send, batch, list, cancel, and 10DLC provisioning. See docs/api/sms.md for details.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl",     "value": "https://YOUR-HOST" },
    { "key": "apiKey",      "value": "sok_test_REPLACE_ME" },
    { "key": "fromNumber",  "value": "+15555550100" },
    { "key": "toNumber",    "value": "+15555550199" },
    { "key": "smsId",       "value": "msg_..." },
    { "key": "brandId",     "value": "brd_..." },
    { "key": "campaignId",  "value": "cmp_..." }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{apiKey}}", "type": "string" }]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Fresh Idempotency-Key per request so retries within 24h replay correctly.",
          "pm.variables.set('idempotencyKey', crypto.randomUUID());"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "Send",
      "item": [
        {
          "name": "Send SMS — minimal",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type",    "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{idempotencyKey}}" }
            ],
            "url": { "raw": "{{baseUrl}}/api/v1/sms", "host": ["{{baseUrl}}"], "path": ["api","v1","sms"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from\": \"{{fromNumber}}\",\n  \"to\":   \"{{toNumber}}\",\n  \"body\": \"Test from Sendoka\"\n}"
            }
          }
        },
        {
          "name": "Send SMS — template + variables",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type",    "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{idempotencyKey}}" }
            ],
            "url": { "raw": "{{baseUrl}}/api/v1/sms", "host": ["{{baseUrl}}"], "path": ["api","v1","sms"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from\": \"{{fromNumber}}\",\n  \"to\":   \"{{toNumber}}\",\n  \"template\": \"order_shipped\",\n  \"variables\": {\n    \"order_id\":     \"ord_abc123\",\n    \"tracking_url\": \"https://track.example.com/ord_abc123\"\n  }\n}"
            }
          }
        },
        {
          "name": "Send SMS — scheduled (local + tz)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/sms", "host": ["{{baseUrl}}"], "path": ["api","v1","sms"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from\": \"{{fromNumber}}\",\n  \"to\":   \"{{toNumber}}\",\n  \"body\": \"Reminder: appointment tomorrow at 9am\",\n  \"scheduled_local\": \"2026-05-18 09:00\",\n  \"scheduled_at_tz\": \"America/New_York\"\n}"
            }
          }
        },
        {
          "name": "Send SMS — pool sender",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/sms", "host": ["{{baseUrl}}"], "path": ["api","v1","sms"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from_pool\": \"support\",\n  \"to\":        \"{{toNumber}}\",\n  \"body\":      \"Your support ticket has an update.\"\n}"
            }
          }
        },
        {
          "name": "Send SMS — MMS with tags + metadata",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type",    "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{idempotencyKey}}" }
            ],
            "url": { "raw": "{{baseUrl}}/api/v1/sms", "host": ["{{baseUrl}}"], "path": ["api","v1","sms"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from\": \"{{fromNumber}}\",\n  \"to\":   \"{{toNumber}}\",\n  \"body\": \"Receipt attached. Reply STOP to opt out.\",\n  \"media_url\": [\"https://example.com/receipt.png\"],\n  \"tags\": [\"transactional\", \"receipt\"],\n  \"metadata\": {\n    \"order_id\": \"ord_abc123\",\n    \"user_id\":  \"usr_42\"\n  }\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Batch",
      "item": [
        {
          "name": "Batch SMS — per-item array (3 items)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/sms/batch", "host": ["{{baseUrl}}"], "path": ["api","v1","sms","batch"] },
            "body": {
              "mode": "raw",
              "raw": "[\n  { \"from\": \"{{fromNumber}}\", \"to\": \"+15555550199\", \"body\": \"msg 1\", \"tags\": [\"batch\"] },\n  { \"from\": \"{{fromNumber}}\", \"to\": \"+15555550200\", \"body\": \"msg 2\", \"tags\": [\"batch\"] },\n  { \"from\": \"{{fromNumber}}\", \"to\": \"+15555550201\", \"body\": \"msg 3\", \"tags\": [\"batch\"] }\n]"
            }
          }
        },
        {
          "name": "Bulk SMS — one body, N recipients",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/sms/batch", "host": ["{{baseUrl}}"], "path": ["api","v1","sms","batch"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from\": \"{{fromNumber}}\",\n  \"to\":   [\"+15555550199\", \"+15555550200\", \"+15555550201\"],\n  \"body\": \"Sale ends tonight\",\n  \"tags\": [\"promo\"],\n  \"metadata\": { \"campaign\": \"sale_q2\" }\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Read",
      "item": [
        {
          "name": "List SMS",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/v1/sms?limit=20",
              "host": ["{{baseUrl}}"],
              "path": ["api","v1","sms"],
              "query": [
                { "key": "limit",  "value": "20" },
                { "key": "status", "value": "sent",  "disabled": true },
                { "key": "tag",    "value": "batch", "disabled": true },
                { "key": "cursor", "value": "",      "disabled": true }
              ]
            }
          }
        },
        {
          "name": "Get SMS by id",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/v1/sms/{{smsId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api","v1","sms","{{smsId}}"]
            }
          }
        }
      ]
    },
    {
      "name": "Mutate",
      "item": [
        {
          "name": "Cancel scheduled SMS",
          "request": {
            "method": "DELETE",
            "url": {
              "raw": "{{baseUrl}}/api/v1/sms/{{smsId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api","v1","sms","{{smsId}}"]
            }
          }
        }
      ]
    },
    {
      "name": "Provision (10DLC)",
      "item": [
        {
          "name": "Provision — brand",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/brands", "host": ["{{baseUrl}}"], "path": ["api","v1","brands"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"display_name\": \"Acme Co\",\n  \"ein\": \"12-3456789\",\n  \"vertical\": \"RETAIL\",\n  \"website\": \"https://acme.example\",\n  \"email\":   \"compliance@acme.example\"\n}"
            }
          }
        },
        {
          "name": "Provision — campaign",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/campaigns", "host": ["{{baseUrl}}"], "path": ["api","v1","campaigns"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"brand_id\": \"{{brandId}}\",\n  \"name\": \"Order alerts\",\n  \"kind\": \"10dlc\",\n  \"use_case\": \"account_notification\",\n  \"description\": \"Transactional order shipping and delivery notifications. Recipients opt in at checkout; opt out via STOP keyword. Frequency: 1-3 msgs per order.\",\n  \"sample_messages\": [\n    \"Acme: order #1234 shipped — track at acme.example/t/1234. Reply STOP to opt out.\",\n    \"Acme: order #1234 out for delivery today.\"\n  ]\n}"
            }
          }
        },
        {
          "name": "Provision — phone number",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/phone-numbers", "host": ["{{baseUrl}}"], "path": ["api","v1","phone-numbers"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"iso_country\": \"US\",\n  \"type\":        \"longcode\",\n  \"campaign_id\": \"{{campaignId}}\"\n}"
            }
          }
        }
      ]
    }
  ]
}
