Get Order

GET/orders/:orderId/full

Request Configuration

Method: GET
URL: https://api.mpowerpromo.com/orders/{{orderId}}/full
Authentication: Required (JWT Bearer token)


Path Parameters

Parameter Description Required Data Type Example
orderId Order ID (numeric) Yes Number 12345

Note: This endpoint uses the numeric orderId, not the MongoDB _id.


Headers

Header Description Required Example
Authorization Bearer JWT token Yes Bearer {{token}}
portal Portal identifier (admin/store) No admin
storeid Store ID for filtering No 507f1f77bcf86cd799439011

Query Parameters

While this endpoint doesn't have explicit query parameters in the URL, you can pass these internally through the request:

Parameter Description Data Type Default
withTestOrders Include test orders Boolean false

Note: Test orders are automatically excluded unless this flag is set or you're accessing from admin portal.


Response Structure

Success Response (200 OK)

Returns a comprehensive order object with all nested data fully populated.

Main Order Fields

Field Description Data Type
_id MongoDB ObjectId ObjectId
orderId Numeric order ID Number
orderStatus Current order status String
orderType Order type String
initialType Initial order type String
orderEmail Order contact email String
dueDate Order due date String (M/D/YYYY)
orderDate Order completion date Number (YYYYMMDD)
createdDate Order creation date Date (ISO 8601)
completedDate Order completed date Number (YYYYMMDD)
approvedAt Approval timestamp Date (ISO 8601)
approvedBy Customer who approved ObjectId

Financial Fields

Field Description Data Type
productTotal Total product price Number
productTotalCost Total product cost Number
chargeTotal Total charges Number
chargeTotalCost Total charges cost Number
taxTotal Total tax Number
shippingTotal Total shipping Number
discountTotal Total discounts Number
orderDiscount Order-level discount Number
productMargin Product margin Number
paymentsTotal Total payments received Number
POPaymentsTotal Total PO payments Number
balance Remaining balance Number
fundraisingTotal Fundraising amount Number
additionalOrderChargesTotal Additional charges Number

Populated Objects

Field Description Populated Data
storeId Store object Full store details including settings, emails, distributor
customerId Customer object Customer with company, addresses, phone numbers, documents, notes
distributorId Distributor object Distributor with payment providers, shipping credentials, addresses, logo
salesUserId Sales user User with profile, photo, name
adminUserId Admin user User with profile, photo, name
createdByUserId Created by user User with profile, photo, name
updatedBy Updated by user User details
billingAddress Billing address Complete address object
customerCompany Company object Company with addresses

Complex Arrays

Field Description Contains
PurchaseOrders Array of purchase orders Fully populated PO objects (see PO structure below)
ShipmentArray Order-level shipments Shipment objects with tracking, documents, FOB points
Documents Order documents Upload objects with user who uploaded
Payments Payment records Payment details (only if authenticated as admin)
discountCodes Discount codes applied Discount code ObjectIds
referenceFields Custom reference fields Reference field values
trackingPackages Tracking packages Tracking details with events and status
fullFilmentLogs Fulfillment logs Order fulfillment records

Additional Data

Field Description Data Type
orderDevice Device used to create order Device details (browser, OS, etc.)
utm UTM tracking data UTM parameters (source, medium, campaign)
updatedUser Last user to update User details
rushOrder Rush order flag Boolean
isFlagged Flagged for attention Boolean
firmDueDate Firm due date flag Boolean
isTest Test order flag Boolean
currency Currency code String
currencyRate Exchange rate Number
allowCreditCardPayments Allow credit cards Boolean
allowECheckPayments Allow e-checks Boolean
allowPOPayments Allow PO payments Boolean

Purchase Order Structure

Each item in the PurchaseOrders array contains:

Basic PO Fields

Field Description Data Type
friendlyPurchaseOrderDetailId PO ID number Number
parentPoId Parent PO ID (if child) Number
status PO status String
type PO type String
productId Product ID String
SO Supplier order number String
supplierCode Supplier's product code String
supplierComments Comments for supplier String

PO Financial Fields

Field Description Data Type
productTotal Product total Number
productTotalCost Product cost Number
chargeTotal Charges total Number
chargeTotalCost Charges cost Number
total PO total Number
margin PO margin Number
shippingTotal Shipping total Number
shippingTotalCost Shipping cost Number
taxTotal Tax total Number

PO Dates

Field Description Format
dueDate PO due date String (M/D/YYYY)
estimatedProductionDate Est. production date String (M/D/YYYY)
estimatedShipDate Est. ship date String (M/D/YYYY)
estimatedDeliveryDate Est. delivery date String (M/D/YYYY)
receivedDate Date received String (M/D/YYYY)
shippedDate Date shipped String (M/D/YYYY)

PO Populated Objects

Field Description Populated Data
supplier Supplier object Full supplier details with PromoStandards credentials, integrations
machine Production machine Machine details
productionManagerId Production manager User details
orderStatusDetails Order status details Status metadata
shipmentStatusDetails Shipment status Shipment metadata
purchaseOrderEmails PO emails sent Email records with sender/recipient
lastFullfilmentOrderPOStatusLog Last status log Log entry
lastFullfilmentOrderPOShipmentStatusLog Last shipment log Log entry

PO Complex Arrays

Field Description Contains
LineItemArray Line items Products with parts, decorations, shipments (see Line Item structure)
ChargeArray Charges Setup fees, art charges, etc.
ShipmentArray PO shipments Shipment addresses with tracking
VirtualProofs Proof files Artwork proofs with approval status
invoices PO invoices Invoice ObjectIds

Line Item Structure

Each item in PurchaseOrders[].LineItemArray contains:

Field Description Data Type
productId Product ID String
quantity Quantity ordered Number
unitPrice Unit price Number
unitCost Unit cost Number
total Line total Number
totalCost Line cost Number
description Item description String
localProduct Product object Fully populated product with supplier, inventory, restrictions
PartArray Parts/sizes Array of part objects with shipments
DecorationArray Decorations Array of decoration objects
ShipmentArray Line shipments Shipment objects with tracking

Sample Response (Abbreviated)

