{
  "info": {
    "name": "Sendam API",
    "description": "Send SMS from your own backend.\n\nSETUP\n1. Create an API key at https://sendam.africa/developers\n2. Set the collection variable `apiKey` to it (use a sk_test_ key first)\n3. Run \"Send SMS\"\n\nA sk_test_ key authenticates exactly like a live key, returns the same shape, and never sends a real message or spends units. Its responses carry \"test_mode\": true.\n\nFull documentation: https://sendam.africa/docs",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://sendam.africa/api", "type": "string" },
    { "key": "apiKey", "value": "sk_test_replace_me", "type": "string" },
    { "key": "senderId", "value": "SENDAM", "type": "string" },
    { "key": "testNumber", "value": "+2348033333333", "type": "string" },
    { "key": "testCountry", "value": "NG", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{apiKey}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Send SMS",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": { "raw": "{{baseUrl}}/sms/send", "host": ["{{baseUrl}}"], "path": ["sms", "send"] },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"senderId\": \"{{senderId}}\",\n  \"body\": \"Your verification code is 4821\",\n  \"recipients\": [\n    { \"e164\": \"{{testNumber}}\", \"country\": \"{{testCountry}}\" }\n  ]\n}"
        },
        "description": "Sends one SMS.\n\nbody       (required) the message text\nrecipients (required) array of { e164, country }\nsenderId   (optional) an approved sender ID\n\nacceptedCount means the provider TOOK the message, not that a handset received it. Where deliveryReportsAvailable is false, accepted is the last word you will get."
      },
      "event": [{
        "listen": "test",
        "script": {
          "type": "text/javascript",
          "exec": [
            "pm.test('request was accepted', () => pm.response.to.have.status(200));",
            "const body = pm.response.json();",
            "pm.test('a message was recorded', () => pm.expect(body.messages).to.be.an('array').that.is.not.empty);",
            "",
            "// A test key must never look like a real send. If this assertion is",
            "// missing you can bill a customer while believing you are in test mode.",
            "if (String(pm.collectionVariables.get('apiKey')).startsWith('sk_test_')) {",
            "  pm.test('test key did NOT send a real message', () => pm.expect(body.test_mode).to.eql(true));",
            "}"
          ]
        }
      }]
    },
    {
      "name": "Send SMS — multiple recipients",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": { "raw": "{{baseUrl}}/sms/send", "host": ["{{baseUrl}}"], "path": ["sms", "send"] },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"senderId\": \"{{senderId}}\",\n  \"body\": \"Your order has shipped.\",\n  \"recipients\": [\n    { \"e164\": \"+2348033333333\", \"country\": \"NG\" },\n    { \"e164\": \"+254703727272\", \"country\": \"KE\" }\n  ]\n}"
        },
        "description": "Recipients in different countries are routed to different providers, so the response carries one entry in `messages` per provider group — not one per recipient."
      }
    },
    {
      "name": "Errors — no API key (401)",
      "request": {
        "auth": { "type": "noauth" },
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": { "raw": "{{baseUrl}}/sms/send", "host": ["{{baseUrl}}"], "path": ["sms", "send"] },
        "body": { "mode": "raw", "raw": "{\n  \"body\": \"hi\",\n  \"recipients\": [{ \"e164\": \"{{testNumber}}\", \"country\": \"NG\" }]\n}" },
        "description": "Confirms the endpoint is actually guarded. Expect 401."
      },
      "event": [{
        "listen": "test",
        "script": {
          "type": "text/javascript",
          "exec": [
            "pm.test('unauthenticated requests are rejected', () => pm.response.to.have.status(401));"
          ]
        }
      }]
    },
    {
      "name": "Errors — missing body (400)",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": { "raw": "{{baseUrl}}/sms/send", "host": ["{{baseUrl}}"], "path": ["sms", "send"] },
        "body": { "mode": "raw", "raw": "{\n  \"recipients\": [{ \"e164\": \"{{testNumber}}\", \"country\": \"NG\" }]\n}" },
        "description": "A malformed request. Expect 400 — do not retry it unchanged."
      },
      "event": [{
        "listen": "test",
        "script": {
          "type": "text/javascript",
          "exec": ["pm.test('malformed requests are rejected', () => pm.response.to.have.status(400));"]
        }
      }]
    },
    {
      "name": "Send email (NOT YET LIVE — returns 503)",
      "request": {
        "method": "POST",
        "header": [],
        "url": { "raw": "{{baseUrl}}/email/send", "host": ["{{baseUrl}}"], "path": ["email", "send"] },
        "body": {
          "mode": "formdata",
          "formdata": [
            { "key": "subject", "value": "Your verification code", "type": "text" },
            { "key": "body", "value": "Your code is 4821", "type": "text" },
            { "key": "recipients", "value": "[\"someone@example.com\"]", "type": "text", "description": "A JSON-encoded array, sent as a form field" }
          ]
        },
        "description": "INCLUDED FOR REFERENCE ONLY — this channel is not enabled and currently returns 503 \"Email is not live yet\".\n\nNote it is multipart/form-data, not JSON, because it accepts file attachments. `recipients` is therefore a JSON-encoded STRING in a form field, not a JSON array."
      },
      "event": [{
        "listen": "test",
        "script": {
          "type": "text/javascript",
          "exec": [
            "pm.test('email channel is not live yet', () => pm.response.to.have.status(503));"
          ]
        }
      }]
    }
  ]
}
