Skip to content

Order Management API Documentation ​

The Order Management API provides comprehensive functionality for creating and managing orders, tracking order status, maintaining order timelines, and generating order analytics. This API supports the complete order lifecycle from creation to completion, including integration with external systems like websites, mobile apps, and third-party platforms.

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 order data for your business.

Rate Limiting ​

The API implements rate limiting to prevent abuse. By default, each tenant is limited to 100 requests per minute.

Endpoints ​

Create Order ​

POST /orders

Create a new order with customer details and product items. This endpoint allows external systems (websites, mobile apps, third-party integrations) to programmatically create orders.

Request Body ​

FieldTypeRequiredDescription
mobilestringYesCustomer mobile number
namestringNoCustomer name
emailstringNoCustomer email
user_idstringNoUser ID for existing customers
product_itemsarrayYesList of products in the order (min: 1 item)
statusstringNoInitial order status (default: "PENDING")
final_amountnumberNoTotal amount (auto-calculated if not provided)
delivery_methodstringNoDelivery method (default: "Local Delivery")
delivery_detailsobjectNoDelivery information
product_customizationsobjectNoProduct-specific customizations
payment_infoobjectNoPayment information
referenceIdstringNoCustom order reference ID (auto-generated if not provided)
external_order_sourcestringNoSource system (e.g., "website", "mobile_app", "shopify")
external_order_idstringNoExternal system order ID
external_order_numberstringNoExternal system order number
notesstringNoOrder notes

Product Item Object ​

FieldTypeRequiredDescription
product_retailer_idstringNoProduct SKU/ID
namestringYesProduct name
quantitynumberYesQuantity ordered (min: 1)
pricenumberYesUnit price (min: 0)

Delivery Details Object ​

FieldTypeDescription
recipient_namestringRecipient name
emailstringDelivery email
phonestringDelivery phone number
alternate_phonestringAlternate phone number
addressstringDelivery address
notesstringDelivery notes
locationobjectGPS coordinates (lat/lng)

Payment Info Object ​

FieldTypeDescription
statusstringPayment status
amountnumberPayment amount
currencystringCurrency code (e.g., "INR", "USD")
payment_idstringPayment gateway ID
methodstringPayment method

Request Example ​

json
{
  "mobile": "+919876543210",
  "name": "John Doe",
  "email": "john@example.com",
  "product_items": [
    {
      "product_retailer_id": "SKU-001",
      "name": "Premium T-Shirt",
      "quantity": 2,
      "price": 599.00
    },
    {
      "product_retailer_id": "SKU-002",
      "name": "Classic Jeans",
      "quantity": 1,
      "price": 1299.00
    }
  ],
  "delivery_method": "Local Delivery",
  "delivery_details": {
    "recipient_name": "John Doe",
    "phone": "+919876543210",
    "address": "123 Main Street, Apartment 4B, Mumbai, Maharashtra 400001"
  },
  "external_order_source": "website",
  "external_order_id": "WEB-12345",
  "notes": "Please deliver before 6 PM"
}

Response (201 Created) ​

json
{
  "success": true,
  "message": "Order created successfully",
  "order": {
    "_id": "64a1b2c3d4e5f6789abc1234",
    "referenceId": "ORD1702345678ABCD",
    "status": "PENDING",
    "mobile": "+919876543210",
    "name": "John Doe",
    "email": "john@example.com",
    "final_amount": 2497.00,
    "delivery_method": "Local Delivery",
    "product_items": [
      {
        "product_retailer_id": "SKU-001",
        "name": "Premium T-Shirt",
        "quantity": 2,
        "price": 599.00
      },
      {
        "product_retailer_id": "SKU-002",
        "name": "Classic Jeans",
        "quantity": 1,
        "price": 1299.00
      }
    ],
    "delivery_details": {
      "recipient_name": "John Doe",
      "phone": "+919876543210",
      "address": "123 Main Street, Apartment 4B, Mumbai, Maharashtra 400001"
    },
    "external_order_source": "website",
    "external_order_id": "WEB-12345",
    "created_at": "2024-12-12 15:30:00",
    "updated_at": "2024-12-12 15:30:00"
  }
}