{
"_id": "507f1f77bcf86cd799439050",
"orderId": 12345,
"orderStatus": "Processing",
"orderType": "Decorated",
"initialType": "New Quote Request",
"orderEmail": "[email protected]",
"dueDate": "12/31/2025",
"orderDate": null,
"createdDate": "2025-11-07T10:30:00.000Z",
"productTotal": 1250.00,
"productTotalCost": 812.50,
"chargeTotal": 125.00,
"chargeTotalCost": 75.00,
"taxTotal": 0,
"shippingTotal": 50.00,
"discountTotal": 0,
"orderDiscount": 0,
"productMargin": 35,
"paymentsTotal": 500.00,
"balance": 925.00,
"rushOrder": true,
"isFlagged": false,
"firmDueDate": true,
"currency": "USD",
"currencyRate": 1,
"allowCreditCardPayments": true,
"allowECheckPayments": true,
"storeId": {
"_id": "507f1f77bcf86cd799439011",
"storeName": "Acme Promo Store",
"storeUrl": "acmepromo.com",
"StoreEmails": [{
"emailType": "Order Confirmation",
"email": "[email protected]"
}],
"distributorId": {
"_id": "507f1f77bcf86cd799439010",
"logo": "https://example.com/logo.png"
},
"StoreFulfillment": []
},
"customerId": {
"_id": "507f1f77bcf86cd799439012",
"userId": {
"_id": "507f1f77bcf86cd799439013",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"photo": "https://example.com/photo.jpg"
},
"companyId": {
"_id": "507f1f77bcf86cd799439015",
"companyName": "Acme Corporation",
"CompanyAddresses": [],
"CompanyBillingAddresses": []
},
"CustomerAddresses": [],
"CustomerPhoneNumbers": [],
"Documents": []
},
"distributorId": {
"_id": "507f1f77bcf86cd799439010",
"paymentProviders": [],
"allowECheckPayments": true,
"logo": "https://example.com/logo.png",
"shippingCredentials": {}
},
"salesUserId": {
"_id": "507f1f77bcf86cd799439013",
"firstName": "Jane",
"lastName": "Sales",
"email": "[email protected]",
"photo": "https://example.com/jane.jpg"
},
"adminUserId": {
"_id": "507f1f77bcf86cd799439014",
"firstName": "Admin",
"lastName": "User",
"email": "[email protected]"
},
"createdByUserId": {
"_id": "507f1f77bcf86cd799439013",
"firstName": "Jane",
"lastName": "Sales"
},
"PurchaseOrders": [
{
"friendlyPurchaseOrderDetailId": 1,
"status": "Sent to Supplier",
"type": "Standard",
"productId": "PROD-001",
"SO": "SO-2025-001",
"supplierCode": "ABC-12345",
"productTotal": 625.00,
"productTotalCost": 406.25,
"chargeTotal": 62.50,
"chargeTotalCost": 37.50,
"total": 712.50,
"margin": 218.75,
"dueDate": "12/25/2025",
"estimatedDeliveryDate": "12/25/2025",
"supplier": {
"_id": "507f1f77bcf86cd799439020",
"name": "Supplier ABC",
"website": "https://supplierabc.com",
"phone": "555-1234",
"isDecorator": false,
"distSupplier": {
"_id": "507f1f77bcf86cd799439021",
"Integrations": []
}
},
"LineItemArray": [
{
"productId": "PROD-001",
"quantity": 100,
"unitPrice": 6.25,
"unitCost": 4.06,
"total": 625.00,
"totalCost": 406.25,
"description": "Custom T-Shirt",
"localProduct": {
"_id": "507f1f77bcf86cd799439030",
"productName": "T-Shirt - Cotton",
"slug": "t-shirt-cotton",
"productId": "PROD-001",
"supplierCode": "ABC-12345",
"supplierId": {
"_id": "507f1f77bcf86cd799439020",
"name": "Supplier ABC"
},
"restrictions": []
},
"PartArray": [
{
"partId": "PART-001",
"description": "Size Large - Navy",
"quantity": 50,
"unitPrice": 6.25,
"unitCost": 4.06,
"ShipmentArray": []
},
{
"partId": "PART-002",
"description": "Size XL - Navy",
"quantity": 50,
"unitPrice": 6.25,
"unitCost": 4.06,
"ShipmentArray": []
}
],
"DecorationArray": [
{
"decorationId": "DECO-001",
"decorationType": "Screen Print",
"location": "Front Center",
"colors": 2
}
],
"ShipmentArray": []
}
],
"ChargeArray": [
{
"chargeName": "Setup Fee",
"chargeType": "Setup",
"price": 50.00,
"cost": 30.00,
"quantity": 1,
"total": 50.00,
"totalCost": 30.00
}
],
"ShipmentArray": [
{
"shipmentId": 1,
"companyName": "Acme Corp",
"contactName": "John Doe",
"street1": "123 Main St",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US",
"email": "[email protected]",
"phone": "555-1234",
"carrier": "UPS",
"carrierService": "Ground",
"shipmentCost": 15.00,
"shipmentPrice": 25.00,
"trackingPackages": []
}
],
"VirtualProofs": [],
"purchaseOrderEmails": []
}
],
"ShipmentArray": [],
"Documents": [],
"Payments": [
{
"_id": "507f1f77bcf86cd799439060",
"type": "Credit Card",
"amount": 500.00,
"currency": "USD",
"createdDate": "2025-11-07T10:30:00.000Z",
"userId": "507f1f77bcf86cd799439013"
}
],
"discountCodes": [],
"referenceFields": [],
"trackingPackages": [],
"fullFilmentLogs": [],
"orderDevice": {
"browser": "Chrome",
"os": "Windows",
"device": "Desktop"
},
"utm": {
"utmSource": "google",
"utmMedium": "cpc",
"utmCampaign": "fall-2025"
},
"createdAt": "2025-11-07T10:30:00.000Z",
"updatedAt": "2025-11-07T14:20:00.000Z"
}

Error Responses

404 Not Found

{
"message": "Order not found!"
}

Causes:

  • Order doesn't exist

  • Order has been soft deleted

  • User doesn't have access to this order's distributor

  • Test order without proper access


Authorization & Access Control

Distributor Filtering

  • Non-admin portal users can only access orders from their own distributor

  • Admin portal users can access orders across distributors

Test Orders

  • Test orders (isTest: true) are automatically filtered unless:

    • Request includes portal header

    • Request includes storeid header

    • Query parameter withTestOrders is true

Supplier Filtering

  • If user has a supplierId, only purchase orders for that supplier are returned

  • Useful for supplier portal access


Key Features

Comprehensive Data Population

This endpoint returns the most complete order data available, including:

  • ✅ All nested purchase orders with line items, parts, and decorations

  • ✅ Complete customer information with company and addresses

  • ✅ Store and distributor details

  • ✅ All team members (sales, admin, created by)

  • ✅ Product details with supplier information

  • ✅ Shipment tracking information

  • ✅ Payment records (admin only)

  • ✅ Order history and logs

  • ✅ Uploaded documents

  • ✅ Artwork proofs

  • ✅ UTM tracking data

  • ✅ Device information

Sensitive Data Handling

When isPrivate: true (which it is for this endpoint):

  • Payment information is included

  • Sensitive store settings are hidden

  • PromoStandards credentials are excluded


Use Cases

  • Order detail views in admin portal

  • Customer order history detail page

  • Order editing preparation

  • Invoice generation

  • Fulfillment processing

  • Order reports with complete data

Get Orders

POST/load-orders

Request Configuration

Method: POST or GET
URL: https://api.mpowerpromo.com/load-orders
Authentication: Required (JWT Bearer token)
API Token Access: Supported

Note: POST method is preferred when sending complex filter parameters in the request body.


Headers

Header Description Required Example
Authorization Bearer JWT token Yes Bearer {{token}}
Content-Type Request content type Yes (POST) application/json
portal Portal identifier (admin/store) No admin
storeid Store ID No 507f1f77bcf86cd799439011
progress Check export progress No true

Request Body Structure

The request body should contain a params object with filter, pagination, and population options:

{
"params": {
"filter": {},
"page": 1,
"limit": 25,
"ascending": 0,
"orderBy": "createdAt",
"populate": [],
"fields": []
}
}

Request Body Parameters

Table 1: Pagination & Sorting

Parameter Description Data Type Default Example
page Page number Number 1 page: 1
limit Results per page (max 100) Number 25 limit: 50
ascending Sort direction (1=asc, 0=desc) Number 0 ascending: 1
orderBy Field to sort by String "createdAt" "orderId"
onlyCount Return only count Boolean false true

Table 2: Filter Object Parameters

All these go inside the filter object:

Parameter Description Data Type Example
orderStatus Filter by order status Array[String] ["Processing", "Shipped"]
orderType Filter by order type Array[String] ["Decorated"]
poStatus Filter by PO status Array[String] ["In Production"]
salesUserId Filter by sales user Array[ObjectId] ["507f1f77bcf86cd799439011"]
adminUserId Filter by admin user Array[ObjectId] ["507f1f77bcf86cd799439012"]
sales Sales user filter (alternative) Array[Object] [{"val": "507f..."}]
admin Admin user filter (alternative) Array[Object] [{"val": "507f..."}]
customerId Filter by customer ObjectId "507f1f77bcf86cd799439013"
storeId Filter by store Array or ObjectId ["507f1f77bcf86cd799439014"]
distributorId Filter by distributor Array[Object] [{"value": "507f..."}]
purchaseOrdersSuppliers Filter by supplier Array[ObjectId] ["507f1f77bcf86cd799439015"]
sourceOrderType Filter by initial type Array[String] ["New Quote Request"]
initialType Web vs non-web Array[String] ["web", "non-web"]
firmDueDate Filter by firm due date Array[Object] [{"name": "Yes"}]
rushOrder Filter by rush order Array[Object] [{"name": "Yes"}]
isFlagged Filter by flagged Array[Object] [{"name": "Yes"}]

Table 3: Date Range Filters

Parameter Description Data Type Example
createdAt Created date range Object {"startDate": "2025-01-01", "endDate": "2025-12-31"}
orderDateRange Order date range Object {"startDate": "2025-01-01", "endDate": "2025-12-31"}
createdAtRange Alternative created range Object {"startDate": "2025-01-01", "endDate": "2025-12-31"}

Table 4: Search & Query

Parameter Description Data Type Example
query Search by order ID, total, customer, store, reference fields String "12345"
companyId Filter by company ObjectId "507f1f77bcf86cd799439016"

Table 5: Boolean Filters

Parameter Description Data Type Default
excludeTestOrders Exclude test orders Boolean Varies by context
existOrderDate Only orders with order date Boolean false
deletedOnly Show only deleted orders Boolean false
withTestOrders Include test orders Boolean false
withoutZoho Exclude Zoho synced orders Boolean false
viewAllDistributorCustomerOrder View all distributor orders Boolean false

