Skip to content
WACM.in
Back to API Reference
REST API v1MCP Supported (25 CRM Tools)

CRM & Sales Pipelines API

Manage sales pipelines, customer enquiries, lead ingestion webhooks, in-chat live chat drawer actions, speed-to-lead SLA response velocity, Meta Click-to-WhatsApp (CTWA) ad attribution, follow-up tasks, internal notes, activity timelines, conversion reports, and team member notification preferences.

Authentication & Scope: All requests use Sanctum Bearer tokens and JSON payloads against https://app.wacm.in/api/v1/crm. All operations are tenant-scoped, role-checked, rate-limited to 60 requests/minute, and guarded by optimistic locking (version) to prevent lost updates.

CRM API reference for developers and AI assistants

LLM Ready

Feed WACM API specs directly to Cursor, Claude, ChatGPT, Antigravity, or custom AI agents.

Download .mdOpenAPI 3.1
Machine-Readable Feeds:/llms.txt /llms-full.txt

Pipelines & Stages

List workspace sales pipelines and their configured active stages, or initialize starter templates (simple, sales, appointments).

GET
/pipelines

List all active pipelines and their ordered stages. Paginated (default 25/page).

POST
/pipelines

Create a custom pipeline (with optional description and stages array) or provision a starter template ('simple', 'sales', 'appointments'). Owner only.

PATCH
/pipelines/{pipeline}

Rename a pipeline or update its description. Owner only.

POST
/pipelines/{pipeline}/stages

Add a new open, won, or lost stage to an existing pipeline. Owner only.

PATCH
/pipelines/{pipeline}/stages/{stage}

Rename a stage or change its outcome classification (must be empty to change outcome). Owner only.

DELETE
/pipelines/{pipeline}/stages/{stage}

Archive an empty pipeline stage (rejected if any leads remain). Owner only.

List pipelines response
{
  "status": "success",
  "data": [
    {
      "id": 1,
      "name": "Default Sales",
      "is_active": true,
      "stages": [
        { "id": 1, "name": "New lead", "outcome": "open", "order": 1 },
        { "id": 2, "name": "Qualified", "outcome": "open", "order": 2 },
        { "id": 3, "name": "Proposal", "outcome": "open", "order": 3 },
        { "id": 4, "name": "Won", "outcome": "won", "order": 4 },
        { "id": 5, "name": "Lost", "outcome": "lost", "order": 5 }
      ]
    }
  ]
}

Leads & Enquiries

Enquiries represent commercial sales opportunities linked to contacts. Filter by pipeline, stage, owner, outcome, response velocity (unresponded, sla_breached), or overdue follow-up status.

GET
/leads

List or search enquiries. Filters include the exact source key (indiamart for IndiaMART), contact_id, pipeline_id, stage_id, owner_id, outcome, follow-up status, search, page, per_page, and sort.

POST
/leads

Create a new enquiry. Requires contact_id, pipeline_id, title, and idempotent creation_key.

POST
/leads/ingest

Authenticated ingestion for web forms and other integrations. Requires name and phone. Accepts optional email, title, requirement, value, currency, pipeline_id, stage_id, and source. Each accepted call creates an enquiry.

GET
/leads/{id}

Get complete enquiry details, contact, owner, current stage, next action, first_response_at timestamp, sla_breached flag, and pending task counts.

PATCH
/leads/{id}

Update enquiry fields. Requires version for optimistic concurrency control.

PUT
/leads/{id}/stage

Move enquiry to another stage. Requires stage_id, version, and lost_reason when outcome is lost.

GET
/leads/{id}/people

List assignable team members who can own this enquiry or receive follow-up tasks.

GET
/leads/{id}/activities

Paginated audit timeline of state transitions, stage movements, and notes for this enquiry.

Create enquiry request
{
  "contact_id": 142,
  "pipeline_id": 1,
  "title": "Annual Enterprise Plan - Acme Corp",
  "requirement": "Requires 10 agents, custom webhook sync, and SLA support",
  "owner_id": 3,
  "value": 120000,
  "creation_key": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"
}
Authenticated lead ingestion request (POST /leads/ingest)
{
  "phone": "+919876543210",
  "name": "Alex Johnson",
  "email": "alex@acme.com",
  "title": "Website Quote Request",
  "requirement": "Interested in WhatsApp broadcast and CRM integration",
  "value": 45000,
  "currency": "INR",
  "source": "website"
}

