How to Use an SMM Panel API: PHP and Python Code Examples

How to Use an SMM Panel API: PHP and Python Code Examples

If you run your own panel, a website or an agency dashboard, placing every order by hand soon becomes slow. An SMM panel API fixes that. It lets your system place orders, check their status and request refills automatically, while you focus on customers.



This guide explains how the API works in simple words, lists every action you'll use, and gives ready-to-use code in PHP and Python.

Quick answer
  • ✓Every request is a POST to one API URL with your API key and an action.
  • ✓The main actions are services, add, status, refill and balance.
  • ✓Replies come back as JSON, so any language can read them.
  • ✓Keep your key secret and check for errors in every reply.

What Is an SMM Panel API?

An API is a way for two systems to talk to each other. With an SMM panel API, your website or panel sends a request such as "order 1,000 likes for this link", and the provider's panel replies with an order ID. Later, your system asks for the status and shows it to your customer.

Resellers use it to connect their own panel to a provider. Agencies use it to manage many client orders from one place.

Before You Start

Get your API key

Log in to your account and copy your API key from the account or API page. Treat it like a password: anyone with your key can place orders using your balance.

Note the API URL

All requests go to one address. On BestSMMPanelIndia it is shown on our API documentation page, along with every parameter.

Add some balance

Orders placed through the API are paid from your wallet, just like orders placed in the dashboard.

The Main API Actions

You send an action value to tell the API what you want. These are the ones you'll use most:

ActionWhat it doesMain parametersYou get back
servicesLists all services and ratesNoneService ID, name, rate, min, max, refill
addPlaces a new orderservice, link, quantityOrder ID
statusChecks one orderorderStatus, charge, start count, remains
statusChecks up to 100 orders at onceorders (comma-separated)Status for each order
refillRequests a refillorderRefill ID
refill_statusChecks a refillrefillRefill status
balanceShows your wallet balanceNoneBalance and currency

For drip-feed orders, add runs and interval (in minutes) to the add action. Our guide to drip feed in an SMM panel explains how to choose them.

Code Examples

Both examples read the API key from an environment variable called SMM_API_KEY, so it never sits inside your code.

PHP example

<?php
define('SMM_API_URL', 'https://bestsmmpanelindia.com/api/v2');
define('SMM_API_KEY', getenv('SMM_API_KEY'));

function smmRequest(array $data)
{
    $data['key'] = SMM_API_KEY;

    $ch = curl_init(SMM_API_URL);
    curl_setopt_array($ch, [
        CURLOPT_POST           => true,
        CURLOPT_POSTFIELDS     => http_build_query($data),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 30,
    ]);
    $response = curl_exec($ch);

    if ($response === false) {
        $error = curl_error($ch);
        curl_close($ch);
        throw new Exception('Connection error: ' . $error);
    }
    curl_close($ch);

    $result = json_decode($response, true);
    if (!is_array($result)) {
        throw new Exception('Unexpected reply: ' . $response);
    }
    if (isset($result['error'])) {
        throw new Exception('API error: ' . $result['error']);
    }
    return $result;
}

// Place an order
$order = smmRequest([
    'action'   => 'add',
    'service'  => 1,
    'link'     => 'https://www.instagram.com/yourpage/',
    'quantity' => 1000,
]);
echo 'Order ID: ' . $order['order'] . PHP_EOL;

// Check its status
$status = smmRequest(['action' => 'status', 'order' => $order['order']]);
echo $status['status'] . ' | remaining: ' . $status['remains'] . PHP_EOL;

Python example

import os
import requests

API_URL = "https://bestsmmpanelindia.com/api/v2"
API_KEY = os.environ["SMM_API_KEY"]


def smm_request(**params):
    params["key"] = API_KEY
    response = requests.post(API_URL, data=params, timeout=30)
    response.raise_for_status()
    result = response.json()
    if isinstance(result, dict) and "error" in result:
        raise RuntimeError(f"API error: {result['error']}")
    return result


# Place an order
order = smm_request(
    action="add",
    service=1,
    link="https://www.instagram.com/yourpage/",
    quantity=1000,
)
print("Order ID:", order["order"])

# Check its status
status = smm_request(action="status", order=order["order"])
print(status["status"], "| remaining:", status["remains"])

What the replies look like

A new order returns its ID:

{"order": 23501}

A status check returns the progress:

{"charge": "27.50", "start_count": "1200", "status": "In progress", "remains": "450", "currency": "INR"}

If something is wrong, you get an error instead:

{"error": "Not enough funds on balance"}

Order Status Meanings

StatusWhat it meansWhat to do
PendingThe order is waiting to startCheck again in a few minutes
ProcessingThe order has been accepted and is being preparedNothing yet
In progressDelivery has startedShow progress using "remains"
CompletedThe full quantity was deliveredMark the order done
PartialOnly part was delivered; the rest is refunded to your balanceRefund your customer for the "remains"
CanceledThe order couldn't run and was refundedTell your customer and check the link

Best Practices for a Smooth Integration

  • Keep your key on the server. Never put it in website JavaScript or share it in screenshots.
  • Sync the service list daily. Rates and service IDs can change, so refresh them before showing prices to customers.
  • Check your balance before big orders. It avoids failed orders and unhappy customers.
  • Don't check status every second. Every few minutes is enough, and use the multiple-order check for up to 100 orders at once.
  • Be careful with retries. If an "add" request times out, check your orders before sending it again, or you may place the same order twice.
  • Log every request and reply. It makes support questions much faster to solve.

Frequently Asked Questions

Which programming languages can I use?

Any language that can send a POST request and read JSON, including PHP, Python, Node.js and Java.

Is the API free to use?

Yes. There's no extra fee for the API. You only pay for the orders you place, at the same rates as the dashboard.

Can I connect the API to my own SMM panel?

Yes. Most panel scripts have a "providers" section where you paste the API URL and key, then import the services you want to sell.

What should I do if I see an error?

Read the error message first. Most errors are a wrong service ID, a private or wrong link, a quantity below the minimum, or low balance. If it still doesn't work, contact support with the request you sent.


Ready to grow your social media presence?

Join 50,000+ happy customers. India's cheapest SMM panel — from just ₹1 per 1000.

100% safe — no password needed Instant automated delivery 24/7 Free refill on eligible services UPI, Paytm & PhonePe accepted
Create Free Account