Table 6: Data Population Options

Parameter Description Data Type Default
populate Custom population array Array[Object/String] []
forcePopulate Force specific populate only Boolean false
withReferenceFields Include reference fields Boolean false
withDistributor Populate distributor Boolean false
withSupplier Populate supplier Boolean false
withPayments Include payment records Boolean false
withPurchaseOrders Include purchase orders Boolean true
withDocuments Include documents Boolean false
withAllowanceCredits Include allowance credits Boolean false
withProductionPurchaseOrders Filter production POs by supplier Boolean false

Table 7: Special Options

Parameter Description Data Type
excludeStatus Exclude PO statuses Array[String]
excludeStatuses Exclude order statuses Array[String]
fields Specific fields to return Array[String]
totalStores Include store totals Boolean

Table 8: Export Options

Parameter Description Data Type Example
exportFormat Export format (csv/excel) String "csv"
exportFields Fields to export Array[String] ["orderId", "orderTotal"]

Sample Request Bodies

1. Basic Order List (Default)

{
"params": {
"page": 1,
"limit": 25,
"ascending": 0,
"orderBy": "createdAt"
}
}

2. Filter by Order Status

{
"params": {
"filter": {
"orderStatus": ["Processing", "In Production", "Shipped"]
},
"page": 1,
"limit": 50,
"ascending": 0,
"orderBy": "updatedAt"
}
}

3. Filter by Sales User

{
"params": {
"filter": {
"sales": [
{"val": "507f1f77bcf86cd799439011"}
]
},
"page": 1,
"limit": 25
}
}

4. Search by Order ID or Customer

{
"params": {
"query": "12345",
"page": 1,
"limit": 25
}
}

5. Date Range Filter

{
"params": {
"filter": {
"createdAt": {
"startDate": "2025-01-01",
"endDate": "2025-12-31"
}
},
"orderDateRange": {
"startDate": "2025-10-01",
"endDate": "2025-10-31"
},
"page": 1,
"limit": 50
}
}

6. Rush Orders with Payments

{
"params": {
"filter": {
"rushOrder": [{"name": "Yes"}],
"orderStatus": ["Processing", "In Production"]
},
"withPayments": true,
"page": 1,
"limit": 25,
"ascending": 0,
"orderBy": "dueDate"
}
}

7. Filter by Store and Supplier

{
"params": {
"filter": {
"storeId": ["507f1f77bcf86cd799439011"],
"purchaseOrdersSuppliers": ["507f1f77bcf86cd799439020"]
},
"withSupplier": true,
"page": 1,
"limit": 25
}
}

8. Advanced: Multiple Filters with Population

{
"params": {
"filter": {
"orderStatus": ["Processing", "Shipped"],
"orderType": ["Decorated"],
"sales": [{"val": "507f1f77bcf86cd799439011"}],
"firmDueDate": [{"name": "Yes"}],
"createdAt": {
"startDate": "2025-11-01",
"endDate": "2025-11-30"
}
},
"withPayments": true,
"withSupplier": true,
"withDistributor": true,
"withReferenceFields": true,
"page": 1,
"limit": 50,
"ascending": 1,
"orderBy": "orderId"
}
}

9. Custom Field Selection

{
"params": {
"filter": {
"orderStatus": ["Processing"]
},
"fields": [
"orderId",
"orderStatus",
"orderTotal",
"customerId",
"dueDate",
"createdAt"
],
"page": 1,
"limit": 100
}
}

10. Export Orders to CSV

{
"params": {
"filter": {
"orderStatus": ["Completed"],
"orderDateRange": {
"startDate": "2025-10-01",
"endDate": "2025-10-31"
}
},
"exportFormat": "csv",
"exportFields": [
"orderId",
"orderStatus",
"orderTotal",
"orderDate",
"customerId.firstName",
"customerId.lastName"
]
}
}

11. Get Only Count

{
"params": {
"filter": {
"orderStatus": ["New Quote Request"]
},
"onlyCount": true
}
}

12. Exclude Test Orders and Specific Statuses

{
"params": {
"filter": {},
"excludeTestOrders": true,
"excludeStatuses": ["Deleted", "Canceled"],
"page": 1,
"limit": 25
}
}

13. Complete Example with All Options

{
"params": {
"filter": {
"orderStatus": ["Processing", "In Production"],
"orderType": ["Decorated"],
"sales": [{"val": "507f1f77bcf86cd799439011"}],
"admin": [{"val": "507f1f77bcf86cd799439012"}],
"storeId": ["507f1f77bcf86cd799439014"],
"rushOrder": [{"name": "Yes"}],
"firmDueDate": [{"name": "Yes"}],
"createdAt": {
"startDate": "2025-11-01",
"endDate": "2025-11-30"
}
},
"excludeTestOrders": true,
"excludeStatuses": ["Deleted", "Canceled", "Archive"],
"withPayments": true,
"withSupplier": true,
"withDistributor": true,
"withPurchaseOrders": true,
"withDocuments": true,
"withReferenceFields": true,
"totalStores": true,
"page": 1,
"limit": 50,
"ascending": 0,
"orderBy": "createdAt"
}
}

Response Structure

Success Response (200 OK)

{
"data": [
{
"_id": "507f1f77bcf86cd799439050",
"orderId": 12345,
"orderStatus": "Processing",
"orderType": "Decorated",
"initialType": "New Quote Request",
"orderTotal": 1250.00,
"balance": 625.00,
"dueDate": "12/31/2025",
"rushOrder": true,
"firmDueDate": true,
"isFlagged": false,
"source": "app",
"customerId": {
"_id": "507f1f77bcf86cd799439012",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]"
},
"storeId": {
"_id": "507f1f77bcf86cd799439011",
"storeName": "Acme Promo"
},
"salesUserId": {
"_id": "507f1f77bcf86cd799439013",
"firstName": "Jane",
"lastName": "Sales"
},
"adminUserId": {
"_id": "507f1f77bcf86cd799439014",
"firstName": "Admin",
"lastName": "User"
},
"PurchaseOrders": [],
"createdAt": "2025-11-07T10:30:00.000Z",
"updatedAt": "2025-11-07T14:20:00.000Z"
}
],
"count": 1,
"totalStores": [
{
"_id": "507f1f77bcf86cd799439011",
"count": 150,
"store": {
"_id": "507f1f77bcf86cd799439011",
"storeName": "Acme Promo"
}
}
],
"referenceFields": []
}

Count Only Response

{
"count": 150
}

Export Progress Response

{
"progress": 0.45
}

Response Fields

Main Response Object

Field Description Data Type
data Array of orders Array[Object]
count Total matching orders Number
totalStores Store breakdown (if requested) Array[Object]
referenceFields Reference fields summary (if requested) Array[Object]

Order Object Fields (Default Population)

Field Description Data Type
_id MongoDB ObjectId ObjectId
orderId Numeric order ID Number
orderStatus Order status String
orderType Order type String
initialType Initial type String
source "web" or "app" String
orderTotal Total amount Number
balance Remaining balance Number
dueDate Due date String
orderDate Order date Number
rushOrder Rush flag Boolean
firmDueDate Firm due date flag Boolean
isFlagged Flagged flag Boolean
customerId Customer object (populated) Object
storeId Store object (populated) Object
salesUserId Sales user (populated) Object
adminUserId Admin user (populated) Object
PurchaseOrders Purchase orders (if included) Array
Payments Payment records (if requested) Array
Documents Documents (if requested) Array
createdAt Creation timestamp Date
updatedAt Update timestamp Date

Authorization & Access Control

Distributor Filtering

  • Users automatically see only orders from their distributor

  • Super admins can use allDistributors filter

  • Use viewAllDistributorCustomerOrder with proper permissions

Supplier Access

  • Supplier users only see orders with POs assigned to them

  • Use withProductionPurchaseOrders: true for supplier filtering

Store Access

  • Store users only see orders from their specific store

Test Orders

  • Automatically excluded unless:

    • withTestOrders: true is set

    • portal or storeid header is present


Special Features

Smart Search

The query parameter searches across:

  • Order ID (numeric match)

  • Order total (price match)

  • Customer name, email, company

  • Store name

  • Reference field values

Date Formats

  • createdAt dates: ISO 8601 strings ("2025-11-07")

  • orderDateRange dates: ISO 8601 strings ("2025-11-07")

  • Results include both web and server-side formatted dates

Sorting Options

