Skip to content

Pipelines API Documentation

The Pipelines API provides Kanban-style workflow management for orders, leads, support tickets, and custom workflows.

Base URL

https://api.talkingshops.com/v1

Authentication

All API requests require authentication using an API key. Include your API key in the request header:

x-tenant-api-key: your_api_key_here

API keys are tenant-specific and automatically provide access to the correct data for your business account.

Rate Limiting

The API implements rate limiting to prevent abuse. Each tenant is limited to requests per minute based on their subscription tier.


Endpoints Overview

MethodEndpointDescription
POST/pipelinesCreate a new pipeline
GET/pipelinesList pipelines
GET/pipelines/:pipelineIdGet pipeline by ID
PUT/pipelines/:pipelineIdUpdate pipeline
PATCH/pipelines/:pipelineIdPartial update pipeline
DELETE/pipelines/:pipelineIdDelete pipeline
GET/pipelines/:pipelineId/check-deleteCheck if pipeline can be deleted
POST/pipelines/seedSeed default pipelines
GET/pipelines/:pipelineId/entitiesGet entities in pipeline (Kanban view)
GET/pipelines/:pipelineId/statsGet pipeline statistics
POST/pipelines/:pipelineId/assignAssign entity to pipeline
PUT/pipelines/:pipelineId/entities/:entityId/stageMove entity to stage
PUT/pipelines/:pipelineId/entities/bulk-stageBulk move entities
PUT/pipelines/:pipelineId/entities/bulk-assignBulk assign entities

Pipeline Entity Types

TypeDescription
orderOrder fulfillment workflow
leadLead qualification pipeline
supportCustomer support workflow
customCustom workflow

Stage Types

TypeDescription
defaultInitial/default stage for new entities
successTerminal success stage
failureTerminal failure stage
neutralNeutral terminal stage

Create Pipeline

Create a new pipeline with stages.

Request

http
POST /v1/pipelines
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "name": "Order Fulfillment",
  "description": "Manage order fulfillment workflow",
  "entityType": "order",
  "stages": [
    { "name": "New", "slug": "new", "order": 0, "type": "default" },
    { "name": "Processing", "slug": "processing", "order": 1 },
    { "name": "Shipped", "slug": "shipped", "order": 2 },
    { "name": "Delivered", "slug": "delivered", "order": 3, "type": "success" }
  ],
  "settings": {
    "enableStageHistory": true,
    "enableOwnerAssignment": true,
    "enableBulkOperations": true
  }
}

Request Body

FieldTypeRequiredDescription
namestringYesPipeline name (max 200 chars)
descriptionstringNoPipeline description (max 5000 chars)
entityTypestringYesEntity type (order, lead, support, custom)
stagesarrayNoPipeline stages (max 50 stages)
settingsobjectNoPipeline settings

Stage Object

FieldTypeDescription
namestringStage name (max 100 chars)
slugstringURL-safe identifier (max 50 chars)
descriptionstringStage description
colorstringStage color hex code
ordernumberStage order
typestringStage type (default, success, failure, neutral)

Response

json
{
  "success": true,
  "message": "Pipeline created successfully",
  "pipeline": {
    "_id": "507f1f77bcf86cd799439012",
    "name": "Order Fulfillment",
    "description": "Manage order fulfillment workflow",
    "entityType": "order",
    "stages": [
      { "name": "New", "slug": "new", "order": 0, "type": "default" },
      { "name": "Processing", "slug": "processing", "order": 1 },
      { "name": "Shipped", "slug": "shipped", "order": 2 },
      { "name": "Delivered", "slug": "delivered", "order": 3, "type": "success" }
    ],
    "settings": {
      "enableStageHistory": true,
      "enableOwnerAssignment": true,
      "enableBulkOperations": true
    },
    "isSystem": false,
    "created_at": "2026-04-10T12:00:00Z",
    "updated_at": "2026-04-10T12:00:00Z"
  }
}

Pipeline Object Fields

FieldTypeDescription
_idstringUnique pipeline identifier
namestringPipeline name
descriptionstringPipeline description
entityTypestringEntity type (order, lead, support, custom)
stagesarrayArray of stage objects
settingsobjectPipeline settings (autoAssign, history, assignments, bulk)
isSystembooleanWhether this is a system pipeline
created_atstringCreation timestamp (ISO 8601)
updated_atstringLast update timestamp (ISO 8601)

List Pipelines

Retrieve all pipelines for the tenant.

Request

http
GET /v1/pipelines?entityType=order&includeSystem=false
x-tenant-api-key: your_api_key_here

Query Parameters

