Skip to main content
PUT
/
api
/
orders
/
{order_id}
/
status
{
  "message": "<string>"
}

Overview

Update the status of an order and optionally provide tracking information. Customer receives email notification for status changes.
Rate Limit: 20 requests per minute

Endpoint

PUT https://api.tribemade.in/api/orders/{order_id}/status

Path Parameters

order_id
string
required
UUID of the order to update

Authentication

X-API-Key
string
required
Your TribeMade API key (format: tb-xxxx-xxx-xxxx)

Request Body

status
string
required
New order status. Must be one of: processing, dispatched, cancelled, delivered
tracking_url
string
Tracking URL for shipment (recommended for dispatched status)

Response

message
string
Success message: “Order status updated successfully”

Order Status Flow

started → processing → dispatched → delivered
            ↘ cancelled (from any status)

Status Values

🔵 processing

status
string
When to use: Start preparing/packing the orderCustomer email: “Your order is being prepared”Tracking URL: Not requiredTiming: Within 24 hours of order placement

🟣 dispatched

status
string
When to use: Hand over to courier/shipping partnerCustomer email: “Your order has been shipped” with tracking linkTracking URL: Highly recommended
  • Example: https://delhivery.com/track/AWB12345
  • Example: https://bluedart.com/tracking/AWB67890
  • Example: https://indiapost.gov.in/track/REG123456
Customer expects: Delivery in 3-7 days

🟢 delivered

status
string
When to use: Customer confirms receipt or auto-marked by courierCustomer email: “Your order has been delivered” with rating requestStatus is final: Cannot be changed after thisCustomer action: Can now rate and review the product

🔴 cancelled

status
string
When to use: Out of stock, payment issue, customer requestCustomer email: “Your order has been cancelled”Status is final: Cannot be changed after thisCan cancel from: Any status (started, processing, dispatched)Important: Handle refunds separately through payment gateway

Examples

Mark as Processing

curl -X PUT https://api.tribemade.in/api/orders/770e8400-e29b-41d4-a716-446655440789/status \
  -H "X-API-Key: tb-a1b2-c3d-e4f5" \
  -H "Content-Type: application/json" \
  -d '{ "status": "processing" }'

Mark as Dispatched with Tracking

curl -X PUT https://api.tribemade.in/api/orders/770e8400-e29b-41d4-a716-446655440789/status \
  -H "X-API-Key: tb-a1b2-c3d-e4f5" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "dispatched",
    "tracking_url": "https://delhivery.com/track/DLVY123456"
  }'
Customer receives: “Order Shipped” email with tracking link

Mark as Delivered

curl -X PUT https://api.tribemade.in/api/orders/770e8400-e29b-41d4-a716-446655440789/status \
  -H "X-API-Key: tb-a1b2-c3d-e4f5" \
  -H "Content-Type: application/json" \
  -d '{ "status": "delivered" }'
Customer receives: “Order Delivered” email with rating request

Cancel Order

curl -X PUT https://api.tribemade.in/api/orders/770e8400-e29b-41d4-a716-446655440789/status \
  -H "X-API-Key: tb-a1b2-c3d-e4f5" \
  -H "Content-Type: application/json" \
  -d '{ "status": "cancelled" }'
Customer receives: “Order Cancelled” email

Success Response

{
  "message": "Order status updated successfully"
}

Error Responses

400 Bad Request - Missing Status

{
  "error": "Status is required"
}
Cause: The status field was not included in the request body.

400 Bad Request - Invalid Status

{
  "error": "Status must be one of: processing, dispatched, cancelled, delivered"
}
Cause: Invalid status value provided. Valid statuses: processing, dispatched, cancelled, delivered

400 Bad Request - Order Already Completed

{
  "error": "Cannot update order status. Order is already delivered."
}
Cause: Trying to update status of an order that’s already in a final state (delivered or cancelled). Note: Once delivered or cancelled, status is permanent and cannot be changed.

404 Not Found

{
  "error": "Order not found"
}
Cause: Order ID doesn’t exist.

403 Forbidden

{
  "error": "Order does not belong to this store"
}
Cause: Order exists but belongs to a different store.

401 Unauthorized

{
  "error": "Invalid API key"
}
or
{
  "error": "Missing API key"
}

429 Too Many Requests