Error Responses ​

400 Bad Request - Missing required fields:

json
{
  "error": {
    "code": "ValidationError",
    "message": "Customer mobile number is required"
  }
}
json
{
  "error": {
    "code": "ValidationError",
    "message": "At least one product item is required"
  }
}
json
{
  "error": {
    "code": "ValidationError",
    "message": "Each product item must have name, quantity, and price"
  }
}

Use Cases ​

  1. Website Checkout: Create orders from your e-commerce website
  2. Mobile App Orders: Submit orders from iOS/Android apps
  3. Third-Party Integrations: Sync orders from Shopify, WooCommerce, etc.
  4. POS Systems: Create orders from point-of-sale systems
  5. Bulk Order Import: Programmatically create multiple orders

Get Orders ​

GET /orders

Retrieve a paginated list of orders with advanced filtering, sorting, and search capabilities.

Query Parameters ​

ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberResults per page (1-100, default: 10)
statusstringFilter by order status
startDatestringFilter by creation date (ISO 8601)
endDatestringFilter by creation date (ISO 8601)
searchTermstringSearch in order ID, customer name, or mobile
sortBystringSort field (created_at, updated_at, final_amount, status, name, mobile, referenceId)
sortDirectionstringSort direction (asc, desc)

Response (200 OK) ​

json
{
  "orders": [
    {
      "_id": "64a1b2c3d4e5f6789abc1234",
      "referenceId": "ORD-001",
      "status": "processing",
      "created_at": "2023-06-21T14:35:12Z",
      "updated_at": "2023-06-21T15:20:30Z",
      "mobile": "919876543210",
      "name": "John Doe",
      "final_amount": 1250.50,
      "delivery_method": "home_delivery",
      "product_items": [
        {
          "name": "Premium T-Shirt",
          "quantity": 2,
          "price": 500.00
        },
        {
          "name": "Jeans",
          "quantity": 1,
          "price": 750.50
        }
      ]
    }
  ],
  "total": 256,
  "totalPages": 26
}

Get Order by ID ​

GET /orders/{orderId}

Retrieve detailed information about a specific order.

Parameters ​

ParameterTypeRequiredDescription
orderIdstringYesUnique order ID

Response (200 OK) ​

json
{
  "_id": "64a1b2c3d4e5f6789abc1234",
  "referenceId": "ORD-001",
  "status": "processing",
  "created_at": "2023-06-21T14:35:12Z",
  "updated_at": "2023-06-21T15:20:30Z",
  "mobile": "919876543210",
  "name": "John Doe",
  "email": "john@example.com",
  "final_amount": 1250.50,
  "delivery_method": "home_delivery",
  "payment_status": "paid",
  "delivery_details": {
    "address": "123 Main St, City, State",
    "tracking_number": "TRK123456789",
    "estimated_delivery": "2023-06-25T18:00:00Z"
  },
  "product_items": [
    {
      "name": "Premium T-Shirt",
      "quantity": 2,
      "price": 500.00,
      "sku": "TSH-PREM-001"
    }
  ],
  "order_history": [
    {
      "status": "confirmed",
      "timestamp": "2023-06-21T14:35:12Z",
      "note": "Order confirmed by customer"
    }
  ]
}

Update Order ​

PUT /orders/{orderId}

Update order information.

Parameters ​

ParameterTypeRequiredDescription
orderIdstringYesUnique order ID

Request ​

json
{
  "updates": {
    "status": "shipped",
    "delivery_method": "express_delivery",
    "payment_status": "paid",
    "delivery_details": {
      "tracking_number": "TRK987654321",
      "estimated_delivery": "2023-06-23T18:00:00Z"
    }
  }
}