ParameterTypeDescription
entityTypestringFilter by entity type
includeSystembooleanInclude system pipelines (default: true)

Response

json
{
  "pipelines": [
    {
      "_id": "507f1f77bcf86cd799439012",
      "name": "Order Fulfillment",
      "entityType": "order",
      "stages": [...],
      "isSystem": true
    }
  ]
}

Get Pipeline by ID

Retrieve a single pipeline by its ID.

Request

http
GET /v1/pipelines/:pipelineId
x-tenant-api-key: your_api_key_here

Update Pipeline

Update an existing pipeline.

Request

http
PUT /v1/pipelines/:pipelineId
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "name": "Updated Pipeline Name",
  "description": "Updated description",
  "stages": [
    { "name": "New", "slug": "new", "order": 0, "type": "default" },
    { "name": "In Progress", "slug": "in_progress", "order": 1 }
  ]
}

Response

json
{
  "success": true,
  "message": "Pipeline updated successfully"
}

Delete Pipeline

Delete a pipeline. System pipelines cannot be deleted.

Request

http
DELETE /v1/pipelines/:pipelineId
x-tenant-api-key: your_api_key_here

Query Parameters

ParameterTypeDescription
forcebooleanForce delete even if entities exist

Response

json
{
  "success": true,
  "message": "Pipeline deleted successfully"
}

Error Responses

  • 404 Not Found - Pipeline does not exist
  • 400 Bad Request - System pipeline cannot be deleted
  • 409 Conflict - Pipeline has entities (use force=true)

Check Delete Pipeline

Check if a pipeline can be safely deleted without affecting entities.

Request

http
GET /v1/pipelines/:pipelineId/check-delete
x-tenant-api-key: your_api_key_here

Response

json
{
  "canDelete": false,
  "isSystem": false,
  "entityCount": 5,
  "entityType": "order",
  "message": "5 entities are using this pipeline"
}

Seed Default Pipelines

Create default pipelines for a tenant.

Request

http
POST /v1/pipelines/seed
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "force": false
}

Request Body

FieldTypeDescription
forcebooleanUpdate existing pipelines (default: false)

Response

json
{
  "success": true,
  "message": "Seeded 3 default pipelines",
  "created": 3
}

Get Pipeline Entities (Kanban View)

Retrieve all entities in a pipeline grouped by stage.

Request

http
GET /v1/pipelines/:pipelineId/entities?stage=new&ownerId=agent_001&limit=50
x-tenant-api-key: your_api_key_here

Query Parameters

ParameterTypeDefaultDescription
ownerIdstring-Filter by owner
stagestring-Filter by stage slug
searchstring-Search in title/name
pagenumber1Page number
limitnumber50Items per page (max 100)

Response

json
{
  "stages": {
    "new": [
      {
        "_id": "507f1f77bcf86cd799439011",
        "title": "Order #123",
        "entityType": "order",
        "status": "confirmed",
        "ownerId": "agent_001",
        "ownerName": "John Doe",
        "stageHistory": [
          {
            "stage": "new",
            "enteredAt": "2026-04-10T10:00:00Z",
            "movedBy": "user",
            "movedByUserId": "agent_001",
            "movedByUserName": "John Doe"
          }
        ],
        "created_at": "2026-04-10T10:00:00Z",
        "updated_at": "2026-04-10T10:00:00Z"
      }
    ],
    "processing": [...],
    "shipped": [...],
    "delivered": [...]
  },
  "total": 150,
  "stageStats": {
    "new": 45,
    "processing": 30,
    "shipped": 50,
    "delivered": 25
  }
}

Pipeline Entity Object Fields

FieldTypeDescription
_idstringUnique entity identifier
titlestringEntity title
entityTypestringEntity type (order, lead, support, custom)
statusstringCurrent status
ownerIdstringAssigned owner ID
ownerNamestringAssigned owner name
stageHistoryarrayArray of stage change history entries
created_atstringCreation timestamp (ISO 8601)
updated_atstringLast update timestamp (ISO 8601)

Stage History Entry Fields

FieldTypeDescription
stagestringStage slug
enteredAtstringWhen entity entered this stage
movedBystringWho moved (user, system, manual)
movedByUserIdstringUser ID who moved
movedByUserNamestringUser name who moved
notestringOptional note
durationnumberTime spent in previous stage (ms)

---

## Assign Entity to Pipeline

Assign an entity to a pipeline.

### Request

