DDigiKeyHub DEVELOPERSAPI REFERENCE 1.0Download OpenAPI
BUILD WITH DIGIKEYHUB

Your storefront.
Our digital inventory.

Connect your bot, website, or shop to DigiKeyHub. Browse products, purchase with your prepaid wallet, and deliver orders through one server-side API.

BASE URLhttps://digikeyhub.com/api/customer
↔One shared wallet

Use the same balance and purchase pricing as the Telegram bot.

↻Safe request retries

Reuse an idempotency key to retrieve the original purchase.

⌘Account-scoped access

Your key can retrieve only your account and your own orders.

01 / GET CONNECTED

From bot to first request

  1. Create your API key

    Open @DigikeyhubBOT in a private chat. Choose API → Create API key. Opening the API menu alone does not create a key. Save the secret when it appears; it cannot be displayed again.

  2. Fund your wallet

    Use the bot's Wallet menu. Your integration spends this same balance. API prices match bot checkout prices; any reseller discount is assigned by the shop.

  3. Check your account

    Set KPS_API_KEY as a secret environment variable on your server, then send the request below.

cURL · first request
curl 'https://digikeyhub.com/api/customer/me' \
  -H "Authorization: Bearer $KPS_API_KEY"
200 OKapplication/json
{
  "user": {
    "id": "YOUR_ACCOUNT_ID",
    "walletBalance": "50"
  }
}

Authentication

Include your key in the Authorization header on every API request. All examples use HTTPS and JSON. The documentation and OpenAPI file are public; account and purchase endpoints require authentication.

Authorization: Bearer kps_YOUR_SECRET_KEY
Content-Type: application/json
Your key can spend your balance.

Keep it on your server. Never put it in a browser bundle, URL, screenshot, public repository, or application log. This documentation does not collect or store API keys.

Access requires an active account, an active key, account API permission, and the shop's API service to be enabled. Key creation in the bot enables API access for your own account without granting administrative permissions.

Pricing & balance

All amounts are USDT decimal strings with up to six decimal places. Use decimal arithmetic in your integration. The API and bot share your wallet and purchase-pricing rules.

  • GET /products returns your unit price for quantity one.
  • Quantity promotions and an optional coupon are applied when an order is purchased. The order's totalAmount is the final amount charged.
  • The server calculates prices. Do not send a price, discount, wallet balance, or another account ID in an order request.
  • Only prepaid wallet payment is supported. Zero or negative purchase totals are rejected.

A product listing is not a stock reservation. Availability and product limits are checked again during checkout.

GET/me

Get your account

Retrieve your account ID and current wallet balance.

GET https://digikeyhub.com/api/customer/me
Authorization: Bearer YOUR_API_KEY

Returns { "user": { "id": "…", "walletBalance": "50" } } with status 200. This endpoint does not top up or modify your balance.

GET/products

List products

Retrieve active, unarchived products and your account's unit prices. Names, descriptions, and input prompts are English strings only. Read description directly, not description.VI or description.EN. Language selection is not supported. All prices and balances use USDT.

200 OKExample product
{
  "products": [{
    "id": "PRODUCT_ID",
    "name": "Example license",
    "description": "Digital license delivery",
    "currency": "USDT",
    "unitPrice": "5",
    "minQuantity": 1,
    "maxQuantity": 10,
    "fulfillmentMode": "AUTOMATIC",
    "inputPrompt": ""
  }]
}

fulfillmentMode is AUTOMATIC or MANUAL. Manual products require customerInput. Products with an inputPrompt also require the requested activation information.

POST/orders

Create an order

Purchase a product with your wallet. Generate a unique Idempotency-Key for each intended purchase, and persist it before submitting the request.

