GpkeysBot Reseller & Customer API Overview
The GpkeysBot Customer API (/api/v1) gives resellers, automation scripts, and server-side storefronts programmatic access to digital product catalogs, real-time account balances, instant balance-backed purchases, order delivery payloads, and immutable ledger history.
How API Keys Work with Your Account
Every API key in GpkeysBot is cryptographically bound to one owning user account:
- Shared Account Balance: Purchases and paid actions made with an API key draw directly from the owning user's USDT balance (
balances.available). - Pre-Execution Enforcement: Every
/api/v1/*request verifies that the key is active, not revoked or expired, that the owning user isACTIVE, that rate limits and fraud checks pass, and that the user's balance state is valid before running the handler. - Atomic Purchases & HTTP 402: Paid actions (
POST /api/v1/purchases,POST /api/v1/actions) serialize concurrent transactions with PostgreSQL row-level locking (SELECT ... FOR UPDATE). If funds are insufficient, the API rejects the request with402 Payment Required(INSUFFICIENT_BALANCE), rolls back any changes, and deducts nothing. - Strict Tenant Isolation: An API key can never access another user's balance, orders, downloads, API keys, or ledger transactions.
Core Concepts
| Concept | Description | Primary Endpoint |
|---|---|---|
| API Key | Bearer/header credential (gpk_live_...) tied to one user, optionally constrained by perRequestCap, monthlySpendCap, and expiresAt. | GET /api/v1/key |
| Balance | Owning user's fixed-point 6-decimal USDT balance ("48.500000"). Always transmitted as a string—never parse as binary float for billing logic. | GET /api/v1/balance |
| Products | Active digital goods (LICENSE_KEY, ACCOUNT, FILE, LINK, TEXT, COURSE, MANUAL) with server-authoritative pricing and stock counts. | GET /api/v1/catalog/products |
| Purchases | Idempotent balance debits creating DELIVERED orders with digital payloads or download pointers. Requires a caller-supplied idempotencyKey. | POST /api/v1/purchases |
| Ledger | Append-only financial record capturing userId, apiKeyId, requestType, signed amount, timestamp, and balanceAfter. | GET /api/v1/ledger |
Base URLs
- Web Portal & Docs: Configured via
DOCS_SITE_URLin.env(supports/and/api/paths) - Production API Host:
https://api.example.complaceholder (configured viaAPI_PUBLIC_URLin.env;TODO(verify)confirm production host) - Local Documentation Mock:
http://localhost:4010(included in this repository viapnpm mock)
Next Steps
- Follow the 5-Minute Quickstart to make your first authenticated call and purchase.
- Explore schemas live in the Interactive API Reference.
- Copy tested integration prompts for your stack in Build with AI for Resellers.