Response (200 OK) ​

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

Update Order Status ​

PUT /orders/{orderId}/status

Update only the order status with automatic timeline generation.

Parameters ​

ParameterTypeRequiredDescription
orderIdstringYesUnique order ID

Request ​

json
{
  "status": "shipped"
}

Response (200 OK) ​

json
{
  "success": true,
  "message": "Order status updated to shipped"
}

Get Order Timeline ​

GET /orders/{orderId}/timeline

Retrieve the complete timeline of events for an order.

Parameters ​

ParameterTypeRequiredDescription
orderIdstringYesUnique order ID

Response (200 OK) ​

json
[
  {
    "id": "evt_001",
    "title": "Order Confirmed",
    "description": "Customer confirmed the order",
    "type": "success",
    "timestamp": "2023-06-21T14:35:12Z",
    "metadata": {
      "payment_method": "online",
      "amount": 1250.50
    }
  },
  {
    "id": "evt_002", 
    "title": "Payment Received",
    "description": "Payment processed successfully",
    "type": "success",
    "timestamp": "2023-06-21T14:37:45Z",
    "metadata": {
      "transaction_id": "txn_abc123"
    }
  },
  {
    "id": "evt_003",
    "title": "Order Shipped",
    "description": "Order dispatched from warehouse",
    "type": "info",
    "timestamp": "2023-06-22T10:15:30Z",
    "metadata": {
      "tracking_number": "TRK987654321"
    }
  }
]

Add Timeline Event ​

POST /orders/{orderId}/timeline

Add a custom event to the order timeline.

Parameters ​

ParameterTypeRequiredDescription
orderIdstringYesUnique order ID

Request ​

json
{
  "event": {
    "title": "Customer Called",
    "description": "Customer contacted regarding delivery preference",
    "type": "info",
    "metadata": {
      "agent": "John Support",
      "duration": "5 minutes"
    }
  }
}

Event Types ​

TypeDescriptionColor Indicator
successPositive events (completion)Green
pendingIn-progress eventsYellow
errorIssues or problemsRed
infoInformational eventsBlue

Response (201 Created) ​

json
{
  "success": true,
  "message": "Timeline event added successfully",
  "eventId": "evt_004"
}

Get Order Statistics ​

GET /orders/stats

Retrieve comprehensive order analytics and statistics.

Query Parameters ​

ParameterTypeDescription
periodstringStatistics period (daily, weekly, monthly)

Response (200 OK) ​

json
{
  "totalOrders": 1250,
  "revenue": 325750.50,
  "averageOrderValue": 260.60,
  "period": {
    "start": "2023-06-01T00:00:00Z",
    "end": "2023-06-30T23:59:59Z"
  }
}

Export Orders ​

GET /orders/export

Export orders to CSV format with optional filtering.

Query Parameters ​

ParameterTypeDescription
statusstringFilter by order status
startDatestringFilter by creation date (ISO 8601)
endDatestringFilter by creation date (ISO 8601)
searchTermstringSearch in orders

Response (200 OK) ​

Returns a CSV file with the following headers:

  • Order ID
  • Reference ID
  • Customer Name
  • Mobile
  • Status
  • Amount
  • Created Date
  • Updated Date
Content-Type: text/csv
Content-Disposition: attachment; filename=orders-2023-06-21.csv

Data Types ​

Order Object ​

FieldTypeDescription
_idstringUnique order identifier
referenceIdstringHuman-readable order reference
statusstringCurrent order status
created_atstringOrder creation timestamp (ISO 8601)
updated_atstringLast update timestamp (ISO 8601)
mobilestringCustomer mobile number
namestringCustomer name
user_idstringUser ID for existing customers (optional)
emailstringCustomer email
final_amountnumberTotal order amount
totalPricenumberAlternative total price field
delivery_methodstringDelivery method
payment_statusstringPayment status
external_order_numberstringExternal system order number
external_order_sourcestringSource system (website, mobile_app, shopify, etc.)
product_itemsarrayList of ordered products
product_customizationsobjectProduct-specific customizations
delivery_detailsobjectDelivery information
status_historyarrayStatus change history
payment_infoobjectPayment information
notesstringOrder notes