IndiaMART enquiries

In workspaces with IndiaMART pilot access, the provider sends live deliveries to the private URL issued by CRM Lead capture. WACM acknowledges an accepted delivery after storing it. Once processed, the imported lead is available through the authenticated CRM API with its normal workspace and lead visibility rules.

List imported IndiaMART enquiries
curl --get "$WACM_BASE_URL/api/v1/crm/leads" \
  --header "Authorization: Bearer $WACM_API_TOKEN" \
  --data-urlencode "source=indiamart"

In an MCP build that supports source filtering, call list_crm_leads with { "source": "indiamart" }. Configure the connection, review deliveries, and rotate URLs in WACM. IndiaMART pilot setup guide

In-Chat Live Chat SideApp Drawer

Embedded directly within the WhatsApp agent inbox (/wpbox/chat via hasSidebar: true). Allows agents to view live customer enquiries, change sales stages, record internal notes, and create leads without switching tabs or context.

MethodDrawer RouteBehavior & Payload
GET/crm/sideapp/contact/{id}Fetch contact details, active enquiries, available pipelines, stages, and recent Meta CTWA ad attribution during an active chat session.
POST/crm/sideapp/contact/{id}/create-leadCreate an enquiry directly from the chat drawer. Automatically inherits ad headline, campaign ID, and CTWA Click ID if the conversation originated from an ad.
POST/crm/sideapp/lead/{id}/stageTransition enquiry stage directly from the conversation drawer. Validates required lost reasons when moving to lost outcome.
POST/crm/sideapp/lead/{id}/noteLog an internal private agent note attached to the enquiry directly from the live chat interface.
POST/crm/sideapp/lead/{id}/taskSchedule a follow-up task with quick presets (1h, today_5pm, tomorrow_10am, 3d) or custom due_local directly inside the chat drawer.
POST/crm/sideapp/lead/{id}/task/{task}/completeMark a pending follow-up task complete in 1 click without leaving the live WhatsApp conversation.

Meta Click-to-WhatsApp (CTWA) Full Attribution & CAPI

When customers start conversations by clicking Meta Click-to-WhatsApp (CTWA) Facebook or Instagram ads, WACM automatically captures the full referral payload on the very first incoming webhook and locks it into the contact and lead lifecycle:

Captured Ad Referral Metadata:
  • source_id — Meta Ad ID
  • headline — Ad headline text
  • body — Ad description body copy
  • source_url — Destination ad link
  • ctwa_clid — Meta Click ID for CAPI conversion tracking
  • media_type, image_url, video_url
Automated Attribution Engine:
  • Automatic Contact Tagging: Ad: <headline> & CTWA Leads
  • Persistent Stamped source_detail: Meta Ad: 123 ("Summer Sale") [CLID: fb.1.xxx]
  • Live Chat Drawer Display: In-drawer Ad Attribution Card showing headline, body, ad link, and CLID status badge
  • Meta Conversions API (CAPI): Preserves ctwa_clid for downstream offline conversion matching when leads reach 'Won' stage

Internal Notes

Private internal notes attached to an enquiry. Notes stay strictly internal and are never disclosed to customers or included in external notification templates.

GET
/leads/{id}/notes

List internal notes for an enquiry, ordered from newest to oldest. Paginated (default 25/page).

POST
/leads/{id}/notes

Add an internal note. Requires body text, optional linked message_id, and optional retry_key.

Follow-up Tasks

Schedule and track team follow-ups. Every task requires an explicit due date, timezone, and assignee. Overdue tasks surface immediately on workspace dashboards.

GET
/tasks

List assigned follow-up tasks across enquiries. Filters: lead_id, status (pending/completed/cancelled), assignee_id, mine, reminded, overdue, due_from, due_to.

GET
/tasks/{id}

Get details of a specific follow-up task by its task ID.

GET
/leads/{id}/tasks

