Reseller Automation API Documentation
Integrate instant wholesale Microsoft license key delivery and automated Phone Activation Confirmation ID (GetCID) generation directly into your WooCommerce, Shopify, WHMCS, or custom store.
1. Environments: Sandbox Test Mode vs. Live Production
Every ResellKeys customer account receives two independent API keypairs inside My Account → Reseller API at zero monthly cost. Both modes share the exact same https://resellkeys.com/api/v1 endpoints.
rk_test_...
- Pre-loaded with $500.00 Sandbox Store Credit & 50 Sandbox CID Points (resettable anytime).
- Never deducts real Store Credit or live license stock.
- Returns realistic simulated keys (
TEST-XXXXX-...-SANDBOX) & Sandbox Order IDs (9xxxxx). - Supports
"simulate_status": "processing" | "canceled" | "refunded"onPOST /ordersto test webhooks end-to-end.
rk_live_...
- Deducts from your live Store Credit (
wallet_balance) or CID Points (cid_points). - Allocates genuine license keys synchronously (
"status": "complete") whenever vault stock is ready. - Supports optional Server IP Whitelisting (single IPv4/IPv6 or CIDR blocks such as
203.0.113.0/24). - All Live API orders & CID generations appear in your ResellKeys account dashboard & monthly statements.
2. Authentication & Request Signing
All requests must be sent over HTTPS with Accept: application/json (and Content-Type: application/json for POST requests). Default rate limit: 60 requests / minute per account.
Your API Secret never travels over the network. Compute lowercase hex HMAC-SHA256(timestamp + "." + raw_body, api_secret). For GET requests with an empty body, sign "<timestamp>." (keep the trailing dot). Timestamp must be within ±300s (5 minutes) of current UTC epoch seconds.
X-RK-Api-Key: rk_test_YOUR_API_KEY X-RK-Timestamp: 1762345678 X-RK-Signature: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
Ideal for quick server-to-server scripts, WooCommerce hooks, or no-code HTTP modules over TLS/HTTPS. Combine with Allowed Server IPs in Live mode for defense-in-depth:
X-RK-Api-Key: rk_test_YOUR_API_KEY X-RK-Api-Secret: YOUR_API_SECRET # Or standard HTTP Authorization header: Authorization: Bearer rk_test_YOUR_API_KEY:YOUR_API_SECRET
3. Endpoints Reference
All paths below are relative to https://resellkeys.com/api/v1.
GET /api/v1/account returns your active Store Credit (wallet_balance in USD) and cid_points balance. Use GET /api/v1/account/transactions?page=1&per_page=20 (optional &order_id=120855) to reconcile wallet debits, top-ups, and refund credits.
{
"success": true,
"mode": "live",
"account": {
"customer_id": 1024,
"name": "Alex Morgan",
"email": "[email protected]",
"currency": "USD",
"wallet_balance": 245.50,
"cid_points": 120,
"sandbox_balances": { "wallet_balance": 500.00, "cid_points": 50 },
"live_balances": { "wallet_balance": 245.50, "cid_points": 120 }
},
"timestamp": 1762345678
}
Returns active products with USD wholesale price, in_stock, instant_delivery (true when pre-loaded vault keys are ready for 1-second synchronous delivery in POST /orders), activation_type ("online" | "phone" | "account"), quantity limits, warranty days, optional 30-day extended warranty pricing (+20%), and free cid_points_reward.
{
"success": true,
"mode": "live",
"count": 1,
"products": [
{
"product_id": 430,
"name": "Windows 10 / 11 Pro 1PC [Retail Online]",
"price": 2.09,
"currency": "USD",
"in_stock": true,
"instant_delivery": true,
"activation_type": "online",
"minimum_quantity": 1,
"max_quantity": 200,
"reset_hours": 0,
"warranty_days": 7,
"extended_warranty_available": true,
"extended_warranty_days": 30,
"extended_warranty_price": 2.51,
"cid_points_reward": 0
}
],
"timestamp": 1762345680
}
- Single or Multi-Item: Pass
product_id+quantityfor a single product, oritems: [{"product_id": 430, "quantity": 2}, ...](up to 25 line items / 500 keys per order). - Idempotency (
client_reference_idorX-Idempotency-Keyheader): Always pass your own store's unique order ID. Retrying after a network timeout returns the existing order ("idempotent_replay": true) and never double-charges. - Synchronous vs. Queued Fulfillment: Returns
"status": "complete"with all license keys immediately insidekeys[]anditems[].keys[]when vault stock is available. If an item is fulfilled by our team (~10–15 mins in business hours), returns"status": "processing"("keys": []) and dispatches a signedorder.completedwebhook the moment keys are allocated. - Strict Instant-Only Mode (
"instant_only": true): Optional boolean. If synchronous vault stock cannot fill the full quantity immediately, returns409 insufficient_instant_stock($0.00charged) instead of queuing. - Sandbox Lifecycle Simulation: When using
rk_test_..., pass"simulate_status": "complete" | "processing" | "canceled" | "refunded"to test every status & webhook flow.
{
"product_id": 430,
"quantity": 2,
"extended_warranty": false,
"instant_only": false,
"client_reference_id": "MYSTORE-ORD-10045",
"webhook_url": "https://yourstore.com/webhooks/resellkeys"
}
200 OK):{
"success": true,
"mode": "live",
"idempotent_replay": false,
"order_id": 120855,
"client_reference_id": "MYSTORE-ORD-10045",
"status": "complete",
"status_label": "Complete",
"refunded_to_store_credit": false,
"currency": "USD",
"total": 4.18,
"cid_points_earned": 0,
"items": [
{
"product_id": 430,
"product_name": "Windows 10 / 11 Pro 1PC [Retail Online]",
"quantity": 2,
"unit_price": 2.09,
"total": 4.18,
"extended_warranty": false,
"warranty_days": 7,
"cid_points_earned": 0,
"keys": [
"XXXXX-XXXXX-XXXXX-XXXXX-11111",
"XXXXX-XXXXX-XXXXX-XXXXX-22222"
]
}
],
"keys": [
"XXXXX-XXXXX-XXXXX-XXXXX-11111",
"XXXXX-XXXXX-XXXXX-XXXXX-22222"
],
"balances": {
"wallet_balance": 241.32,
"cid_points": 120
},
"created_at": "2026-11-25T11:30:00+05:30",
"timestamp": 1762345685
}
GET /api/v1/orders/{order_id} returns the exact same JSON structure as POST /api/v1/orders (works for both Live orders and Sandbox 9xxxxx orders).
GET /api/v1/orders supports query filters ?client_reference_id=MYSTORE-ORD-10045, ?status=complete|processing|canceled|refunded, ?page=1, and ?per_page=20 (max 100).
Re-dispatches the signed webhook for an existing Sandbox or Live order without creating a duplicate order or charging credit. In Sandbox mode (rk_test_...), pass optional JSON {"event": "order.completed" | "order.canceled" | "order.refunded", "webhook_url": "https://..."}. Use POST /api/v1/webhooks/test to send a sample signed order.completed ping (order_id: 900001) to verify your webhook endpoint responds with HTTP 2xx.
Converts a 54-digit (9×6) or 63-digit (9×7) Microsoft Installation ID (iid, dashes or spaces allowed) into an 8-block Confirmation ID (A–H). Deducts 1 CID Point only when a valid CID is issued; re-querying a previously solved IID returns "cached": true with 0 points deducted.
{
"iid": "0049526-6362165-1715532-0847640-7500912-1046725-5459370-7151290-6278081"
}
200 OK):{
"success": true,
"mode": "live",
"iid": "004952663621651715532084764075009121046725545937071512906278081",
"cid": "111111-222222-333333-444444-555555-666666-777777-888888",
"blocks": {
"A": "111111", "B": "222222", "C": "333333", "D": "444444",
"E": "555555", "F": "666666", "G": "777777", "H": "888888"
},
"cached": false,
"points_deducted": 1,
"cid_points_remaining": 119,
"timestamp": 1762345700
}
4. Outbound Webhooks & HMAC Verification
When a processing order finishes key allocation (or if an unfulfilled processing order is canceled/refunded back to Store Credit), ResellKeys sends a signed POST callback to your configured webhook_url.
order.canceled
order.refunded
sha256=<hex_hmac>
order.completed):{
"event_id": "evt_120855_a1b2c3d4e5f6",
"event": "order.completed",
"mode": "live",
"order_id": 120855,
"client_reference_id": "MYSTORE-ORD-10045",
"status": "complete",
"currency": "USD",
"total": 4.18,
"items": [
{
"product_id": 430,
"product_name": "Windows 10 / 11 Pro 1PC [Retail Online]",
"quantity": 2,
"unit_price": 2.09,
"total": 4.18,
"keys": [
"XXXXX-XXXXX-XXXXX-XXXXX-11111",
"XXXXX-XXXXX-XXXXX-XXXXX-22222"
]
}
],
"keys": [
"XXXXX-XXXXX-XXXXX-XXXXX-11111",
"XXXXX-XXXXX-XXXXX-XXXXX-22222"
],
"timestamp": 1762345690
}
<?php
$webhookSecret = getenv('RK_WEBHOOK_SECRET'); // whsec_...
$rawBody = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_RK_WEBHOOK_TIMESTAMP'] ?? '';
$signatureHdr = $_SERVER['HTTP_X_RK_WEBHOOK_SIGNATURE'] ?? '';
if (!ctype_digit($timestamp) || abs(time() - (int) $timestamp) > 300) {
http_response_code(401);
exit('Stale timestamp');
}
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $rawBody, $webhookSecret);
if (!hash_equals($expected, $signatureHdr)) {
http_response_code(401);
exit('Invalid signature');
}
$event = json_decode($rawBody, true);
// Deduplicate by $event['event_id'] or $event['order_id'], then deliver $event['keys']
http_response_code(200);
echo 'OK';
5. HTTP Status & Error Codes
Errors return {"success": false, "error": {"code": "...", "message": "..."}, "timestamp": ...}.
| HTTP | Error Code (error.code) |
Description & Recommended Handling |
|---|---|---|
| 401 | invalid_credentials / invalid_signature / timestamp_expired | Verify X-RK-Api-Key, HMAC string {timestamp}.{rawBody}, and server NTP clock sync (±300s). |
| 402 | insufficient_store_credit / insufficient_cid_points | Top up Store Credit / CID Points (or click Reset Sandbox in Test Mode). |
| 403 | api_disabled / ip_not_whitelisted | Enable API access or add your production server IP/CIDR under My Account → Reseller API. |
| 404 | product_not_found / order_not_found | Check the product_id in the reference table below or verify order_id. |
| 409 | product_unavailable / insufficient_instant_stock | Product out of stock, or instant_only: true exceeded synchronous vault keys ($0.00 charged). |
| 422 | invalid_items / purchase_limit_exceeded / invalid_installation_id | Check quantity bounds (minimum_quantity..max_quantity) or 54/63-digit IID format. |
| 429 | rate_limit_exceeded | Exceeded 60 requests/min per account. Back off for a few seconds and retry with the same client_reference_id. |
6. Ready-to-Run Integration Examples
HMAC-SHA256 signed helper functions with zero external dependencies.
<?php
$apiKey = getenv('RK_API_KEY'); // rk_test_... or rk_live_...
$apiSecret = getenv('RK_API_SECRET'); // Your API Secret
function callResellKeysApi(string $method, string $path, array $payload = [], string $apiKey = '', string $apiSecret = ''): array {
$url = 'https://resellkeys.com/api/v1' . $path;
$timestamp = (string) time();
$rawBody = empty($payload) ? '' : json_encode($payload, JSON_UNESCAPED_SLASHES);
$signature = hash_hmac('sha256', $timestamp . '.' . $rawBody, $apiSecret);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 25,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
'X-RK-Api-Key: ' . $apiKey,
'X-RK-Timestamp: ' . $timestamp,
'X-RK-Signature: ' . $signature,
],
]);
if ($rawBody !== '') {
curl_setopt($ch, CURLOPT_POSTFIELDS, $rawBody);
}
$response = curl_exec($ch);
curl_close($ch);
return json_decode((string) $response, true) ?: [];
}
// 1. Order a license key (idempotent via client_reference_id)
$order = callResellKeysApi('POST', '/orders', [
'product_id' => 430,
'quantity' => 1,
'client_reference_id' => 'WC-ORDER-9001',
], $apiKey, $apiSecret);
// 2. Generate a Microsoft Phone Activation Confirmation ID (GetCID)
$cid = callResellKeysApi('POST', '/cid/generate', [
'iid' => '0049526-6362165-1715532-0847640-7500912-1046725-5459370-7151290-6278081',
], $apiKey, $apiSecret);
7. API Product ID Catalog (product_id Reference)
Live reference of all 202 active products to map exact product_id variations in your store. Always query GET /api/v1/products for live stock before ordering.