CRM API

Base URL

All CRM endpoints are prefixed with:

/dev/crm

Note: All endpoints require authentication via Bearer token in the Authorization header.

Lead Management

Endpoints for managing leads and lead conversion

List Leads

Retrieve all leads

GET /dev/crm/leads
Authorization: Bearer YOUR_API_KEY

Get Lead

Retrieve a specific lead by ID

GET /dev/crm/leads/:leadId
Authorization: Bearer YOUR_API_KEY

Create Lead

Create a new lead

Required Fields:

  • name (string)
  • email (string, valid email)

Optional Fields:

  • phone (string)
  • company (string)
  • source (enum: 'campaign', 'website', 'referral', 'direct', 'social', 'email', 'other')
  • campaign_id (UUID)
  • status (enum: 'new', 'contacted', 'qualified', 'proposal', 'negotiation', 'converted', 'lost', 'won')
  • score (number, 0-100)
  • notes (string)
  • last_contact (date)
  • custom_fields (object)
  • assigned_to (UUID)
POST /dev/crm/leads
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "+1234567890",
  "company": "Acme Corp",
  "source": "website",
  "status": "new",
  "score": 75,
  "notes": "Interested in premium plan",
  "campaign_id": "uuid-here",
  "assigned_to": "uuid-here"
}

Update Lead

Update an existing lead

PUT /dev/crm/leads/:leadId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "name": "John Doe Updated",
  "status": "qualified",
  "score": 85,
  "notes": "Updated notes"
}

Delete Lead

Delete a lead

DELETE /dev/crm/leads/:leadId
Authorization: Bearer YOUR_API_KEY

Convert Lead

Convert a lead to a customer

POST /dev/crm/leads/:leadId/convert
Authorization: Bearer YOUR_API_KEY

Import Leads

Bulk import leads from CSV file

POST /dev/crm/leads/import
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

file: (CSV file)

Export Leads

Export leads to CSV

GET /dev/crm/leads/export
Authorization: Bearer YOUR_API_KEY

Start Lead Nurturing

Process lead nurturing workflow

POST /dev/crm/leads/nurture/start
Authorization: Bearer YOUR_API_KEY

Lead Interactions

Endpoints for managing lead interactions

Get Lead Interactions

Retrieve all interactions for a specific lead

GET /dev/crm/leads/:leadId/interactions
Authorization: Bearer YOUR_API_KEY

Create Lead Interaction

Record a new interaction with a lead

Required Fields:

  • type (enum: 'call', 'email', 'meeting', 'note')

Optional Fields:

  • notes (string)
  • next_action (string)
  • next_action_date (ISO date string)
POST /dev/crm/leads/:leadId/interactions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "type": "call",
  "notes": "Discussed pricing and features",
  "next_action": "Send proposal",
  "next_action_date": "2024-01-15T10:00:00Z"
}

Update Lead Interaction

Update an existing lead interaction

PUT /dev/crm/leads/:leadId/interactions/:interactionId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "type": "meeting",
  "notes": "Updated notes",
  "next_action": "Follow up call"
}

Delete Lead Interaction

Delete a lead interaction

DELETE /dev/crm/leads/:leadId/interactions/:interactionId
Authorization: Bearer YOUR_API_KEY

Customer Management

Endpoints for managing customers

List Customers

Retrieve all customers

GET /dev/crm/customers
Authorization: Bearer YOUR_API_KEY

Create Customer

Create a new customer

Required Fields:

  • name (string)
  • email (string, valid email)

Optional Fields:

  • lead_id (UUID)
  • phone (string)
  • company (string)
  • type (enum: 'individual', 'business')
  • status (enum: 'active', 'inactive', 'blocked')
  • billing_address (string)
  • shipping_address (string)
  • payment_terms (string)
  • credit_limit (number, min 0)
  • tax_id (string)
  • custom_fields (object)
  • assigned_to (UUID)
POST /dev/crm/customers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "name": "Jane Smith",
  "email": "jane@example.com",
  "phone": "+1234567890",
  "company": "Tech Corp",
  "type": "business",
  "status": "active",
  "billing_address": "123 Main St",
  "payment_terms": "Net 30"
}

Update Customer

Update an existing customer

PUT /dev/crm/customers/:customerId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "status": "active",
  "credit_limit": 10000.00,
  "notes": "Updated customer information"
}

Delete Customer

Delete a customer

DELETE /dev/crm/customers/:customerId
Authorization: Bearer YOUR_API_KEY

Import Customers

Bulk import customers from CSV file

POST /dev/crm/customers/import
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

file: (CSV file)

Export Customers

Export customers to CSV

GET /dev/crm/customers/export
Authorization: Bearer YOUR_API_KEY

