Skip to main content

Quickstart (Under 5 Minutes)

Go from zero to verifying your account balance and placing your first idempotent purchase.

Step 1: Create an API Key​

Generate an API key from your GpkeysBot account interface (see API Key Management for limits, spend caps, and key rotation rules).

Save your key immediately

The full secret (gpk_live_...) is displayed only once at creation time. The server stores only an HMAC-SHA256 digest and cannot recover a lost key.

Step 2: Store the Key in Your Environment​

Never commit credentials to Git or embed them in client-side JavaScript.

export GPKEYS_API_KEY="YOUR_API_KEY"
export GPKEYS_BASE_URL="https://api.example.com" # Replace with your confirmed API URL or http://localhost:4010 for the local mock

Step 3: Verify Authentication & Balance​

Send a GET request to /api/v1/balance using the x-api-key header:

curl -sS -X GET "${GPKEYS_BASE_URL}/api/v1/balance" \
-H "x-api-key: ${GPKEYS_API_KEY}" \
-H "Accept: application/json"

Example 200 OK response:

{
"userId": "usr_mock_01",
"apiKeyId": "key_mock_01",
"currency": "USDT",
"available": "100.000000",
"limits": {
"monthlySpendCap": "250.000000",
"perRequestCap": "50.000000",
"expiresAt": null
}
}

Step 4: Browse Products & Check Price​

Fetch active catalog items to retrieve the authoritative id, priceUsdt, and availableUnits:

curl -sS -X GET "${GPKEYS_BASE_URL}/api/v1/catalog/products?limit=5" \
-H "x-api-key: ${GPKEYS_API_KEY}"

Step 5: Make Your First Idempotent Purchase​

Include a unique idempotencyKey (8–128 characters) so network retries never charge twice:

curl -sS -X POST "${GPKEYS_BASE_URL}/api/v1/purchases" \
-H "x-api-key: ${GPKEYS_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"productId": "prod_win11_pro",
"quantity": 1,
"idempotencyKey": "quickstart-order-0001"
}'
  • Returns 201 Created (created: true) on initial fulfillment, with delivered license keys/accounts/instructions inside order.items.
  • Retrying with the same idempotencyKey returns 200 OK (created: false) with the exact same order without deducting balance again.
  • Insufficient funds return 402 Payment Required (INSUFFICIENT_BALANCE).

Continue to Authentication or test endpoints interactively in the API Reference.