Reseller API
Sell Crapplet VPS, hosting and servers on your own website under your own brand. Your site calls this API; orders are paid from your Crapplet wallet at your wholesale price; we set the service up and tell your site when it's ready.
Everything is JSON over HTTPS. Your customers never see Crapplet — they buy from you, and you manage their services through this API or your reseller dashboard.
Quick start
- Open your reseller dashboard → API tab → Create API key. Copy the key (it starts with
ck_) — it's shown once. - List the plans you can sell and their wholesale prices:
curl -H "Authorization: Bearer ck_YOUR_KEY" \ https://crapplet.co.in/api/v1/reseller/plans - Place an order when your customer pays you:
curl -X POST -H "Authorization: Bearer ck_YOUR_KEY" -H "Content-Type: application/json" \ -d '{"planId":"PLAN_ID","cycle":"MONTHLY","hostname":"vps1.customer.com","osTemplateId":"OS_ID","reference":"ORDER-1001"}' \ https://crapplet.co.in/api/v1/reseller/orders - Set a webhook to hear when the server is ready, or poll
GET /services/{id}untilstatusisACTIVE, then give your customer the IP and login.
Authentication
Send your API key as a Bearer token on every request:
Authorization: Bearer ck_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Keys are created and revoked in your reseller dashboard. A key only ever sees your customers, services and invoices.
- Keep keys on your server. Never put a key in browser JavaScript or a mobile app — anyone could read it.
- When creating a key you can limit it to your web server's IP addresses; requests from anywhere else are refused.
- A missing, wrong or revoked key gets
401.
Amounts, errors and limits
Money
All amounts are integers in paise (₹1 = 100). 45000 means ₹450.00. Prices are before GST; invoices show the GST added.
Billing cycles
MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL, BIENNIAL, TRIENNIAL — only the cycles a plan lists in prices can be ordered.
Errors
Errors return a non-2xx status and a JSON body:
{ "error": "Plan not found — list plans with GET /plans", "code": "NOT_FOUND" }
| Status | Meaning |
|---|---|
400 | Invalid request. Validation errors include details with the field problems. |
401 | No key, a wrong key, or a revoked key. |
402 | INSUFFICIENT_FUNDS — your wallet can't cover it. Top up, then pay the invoice. |
403 | Your reseller account isn't approved (or is suspended). |
404 | Not found — or not yours. |
409 | Conflict, e.g. that domain already has a hosting account. |
429 | RATE_LIMITED — more than 300 requests a minute on one key. Wait for the time in the RateLimit-Reset header. |
5xx | Our side. Safe to retry orders when you send a reference (see below). |
Selling on your website — the full flow
- Show plans. Call
GET /plans(cache it for a few minutes). Show your price —wholesaleis what you pay us. - Customer pays you on your website, with your own payment gateway.
- Order from us with
POST /orders, passing your own order number asreference. If your request times out, send it again with the samereference— you'll get the same order back, never a second one. - Wait for setup. The service goes
PROVISIONING→ACTIVE(usually 1–5 minutes for a VPS). Theservice.activewebhook tells you; or pollGET /services/{id}. - Hand over.
GET /services/{id}returns the IP, username and password. Email them to your customer. - Renewals. Before each due date we create a renewal invoice for you. It's paid from your wallet automatically when the balance covers it — keep your wallet topped up. If not, pay it with
POST /invoices/{id}/pay. Unpaid renewals are suspended and later terminated, as for any customer.
Account
/meYour reseller account and wallet balance.
{
"reseller": { "id": "cm…", "brandName": "HostBiz", "status": "APPROVED", "discountPct": 10 },
"wallet": { "balance": 250000, "currency": "INR" }
}
/plansEvery plan you can sell, with your wholesale price per billing cycle.
{
"plans": [
{
"id": "cmplan123",
"name": "Linux VPS G2",
"type": "VPS_LINUX",
"category": "vps", // vps | hosting | other
"requires": ["hostname", "osTemplateId"], // what POST /orders needs for this plan
"specs": { "cpuCores": 2, "ramMb": 4096, "diskGb": 80, "bandwidthGb": 10240, "ipv4": 1, "virtType": "KVM" },
"allowIpSelection": false,
"locations": [ { "serverId": "cmsrv1", "name": "Noida" } ],
"os": [ { "id": "cmos1", "name": "Ubuntu 24.04" }, { "id": "cmos2", "name": "Windows Server 2022" } ],
"prices": [
{ "cycle": "MONTHLY", "retailList": 54900, "wholesale": 44910, "yourRetail": null },
{ "cycle": "ANNUAL", "retailList": 658800, "wholesale": 538920, "yourRetail": null }
]
}
]
}
| Field | Meaning |
|---|---|
wholesale | What you pay us per cycle, after your reseller discount. |
retailList | Our own public price, for reference. |
yourRetail | The retail price you saved in your dashboard (optional, for your records). |
requires | hostname + osTemplateId for VPS, domain for hosting. |
Orders
/ordersOrder any plan. Paid from your wallet; the service is set up as soon as it's paid.
| Field | Type | Description |
|---|---|---|
planIdrequired | string | From GET /plans. |
cycle | string | Default MONTHLY. |
hostname | string | VPS hostname, e.g. vps1.customer.com. Required for VPS. |
domain | string | The website domain for hosting plans, e.g. customer.com. Required for hosting. |
osTemplateId | string | Operating system from the plan's os list. Required for VPS. |
serverId | string | Location from the plan's locations (optional). |
ipId | string | A specific IP from GET /ips — only for plans with allowIpSelection. |
customerId | string | Your end customer from POST /customers (optional, for your records). |
retailAmount | integer | What you charge your customer, in paise (optional, for your reports). |
reference | string | Your own order number. Strongly recommended: repeating a request with the same reference returns the original order instead of creating another. The Idempotency-Key header works the same way. |
curl -X POST https://crapplet.co.in/api/v1/reseller/orders \
-H "Authorization: Bearer ck_YOUR_KEY" -H "Content-Type: application/json" \
-d '{
"planId": "cmplan123",
"cycle": "MONTHLY",
"hostname": "vps1.customer.com",
"osTemplateId": "cmos1",
"reference": "ORDER-1001",
"retailAmount": 79900
}'<?php
$ch = curl_init('https://crapplet.co.in/api/v1/reseller/orders');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('CRAPPLET_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'planId' => 'cmplan123', 'cycle' => 'MONTHLY',
'hostname' => 'vps1.customer.com', 'osTemplateId' => 'cmos1',
'reference' => 'ORDER-' . $orderId, // your order number — makes retries safe
]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status === 402) { /* top up your wallet, then POST /invoices/{$body['invoiceId']}/pay */ }
$serviceId = $body['serviceId'];const r = await fetch("https://crapplet.co.in/api/v1/reseller/orders", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.CRAPPLET_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ planId: "cmplan123", cycle: "MONTHLY", hostname: "vps1.customer.com", osTemplateId: "cmos1", reference: `ORDER-${orderId}` }),
});
const body = await r.json();
if (r.status === 402) { /* top up, then POST /invoices/${body.invoiceId}/pay */ }
const { serviceId } = body;Responses
201 — paid and being set up:
{ "serviceId": "cmsvc1", "orderId": "cmord1", "invoiceId": "cminv1", "amount": 44910, "paid": true, "status": "PROVISIONING" }
200 — the same reference was ordered before (nothing new is created):
{ "serviceId": "cmsvc1", "invoiceId": "cminv1", "status": "ACTIVE", "duplicate": true }
402 — your wallet is short. The order and invoice exist but nothing is set up until it's paid:
{ "serviceId": "cmsvc1", "orderId": "cmord1", "invoiceId": "cminv1", "amount": 44910, "paid": false, "status": "PENDING",
"error": "Insufficient wallet balance — top up, then POST /invoices/{invoiceId}/pay", "code": "INSUFFICIENT_FUNDS" }
Services
/services?status=ACTIVE&reference=ORDER-1001&page=1&limit=50Your services, newest first. All filters are optional: status, reference, customerId, page, limit (max 200).
{
"services": [
{ "id": "cmsvc1", "reference": "ORDER-1001", "plan": "Linux VPS G2", "planId": "cmplan123", "status": "ACTIVE",
"hostname": "vps1.customer.com", "ip": "103.0.0.10", "ips": ["103.0.0.10"], "os": "Ubuntu 24.04",
"customerId": null, "suspendReason": null, "terminationReason": null }
],
"page": 1, "limit": 50, "total": 1
}
/services/{id}One service with its login details, billing and — for a running VPS — live state.
{
"service": {
"id": "cmsvc1", "reference": "ORDER-1001", "plan": "Linux VPS G2", "status": "ACTIVE",
"hostname": "vps1.customer.com", "ip": "103.0.0.10", "ips": ["103.0.0.10"], "os": "Ubuntu 24.04",
"username": "root", "password": "Xy7#…",
"billingCycle": "MONTHLY", "nextDueDate": "2026-12-14T00:00:00.000Z",
"wholesaleAmount": 44910, "retailAmount": 79900, "createdAt": "2026-11-14T12:00:00.000Z",
"live": { "state": "running", "cpuPct": 3.2, "memUsedMb": 612, "memTotalMb": 4096, "diskTotalGb": 80 }
}
}
Administrator, Linux as root. The password changes after reset_password or reinstall — read it again afterwards./services/{id}/actionQueue an action. Returns 202 { "queued": true }; the result shows in GET /services/{id} and as a webhook.
| action | For | Notes |
|---|---|---|
start · stop · shutdown · reboot | VPS | stop is a hard power-off; shutdown asks the OS. |
reinstall | VPS | Pass osTemplateId. Erases the disk. Optional password (10–64 characters, upper case, lower case and a number); otherwise a new one is generated. |
reset_password | VPS, hosting | New root / Administrator / cPanel password. |
suspend · unsuspend | All | Optional reason. Services we suspended for non-payment unsuspend only when the invoice is paid. |
{ "action": "reinstall", "osTemplateId": "cmos2", "password": "N3w-Strong-Pass" }
/services/{id}/loginFor hosting: a one-time link that logs your customer straight into cPanel (or webmail with {"service":"webmaild"}). Valid for 60 seconds — redirect to it immediately.
{ "url": "https://server.example.com:2083/cpsess…/login/?session=…", "expiresInSeconds": 60 }
/services/{id}Cancel or terminate. A service not yet set up is cancelled at once (200 {"ok":true,"status":"CANCELLED"}). A live one is terminated — the server and its data are deleted (202 {"queued":true}, then the service.terminated webhook). It stops renewing.
/ips?productId=PLAN_ID&serverId=&search=Free IPs for plans with allowIpSelection, so your customer can pick one. Hold one for checkout with POST /ips/{ipId}/reserve {"productId":"…"}, then pass it as ipId in the order.
/customersOptional: keep a record of your end customers here and attach services to them with customerId. They are yours — we never email them or let them log in to Crapplet.
{ "email": "asha@customer.com", "firstName": "Asha", "lastName": "Rao", "phone": "+919900000000", "companyName": "Asha Designs", "country": "IN" }
Returns 201 { "customer": { "id": "cmcus1", "email": "asha@customer.com" } }. GET /customers lists them.
Wallet & invoices
/walletBalance and the last 100 wallet movements. Add funds in the client area (Wallet & credit).
{ "balance": 155000, "currency": "INR",
"transactions": [ { "amount": -44910, "balanceAfter": 155000, "description": "Applied to invoice PF-000412", "createdAt": "…" } ] }
/invoices?status=UNPAID&page=1&limit=50Your invoices (orders and renewals). GET /invoices/{id} adds the lines.
{
"invoice": {
"id": "cminv1", "number": "CIPL/2026-27/00042", "status": "PAID", "currency": "INR",
"subtotal": 44910, "tax": 8084, "total": 52994, "amountDue": 0,
"issueDate": "…", "dueDate": "…", "paidAt": "…",
"items": [ { "description": "Linux VPS G2 — vps1.customer.com (14 Nov – 14 Dec 2026)", "quantity": 1, "unitPrice": 44910, "amount": 44910, "serviceId": "cmsvc1" } ]
}
}
/invoices/{id}/payPay an unpaid invoice from your wallet. 200 {"paid":true,"applied":52994}, or 402 if the balance is short. Paying an order's invoice starts the setup; paying an overdue renewal restores a suspended service.
Webhooks
Instead of polling, give us a URL and we POST a signed JSON event to it whenever something changes.
| Event | When |
|---|---|
service.active | A new service is ready (IP and login are in GET /services/{id}). |
service.failed | Setup failed. Our team is alerted and will retry or refund. |
service.suspended | Suspended — by you, by us, or for an overdue renewal (suspendReason). |
service.unsuspended | Running again. |
service.terminated | Terminated; the server is gone (terminationReason). |
service.reinstalled | Reinstall finished — fetch the new password. |
invoice.paid | An order, renewal or top-up invoice was paid. |
What we send
POST https://yourwebsite.com/crapplet-webhook
Content-Type: application/json
X-Crapplet-Event: service.active
X-Crapplet-Timestamp: 1763112345
X-Crapplet-Signature: sha256=5f0c…
{
"id": "evt_9c2f…",
"event": "service.active",
"createdAt": "2026-11-14T12:03:10.000Z",
"data": { "id": "cmsvc1", "reference": "ORDER-1001", "plan": "Linux VPS G2", "status": "ACTIVE",
"hostname": "vps1.customer.com", "ip": "103.0.0.10", "ips": ["103.0.0.10"], "os": "Ubuntu 24.04", … }
}
invoice.paid carries { id, number, total, currency, paidAt, serviceIds }.
Verify every request
Compute HMAC-SHA256 of timestamp + "." + raw body with your signing secret and compare it to the header. Reject requests older than 5 minutes.
<?php
$secret = getenv('CRAPPLET_WEBHOOK_SECRET'); // whsec_…
$body = file_get_contents('php://input'); // the raw body, before json_decode
$ts = $_SERVER['HTTP_X_CRAPPLET_TIMESTAMP'] ?? '';
$sig = $_SERVER['HTTP_X_CRAPPLET_SIGNATURE'] ?? '';
$expect = 'sha256=' . hash_hmac('sha256', $ts . '.' . $body, $secret);
if (!hash_equals($expect, $sig) || abs(time() - (int)$ts) > 300) { http_response_code(400); exit; }
$event = json_decode($body, true);
// ignore events you've already processed: store $event['id']
if ($event['event'] === 'service.active') {
// look up your order by $event['data']['reference'], then fetch login details:
// GET /services/{$event['data']['id']} → email IP + password to your customer
}
http_response_code(200);import crypto from "node:crypto";
import express from "express";
const app = express();
app.post("/crapplet-webhook", express.raw({ type: "application/json" }), (req, res) => {
const ts = req.get("X-Crapplet-Timestamp") ?? "";
const expect = "sha256=" + crypto.createHmac("sha256", process.env.CRAPPLET_WEBHOOK_SECRET).update(`${ts}.${req.body}`).digest("hex");
const sig = req.get("X-Crapplet-Signature") ?? "";
const fresh = Math.abs(Date.now() / 1000 - Number(ts)) < 300;
if (!fresh || sig.length !== expect.length || !crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expect))) return res.sendStatus(400);
const event = JSON.parse(req.body.toString());
// dedupe on event.id, then handle event.event
res.sendStatus(200);
});Delivery
- Reply with any
2xxwithin 10 seconds. Do slow work after replying. - If we don't get a
2xx, we retry twice: after 10 seconds and after a minute. Your dashboard shows the last delivery result. - An event can arrive more than once — use
idto ignore repeats. Webhooks are a signal;GET /services/{id}is always the truth. - The URL must be public
https://.
/webhookSet or change your URL (you can also do this in the dashboard). The response contains a new signing secret, shown once.
{ "url": "https://yourwebsite.com/crapplet-webhook" }
→ { "url": "https://yourwebsite.com/crapplet-webhook", "secret": "whsec_…", "note": "Store this secret now…" }
GET /webhook shows the URL and the last delivery · POST /webhook/test sends a test service.active event (with "test": true) and returns the result · DELETE /webhook stops events.
Status values
| Service status | Meaning |
|---|---|
PENDING | Ordered, waiting for payment (or for our team on a manually set-up plan). |
PROVISIONING | Paid; being set up. |
ACTIVE | Running. |
SUSPENDED | Suspended (see suspendReason). |
FAILED | Setup failed; our team is on it. |
TERMINATED · CANCELLED | Ended (see terminationReason). |
Invoice status: UNPAID, PAID, CANCELLED, REFUNDED.
Older /vps endpoints
Integrations built before /orders keep working: GET /vps, GET /vps/{id}, POST /vps (VPS only), POST /vps/{id}/action, DELETE /vps/{id}. New integrations should use /orders and /services, which cover every product and support reference.
Website
Dashboard