List all follow-up tasks linked to a specific enquiry.

POST
/leads/{id}/tasks

Schedule a follow-up task for an enquiry. Requires title, due_at (ISO 8601), optional assignee_id, and optional retry_key.

GET
/leads/{id}/tasks/{task_id}

Get details of a specific task within its enquiry context.

PATCH
/leads/{id}/tasks/{task_id}

Update task title, due_at, or assignee. Requires version for optimistic concurrency control.

PUT
/leads/{id}/tasks/{task_id}/complete

Mark a task completed. Requires outcome notes and version.

PUT
/leads/{id}/tasks/{task_id}/cancel

Mark a task cancelled. Requires cancellation reason and version.

Schedule follow-up task request
{
  "title": "Product Demo Call & Pricing Review",
  "due_at": "2026-10-20T10:30:00+05:30",
  "assignee_id": 3,
  "retry_key": "c3a4f891-628d-4a11-8e7c-b3972a91219b"
}

Reports & Funnel Analytics

Query conversion cohorts, intake growth, team performance leaderboard (team_leaderboard), Meta Click-to-WhatsApp ad ROI (meta_ads), speed-to-lead first response SLA compliance, and stage stay duration over customizable date ranges and timezones.

GET
/reports

Read CRM conversion cohorts, intake trends, team_leaderboard, meta_ads performance, and stage stay durations. Parameters: from, to, timezone, pipeline_id, owner_id, source, compare, page.

Automation & Notification Preferences

Configure staff WhatsApp notification preferences. Notifications are dispatched only to opted-in, verified work numbers to protect staff privacy and prevent unverified sends.

GET
/automation/preferences

Read the authenticated team member's notification preferences, verified work number, and active verification status.

PUT
/automation/preferences

Save work WhatsApp number, opt-in status, and notify_tasks preference. Returns a 10-minute verification code when a new number is enrolled.

Model Context Protocol (MCP) Integration

The official @codingmantra/wacm-mcp package provides 25 dedicated CRM tools (10 read + 15 action) for Claude Desktop, Cursor, and Antigravity:

MCP Tool NameTarget EndpointDescription
list_crm_pipelines/crm/pipelinesList sales pipelines and their active stages.
list_crm_leads/crm/leadsList enquiries by source, pipeline, stage, owner, or follow-up status. Use source: indiamart with an MCP build that supports the filter.
get_crm_lead/crm/leads/{lead_id}Read complete details of an enquiry by lead_id.
list_crm_lead_notes/crm/leads/{lead_id}/notesList internal notes linked to an enquiry.
list_crm_lead_activities/crm/leads/{lead_id}/activitiesList timeline activity history for an enquiry.
list_crm_lead_people/crm/leads/{lead_id}/peopleList assignable team members and active stakeholders for an enquiry.
list_crm_tasks/crm/tasksList assigned follow-up tasks and due reminders.
get_crm_task/crm/tasks/{task_id}Read details of a specific follow-up task.
get_crm_reports/crm/reportsRead conversion cohorts, intake trends, and stage stay durations.
get_crm_automation_preferences/crm/automation/preferencesRead the team member's notification preferences and verification status.
create_crm_pipeline / update_crm_pipelinePOST / PATCH /crm/pipelinesCreate custom or starter pipelines and rename/update pipeline descriptions.
add / update / archive_crm_pipeline_stage/crm/pipelines/{pipeline_id}/stagesAdd custom stages, rename/reclassify stages, or archive empty stages.
create_crm_lead / ingest_crm_lead / update_crm_lead/crm/leads & /crm/leads/ingestCreate leads for existing contacts, 1-step ingest by phone/name, or update deal fields.
update_crm_lead_stage / add_crm_lead_note/crm/leads/{lead_id}/stage & /notesMove leads across pipeline stages (with lost reason validation) and log internal notes.
create / update / complete / cancel_crm_task/crm/leads/{lead_id}/tasksSchedule, reschedule, complete, or cancel follow-up tasks with optimistic locking.
update_crm_automation_preferencesPUT /crm/automation/preferencesManage the authenticated team member's WhatsApp notification opt-in preferences.