Common orderBy values:

  • "createdAt" - Creation date (default)

  • "updatedAt" - Last updated

  • "orderId" - Order number

  • "dueDate" - Due date

  • "orderTotal" - Total amount

  • "customerId.firstName" - Customer name

  • "salesUserId.firstName" - Sales rep name

  • "storeId.storeName" - Store name

Export Functionality

When exportFormat is specified:

  1. First request initiates export (returns progress)

  2. Subsequent requests check progress

  3. Use progress header to check status

  4. Export completes when progress reaches 1.0


Error Responses

200 OK (Empty Result)

{
"data": [],
"count": 0
}

Causes:

  • No orders match filters

  • User doesn't have access to any orders

401 Unauthorized

Causes:

  • Missing or invalid authentication token

Use Cases

  • Order list views in admin portal

  • Customer order history lists

  • Sales dashboard filtered by rep

  • Store order reports

  • Production queue for suppliers

  • Order exports for accounting

  • Analytics and reporting


Performance Tips

  1. Use limit wisely - max is 100

  2. Request only needed fields with fields parameter

  3. Avoid unnecessary population - only set with\\\\* flags you need

  4. Use specific filters instead of broad searches

  5. Cache frequently accessed lists

Example request body

{
  "params": {
    "filter": {
      "orderStatus": [
        "New Quote Request",
        "Quote In Progress",
        "Quote Sent",
        "Processing",
        "In Production",
        "Shipped"
      ],
      "orderType": [
        "Decorated",
        "Blank",
        "Sample"
      ],
      "poStatus": [
        "New",
        "Sent to Supplier",
        "In Production",
        "Shipped"
      ],
      "sales": [
        {
          "val": "507f1f77bcf86cd799439011"
        },
        {
          "val": "507f1f77bcf86cd799439012"
        }
      ],
      "admin": [
        {
          "val": "507f1f77bcf86cd799439013"
        }
      ],
      "customerId": "507f1f77bcf86cd799439014",
      "storeId": [
        "507f1f77bcf86cd799439015",
        "507f1f77bcf86cd799439016"
      ],
      "distributorId": [
        {
          "value": "507f1f77bcf86cd799439017"
        }
      ],
      "purchaseOrdersSuppliers": [
        "507f1f77bcf86cd799439018",
        "507f1f77bcf86cd799439019"
      ],
      "sourceOrderType": [
        "New Quote Request",
        "Reorder Request",
        "Customer Initiated"
      ],
      "initialType": [
        "web",
        "non-web"
      ],
      "firmDueDate": [
        {
          "name": "Yes"
        }
      ],
      "rushOrder": [
        {
          "name": "Yes"
        }
      ],
      "isFlagged": [
        {
          "name": "No"
        }
      ],
      "createdAt": {
        "startDate": "2025-01-01",
        "endDate": "2025-12-31"
      }
    },
    "query": "",
    "companyId": "",
    "orderDateRange": {
      "startDate": "2025-10-01",
      "endDate": "2025-10-31"
    },
    "createdAtRange": {
      "startDate": "2025-11-01",
      "endDate": "2025-11-30"
    },
    "excludeTestOrders": true,
    "existOrderDate": false,
    "deletedOnly": false,
    "withTestOrders": false,
    "withoutZoho": false,
    "viewAllDistributorCustomerOrder": false,
    "excludeStatuses": [
      "Deleted",
      "Canceled",
      "Archive"
    ],
    "excludeStatus": [
      "Canceled",
      "Archive"
    ],
    "page": 1,
    "limit": 50,
    "ascending": 0,
    "orderBy": "createdAt",
    "onlyCount": false,
    "populate": [
      {
        "path": "billingAddress"
      },
      {
        "path": "parent"
      }
    ],
    "forcePopulate": false,
    "withReferenceFields": true,
    "withDistributor": true,
    "withSupplier": true,
    "withPayments": true,
    "withPurchaseOrders": true,
    "withDocuments": true,
    "withAllowanceCredits": true,
    "withProductionPurchaseOrders": false,
    "totalStores": true,
    "fields": [
      "_id",
      "orderId",
      "orderStatus",
      "orderType",
      "initialType",
      "orderTotal",
      "productTotal",
      "balance",
      "dueDate",
      "orderDate",
      "rushOrder",
      "firmDueDate",
      "isFlagged",
      "customerId",
      "storeId",
      "salesUserId",
      "adminUserId",
      "distributorId",
      "createdAt",
      "updatedAt",
      "createdByUserId",
      "PurchaseOrders",
      "Payments",
      "Documents",
      "ShipmentArray"
    ],
    "exportFormat": "",
    "exportFields": []
  }
}

Create Order

POST/orders

Request Configuration

Method: POST
URL: https://api.mpowerpromo.com/orders
Authentication: Required (JWT Bearer token)
API Token Access: Supported


Headers

Header Description Required Example
Authorization Bearer JWT token Yes Bearer {{token}}
Content-Type Request content type Yes application/json
portal Portal identifier (app/store) No app

Request Body - Top Level Parameters

Parameter Description Required Data Type Default
order Main order object (see Order Object section) Yes Object -
customer Customer object with _id, userId, adminUserId No Object -
status Initial order status No String "New Quote Request"
isDuplicate Whether this is a duplicate/reorder No Boolean false
duplicatedPO Specific PO ID to duplicate No Number -
followUpDetails Notes for order follow-up No String -
recaptchaToken Recaptcha validation token No String -

Order Object Parameters

Table 1: Core Order Information

Field Description Required Data Type
storeId Store MongoDB ObjectId Yes ObjectId
customerId Customer MongoDB ObjectId No ObjectId
customerCompany Company MongoDB ObjectId No ObjectId
orderEmail Order contact email No String (email)
orderStatus Order status (auto-set from status param) No String
orderType Type of order No String
initialType Initial type classification No String

Table 2: Sales & Team Assignment

Field Description Required Data Type
salesUserId Sales representative ObjectId No ObjectId
adminUserId Admin user ObjectId No ObjectId
createdByUserId Created by user ObjectId (auto-set) No ObjectId

Table 3: Financial Fields

Field Description Required Data Type
productTotal Total product price No Number
productTotalCost Total product cost No Number
chargeTotal Total charges (setup, art, etc.) No Number
chargeTotalCost Total charges cost No Number
taxTotal Total tax amount No Number
shippingTotal Total shipping price No Number
discountTotal Total discounts applied No Number
orderDiscount Order-level discount No Number
productMargin Product margin percentage No Number
paymentsTotal Total payments received No Number
balance Remaining balance No Number
fundraisingTotal Fundraising amount No Number
additionalOrderChargesTotal Additional charges total No Number

Table 4: Currency & Payment Options

Field Description Required Data Type
currency Currency code No String
currencyRate Currency exchange rate No Number
allowCreditCardPayments Allow credit card payments No Boolean
allowECheckPayments Allow e-check payments No Boolean
allowPOPayments Allow PO payments No Boolean

Table 5: Dates & Scheduling

Field Description Required Data Type Format
dueDate Order due date No String M/D/YYYY
orderDate Order completion date No Number YYYYMMDD
invoiceDate Invoice date No Number YYYYMMDD
completedDate Completion date No Number YYYYMMDD
approvedAt Approval timestamp No Date ISO 8601

Table 6: Flags & Options

Field Description Required Data Type
rushOrder Mark as rush order No Boolean
isFlagged Flag for attention No Boolean
firmDueDate Due date is firm No Boolean
isTest Test order flag No Boolean

Table 7: Integration Fields

Field Description Required Data Type
invoiceQBId QuickBooks invoice ID No String
customerQBId QuickBooks customer ID No String
orderZohoId Zoho order ID No String
orderHubspotId HubSpot order ID No String
invoiceXeroId Xero invoice ID No String

Table 8: Complex Arrays

Field Description Required Data Type
PurchaseOrders Array of purchase orders No Array[Object]
ShipmentArray Array of shipments No Array[Object]
discountCodes Array of discount code IDs No Array[ObjectId]
Payments Array of payment objects No Array[Object]
Documents Array of document IDs No Array[ObjectId]
referenceFields Custom reference fields No Array[Object]

Purchase Order Object Structure

Each item in the PurchaseOrders array can contain:

Field Description Data Type
status PO status String
type PO type String
supplier Supplier ObjectId ObjectId
productId Product ID String
SO Supplier order number String
productTotal Product total price Number
productTotalCost Product total cost Number
total PO total Number
LineItemArray Array of line items Array[Object]
ChargeArray Array of charges Array[Object]
ShipmentArray Array of shipments Array[Object]
VirtualProofs Array of proof files Array[Object]
estimatedDeliveryDate Estimated delivery String (M/D/YYYY)
dueDate PO due date String (M/D/YYYY)