Get Customer Segments

Retrieve customer segments

GET /dev/crm/customers/segments
Authorization: Bearer YOUR_API_KEY

Get Customer Health

Get customer health metrics

GET /dev/crm/customers/:customerId/health
Authorization: Bearer YOUR_API_KEY

Customer Interactions

Endpoints for managing customer interactions

Get Customer Interactions

Retrieve all interactions for a specific customer

GET /dev/crm/customers/:customerId/interactions
Authorization: Bearer YOUR_API_KEY

Create Customer Interaction

Record a new customer interaction

Required Fields:

  • type (enum: 'email', 'call', 'meeting', 'support', 'purchase', 'other')
  • subject (string)
  • date (date)

Optional Fields:

  • description (string)
  • outcome (string)
  • next_action (string)
  • next_action_date (date)
POST /dev/crm/customers/:customerId/interactions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "type": "call",
  "subject": "Product Discussion",
  "description": "Discussed new features and pricing",
  "date": "2024-01-15T10:00:00Z",
  "outcome": "positive",
  "next_action": "Send proposal",
  "next_action_date": "2024-01-20T10:00:00Z"
}

Update Customer Interaction

Update an existing customer interaction

PUT /dev/crm/customers/:customerId/interactions/:interactionId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "description": "Updated interaction notes",
  "outcome": "completed"
}

Delete Customer Interaction

Delete a customer interaction

DELETE /dev/crm/customers/:customerId/interactions/:interactionId
Authorization: Bearer YOUR_API_KEY

Order Management

Endpoints for managing customer orders

List Orders

Retrieve all orders

GET /dev/crm/orders
Authorization: Bearer YOUR_API_KEY

Get Order

Retrieve a specific order by ID

GET /dev/crm/orders/:orderId
Authorization: Bearer YOUR_API_KEY

Create Order

Create a new order

Required Fields:

  • customer_id (UUID)
  • product_id (UUID)
  • quantity (number, integer, min 1)

Optional Fields:

  • status (enum: 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
  • order_date (date)
  • shipping_address (string)
  • billing_address (string)
  • notes (string)
POST /dev/crm/orders
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "customer_id": "uuid-here",
  "product_id": "uuid-here",
  "quantity": 2,
  "status": "pending",
  "order_date": "2024-01-15T10:00:00Z",
  "shipping_address": "123 Main St",
  "billing_address": "123 Main St",
  "notes": "Rush delivery"
}

Update Order

Update an existing order

PUT /dev/crm/orders/:orderId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "status": "shipped",
  "notes": "Order shipped via express"
}

Delete Order

Delete an order

DELETE /dev/crm/orders/:orderId
Authorization: Bearer YOUR_API_KEY

Feedback Management

Endpoints for managing customer feedback

Request Feedback

Send feedback request to customer

POST /dev/crm/customers/:customerId/feedback/request
Authorization: Bearer YOUR_API_KEY

Process Feedback

Process received feedback

POST /dev/crm/feedback/:feedbackId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "rating": 5,
  "comment": "Great service!",
  "category": "support"
}

Get Feedback Analytics

Get feedback analytics and insights

GET /dev/crm/feedback/analytics
Authorization: Bearer YOUR_API_KEY

Process Feedback Reminders

Process feedback reminder notifications

POST /dev/crm/feedback/process-reminders
Authorization: Bearer YOUR_API_KEY

Get Feedback Themes

Get theme analysis from feedback

GET /dev/crm/feedback/themes
Authorization: Bearer YOUR_API_KEY

Get Feedback Dashboard

Get feedback dashboard data

GET /dev/crm/feedback/dashboard
Authorization: Bearer YOUR_API_KEY

Analytics & Reporting

Endpoints for CRM analytics and reporting

Get Lead Metrics

Get lead performance metrics and statistics

GET /dev/crm/reports/leads
Authorization: Bearer YOUR_API_KEY

Get Customer Metrics

Get customer performance metrics and statistics

GET /dev/crm/reports/customers
Authorization: Bearer YOUR_API_KEY

Get Dashboard Analytics

Get comprehensive CRM analytics dashboard data

GET /dev/crm/analytics/dashboard
Authorization: Bearer YOUR_API_KEY

Process Follow-ups

Process automated follow-up workflows

POST /dev/crm/followups/process
Authorization: Bearer YOUR_API_KEY

Error Responses

400 Bad Request
{
  "message": "Invalid request parameters"
}

401 Unauthorized
{
  "message": "Invalid or missing API key"
}

404 Not Found
{
  "message": "Resource not found"
}

409 Conflict
{
  "message": "Resource already exists"
}

Contents