FieldTypeRules
productId requiredstringProduct ID returned by the catalog; up to 64 letters, digits, underscores or hyphens.
quantityintegerDefaults to 1. Must satisfy the product's min/max limits and the request limit of 10,000.
paymentProviderstringOnly WALLET is accepted; it is also the default.
customerInputstringRequired for manual/activation products; 1–4,000 characters after trimming.
couponCodestringOptional valid product coupon; 1–64 letters, digits, underscores or hyphens.

Additional fields are rejected. The API does not accept client-supplied prices or account IDs.

cURL · create a purchase
# Set REQUEST_ID once for this purchase. Keep it for every retry.
curl --request POST 'https://digikeyhub.com/api/customer/orders' \
  -H "Authorization: Bearer $KPS_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $REQUEST_ID" \
  --data '{"productId":"PRODUCT_ID","quantity":1,"paymentProvider":"WALLET"}'
201 CreatedNew order or successful replay
{
  "order": {
    "id": "ORDER_ID",
    "publicId": "PRODUCT-12345678",
    "productId": "PRODUCT_ID",
    "quantity": 1,
    "unitPrice": "5",
    "totalAmount": "5",
    "currency": "USDT",
    "status": "COMPLETED",
    "deliveryPayload": ["EXAMPLE_LICENSE_ONLY"],
    "createdAt": "2026-10-29T00:00:00.000Z",
    "deliveredAt": "2026-10-29T00:00:01.000Z",
    "refundedAt": null
  }
}
A successful request can still be processing.

Check order.status. Only a COMPLETED order contains delivery information. For manual or pending fulfillment, retrieve the same order later.

GET/orders

List your orders

Returns { "orders": [ … ] } with your latest 50 orders, newest first. Each entry has the same public order fields as the create-order response. The list includes orders from your account's bot purchases as well as API purchases.

No pagination or filter parameters are currently supported. Use the individual order endpoint for an older order whose ID you have retained.

GET/orders/{orderId}

Retrieve an order

Use either the internal id or public publicId returned at checkout. The response is { "order": { … } }. Missing orders and orders belonging to another account both return 404.

curl 'https://digikeyhub.com/api/customer/orders/ORDER_ID' \
  -H "Authorization: Bearer $KPS_API_KEY"

Delivery information is exposed only when status is COMPLETED. deliveryPayload may be an array, object, or string depending on the product; preserve its structure rather than assuming a fixed credential format.

Retries without duplicate purchases

An idempotency key identifies one intended purchase. It must contain 16–128 ASCII letters, digits, underscores, or hyphens. A UUID is suitable.

Persist request + key→Submit purchase→Save returned order ID
  • On a timeout, lost connection, or server error, retry the same body with the same key.
  • A successful replay returns the original order with 201, without another charge or allocation.
  • Changing the body while reusing a key returns 409 IDEMPOTENCY_CONFLICT.
  • Keys are scoped to your account and remain associated with their orders, including across API-key replacement.
  • A new idempotency key represents a new purchase. Do not generate one just because a response was lost.

After an uncertain response, check the existing order if you have its ID. Otherwise, resubmit the original request and key. An upstream delay does not mean the purchase failed.

Order lifecycle

StatusMeaningIntegration action
PAIDPayment is recorded; fulfillment has not finished.Retrieve the same order later.
PROCESSINGManual work or supplier confirmation is pending.Poll with backoff; do not purchase again.
COMPLETEDThe order is fulfilled.Read deliveryPayload and deliver to your customer securely.
REFUNDEDThe order has been refunded according to shop handling.Check your wallet; contact support if needed.
FAILED / CANCELLEDFulfillment did not complete or the order was cancelled.Do not assume a refund; check account/order state.
PENDING_PAYMENTA bot order is awaiting payment.Complete or manage payment in the bot.

Start polling after a few seconds and increase the interval if the order remains pending. Webhooks and reseller cancellation/refund endpoints are not currently available. A supplier timeout requires reconciliation by the shop, not an automatic replacement purchase.

Server-side code examples

These examples require KPS_API_KEY and a persisted PURCHASE_REQUEST_ID in the server environment. Set PRODUCT_ID to a real catalog ID. Running the purchase code spends wallet funds.