Shipment Object Structure

Each item in the ShipmentArray can contain:

Field Description Data Type
companyName Company name String
contactName Contact name String
street1 Street address line 1 String
street2 Street address line 2 String
city City String
state State/Province String
postalCode Postal/ZIP code String
country Country String
email Shipping email String
phone Shipping phone String
carrier Carrier name String
carrierService Carrier service level String
shipmentCost Shipping cost Number
shipmentPrice Shipping price Number
Quantity Shipment quantity object Object

Sample Request Bodies

1. Minimal Order (New Quote Request)

{
"order": {
"storeId": "507f1f77bcf86cd799439011",
"customerId": "507f1f77bcf86cd799439012",
"orderEmail": "[email protected]",
"currency": "USD",
"currencyRate": 1,
"PurchaseOrders": []
},
"status": "New Quote Request"
}

2. Order with Customer Object

{
"order": {
"storeId": "507f1f77bcf86cd799439011",
"orderEmail": "[email protected]",
"dueDate": "12/31/2025",
"rushOrder": false,
"firmDueDate": true,
"allowCreditCardPayments": true,
"allowECheckPayments": false,
"currency": "USD",
"currencyRate": 1,
"PurchaseOrders": []
},
"customer": {
"_id": "507f1f77bcf86cd799439012",
"userId": "507f1f77bcf86cd799439013",
"adminUserId": "507f1f77bcf86cd799439014"
},
"status": "Quote In Progress"
}

3. Complete Order with Purchase Order

{
"order": {
"storeId": "507f1f77bcf86cd799439011",
"customerId": "507f1f77bcf86cd799439012",
"orderEmail": "[email protected]",
"customerCompany": "507f1f77bcf86cd799439015",
"salesUserId": "507f1f77bcf86cd799439013",
"adminUserId": "507f1f77bcf86cd799439014",
"productTotal": 500.00,
"productTotalCost": 325.00,
"chargeTotal": 50.00,
"chargeTotalCost": 30.00,
"taxTotal": 0,
"shippingTotal": 25.00,
"discountTotal": 0,
"orderDiscount": 0,
"productMargin": 35,
"rushOrder": false,
"isFlagged": false,
"firmDueDate": true,
"dueDate": "12/31/2025",
"allowCreditCardPayments": true,
"allowECheckPayments": true,
"currency": "USD",
"currencyRate": 1,
"PurchaseOrders": [
{
"status": "New",
"type": "Standard",
"supplier": "507f1f77bcf86cd799439020",
"productId": "PROD-001",
"productTotal": 500.00,
"productTotalCost": 325.00,
"chargeTotal": 50.00,
"chargeTotalCost": 30.00,
"total": 575.00,
"dueDate": "12/31/2025",
"LineItemArray": [],
"ChargeArray": [],
"ShipmentArray": []
}
],
"ShipmentArray": [
{
"companyName": "Acme Corp",
"contactName": "John Doe",
"street1": "123 Main St",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US",
"email": "[email protected]",
"phone": "555-1234",
"carrier": "UPS",
"carrierService": "Ground",
"shipmentCost": 15.00,
"shipmentPrice": 25.00
}
],
"discountCodes": [],
"referenceFields": []
},
"status": "Quote In Progress"
}

4. Duplicate Order (Reorder)

{
"order": {
"orderId": 12345,
"storeId": "507f1f77bcf86cd799439011",
"customerId": "507f1f77bcf86cd799439012",
"PurchaseOrders": []
},
"isDuplicate": true,
"followUpDetails": "Customer requested reorder with same specifications",
"status": "New Quote Request"
}

5. Duplicate Specific Purchase Order

{
"order": {
"orderId": 12345,
"storeId": "507f1f77bcf86cd799439011",
"customerId": "507f1f77bcf86cd799439012",
"PurchaseOrders": []
},
"isDuplicate": true,
"duplicatedPO": 1,
"followUpDetails": "Customer wants to reorder only PO #1",
"status": "New Quote Request"
}

Response

Success Response (200 OK)

Returns the complete created order object with:

  • Auto-generated orderId (numeric)

  • Auto-assigned salesUserId and adminUserId (if not provided)

  • Created createdDate timestamp

  • Populated PurchaseOrders with friendlyPurchaseOrderDetailId values

  • Auto-calculated totals

  • Created order follow-up record

{
"_id": "507f1f77bcf86cd799439050",
"orderId": 12346,
"storeId": "507f1f77bcf86cd799439011",
"customerId": "507f1f77bcf86cd799439012",
"orderStatus": "New Quote Request",
"salesUserId": "507f1f77bcf86cd799439013",
"adminUserId": "507f1f77bcf86cd799439014",
"createdByUserId": "507f1f77bcf86cd799439013",
"createdDate": "2025-11-07T10:30:00.000Z",
"productTotal": 500.00,
"total": 0,
"PurchaseOrders": [],
"createdAt": "2025-11-07T10:30:00.000Z",
"updatedAt": "2025-11-07T10:30:00.000Z"
}

Error Response (400/403/500)

{
"message": "Error description"
}

Common Error Messages:

  • "User is not authorized to create orders for this distributor." (403)

  • "Recaptcha token is invalid!" (400)

  • "Store not found" (500)

  • Order creation validation errors (500)


Important Notes

Automatic Field Handling