{
  "error": "Rate limit exceeded",
  "retry_after": 60
}

Tracking URL Guidelines

When to Provide

  • Required: When status = dispatched
  • Optional: Can be added/updated at any time
  • Best practice: Add immediately when shipping

Format & Examples

https://delhivery.com/track/AWBXXXXXXXX
Example: https://delhivery.com/track/AWB123456789
https://bluedart.com/tracking/AWBXXXXXXXX
Example: https://bluedart.com/tracking/AWB987654321
https://indiapost.gov.in/track/REGXXXXXXXX
Example: https://indiapost.gov.in/track/REG123456IN
Any valid tracking URL from your shipping provider:
  • FedEx, DHL, DTDC, etc.
  • Must be a valid HTTPS URL
  • Should provide real-time tracking

What Happens

  • URL is saved to database
  • Included in customer email notifications
  • Customer can click to track their shipment
  • Displayed on order status page

Common Use Cases

Automated Fulfillment Workflow

import requests

class OrderFulfillment:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = "https://api.tribemade.in/api/orders"
    
    def update_status(self, order_id, status, tracking_url=None):
        """Update order status"""
        url = f"{self.base_url}/{order_id}/status"
        headers = {
            "X-API-Key": self.api_key,
            "Content-Type": "application/json"
        }
        
        data = {"status": status}
        if tracking_url:
            data["tracking_url"] = tracking_url
        
        response = requests.put(url, headers=headers, json=data)
        return response.status_code == 200
    
    def fulfill_order(self, order_id):
        """Complete fulfillment workflow"""
        print(f"Starting fulfillment for order {order_id[:8]}...")
        
        # Step 1: Mark as processing
        if self.update_status(order_id, "processing"):
            print("✓ Marked as processing")
        else:
            print("✗ Failed to mark as processing")
            return False
        
        # Step 2: Pack and prepare (your logic here)
        print("✓ Order packed and ready")
        
        # Step 3: Create shipping label (your shipping provider API)
        tracking_url = self.create_shipping_label(order_id)
        
        # Step 4: Mark as dispatched with tracking
        if self.update_status(order_id, "dispatched", tracking_url):
            print(f"✓ Marked as dispatched with tracking: {tracking_url}")
            return True
        else:
            print("✗ Failed to mark as dispatched")
            return False
    
    def create_shipping_label(self, order_id):
        """Create shipping label (mock implementation)"""
        # Integrate with your shipping provider API
        # Return tracking URL
        return "https://delhivery.com/track/AWB123456"

# Usage
fulfillment = OrderFulfillment("tb-a1b2-c3d-e4f5")
fulfillment.fulfill_order("770e8400-e29b-41d4-a716-446655440789")

Webhook-Triggered Status Update

from flask import Flask, request
import requests

app = Flask(__name__)

@app.route('/webhook/orders', methods=['POST'])
def handle_new_order():
    """
    Receive webhook notification and automatically mark as processing
    """
    data = request.get_json()
    
    if data.get('event') != 'order.created':
        return '', 400
    
    order_id = data.get('order_id')
    
    # Automatically mark new orders as processing
    url = f"https://api.tribemade.in/api/orders/{order_id}/status"
    headers = {
        "X-API-Key": "tb-a1b2-c3d-e4f5",
        "Content-Type": "application/json"
    }
    data = {"status": "processing"}
    
    response = requests.put(url, headers=headers, json=data)
    
    if response.status_code == 200:
        print(f"✓ Order {order_id[:8]}... marked as processing")
    
    return '', 200

app.run(port=5000)

Bulk Status Update

import requests
import time

