Get Order Details
curl --request GET \
--url https://api.example.com/api/orders/{order_id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.example.com/api/orders/{order_id}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://api.example.com/api/orders/{order_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/orders/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/orders/{order_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/orders/{order_id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/orders/{order_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_at": "<string>",
"product_id": "<string>",
"product_name": "<string>",
"product_image": "<string>",
"status": "<string>",
"customer": {
"name": "<string>",
"email": "<string>",
"number": "<string>",
"full_address": {
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>"
},
"pincode": "<string>"
},
"order_details": {
"quantity": 123,
"amount": 123,
"variation": {},
"size": {},
"color": {},
"special_instructions": {},
"custom_questions": [
{}
]
},
"rating": {},
"review": {},
"tracking_url": {}
}Order APIs
Get Order Details
Retrieve complete details of an order
GET
/
api
/
orders
/
{order_id}
Get Order Details
curl --request GET \
--url https://api.example.com/api/orders/{order_id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.example.com/api/orders/{order_id}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://api.example.com/api/orders/{order_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/orders/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/orders/{order_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/orders/{order_id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/orders/{order_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_at": "<string>",
"product_id": "<string>",
"product_name": "<string>",
"product_image": "<string>",
"status": "<string>",
"customer": {
"name": "<string>",
"email": "<string>",
"number": "<string>",
"full_address": {
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>"
},
"pincode": "<string>"
},
"order_details": {
"quantity": 123,
"amount": 123,
"variation": {},
"size": {},
"color": {},
"special_instructions": {},
"custom_questions": [
{}
]
},
"rating": {},
"review": {},
"tracking_url": {}
}Overview
Retrieve complete details of an order including customer information, order status, product details, and more. Use this endpoint to fetch order data for processing, analytics, or integration with other systems.Rate Limit: 50 requests per minute
Endpoint
GET https://api.tribemade.in/api/orders/{order_id}
Path Parameters
string
required
UUID of the order to retrieve
Authentication
string
required
Your TribeMade API key (format:
tb-xxxx-xxx-xxxx)Response Fields
Always Present
string
Order unique identifier (UUID)
string
Order creation timestamp (ISO 8601 format, UTC)
string
Associated product UUID
string
Product name at time of order
string
Product main image URL
string
Current order status:
started, processing, dispatched, cancelled, or deliveredobject
Customer information object
object
Order details object
Show properties
Show properties
integer
Quantity ordered
number
Total amount paid in INR
string | null
Selected product variation (null if not applicable)
string | null
Selected size (null if not applicable)
string | null
Selected color (null if not applicable)
string | null
Customer instructions (null if none provided)
array
Answers to custom questions (empty array if none)
Conditional Fields
number | null
Customer rating (1-5) if provided, null otherwise
string | null
Customer review text if provided, null otherwise
string | null
Shipment tracking URL if available, null otherwise
Order Status Values
| Status | Description | When Used |
|---|---|---|
started | Payment received, order created | Initial state after successful payment |
processing | Order being prepared/packed | When you start preparing the order |
dispatched | Order shipped to customer | When handed over to courier |
delivered | Order delivered successfully | When customer receives order |
cancelled | Order cancelled | When order is cancelled |
Examples
Basic Request
curl https://api.tribemade.in/api/orders/770e8400-e29b-41d4-a716-446655440789 \
-H "X-API-Key: tb-a1b2-c3d-e4f5"
import requests
order_id = "770e8400-e29b-41d4-a716-446655440789"
url = f"https://api.tribemade.in/api/orders/{order_id}"
headers = {
"X-API-Key": "tb-a1b2-c3d-e4f5"
}
response = requests.get(url, headers=headers)
order = response.json()
print(order)
const fetch = require('node-fetch');
const orderId = '770e8400-e29b-41d4-a716-446655440789';
const url = `https://api.tribemade.in/api/orders/${orderId}`;
const headers = {
'X-API-Key': 'tb-a1b2-c3d-e4f5'
};
fetch(url, { headers })
.then(response => response.json())
.then(order => console.log(order));
<?php
$order_id = '770e8400-e29b-41d4-a716-446655440789';
$url = "https://api.tribemade.in/api/orders/{$order_id}";
$headers = array(
'X-API-Key: tb-a1b2-c3d-e4f5'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$order = json_decode($response, true);
print_r($order);
?>
Success Response
{
"id": "770e8400-e29b-41d4-a716-446655440789",
"created_at": "2024-11-16T10:30:00.000000Z",
"product_id": "660e8400-e29b-41d4-a716-446655440123",
"product_name": "Premium Cotton T-Shirt",
"product_image": "https://cdn.example.com/products/tshirt-main.jpg",
"status": "dispatched",
"customer": {
"name": "Rahul Sharma",
"email": "rahul.sharma@example.com",
"number": "9876543210",
"full_address": {
"line1": "123, MG Road",
"line2": "Apartment 4B",
"city": "Mumbai",
"state": "Maharashtra",
"country": "India"
},
"pincode": "400001"
},
"order_details": {
"variation": "Slim Fit",
"size": "L",
"color": "Navy Blue",
"quantity": 2,
"amount": 2048,
"special_instructions": "Please gift wrap",
"custom_questions": []
},
"rating": 4.5,
"review": "Excellent quality and fit!",
"tracking_url": "https://delhivery.com/track/DLVY123456"
}
Error Responses
404 Not Found
{
"error": "Order not found"
}
403 Forbidden
{
"error": "Order does not belong to this store"
}
401 Unauthorized
{
"error": "Missing API key"
}
{
"error": "Invalid API key"
}
429 Too Many Requests
{
"error": "Rate limit exceeded",
"retry_after": 60
}
Common Use Cases
Process New Orders
Fetch order details when you receive a webhook notification:import requests
def process_order(order_id):
"""
Fetch and process order details
"""
url = f"https://api.tribemade.in/api/orders/{order_id}"
headers = {"X-API-Key": "tb-a1b2-c3d-e4f5"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
order = response.json()
# Extract key information
customer = order['customer']
order_details = order['order_details']
print(f"Order ID: {order['id']}")
print(f"Customer: {customer['name']}")
print(f"Email: {customer['email']}")
print(f"Phone: {customer['number']}")
print(f"Address: {customer['full_address']['line1']}, {customer['full_address']['city']}")
print(f"Product: {order['product_name']}")
print(f"Quantity: {order_details['quantity']}")
print(f"Amount: ₹{order_details['amount']}")
if order_details['size']:
print(f"Size: {order_details['size']}")
if order_details['color']:
print(f"Color: {order_details['color']}")
return order
else:
print(f"Error: {response.json()['error']}")
return None
# Usage (typically called from webhook handler)
order = process_order("770e8400-e29b-41d4-a716-446655440789")
Generate Packing Slip
Create a packing slip with order information:import requests
from datetime import datetime
def generate_packing_slip(order_id):
"""
Generate packing slip for order
"""
url = f"https://api.tribemade.in/api/orders/{order_id}"
headers = {"X-API-Key": "tb-a1b2-c3d-e4f5"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
order = response.json()
# Format packing slip
slip = f"""
═══════════════════════════════════════
PACKING SLIP
═══════════════════════════════════════
Order ID: {order['id'][:8]}...
Date: {datetime.fromisoformat(order['created_at'].replace('Z', '+00:00')).strftime('%B %d, %Y')}
CUSTOMER DETAILS:
────────────────────────────────────────
Name: {order['customer']['name']}
Phone: {order['customer']['number']}
Email: {order['customer']['email']}
DELIVERY ADDRESS:
────────────────────────────────────────
{order['customer']['full_address']['line1']}
{order['customer']['full_address'].get('line2', '')}
{order['customer']['full_address']['city']}, {order['customer']['full_address']['state']}
PIN: {order['customer']['pincode']}
{order['customer']['full_address']['country']}
ORDER DETAILS:
────────────────────────────────────────
Product: {order['product_name']}
Quantity: {order['order_details']['quantity']}
"""
if order['order_details']['size']:
slip += f"Size: {order['order_details']['size']}\n "
if order['order_details']['color']:
slip += f"Color: {order['order_details']['color']}\n "
if order['order_details']['variation']:
slip += f"Variation: {order['order_details']['variation']}\n "
if order['order_details']['special_instructions']:
slip += f"""
SPECIAL INSTRUCTIONS:
────────────────────────────────────────
{order['order_details']['special_instructions']}
"""
slip += f"""
────────────────────────────────────────
Amount Paid: ₹{order['order_details']['amount']}
═══════════════════════════════════════
"""
print(slip)
return slip
return None
# Usage
generate_packing_slip("770e8400-e29b-41d4-a716-446655440789")
Integrate with Shipping Provider
Automatically create shipping labels:import requests
def create_shipping_label(order_id):
"""
Fetch order and create shipping label with courier API
"""
# Get order details
url = f"https://api.tribemade.in/api/orders/{order_id}"
headers = {"X-API-Key": "tb-a1b2-c3d-e4f5"}
response = requests.get(url, headers=headers)
if response.status_code != 200:
print(f"Error fetching order: {response.json()['error']}")
return None
order = response.json()
customer = order['customer']
address = customer['full_address']
# Prepare shipping data
shipping_data = {
"order_id": order['id'],
"customer_name": customer['name'],
"customer_phone": customer['number'],
"address": {
"line1": address['line1'],
"line2": address.get('line2', ''),
"city": address['city'],
"state": address['state'],
"country": address['country'],
"pincode": customer['pincode']
},
"product_name": order['product_name'],
"quantity": order['order_details']['quantity'],
"amount": order['order_details']['amount']
}
# Call your shipping provider API
# shipping_label = create_delhivery_shipment(shipping_data)
# tracking_url = shipping_label['tracking_url']
# For demo:
print(f"Created shipping label for order {order['id'][:8]}...")
print(f"Shipping to: {customer['name']}, {address['city']}")
return shipping_data
# Usage
create_shipping_label("770e8400-e29b-41d4-a716-446655440789")
Export Orders for Analytics
Fetch multiple orders for reporting:import requests
import csv
from datetime import datetime
def export_orders_to_csv(order_ids, filename="orders_export.csv"):
"""
Export multiple orders to CSV for analysis
"""
url_base = "https://api.tribemade.in/api/orders"
headers = {"X-API-Key": "tb-a1b2-c3d-e4f5"}
orders_data = []
for order_id in order_ids:
url = f"{url_base}/{order_id}"
response = requests.get(url, headers=headers)
if response.status_code == 200:
order = response.json()
orders_data.append({
"Order ID": order['id'][:13],
"Date": datetime.fromisoformat(order['created_at'].replace('Z', '+00:00')).strftime('%Y-%m-%d'),
"Customer": order['customer']['name'],
"City": order['customer']['full_address']['city'],
"State": order['customer']['full_address']['state'],
"Product": order['product_name'],
"Quantity": order['order_details']['quantity'],
"Amount": order['order_details']['amount'],
"Status": order['status'],
"Rating": order.get('rating', 'N/A')
})
# Write to CSV
if orders_data:
with open(filename, 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=orders_data[0].keys())
writer.writeheader()
writer.writerows(orders_data)
print(f"✓ Exported {len(orders_data)} orders to {filename}")
return filename
return None
# Usage
order_ids = ["770e8400-...", "880e8400-...", "990e8400-..."]
export_orders_to_csv(order_ids)
Best Practices
Use webhooks instead of polling
Use webhooks instead of polling
Instead of repeatedly calling this endpoint to check for new orders, use webhooks to receive real-time notifications:❌ Bad: Polling for new orders✅ Good: Webhook notifications
while True:
check_for_new_orders() # Wastes API calls
time.sleep(60)
@app.route('/webhook', methods=['POST'])
def handle_order():
order_data = request.json
order_id = order_data['order_id']
process_order(order_id) # Fetch full details only when needed
return '', 200
Cache order data
Cache order data
Store order data locally to reduce API calls:
- Cache orders after first fetch
- Only re-fetch if data might have changed (status update)
- Use order ID as cache key
Handle errors gracefully
Handle errors gracefully
Always check for errors:
response = requests.get(url, headers=headers)
if response.status_code == 200:
order = response.json()
# Process order
elif response.status_code == 404:
print("Order not found")
elif response.status_code == 403:
print("Order doesn't belong to your store")
else:
print(f"Error: {response.status_code}")
Check for null values
Check for null values
Some fields may be null - always check before using:
order = response.json()
# These fields may be null
if order['order_details']['size']:
print(f"Size: {order['order_details']['size']}")
if order.get('tracking_url'):
print(f"Track: {order['tracking_url']}")
if order.get('rating'):
print(f"Rating: {order['rating']}/5")
Next Steps
Update Order Status
Update order status and add tracking information
Webhooks
Receive real-time order notifications
Product APIs
Manage your product catalog
Rate Limits
Understand API rate limits
⌘I