Fields Auto-Set by API (don't include in request):

  • orderId - Auto-generated sequence number

  • createdByUserId - Set from authenticated user

  • distributorId - Set from authenticated user

  • createdBy - Set from authenticated user

  • createdDate - Set to current UTC time

  • total - Calculated from order items

Fields Removed if Present:

  • orderId (in order object) - Conflicts with auto-generation

  • _id - MongoDB handles this

  • orderDate - Set when order is completed

Sales Assignment Logic

If not provided, salesUserId and adminUserId are assigned based on:

  1. Store's sales strategy (Round-rolling, etc.)

  2. Customer's assigned user IDs

  3. Falls back to the creating user

Order Duplication

When isDuplicate: true:

  • Purchase orders are duplicated with new IDs

  • Shipment information is cleared

  • A "Reorder Request" follow-up is created

  • Original order ID is logged in changes

Authorization

  • Must have JWT authentication

  • User must belong to the same distributor as the store

  • Super admins can create orders for any distributor


Status Options

Common Order Statuses

  • "New Quote Request"

  • "Quote In Progress"

  • "Quote Sent"

  • "Pending Payment"

  • "Processing"

  • "Sent to Supplier"

  • "In Production"

  • "Proof Pending Approval"

  • "Shipped"

  • "Delivered"

  • "Completed"

  • "Canceled"

  • "On Hold"

Example request body

{
  "order": {
    "storeId": "507f1f77bcf86cd799439011",
    "customerId": "507f1f77bcf86cd799439012",
    "customerCompany": "507f1f77bcf86cd799439015",
    "orderEmail": "[email protected]",
    "salesUserId": "507f1f77bcf86cd799439013",
    "adminUserId": "507f1f77bcf86cd799439014",
    "productTotal": 1250.0,
    "productTotalCost": 812.5,
    "chargeTotal": 125.0,
    "chargeTotalCost": 75.0,
    "taxTotal": 0,
    "shippingTotal": 50.0,
    "discountTotal": 0,
    "orderDiscount": 0,
    "productMargin": 35,
    "rushOrder": true,
    "isFlagged": false,
    "firmDueDate": true,
    "dueDate": "12/31/2025",
    "allowCreditCardPayments": true,
    "allowECheckPayments": true,
    "allowPOPayments": false,
    "currency": "USD",
    "currencyRate": 1,
    "initialType": "New Quote Request",
    "PurchaseOrders": [
      {
        "status": "New",
        "type": "Standard",
        "supplier": "507f1f77bcf86cd799439020",
        "supplierCode": "ABC-12345",
        "productId": "PROD-001",
        "SO": "SO-2025-001",
        "productTotal": 625.0,
        "productTotalCost": 406.25,
        "chargeTotal": 62.5,
        "chargeTotalCost": 37.5,
        "total": 712.5,
        "margin": 218.75,
        "shippingTotal": 25.0,
        "shippingTotalCost": 15.0,
        "taxTotal": 0,
        "rush": true,
        "taxExempt": false,
        "dueDate": "12/25/2025",
        "estimatedProductionDate": "12/10/2025",
        "estimatedShipDate": "12/20/2025",
        "estimatedDeliveryDate": "12/25/2025",
        "supplierComments": "Rush order - please expedite production",
        "LineItemArray": [
          {
            "productId": "PROD-001",
            "quantity": 100,
            "unitPrice": 6.25,
            "unitCost": 4.06,
            "total": 625.0,
            "totalCost": 406.25,
            "description": "Custom T-Shirt - Navy Blue",
            "PartArray": [
              {
                "partId": "PART-001",
                "description": "Size Large",
                "quantity": 50,
                "unitPrice": 6.25,
                "unitCost": 4.06
              },
              {
                "partId": "PART-002",
                "description": "Size XL",
                "quantity": 50,
                "unitPrice": 6.25,
                "unitCost": 4.06
              }
            ],
            "DecorationArray": [
              {
                "decorationId": "DECO-001",
                "decorationType": "Screen Print",
                "location": "Front Center",
                "colors": 2,
                "quantity": 100,
                "unitPrice": 0,
                "unitCost": 0
              }
            ]
          }
        ],
        "ChargeArray": [
          {
            "chargeName": "Setup Fee",
            "chargeType": "Setup",
            "price": 50.0,
            "cost": 30.0,
            "quantity": 1,
            "total": 50.0,
            "totalCost": 30.0,
            "margin": 20.0
          },
          {
            "chargeName": "Art Charge",
            "chargeType": "Art",
            "price": 12.5,
            "cost": 7.5,
            "quantity": 1,
            "total": 12.5,
            "totalCost": 7.5,
            "margin": 5.0
          }
        ],
        "ShipmentArray": [
          {
            "companyName": "Acme Corporation",
            "contactName": "John Doe",
            "street1": "123 Business Ave",
            "street2": "Suite 100",
            "city": "New York",
            "state": "NY",
            "postalCode": "10001",
            "country": "US",
            "email": "[email protected]",
            "phone": "555-123-4567",
            "carrier": "UPS",
            "carrierService": "Ground",
            "shipmentCost": 15.0,
            "shipmentPrice": 25.0,
            "access": "Customer",
            "Quantity": {
              "value": 100,
              "uom": "EA"
            }
          }
        ],
        "VirtualProofs": []
      },
      {
        "status": "New",
        "type": "Standard",
        "supplier": "507f1f77bcf86cd799439021",
        "supplierCode": "XYZ-67890",
        "productId": "PROD-002",
        "SO": "SO-2025-002",
        "productTotal": 625.0,
        "productTotalCost": 406.25,
        "chargeTotal": 62.5,
        "chargeTotalCost": 37.5,
        "total": 712.5,
        "margin": 218.75,
        "shippingTotal": 25.0,
        "shippingTotalCost": 15.0,
        "taxTotal": 0,
        "rush": true,
        "taxExempt": false,
        "dueDate": "12/25/2025",
        "estimatedDeliveryDate": "12/25/2025",
        "LineItemArray": [
          {
            "productId": "PROD-002",
            "quantity": 50,
            "unitPrice": 12.5,
            "unitCost": 8.125,
            "total": 625.0,
            "totalCost": 406.25,
            "description": "Custom Mug - White",
            "PartArray": [
              {
                "partId": "PART-003",
                "description": "11oz Ceramic Mug",
                "quantity": 50,
                "unitPrice": 12.5,
                "unitCost": 8.125
              }
            ],
            "DecorationArray": [
              {
                "decorationId": "DECO-002",
                "decorationType": "Full Color",
                "location": "Wrap",
                "colors": 4,
                "quantity": 50,
                "unitPrice": 0,
                "unitCost": 0
              }
            ]
          }
        ],
        "ChargeArray": [
          {
            "chargeName": "Setup Fee",
            "chargeType": "Setup",
            "price": 62.5,
            "cost": 37.5,
            "quantity": 1,
            "total": 62.5,
            "totalCost": 37.5,
            "margin": 25.0
          }
        ],
        "ShipmentArray": [
          {
            "companyName": "Acme Corporation",
            "contactName": "Jane Smith",
            "street1": "456 Office Blvd",
            "city": "Los Angeles",
            "state": "CA",
            "postalCode": "90001",
            "country": "US",
            "email": "[email protected]",
            "phone": "555-987-6543",
            "carrier": "FedEx",
            "carrierService": "2Day",
            "shipmentCost": 15.0,
            "shipmentPrice": 25.0,
            "access": "Customer",
            "Quantity": {
              "value": 50,
              "uom": "EA"
            }
          }
        ],
        "VirtualProofs": []
      }
    ],
    "ShipmentArray": [],
    "discountCodes": [],
    "referenceFields": [
      {
        "referenceField": "507f1f77bcf86cd799439030",
        "value": "Project Alpha"
      },
      {
        "referenceField": "507f1f77bcf86cd799439031",
        "value": "Department Marketing"
      }
    ],
    "Documents": [],
    "Payments": []
  },
  "customer": {
    "_id": "507f1f77bcf86cd799439012",
    "userId": "507f1f77bcf86cd799439013",
    "adminUserId": "507f1f77bcf86cd799439014"
  },
  "status": "New Quote Request",
  "isDuplicate": false,
  "followUpDetails": ""
}

Update Order

PUT/orders/:orderId/edit

Request Configuration

Method: PUT
URL: https://api.mpowerpromo.com/orders/{{orderId}}/edit
Authentication: Required (JWT Bearer token)
API Token Access: Supports API token authentication


Path Parameters

Parameter Description Required Data Type Example
orderId Order ID (numeric, not ObjectId) Yes Number 12345

Important: This endpoint uses the numeric orderId, not the MongoDB _id.


Headers

Header Description Required Example
Authorization Bearer JWT token or API token Yes {{vault:bearer-token}}
Content-Type Content type Yes application/json

Request Body Parameters

Basic Order Information

Field Description Required Data Type Notes
orderStatus Order status No String Enum: Pending, Processing, Shipped, Delivered, Canceled, Deleted, etc.
orderType Order type No String Enum: Standard, Sample, Quote, etc.
orderDate Order date No DateOnly Format: YYYY-MM-DD
completedDate Completion date No DateOnly Format: YYYY-MM-DD
invoiceDate Invoice date No DateOnly Format: YYYY-MM-DD
dueDate Due date No String Format: M/D/YYYY
orderEmail Customer email for order No String Valid email format

Customer & Store References

Field Description Required Data Type Notes
customerId Customer ObjectId reference No ObjectId -
customerOriginId Original customer ID No ObjectId -
storeId Store ObjectId reference No ObjectId Required on creation
distributorId Distributor ObjectId reference No ObjectId -
customerCompany Company ObjectId reference No ObjectId -

User Assignments

Field Description Required Data Type Notes
salesUserId Sales user ObjectId No ObjectId -
adminUserId Admin user ObjectId No ObjectId -
createdByUserId User who created order No ObjectId -
updatedBy User who last updated No ObjectId Auto-set
approvedBy Customer who approved No ObjectId -
approvedAt Approval timestamp No Date ISO 8601

Financial Totals (Usually Auto-Calculated)

Field Description Required Data Type Notes
orderTotal Total order amount No Number Auto-calculated
productTotal Total product cost No Number Auto-calculated
productTotalCost Product cost (no markup) No Number Auto-calculated
taxTotal Total tax amount No Number Can be manually set to 0
shippingTotal Total shipping cost No Number Auto-calculated
chargeTotal Total additional charges No Number Auto-calculated
chargeTotalCost Charge cost (no markup) No Number Auto-calculated
discountTotal Total discounts No Number Auto-calculated
orderDiscount Order-level discount No Number Manual discount
paymentsTotal Total payments received No Number Auto-calculated
balance Remaining balance No Number Auto-calculated
productMargin Product profit margin % No Number Auto-calculated

External System IDs

Field Description Required Data Type Notes
invoiceQBId QuickBooks invoice ID No String -
customerQBId QuickBooks customer ID No String -
invoiceXeroId Xero invoice ID No String -
orderZohoId Zoho CRM order ID No String Auto-synced
orderHubspotId HubSpot order ID No String Auto-synced

Flags & Settings

Field Description Required Data Type Notes
isTest Test order flag No Boolean -
rushOrder Rush order flag No Boolean -
isFlagged Flagged for review No Boolean -
firmDueDate Firm due date required No Boolean -
isBatched Part of batch order No Boolean -
initialType Initial order type No String Enum: Cart, Saved, Quote, etc.

Payment Settings

Field Description Required Data Type Notes
allowCreditCardPayments Allow credit card No Boolean -
allowECheckPayments Allow eCheck No Boolean -
allowPOPayments Allow purchase order No Boolean -
currency Currency code No String USD, CAD, etc.
currencyRate Exchange rate No Number -

Complex Arrays

Field Description Required Data Type Notes
PurchaseOrders Array of purchase orders No Array[Object] See PO schema below
ShipmentArray Order-level shipments No Array[Object] Shipping details
Documents Document ObjectId references No Array[ObjectId] -
Payments Payment records No Array[Object] Payment history
discountCodes Discount code references No Array[ObjectId] Applied codes
trackingPackages Tracking package references No Array[ObjectId] Shipment tracking
referenceFields Custom fields No Array[Object] Store-specific fields

Date Fields

Field Description Required Data Type Notes
qbSyncedAt QuickBooks sync timestamp No Date Auto-set
reconciledAt Reconciliation timestamp No Date -
shippingReconciliationAt Shipping reconciliation date No DateOnly -
supplierReconciliationAt Supplier reconciliation date No DateOnly -
deletedAt Soft delete timestamp No Date -
cancelDeletedAt Cancel/delete timestamp No Date -

Deletion Fields

Field Description Required Data Type Notes
deletedAt Deletion timestamp No Date Soft delete
deletedReason Reason for deletion No String -
deletedBy User who deleted No ObjectId -

Excluded Fields (Auto-Managed)

These fields are automatically removed or managed:

  • ❌ orderId - Cannot be changed (path parameter)

  • ❌ createdBy - Removed from body

  • ❌ updatedAt - Auto-updated


Example Requests

1. Update Order Status

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"orderStatus": "Processing"
}