// Node.js 18+. Reuse the SAME request ID and body after a timeout.
const key = process.env.KPS_API_KEY;
const requestId = process.env.PURCHASE_REQUEST_ID;
const productId = process.env.PRODUCT_ID;
if (!key || !requestId || !productId) throw new Error('Missing configuration');

const response = await fetch('https://digikeyhub.com/api/customer/orders', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${key}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': requestId
  },
  body: JSON.stringify({ productId, quantity: 1, paymentProvider: 'WALLET' }),
  signal: AbortSignal.timeout(20000)
});
const result = await response.json();
if (!response.ok) throw new Error(result.code || result.error || 'Request failed');
// Store result.order.id and result.order.status in your database.
// Do not log deliveryPayload or API keys.

Errors & rate limits

Error responses contain error, and may also contain a machine-readable code or field-validation details. Check the HTTP status first; do not assume every error has a code.

{
  "error": "INSUFFICIENT_WALLET_BALANCE",
  "code": "INSUFFICIENT_WALLET_BALANCE"
}
HTTPMeaning / common codesWhat to do
400Invalid request, IDEMPOTENCY_KEY_REQUIRED, MANUAL_INPUT_REQUIRED, INVALID_QUANTITY, INVALID_ORDER_AMOUNT, invalid/expired couponCorrect the input. If changing an already-created purchase request, use a new intended-purchase ID.
401Missing, invalid, or revoked keyCheck the Bearer header or replace your key in the bot.
403ACCOUNT_NOT_AUTHORIZEDCheck account/API access with the shop.
404Order unavailable to your accountCheck the order ID and account.
409IDEMPOTENCY_CONFLICT, INSUFFICIENT_WALLET_BALANCE, PRODUCT_NOT_AVAILABLE, DISCOUNT_CODE_LIMIT_REACHEDRead the error. Never retry a changed purchase with an already-used key.
429RATE_LIMIT_EXCEEDEDWait for the Retry-After number of seconds; retain the original purchase key.
500INTERNAL_ERRORThe outcome can be uncertain. Check the order or retry the same body and key.
503API_DISABLEDThe shop has temporarily disabled the API. Retry later.

The application limit is 120 requests per minute per account and connection IP, per backend instance. Shared proxies may share the connection limit. Poll conservatively and respect any additional edge limits. Rate-limit responses include Retry-After.

Keep your integration secure

  • Use HTTPS with certificate verification enabled.
  • Keep API keys in a server-side secret store. Never send a key to an unofficial URL.
  • Protect delivered keys and account credentials in your own storage and logs.
  • Revoke or replace exposed keys in the bot. Replacement invalidates all existing keys for your account.
  • Persist purchase IDs and idempotency keys, and retain an auditable mapping to your customer orders.
  • Do not resell an item twice or automatically return already-exposed credentials to your stock after a refund.

Authenticated responses are marked Cache-Control: no-store. The API never provides another account's orders or raw supplier responses.

Frequently asked questions

Does opening the API menu create a key?

No. Only pressing Create API key in a private bot chat creates a key and enables your account's API access.

Can I recover my API key?

No. The secret is displayed once. Use Replace API key and update your integration. Creation/replacement has a 60-second cooldown. Revocation remains available immediately.

Is there a separate reseller wallet or automatic discount?

No. You use the bot wallet and checkout prices. The shop can assign an account or product discount manually.

Can I create keys from my website without Telegram?

There is no public unauthenticated key-creation endpoint. Customers create, replace, and revoke their keys through the private bot.

How do I handle manual products?

Collect the requested activation information and send it as customerInput. The paid order remains PROCESSING until fulfillment is completed. Poll the existing order instead of submitting another purchase.

Can I test without purchasing?

Use GET /me and GET /products to verify access. There is no separate sandbox endpoint. POST /orders is a real wallet purchase.