Order Product Item Object ​

FieldTypeDescription
namestringProduct name
quantitynumberQuantity ordered
pricenumber | stringUnit price
product_retailer_idstringProduct SKU/ID

Delivery Details Object ​

FieldTypeDescription
recipient_namestringRecipient name
emailstringDelivery email
phonestringDelivery phone
alternate_phonestringAlternate phone
addressstringDelivery address
notesstringDelivery notes
locationobjectGPS coordinates

Payment Info Object ​

FieldTypeDescription
statusstringPayment status
amountnumberPayment amount
currencystringCurrency code
payment_idstringPayment gateway ID
methodstringPayment method
timestampstringPayment timestamp
reference_idstringPayment reference

Timeline Event Object ​

FieldTypeDescription
idstringUnique event identifier
titlestringEvent title
descriptionstringEvent description
typestringEvent type (success, pending, error, info)
timestampstringEvent timestamp (ISO 8601)
metadataobjectAdditional event data

Common Order Statuses ​

StatusDescription
pendingOrder placed, awaiting confirmation
confirmedOrder confirmed by customer
processingOrder being prepared
shippedOrder dispatched
deliveredOrder delivered to customer
completedOrder completed successfully
cancelledOrder cancelled
refundedOrder refunded

Error Handling ​

The API uses standard HTTP status codes and returns errors in a consistent format:

json
{
  "error": {
    "code": "ErrorType",
    "message": "Human-readable error message",
    "details": {
      // Additional error details, if applicable
    }
  }
}

Common Error Codes ​

CodeStatusDescription
AuthenticationError401Invalid or missing API key
ValidationError400Invalid request parameters
NotFoundError404Order not found
InternalServerError500Server error

Best Practices ​

  1. Use pagination: Always implement pagination when fetching order lists to avoid performance issues.

  2. Track order timeline: Use timeline events to maintain a complete audit trail of order progress.

  3. Implement status updates: Regularly update order status to keep customers informed.

  4. Monitor order metrics: Use order statistics to analyze business performance and identify trends.

  5. Handle errors gracefully: Implement proper error handling for all API calls.

  6. Use filtering: Leverage filtering options to efficiently find specific orders.

  7. Export for analysis: Use the export functionality for offline analysis and reporting.

Workflow Examples ​

Complete Order Lifecycle ​

  1. Order Creation: Create order via POST /orders with status PENDING
  2. Confirmation: Status updated to confirmed via PUT /orders/{id}/status
  3. Processing: Status updated to processing
  4. Shipping: Status updated to shipped with tracking details
  5. Delivery: Status updated to delivered
  6. Completion: Status updated to completed

Create Order from External System ​

bash
# Example: Create order from website checkout
curl -X POST https://api.talkingshops.com/v1/orders \
  -H "Content-Type: application/json" \
  -H "x-tenant-api-key: your_api_key_here" \
  -d '{
    "mobile": "+919876543210",
    "name": "John Doe",
    "product_items": [
      {"name": "Product A", "quantity": 1, "price": 500}
    ],
    "external_order_source": "website",
    "external_order_id": "CHECKOUT-123"
  }'

Timeline Management ​

  • Automatically generated events for status changes
  • Custom events for customer interactions
  • Integration points for external systems
  • Historical audit trail maintenance

Integration Notes ​

  • Orders are linked to customers through mobile numbers
  • Timeline events support rich metadata for custom integrations
  • Export functionality supports business intelligence tools
  • Status updates can trigger webhook notifications (if configured)
  • Compatible with WhatsApp messaging API for order notifications

Talking Shops product guides and API reference