Why Automate With API?
Manual order placement: Place 100 orders per day = 2 hours of work. Automated with API: Place 100 orders = 30 seconds of code.
If you're handling 50+ orders/day, API integration is mandatory.
Getting Your API Key
1. Log into SH SMM Panel dashboard 2. Settings → API Keys 3. Create new key 4. Copy (treat like password, keep secret)
JavaScript Example
```javascript const API_KEY = 'your_api_key'; const BASE_URL = 'https://api.shsmmpanel.com';
async function placeOrder(reelUrl, targetViews) { const response = await fetch(`${BASE_URL}/api/orders/create`, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ reel_url: reelUrl, target_views: targetViews, delivery_curve: 'organic', panel_id: 'panel_1' }) });
const data = await response.json(); return data; }
// Usage placeOrder('https://instagram.com/reel/ABC123/', 10000) .then(order => console.log('Order placed:', order.id)); ```
Python Example
```python import requests
API_KEY = 'your_api_key' BASE_URL = 'https://api.shsmmpanel.com'
def place_order(reel_url, target_views): headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' }
payload = { 'reel_url': reel_url, 'target_views': target_views, 'delivery_curve': 'organic', 'panel_id': 'panel_1' }
response = requests.post( f'{BASE_URL}/api/orders/create', headers=headers, json=payload )
return response.json()
# Usage order = place_order('https://instagram.com/reel/ABC123/', 10000) print(f'Order placed: {order["id"]}') ```
Batch Orders
Don't place orders one at a time. Batch them:
```javascript async function placeMultipleOrders(orders) { const response = await fetch(`${BASE_URL}/api/orders/bulk`, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ orders: orders // Array of order objects }) });
return response.json(); }
// Place 50 orders in one request const orders = Array.from({length: 50}, (_, i) => ({ reel_url: `https://instagram.com/reel/${i}/`, target_views: 10000, delivery_curve: 'organic' }));
placeMultipleOrders(orders) .then(result => console.log(`Placed ${result.count} orders`)); ```
Error Handling
Always handle errors:
```javascript async function placeOrderSafely(reelUrl, targetViews) { try { const response = await fetch(`${BASE_URL}/api/orders/create`, { // ... request config });
if (!response.ok) { throw new Error(`API error: ${response.status}`); }
const data = await response.json();
if (!data.success) { throw new Error(data.error); }
return data.data; } catch (error) { console.error('Order failed:', error.message); // Handle error (log, retry, notify user, etc) } } ```
Check Order Status
Monitor delivery in real-time:
```javascript async function checkOrderStatus(orderId) { const response = await fetch( `${BASE_URL}/api/orders/${orderId}`, { headers: { 'Authorization': `Bearer ${API_KEY}` } } );
const order = await response.json(); console.log(`Status: ${order.status}`); console.log(`Views delivered: ${order.views_delivered}/${order.target_views}`); } ```
Webhooks for Real-Time Updates
Don't poll. Use webhooks:
```javascript // In your Express app app.post('/webhook/shsmm', (req, res) => { const event = req.body;
if (event.event === 'order.completed') { console.log(`Order ${event.order_id} completed!`); // Update your database // Notify customer // Process payment }
res.json({success: true}); }); ```
Best Practices
1. **Never hardcode API keys** - Use environment variables 2. **Batch orders** - Don't place 100 orders with 100 API calls 3. **Cache panel list** - Don't fetch panels on every order 4. **Use webhooks** - Don't poll for status updates 5. **Set retry logic** - Network failures happen 6. **Log everything** - Track all API calls for debugging
Start with these basics and you'll save hours per week of manual work!