{
  "info": {
    "name": "OutreachAgent API",
    "_postman_id": "outreachagent-v1-collection",
    "description": "Official Postman collection for the OutreachAgent Public API.\n\n**Base URL:** `https://api.crm.emacronai.com`\n\n**Authentication:** Bearer token — pass your API key in the Authorization header.\n```\nAuthorization: Bearer oa_live_xxxxxxxxxxxx\n```\n\n**Get your API key:** [crm.emacronai.com → Settings → API Keys](https://crm.emacronai.com/settings/api-keys)\n\n**Full docs:** [crm.emacronai.com/docs](https://crm.emacronai.com/docs)\n\n---\n### Quick Start\n1. Set the `api_key` variable to your key\n2. Set `workspace_id` to your workspace ID (visible in Settings)\n3. Run **GET /api/v1/account** to verify your connection",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "https://api.crm.emacronai.com", "type": "string" },
    { "key": "api_key",  "value": "oa_live_YOUR_KEY_HERE", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{api_key}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Account",
      "description": "Workspace health, credit balance, and connection status.",
      "item": [
        {
          "name": "Get Account Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/account",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "account"]
            },
            "description": "Returns workspace health: credit balance, WhatsApp connection status, and active module status.\n\nUse this to verify your API key is working."
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"workspace_id\": \"ws_abc123\",\n  \"name\": \"Acme Corp\",\n  \"credit_balance\": 4850,\n  \"plan_type\": \"growth\",\n  \"whatsapp\": {\n    \"connected\": true,\n    \"phone_number\": \"+919876543210\",\n    \"display_name\": \"Acme Support\"\n  },\n  \"modules\": {\n    \"email_outreach\": true,\n    \"whatsapp_campaigns\": true,\n    \"inbox\": true,\n    \"crm\": true\n  },\n  \"low_balance\": false\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "WhatsApp OTP",
      "description": "Send and verify one-time passwords via WhatsApp Business API.",
      "item": [
        {
          "name": "Send OTP",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/whatsapp/otp/send",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "whatsapp", "otp", "send"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"+919876543210\",\n  \"expiry\": 300,\n  \"length\": 6,\n  \"custom_message\": \"Your {{otp}} is your OutreachAgent verification code. Valid for 5 minutes.\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Send a WhatsApp OTP to a phone number.\n\n**Fields:**\n- `phone` (required) — E.164 format e.g. `+919876543210`\n- `expiry` (optional) — seconds until OTP expires. Default: 300 (5 min)\n- `length` (optional) — OTP digit length. Default: 6\n- `custom_message` (optional) — use `{{otp}}` placeholder\n\n**Cost:** 1 credit per OTP sent.\n\nReturns a `request_id` — save this to verify the OTP."
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"request_id\": \"otp_abc123xyz\",\n  \"phone\": \"+919876543210\",\n  \"expires_at\": \"2026-09-01T10:15:00Z\",\n  \"credits_used\": 1\n}"
            },
            {
              "name": "Invalid phone",
              "status": "Bad Request",
              "code": 400,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"error\": \"Invalid phone number format. Use E.164 e.g. +919876543210\"\n}"
            }
          ]
        },
        {
          "name": "Verify OTP",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/whatsapp/otp/verify",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "whatsapp", "otp", "verify"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"request_id\": \"otp_abc123xyz\",\n  \"otp\": \"482910\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Verify an OTP against a previously sent `request_id`.\n\nThe OTP is single-use — it is invalidated after the first successful verification."
          },
          "response": [
            {
              "name": "Verified",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"verified\": true,\n  \"phone\": \"+919876543210\"\n}"
            },
            {
              "name": "Invalid OTP",
              "status": "Bad Request",
              "code": 400,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"verified\": false,\n  \"error\": \"OTP is incorrect or has expired\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "WhatsApp Messages",
      "description": "Send WhatsApp messages and template broadcasts.",
      "item": [
        {
          "name": "Send Text Message",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/whatsapp/send",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "whatsapp", "send"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"to\": \"+919876543210\",\n  \"message\": \"Hello! Your order #12345 has been shipped and will arrive by tomorrow.\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Send a free-form WhatsApp text message.\n\n**Note:** Can only be sent within 24h of receiving a message from the user (per Meta policy). For outbound-only messages, use template messages.\n\n**Cost:** 1 credit per message."
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"message_id\": \"wamid.HBgLMTk4NzY1NDMyMTAVAgARGBIxMjM0NTY3ODkwMTIzNDU2\",\n  \"status\": \"sent\",\n  \"to\": \"+919876543210\"\n}"
            }
          ]
        },
        {
          "name": "Send Template Message",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/whatsapp/send-template",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "whatsapp", "send-template"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"to\": \"+919876543210\",\n  \"template_name\": \"order_confirmation\",\n  \"language\": \"en\",\n  \"components\": [\n    {\n      \"type\": \"body\",\n      \"parameters\": [\n        { \"type\": \"text\", \"text\": \"Rahul\" },\n        { \"type\": \"text\", \"text\": \"#ORD-9981\" },\n        { \"type\": \"text\", \"text\": \"Tomorrow by 6 PM\" }\n      ]\n    }\n  ]\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Send a pre-approved Meta template message. Use this for outbound notifications (order updates, reminders, alerts).\n\nTemplate must be approved in your WhatsApp Business Manager before use."
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"message_id\": \"wamid.HBgLMTk4NzY1NDMyMTAVAgARGBIxMjM0NTY3ODkwMTIzNDU2\",\n  \"status\": \"sent\",\n  \"to\": \"+919876543210\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Contacts",
      "description": "Create, read, and update CRM contacts.",
      "item": [
        {
          "name": "List Contacts",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/contacts?page=1&limit=50&search=rahul",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "contacts"],
              "query": [
                { "key": "page", "value": "1", "description": "Page number (default: 1)" },
                { "key": "limit", "value": "50", "description": "Results per page (max: 100)" },
                { "key": "search", "value": "rahul", "description": "Search by name, email, or phone" }
              ]
            },
            "description": "List all contacts in your workspace with pagination.\n\nScope required: `contacts:read`"
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"data\": [\n    {\n      \"id\": \"contact_abc123\",\n      \"name\": \"Rahul Sharma\",\n      \"email\": \"rahul@example.com\",\n      \"phone\": \"+919876543210\",\n      \"company_name\": \"Acme Corp\",\n      \"status\": \"lead\",\n      \"created_at\": \"2026-08-15T10:30:00Z\"\n    }\n  ],\n  \"total\": 124,\n  \"page\": 1,\n  \"limit\": 50\n}"
            }
          ]
        },
        {
          "name": "Get Contact",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/contacts/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "contacts", ":id"],
              "variable": [{ "key": "id", "value": "contact_abc123", "description": "Contact ID" }]
            },
            "description": "Get a single contact by ID.\n\nScope required: `contacts:read`"
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"id\": \"contact_abc123\",\n  \"name\": \"Rahul Sharma\",\n  \"email\": \"rahul@example.com\",\n  \"phone\": \"+919876543210\",\n  \"company_name\": \"Acme Corp\",\n  \"designation\": \"CTO\",\n  \"status\": \"lead\",\n  \"tags\": [\"hot-lead\", \"saas\"],\n  \"notes\": \"Met at SaaS India conference\",\n  \"created_at\": \"2026-08-15T10:30:00Z\"\n}"
            }
          ]
        },
        {
          "name": "Create Contact",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/contacts",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "contacts"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Priya Mehta\",\n  \"email\": \"priya@startup.io\",\n  \"phone\": \"+919123456789\",\n  \"company_name\": \"BuildFast Inc\",\n  \"designation\": \"Founder\",\n  \"status\": \"lead\",\n  \"tags\": [\"inbound\", \"startup\"],\n  \"notes\": \"Signed up via website contact form\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Create a new contact in your CRM.\n\n**Required:** at least one of `name`, `email`, or `phone`\n\nScope required: `contacts:write`"
          },
          "response": [
            {
              "name": "Created",
              "status": "Created",
              "code": 201,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"id\": \"contact_xyz789\",\n  \"name\": \"Priya Mehta\",\n  \"email\": \"priya@startup.io\",\n  \"phone\": \"+919123456789\",\n  \"company_name\": \"BuildFast Inc\",\n  \"status\": \"lead\",\n  \"created_at\": \"2026-09-05T14:22:00Z\"\n}"
            }
          ]
        },
        {
          "name": "Update Contact",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/contacts/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "contacts", ":id"],
              "variable": [{ "key": "id", "value": "contact_abc123", "description": "Contact ID" }]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"customer\",\n  \"tags\": [\"converted\", \"enterprise\"],\n  \"notes\": \"Closed deal — Enterprise plan\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Update any fields on an existing contact. Only fields provided are updated.\n\nScope required: `contacts:write`"
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"id\": \"contact_abc123\",\n  \"status\": \"customer\",\n  \"updated_at\": \"2026-09-05T15:00:00Z\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Conversations",
      "description": "Access inbox conversations across all channels.",
      "item": [
        {
          "name": "List Conversations",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/conversations?page=1&limit=20&status=open",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "conversations"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "limit", "value": "20" },
                { "key": "status", "value": "open", "description": "open | resolved | all" }
              ]
            },
            "description": "List inbox conversations across WhatsApp, Email, Instagram, and other channels.\n\nScope required: `conversations:read`"
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"data\": [\n    {\n      \"id\": \"conv_abc123\",\n      \"contact\": { \"id\": \"contact_xyz\", \"name\": \"Rahul\", \"phone\": \"+919876543210\" },\n      \"channel\": \"whatsapp\",\n      \"status\": \"open\",\n      \"last_message\": \"I'm interested in the Growth plan\",\n      \"last_message_at\": \"2026-09-05T14:10:00Z\",\n      \"unread_count\": 2\n    }\n  ],\n  \"total\": 38,\n  \"page\": 1,\n  \"limit\": 20\n}"
            }
          ]
        },
        {
          "name": "Get Conversation + Messages",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/conversations/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "conversations", ":id"],
              "variable": [{ "key": "id", "value": "conv_abc123", "description": "Conversation ID" }]
            },
            "description": "Get a conversation with its full message history.\n\nScope required: `conversations:read`"
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"id\": \"conv_abc123\",\n  \"contact\": { \"id\": \"contact_xyz\", \"name\": \"Rahul\", \"phone\": \"+919876543210\" },\n  \"channel\": \"whatsapp\",\n  \"status\": \"open\",\n  \"messages\": [\n    { \"id\": \"msg_1\", \"direction\": \"inbound\", \"content\": \"Hi, I want to know about pricing\", \"at\": \"2026-09-05T14:00:00Z\" },\n    { \"id\": \"msg_2\", \"direction\": \"outbound\", \"content\": \"Hi Rahul! Our Growth plan starts at ₹2,999/month.\", \"at\": \"2026-09-05T14:02:00Z\" }\n  ]\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Leads",
      "description": "List and manage sales leads in your pipeline.",
      "item": [
        {
          "name": "List Leads",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/leads?page=1&limit=50&status=new",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "leads"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "limit", "value": "50" },
                { "key": "status", "value": "new", "description": "new | contacted | qualified | proposal | won | lost" }
              ]
            },
            "description": "List leads from your CRM pipeline.\n\nScope required: `leads:read`"
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"data\": [\n    {\n      \"id\": \"lead_abc\",\n      \"contact\": { \"id\": \"contact_xyz\", \"name\": \"Priya Mehta\", \"email\": \"priya@startup.io\" },\n      \"status\": \"new\",\n      \"source\": \"website_contact\",\n      \"value\": 50000,\n      \"created_at\": \"2026-09-05T12:00:00Z\"\n    }\n  ],\n  \"total\": 22,\n  \"page\": 1,\n  \"limit\": 50\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Webhooks",
      "description": "Register endpoints to receive real-time event notifications.",
      "item": [
        {
          "name": "Register Webhook",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{base_url}}/api/v1/webhooks",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "webhooks"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://yourdomain.com/webhooks/outreachagent\",\n  \"events\": [\"message.received\", \"contact.created\", \"booking.created\"],\n  \"name\": \"My App Webhook\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Register a URL to receive webhook events.\n\n**Available events:**\n- `message.received` — new inbound message from any channel\n- `message.sent` — outbound message delivered\n- `contact.created` — new contact added\n- `booking.created` — new demo/meeting booked\n- `otp.verified` — OTP successfully verified\n- `campaign.completed` — email campaign finished sending\n\n**Signature verification:** Every request includes an `X-Webhook-Signature` header — HMAC-SHA256 of the raw body signed with your webhook secret."
          },
          "response": [
            {
              "name": "Created",
              "status": "Created",
              "code": 201,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"id\": \"hook_abc123\",\n  \"url\": \"https://yourdomain.com/webhooks/outreachagent\",\n  \"events\": [\"message.received\", \"contact.created\", \"booking.created\"],\n  \"secret\": \"whsec_xxxxxxxxxxxxxxxxxxxx\",\n  \"created_at\": \"2026-09-05T14:00:00Z\"\n}"
            }
          ]
        },
        {
          "name": "List Webhooks",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/webhooks",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "webhooks"]
            },
            "description": "List all registered webhook endpoints. Secrets are masked in responses."
          },
          "response": [
            {
              "name": "Success",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"data\": [\n    {\n      \"id\": \"hook_abc123\",\n      \"url\": \"https://yourdomain.com/webhooks/outreachagent\",\n      \"events\": [\"message.received\", \"contact.created\"],\n      \"is_active\": true,\n      \"secret\": \"whsec_****xxxx\",\n      \"created_at\": \"2026-09-05T14:00:00Z\"\n    }\n  ]\n}"
            }
          ]
        },
        {
          "name": "Delete Webhook",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/webhooks/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "webhooks", ":id"],
              "variable": [{ "key": "id", "value": "hook_abc123", "description": "Webhook ID" }]
            },
            "description": "Delete a registered webhook endpoint."
          },
          "response": [
            {
              "name": "Deleted",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{ \"deleted\": true }"
            }
          ]
        }
      ]
    },
    {
      "name": "OAuth",
      "description": "Manage API key connections and OAuth integrations.",
      "item": [
        {
          "name": "Revoke Connection (OAuth)",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/v1/oauth/connection",
              "host": ["{{base_url}}"],
              "path": ["api", "v1", "oauth", "connection"]
            },
            "description": "Revoke the current API key and disconnect the OAuth integration. The key is permanently invalidated after this call."
          },
          "response": [
            {
              "name": "Revoked",
              "status": "OK",
              "code": 200,
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{ \"revoked\": true, \"message\": \"API key revoked successfully\" }"
            }
          ]
        }
      ]
    }
  ]
}