2. Update Sales & Admin Users

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"salesUserId": "507f1f77bcf86cd799439011",
"adminUserId": "507f1f77bcf86cd799439012"
}

3. Set Order Date

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"orderDate": "2025-10-28"
}

4. Update Order Email & Due Date

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"orderEmail": "[email protected]",
"dueDate": "11/30/2025"
}

5. Mark as Rush Order

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"rushOrder": true,
"firmDueDate": true,
"isFlagged": true
}

6. Update External System IDs

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"invoiceQBId": "QB-INV-12345",
"customerQBId": "QB-CUST-67890",
"orderZohoId": "ZOHO-ORD-11111"
}

7. Set Test Order Flag

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"isTest": true
}

8. Update Order Discount

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"orderDiscount": 50.00
}

9. Reset Tax to Zero

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"taxTotal": 0
}

10. Update Multiple Fields

PUT https://api.mpowerpromo.com/orders/12345/edit
Authorization: Bearer {{token}}
Content-Type: application/json
{
"orderStatus": "Shipped",
"completedDate": "2025-10-28",
"rushOrder": false,
"salesUserId": "507f1f77bcf86cd799439011",
"orderEmail": "[email protected]"
}

Response Format

Success Response (200)

Returns the updated order object:

{
"_id": "507f1f77bcf86cd799439999",
"orderId": 12345,
"orderStatus": "Processing",
"orderType": "Standard",
"orderDate": "2025-10-28",
"orderTotal": 1250.50,
"productTotal": 1000.00,
"taxTotal": 100.50,
"shippingTotal": 150.00,
"balance": 0,
"customerId": "507f1f77bcf86cd799439011",
"storeId": "507f1f77bcf86cd799439012",
"distributorId": "507f1f77bcf86cd799439013",
"salesUserId": "507f1f77bcf86cd799439014",
"admin UserId": "507f1f77bcf86cd799439015",
"isTest": false,
"rushOrder": false,
"isFlagged": false,
"PurchaseOrders": [],
"createdAt": "2025-10-01T09:00:00.000Z",
"updatedAt": "2025-10-28T15:30:00.000Z"
}

Error Responses

404 - Order Not Found

{
"message": "Order not found"
}

401 - Unauthorized

{
"message": "Unauthorized"
}

422 - Validation Error

{
"message": "Validation failed",
"errors": []
}

Automatic Behaviors

1. Change Logging

  • All changes are automatically tracked

  • Creates detailed diff of before/after state

  • Logs to Log collection with category ORDER_UPDATES

  • Includes IP address, user ID, and timestamp

2. Socket Notifications

  • Sends CART_UPDATED_FRESH event via WebSocket

  • Notifies connected clients of order updates

  • Real-time updates for order management UI

3. API Token Logging

  • Logs all API token-based requests

  • Tracks which integration/API key made the change

  • Audits external system access

4. Field Auto-Management

  • updatedBy automatically set to current user

  • orderId and createdBy removed from request body

  • Cannot be changed via this endpoint


Important Notes

Order ID vs MongoDB ID

  • This endpoint uses numeric orderId, not MongoDB _id

  • Example: Use 12345, not 507f1f77bcf86cd799439999

Partial Updates

  • Only send fields you want to update

  • Unspecified fields remain unchanged

  • Arrays are replaced entirely if provided

Financial Totals

  • Most totals are auto-calculated from purchase orders

  • Manual updates may be overwritten on next save

  • Use with caution

Status Changes

  • Changing status may trigger side effects

  • May update virtual proofs, inventory, notifications

  • Test in development environment first

External System Sync

  • Changes may auto-sync to QuickBooks, Zoho, HubSpot

  • Sync happens asynchronously after update

  • Check sync status in response or logs


Complete Field Reference (CSV)

Field,Description,Required,Data Type,Updatable
orderStatus,Order status,No,String,Yes
orderType,Order type,No,String,Yes
orderDate,Order date,No,DateOnly,Yes
completedDate,Completion date,No,DateOnly,Yes
dueDate,Due date,No,String,Yes
orderEmail,Customer email,No,String,Yes
customerId,Customer reference,No,ObjectId,Yes
storeId,Store reference,No,ObjectId,Yes
distributorId,Distributor reference,No,ObjectId,Yes
salesUserId,Sales user,No,ObjectId,Yes
adminUserId,Admin user,No,ObjectId,Yes
orderTotal,Total amount,No,Number,Yes (auto-calc)
productTotal,Product total,No,Number,Yes (auto-calc)
taxTotal,Tax total,No,Number,Yes
shippingTotal,Shipping total,No,Number,Yes (auto-calc)
orderDiscount,Order discount,No,Number,Yes
invoiceQBId,QuickBooks invoice ID,No,String,Yes
orderZohoId,Zoho order ID,No,String,Yes
orderHubspotId,HubSpot order ID,No,String,Yes
isTest,Test flag,No,Boolean,Yes
rushOrder,Rush flag,No,Boolean,Yes
isFlagged,Flagged status,No,Boolean,Yes
orderId,Order ID (numeric),No,Number,No (path param)
createdBy,Creator,No,ObjectId,No (auto-removed)

Best Practices

  1. Use Numeric Order ID: Always use the numeric orderId, not MongoDB _id

  2. Partial Updates: Only include fields you're changing

  3. Test Mode: Use isTest: true for testing integrations

  4. Status Transitions: Follow proper status flow (Pending → Processing → Shipped)

  5. Validation: Validate data before sending to avoid errors

  6. Logging: All changes are logged - ensure proper user context

  7. Real-time Updates: Changes trigger socket events for UI updates

  8. External Sync: Be aware changes may sync to external systems

Example request body

{
  "orderStatus": "Sent to Supplier",
  "orderType": "Decorated",
  "orderDate": 20251028,
  "invoiceDate": 20251028,
  "dueDate": "12/15/2025",
  "salesUserId": "623cf6b7c7d17379aa86761e",
  "adminUserId": "6074cd3d8e893a101463978e",
  "storeId": "5c7edfd8208c866f6f7c7fd0",
  "productTotal": 467.1,
  "productTotalCost": 298.944,
  "chargeTotal": 77.8,
  "chargeTotalCost": 66.591,
  "taxTotal": 0,
  "shippingTotal": 99.5,
  "discountTotal": 0,
  "orderDiscount": 0,
  "productMargin": 36,
  "rushOrder": false,
  "isFlagged": false,
  "firmDueDate": true,
  "allowECheckPayments": false,
  "allowCreditCardPayments": true,
  "currency": "USD",
  "currencyRate": 1,
  "discountCodes": [
    "WELCOME10"
  ],
  "invoiceQBId": "41663",
  "orderStatusChecked": 1730132800000,
  "orderShipmentStatusChecked": 1730135400000
}

Delete Order

DELETE/orders/:orderId

Request Configuration

Method: DELETE
URL: https://api.mpowerpromo.com/orders/{{orderId}}
Authentication: Required (JWT Bearer token)
API Token Access: Supported

