Quick start
Base address for every request:
https://pluggafrica.com/api/v1
Send your key in the Authorization header on every request:
Authorization: Bearer plg_live_your_key_here
Buy a WhatsApp number from the USA
# 1. Buy the number curl -X POST https://pluggafrica.com/api/v1/orders \ -H "Authorization: Bearer $PLUGG_KEY" \ -H "Content-Type: application/json" \ -d '{"service":"whatsapp","country":"usa"}' # 2. Check it every 5 seconds until "code" is filled in curl https://pluggafrica.com/api/v1/orders/ORDER_ID \ -H "Authorization: Bearer $PLUGG_KEY" # 3. No code? Cancel and get your money back curl -X POST https://pluggafrica.com/api/v1/orders/ORDER_ID/cancel \ -H "Authorization: Bearer $PLUGG_KEY"
const API = "https://pluggafrica.com/api/v1"; const H = { Authorization: "Bearer " + process.env.PLUGG_KEY, "Content-Type": "application/json" }; const buy = await (await fetch(API + "/orders", { method: "POST", headers: H, body: JSON.stringify({ service: "whatsapp", country: "usa" }), })).json(); if (!buy.ok) throw new Error(buy.error.message); console.log("Number:", buy.order.phone); // check every 5 seconds for up to 15 minutes for (let i = 0; i < 180; i++) { await new Promise(r => setTimeout(r, 5000)); const o = await (await fetch(API + "/orders/" + buy.order.id, { headers: H })).json(); if (o.order.code) { console.log("Code:", o.order.code); break; } if (o.order.status !== "waiting") break; }
import os, time, requests API = "https://pluggafrica.com/api/v1" H = {"Authorization": "Bearer " + os.environ["PLUGG_KEY"]} buy = requests.post(API + "/orders", headers=H, json={"service": "whatsapp", "country": "usa"}).json() if not buy["ok"]: raise SystemExit(buy["error"]["message"]) print("Number:", buy["order"]["phone"]) for _ in range(180): # up to 15 minutes time.sleep(5) o = requests.get(API + "/orders/" + buy["order"]["id"], headers=H).json()["order"] if o["code"]: print("Code:", o["code"]); break if o["status"] != "waiting": break
$api = "https://pluggafrica.com/api/v1"; $h = ["Authorization: Bearer " . getenv("PLUGG_KEY"), "Content-Type: application/json"]; $ch = curl_init($api . "/orders"); curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_HTTPHEADER => $h, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode(["service" => "whatsapp", "country" => "usa"])]); $buy = json_decode(curl_exec($ch), true); echo "Number: " . $buy["order"]["phone"]; // then GET $api/orders/{id} every 5 seconds until ["order"]["code"] is set
Endpoints
| Request | What it does |
|---|---|
GET/balance | Your Plugg wallet balance in naira. |
GET/countries | Every country, with the slug to use (for example usa, england). |
GET/services?country=usa | Services in a country with the starting price and stock. |
GET/operators?country=usa&service=whatsapp | Each operator with price, stock and success rate. One is marked recommended. |
POST/orders | Buy a number. Body: {"service":"whatsapp","country":"usa","operator":"any"}. operator is optional. Paid from your wallet. |
GET/orders/{id} | Order status and the code once it arrives. Check every 5 to 10 seconds. |
POST/orders/{id}/cancel | Cancel an order that has no code yet. The money goes back to your wallet. |
GET/orders | Your last 50 orders. |
Example answer from POST /orders
{
"ok": true,
"order": { "id": "912345678", "phone": "+12543410365", "service": "whatsapp",
"country": "usa", "price_ngn": 5800, "status": "waiting", "code": null },
"balance_ngn": 9200
}
Order status is one of waiting, received, refunded or cancelled. A number stays open for about 15 minutes. If no code arrives in that time, the money goes back to your wallet by itself.
Errors
Every error looks like {"ok":false,"error":{"code":"...","message":"..."}}. The message is safe to show to your own customers.
| HTTP | code | Meaning |
|---|---|---|
| 401 | invalid_key | Missing, wrong or revoked key. |
| 402 | insufficient_balance | Not enough in your wallet. needed_ngn tells you the price. |
| 409 | out_of_stock | No number available right now. Nothing was charged. |
| 409 | code_received | You tried to cancel an order that already has a code. |
| 429 | rate_limited | Slow down. Limits: 60 requests and 10 purchases per minute per account. |
| 503 | restocking | Numbers are restocking for a few minutes. Nothing was charged. |
Questions
How much do numbers cost through the API?
The same as on pluggafrica.com. Check /operators for the live price before you buy. You can resell at any price you like.
What happens if the code never comes?
Cancel the order, or let it expire after about 15 minutes. Either way the full price goes back to your Plugg wallet.
Is it safe to put my key in a website or app?
No. Keep the key on your server or in your bot's settings, never in a web page or mobile app that customers can open. Anyone with your key can spend your wallet balance. If a key leaks, revoke it here and create a new one.
Can I use this for a Telegram or WhatsApp bot?
Yes. That is the most common use. Your bot calls the API, shows the number to your customer and sends them the code when it arrives.
Are there rules?
Numbers are for receiving one verification code. Follow the terms of the apps you verify, and do not use numbers for fraud or spam. Accounts that abuse the API are switched off.