{
  "info": {
    "_postman_id": "nexwapi-public-v1",
    "name": "Nexwapi Public API",
    "description": "Official Nexwapi WhatsApp Business API (x-api-key auth).\n\n1. Set collection variables `baseUrl` and `apiKey`.\n2. Generate your secret key from Developer Settings in the Nexwapi dashboard.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.nexwapi.com" },
    { "key": "apiKey", "value": "nex_YOUR_SECRET_KEY" }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "x-api-key", "type": "string" },
      { "key": "value", "value": "{{apiKey}}", "type": "string" },
      { "key": "in", "value": "header", "type": "string" }
    ]
  },
  "item": [
    {
      "name": "Account",
      "item": [
        {
          "name": "Get account",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/api/v1/account",
            "description": "Probe API key, plan, and webhook configuration."
          }
        }
      ]
    },
    {
      "name": "Messages",
      "item": [
        {
          "name": "Send text message",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"to\": \"919876543210\",\n  \"text\": \"Hello from Nexwapi!\"\n}"
            },
            "url": "{{baseUrl}}/api/v1/messages",
            "description": "Send a plain text message inside the 24-hour customer service window."
          }
        },
        {
          "name": "Send template message",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"to\": \"919876543210\",\n  \"template\": \"otp_login\",\n  \"params\": [\"123456\"],\n  \"language\": \"en\"\n}"
            },
            "url": "{{baseUrl}}/api/v1/messages",
            "description": "Send an approved WhatsApp template (works outside the 24h window)."
          }
        }
      ]
    },
    {
      "name": "Contacts",
      "item": [
        {
          "name": "List contacts",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/contacts?limit=25",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "contacts"],
              "query": [
                { "key": "limit", "value": "25" },
                { "key": "q", "value": "", "disabled": true },
                { "key": "phone", "value": "", "disabled": true }
              ]
            }
          }
        },
        {
          "name": "Upsert contact",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"919876543210\",\n  \"name\": \"Riya Sharma\",\n  \"email\": \"riya@example.com\",\n  \"optedIn\": true,\n  \"tags\": [\"vip\"],\n  \"attributes\": { \"city\": \"Mumbai\" }\n}"
            },
            "url": "{{baseUrl}}/api/v1/contacts"
          }
        },
        {
          "name": "Set opt-in",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"optedIn\": true\n}"
            },
            "url": "{{baseUrl}}/api/v1/contacts/919876543210/opt-in"
          }
        }
      ]
    },
    {
      "name": "Templates",
      "item": [
        {
          "name": "List approved templates",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/api/v1/templates"
          }
        }
      ]
    },
    {
      "name": "Events",
      "item": [
        {
          "name": "Track contact event",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": \"Order Placed\",\n  \"phone\": \"919876543210\",\n  \"traits\": {\n    \"order_id\": \"ORD-1001\",\n    \"amount\": \"1499\"\n  }\n}"
            },
            "url": "{{baseUrl}}/api/v1/events"
          }
        }
      ]
    }
  ]
}