Important: This is a soft delete - the order is not permanently removed from the database. Instead, it is marked as deleted with a timestamp and reason.


Path Parameters

Parameter Description Required Data Type Example
orderId Order ID (numeric) Yes Number 12345

Note: This endpoint uses the numeric orderId, not the MongoDB _id.


Headers

Header Description Required Example
Authorization Bearer JWT token Yes Bearer {{token}}
Content-Type Request content type No application/json

Request Body

No request body required - this is a simple DELETE operation.


What Happens When You Delete an Order

1. Order is Soft Deleted

The order record is updated with:

  • deletedAt: Current timestamp

  • deletedBy: User ID who deleted the order

  • orderStatus: Changed to "Deleted"

  • deletedReason: Set to "User deleted. {user_email}"

2. Order Follow-Ups are Deleted

All associated follow-up records are also soft deleted:

  • All OrderFollowUp records linked to this order get a deletedAt timestamp

3. Socket Notification

If socket connections are active, a cart update notification is broadcast.

4. API Token Logging

If the request used an API token, the action is logged for tracking.


Response

Success Response (200 OK)

Returns the deleted order object with updated fields:

{
"_id": "507f1f77bcf86cd799439050",
"orderId": 12345,
"orderStatus": "Deleted",
"orderType": "Decorated",
"orderEmail": "[email protected]",
"customerId": "507f1f77bcf86cd799439012",
"storeId": "507f1f77bcf86cd799439011",
"salesUserId": "507f1f77bcf86cd799439013",
"adminUserId": "507f1f77bcf86cd799439014",
"productTotal": 1250.00,
"orderTotal": 1425.00,
"deletedAt": "2025-11-07T14:30:00.000Z",
"deletedBy": "507f1f77bcf86cd799439013",
"deletedReason": "User deleted. [email protected]",
"PurchaseOrders": [],
"createdAt": "2025-11-07T10:30:00.000Z",
"updatedAt": "2025-11-07T14:30:00.000Z"
}

Key Response Fields

Field Description Data Type
deletedAt Deletion timestamp Date (ISO 8601)
deletedBy User who deleted (ObjectId) ObjectId
orderStatus Changed to "Deleted" String
deletedReason Reason for deletion String

Sample Request

cURL Example

curl --location --request DELETE 'https://api.mpowerpromo.com/orders/12345' \
--header 'Authorization: Bearer {{token}}'

Postman Example

Method: DELETE
URL: https://api.mpowerpromo.com/orders/12345
Headers:

Authorization: Bearer {{token}}

Body: None

JavaScript/Axios Example

const axios = require('axios');
axios.delete('https://api.example.com/orders/12345', {
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
}
})
.then(response => {
console.log('Order deleted:', response.data);
})
.catch(error => {
console.error('Error deleting order:', error.response.data);
});

Error Responses

404 Not Found

{
"message": "Order not found"
}

Causes:

  • Order doesn't exist

  • Invalid orderId format

  • Order already deleted

401 Unauthorized

{
"message": "Unauthorized"
}

Causes:

  • Missing authentication token

  • Invalid authentication token

  • Expired token

403 Forbidden

Causes:

  • User doesn't have permission to delete orders

  • User doesn't belong to the order's distributor

  • API token doesn't have delete permissions


Important Notes

Soft Delete vs Hard Delete

  • ✅ Soft Delete: Order remains in database

  • ✅ Can be restored: Use the un-delete endpoint

  • ✅ Audit trail: Deletion is tracked with timestamp, user, and reason

  • ❌ Not immediately removed: Order still exists in database

  • ❌ Won't appear in normal queries: Queries filter out deleted orders by default

What Gets Deleted

Item Action
Order record Soft deleted (marked with deletedAt)
Order follow-ups Soft deleted (all related follow-ups)
Purchase orders Remain but inaccessible via order
Payments Remain in database
Documents Remain in database
Shipments Remain in database

What Doesn't Get Deleted

The following remain unchanged:

  • Customer record

  • Store record

  • Payment records

  • Documents/uploads

  • Logs and history

  • Related data in other systems (QB, Zoho, etc.)


Restoring Deleted Orders

Un-Delete Endpoint

You can restore a deleted order using:

Method: POST
URL: https://api.mpowerpromo.com/orders/{{_id}}/un-delete

Note: This uses the MongoDB _id, not the numeric orderId.

curl --location --request POST 'https://api.mpowerpromo.com/orders/507f1f77bcf86cd799439050/un-delete' \
--header 'Authorization: Bearer {{token}}'

Response:

{
"_id": "507f1f77bcf86cd799439050",
"orderId": 12345,
"orderStatus": "Deleted",
"cancelDeletedAt": "2025-11-07T15:00:00.000Z"
}

Note: The deletedAt field is removed, and cancelDeletedAt is set to track the restoration.


Viewing Deleted Orders

To view deleted orders in the load-orders endpoint:

{
"params": {
"deletedOnly": true,
"page": 1,
"limit": 25
}
}

Authorization & Permissions

Required Permissions

  • Must be authenticated

  • Must have access to the order's distributor

  • API tokens must have delete permissions enabled

Who Can Delete Orders

  • ✅ Admin users

  • ✅ Sales users (for their own orders)

  • ✅ Users with proper role permissions

  • ✅ API tokens with delete access

  • ❌ Customers cannot delete orders


Use Cases

When to Delete an Order

  • Order created by mistake

  • Duplicate order entry

  • Test order cleanup

  • Customer canceled before processing

  • Order entered in wrong system

When NOT to Delete

  • ❌ Completed orders - Use "Canceled" status instead

  • ❌ Orders with payments - Refund first, then delete

  • ❌ Orders in production - Cancel with supplier first

  • ❌ Shipped orders - Use appropriate status instead


Best Practices

Before Deleting

  1. Check order status - Ensure it's safe to delete

  2. Verify with team - Confirm no one is working on it

  3. Document reason - The deletion reason is auto-generated but you may want to add a note

  4. Check for payments - Handle any payments appropriately

  5. Notify stakeholders - Customer, supplier, etc.

After Deleting

  1. Verify deletion - Check the response confirms deletion

  2. Notify team - Let relevant team members know

  3. Update external systems - If integrated with QB, Zoho, etc.

  4. Document - Add notes if needed for audit purposes


Related Endpoints

Endpoint Purpose
POST /orders/:_id/un-delete Restore a deleted order
POST /load-orders View deleted orders with deletedOnly: true
PATCH /orders/:orderId Update order status to "Canceled" instead

Difference: Delete vs Cancel

Action Delete Cancel
Status "Deleted" "Canceled"
Visibility Hidden from normal queries Visible in order lists
Reversible Yes (un-delete endpoint) Yes (update status)
Use Case Mistakes, duplicates, tests Legitimate cancellations
Recommended Internal errors Business operations

Recommendation: Use Cancel status for normal business operations. Use Delete only for data cleanup and errors.


Example Workflow

Delete Order Flow

// 1. Get the order to verify it exists
const order = await axios.get('https://api.mpowerpromo.com/orders/12345/full', {
headers: { Authorization: 'Bearer {{token}}' }
});
console.log(`Deleting order ${order.data.orderId} - ${order.data.orderStatus}`);
// 2. Delete the order
const deletedOrder = await axios.delete('https://api.mpowerpromo.com/orders/12345', {
headers: { Authorization: 'Bearer {{token}}' }
});
console.log(`Order deleted at: ${deletedOrder.data.deletedAt}`);
console.log(`Deleted by: ${deletedOrder.data.deletedBy}`);
console.log(`Reason: ${deletedOrder.data.deletedReason}`);
// 3. Verify deletion
const orders = await axios.post('https://api.mpowerpromo.com/load-orders', {
params: {
filter: { orderId: 12345 }
}
}, {
headers: { Authorization: 'Bearer {{token}}' }
});
console.log(`Order visible in normal queries: ${orders.data.data.length > 0}`);
// 4. Check deleted orders list
const deletedOrders = await axios.post('https://api.mpowerpromo.com/load-orders', {
params: {
deletedOnly: true,
filter: { orderId: 12345 }
}
}, {
headers: { Authorization: 'Bearer {{token}}' }
});
console.log(`Order in deleted list: ${deletedOrders.data.data.length > 0}`)

Ready to run all of promo in one place?

See how MPower replaces your disconnected tools with one platform — from the first lead to the final shipment.

No credit card required.

Download

Never miss a beat. Download our app and work on the go with all the same features as our desktop application.

Powered by MPower PromoPlatform privacy