```http
POST /v1/pipelines/:pipelineId/assign
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "entityId": "507f1f77bcf86cd799439011",
  "ownerId": "agent_001",
  "ownerName": "John Doe",
  "initialStage": "new"
}

Request Body

FieldTypeRequiredDescription
entityIdstringYesEntity ID to assign
ownerIdstringNoOwner ID
ownerNamestringNoOwner name
initialStagestringNoInitial stage slug

Response

json
{
  "success": true,
  "message": "Entity assigned to pipeline successfully"
}

Move Entity to Stage

Move an entity to a different stage in the pipeline.

Request

http
PUT /v1/pipelines/:pipelineId/entities/:entityId/stage
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "stage": "processing",
  "note": "Order confirmed with customer",
  "movedByUserId": "agent_001",
  "movedByUserName": "John Doe"
}

Request Body

FieldTypeRequiredDescription
stagestringYesTarget stage slug
notestringNoNote for the stage change (max 1000 chars)
movedByUserIdstringNoUser ID who is moving the entity
movedByUserNamestringNoUser name who is moving the entity

Response

json
{
  "success": true,
  "message": "Entity moved to \"processing\" successfully"
}

Bulk Move Entities

Move multiple entities to a stage in a single operation.

Request

http
PUT /v1/pipelines/:pipelineId/entities/bulk-stage
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "entityIds": [
    "507f1f77bcf86cd799439011",
    "507f1f77bcf86cd799439012",
    "507f1f77bcf86cd799439013"
  ],
  "stage": "processing",
  "note": "Batch processing",
  "movedByUserId": "agent_001"
}

Request Body

FieldTypeRequiredDescription
entityIdsarrayYesArray of entity IDs (max 50)
stagestringYesTarget stage slug
notestringNoNote for the stage change
movedByUserIdstringNoUser ID who is moving the entities
movedByUserNamestringNoUser name who is moving the entities

Response

json
{
  "success": true,
  "moved": 3,
  "failed": 0,
  "errors": []
}

Bulk Assign Entities

Assign multiple entities to an owner.

Request

http
PUT /v1/pipelines/:pipelineId/entities/bulk-assign
Content-Type: application/json
x-tenant-api-key: your_api_key_here

{
  "entityIds": [
    "507f1f77bcf86cd799439011",
    "507f1f77bcf86cd799439012"
  ],
  "ownerId": "agent_002",
  "ownerName": "Jane Smith"
}

Request Body

FieldTypeRequiredDescription
entityIdsarrayYesArray of entity IDs (max 50)
ownerIdstringYesOwner ID
ownerNamestringNoOwner name

Response

json
{
  "success": true,
  "assigned": 2,
  "failed": 0,
  "errors": []
}

Get Pipeline Statistics

Get aggregated statistics for a pipeline.

Request

http
GET /v1/pipelines/:pipelineId/stats
x-tenant-api-key: your_api_key_here

Response

json
{
  "pipelineId": "507f1f77bcf86cd799439012",
  "total": 150,
  "stageStats": {
    "new": { "count": 45, "averageDuration": 3600000 },
    "processing": { "count": 30, "averageDuration": 7200000 }
  },
  "stageDistribution": {
    "new": 45,
    "processing": 30,
    "shipped": 50,
    "delivered": 25
  }
}

Error Codes

CodeHTTP StatusDescription
AuthenticationError401Invalid or missing API key
ValidationError400Request validation failed
NotFoundError404Resource not found
ConflictError409Resource conflict (e.g., pipeline in use)
InternalServerError500Internal server error

Input Constraints

FieldMax Length
name200 characters
description5000 characters
note1000 characters
stages50 stages per pipeline
stage name100 characters
stage slug50 characters

Pagination & Bulk Limits

OperationMax Limit
Get Pipeline Entities100 per request
Bulk Move50 entities
Bulk Assign50 entities

Stage History

Every stage change is recorded in the entity's stage history. The history is capped at 100 entries per entity to prevent unbounded growth.

Each stage history entry includes:

  • stage - Stage slug
  • enteredAt - ISO 8601 timestamp
  • movedBy - "user" or "manual"
  • movedByUserId - User who moved (if applicable)
  • movedByUserName - User name (if applicable)
  • note - Optional note for the move
  • duration - Time spent in previous stage (ms)

Audit Events

All operations are logged with structured audit events:

EventDescription
PIPELINE_CREATEDPipeline created
PIPELINE_UPDATEDPipeline updated
PIPELINE_DELETEDPipeline deleted
ENTITY_ASSIGNEDEntity assigned to pipeline
ENTITY_MOVEDEntity moved between stages
BULK_MOVEBulk stage move operation
BULK_ASSIGNBulk assignment operation

Transform WhatsApp into Your Business Growth Engine