def bulk_update_status(order_ids, status, tracking_urls=None):
    """
    Update status for multiple orders
    
    order_ids: List of order IDs
    status: New status
    tracking_urls: Dict mapping order_id to tracking_url (optional)
    """
    base_url = "https://api.tribemade.in/api/orders"
    headers = {
        "X-API-Key": "tb-a1b2-c3d-e4f5",
        "Content-Type": "application/json"
    }
    
    results = {"success": [], "failed": []}
    
    for order_id in order_ids:
        url = f"{base_url}/{order_id}/status"
        data = {"status": status}
        
        # Add tracking URL if provided
        if tracking_urls and order_id in tracking_urls:
            data["tracking_url"] = tracking_urls[order_id]
        
        try:
            response = requests.put(url, headers=headers, json=data)
            
            if response.status_code == 200:
                results["success"].append(order_id)
                print(f"✓ Updated {order_id[:8]}... to {status}")
            else:
                results["failed"].append(order_id)
                error = response.json().get('error', 'Unknown error')
                print(f"✗ Failed {order_id[:8]}...: {error}")
        
        except Exception as e:
            results["failed"].append(order_id)
            print(f"✗ Error {order_id[:8]}...: {str(e)}")
        
        # Respect rate limit (20 req/min)
        time.sleep(3)
    
    print(f"\n✓ Success: {len(results['success'])}")
    print(f"✗ Failed: {len(results['failed'])}")
    
    return results

# Usage - Mark multiple orders as dispatched
order_ids = ["770e8400-...", "880e8400-...", "990e8400-..."]
tracking_urls = {
    "770e8400-...": "https://delhivery.com/track/AWB111",
    "880e8400-...": "https://delhivery.com/track/AWB222",
    "990e8400-...": "https://delhivery.com/track/AWB333"
}

bulk_update_status(order_ids, "dispatched", tracking_urls)

Integration with Shipping Provider

import requests

def ship_order_with_delhivery(order_id):
    """
    Complete workflow: Get order → Create shipment → Update status
    """
    api_key = "tb-a1b2-c3d-e4f5"
    base_url = "https://api.tribemade.in/api/orders"
    
    # Step 1: Get order details
    get_url = f"{base_url}/{order_id}"
    headers = {"X-API-Key": api_key}
    
    response = requests.get(get_url, headers=headers)
    if response.status_code != 200:
        print("Failed to fetch order")
        return False
    
    order = response.json()
    customer = order['customer']
    
    # Step 2: Create Delhivery shipment (mock)
    # In reality, you'd call Delhivery API here
    delhivery_data = {
        "order_id": order['id'],
        "customer_name": customer['name'],
        "phone": customer['number'],
        "address": customer['full_address'],
        "pincode": customer['pincode']
    }
    
    # Mock response
    tracking_awb = "AWB123456789"
    tracking_url = f"https://delhivery.com/track/{tracking_awb}"
    print(f"✓ Created Delhivery shipment: {tracking_awb}")
    
    # Step 3: Update order status with tracking
    update_url = f"{base_url}/{order_id}/status"
    headers["Content-Type"] = "application/json"
    
    data = {
        "status": "dispatched",
        "tracking_url": tracking_url
    }
    
    response = requests.put(update_url, headers=headers, json=data)
    
    if response.status_code == 200:
        print(f"✓ Order marked as dispatched with tracking")
        print(f"  Tracking: {tracking_url}")
        return True
    else:
        print("✗ Failed to update order status")
        return False

# Usage
ship_order_with_delhivery("770e8400-e29b-41d4-a716-446655440789")

Best Practices

Follow the natural order of statuses:✅ Good flow:
started → processing → dispatched → delivered
❌ Don’t skip steps:
started → delivered  (skip processing and dispatched)
For dispatched status, always provide tracking URL:✅ Good:
{
    "status": "dispatched",
    "tracking_url": "https://delhivery.com/track/AWB123"
}
❌ Bad:
{
    "status": "dispatched"
    # Missing tracking_url - customer can't track shipment
}
Update orders at each stage:
  • Mark processing within 24 hours of order
  • Mark dispatched same day as shipping
  • Mark delivered based on courier confirmation
Timely updates improve customer satisfaction.
Remember that delivered and cancelled are final:
  • Cannot be changed after setting
  • Double-check before marking as delivered
  • Ensure refunds are processed before cancelling
Add retry logic for failed updates:
def update_with_retry(order_id, status, max_retries=3):
    for attempt in range(max_retries):
        try:
            response = update_order_status(order_id, status)
            if response.status_code == 200:
                return True
            time.sleep(2 ** attempt)  # Exponential backoff
        except Exception as e:
            if attempt == max_retries - 1:
                raise
    return False

Typical Order Timeline

  • Day 0: Order placed → started
  • Day 0-1: Preparation begins → processing
  • Day 1-2: Shipped out → dispatched (with tracking)
  • Day 4-7: Customer receives → delivered

Next Steps