Buying KVs with Credits Through the API

List products, spend credits, and stream kv.bin without a browser

Unshared.shop / Blog / Buying KVs with Credits Through the API
Cyanokit September 16, 2026 13 min read API Documentation

Checkout without the dashboard UI

If you already hold store credits, you can list digital KV products, spend credits, and pull the file entirely through https://api.unshared.shop/api/. Physical items still need the website — purchase rejects anything that is not type = digital.

Token required. Send X-API-Token from My Profile. Regenerating the token invalidates the previous one immediately.

1) See what you can buy

GET /api/?action=products

Public. Each row has name (this is what you send as product_name), id, live price, credit_cost (sale-aware; if the catalog has no credit override it is ceil(sale_price * 10)), is_kv, and stock.

2) Spend credits

POST /api/?action=purchase
Content-Type: application/x-www-form-urlencoded
X-API-Token: YOUR_TOKEN

product_name=1key&product_id=39&discount_code=OPTIONAL

Success looks like:

{
  "success": true,
  "transaction_id": "…",
  "product_name": "1key",
  "credits_spent": 60,
  "credits_remaining": 120,
  "download_token": "base64-file-location",
  "is_kv": true
}

Optional product_id must match the row for that name or the API returns Product mismatch. Discount codes use the same rules as the shop (percent off credits). Purchase bonus credits are not applied to credit checkouts — those bonuses are for PayPal and card payments only. If sell-time KV validation opens a replacement ticket, extra ticket fields are included on the JSON.

3) List existing files

GET /api/?action=downloads
GET /api/?action=downloads&include_deleted=true

Each digital purchase includes download_token and a relative download_url such as /api/?action=download&token=…&txn=…. is_kv is inferred from the product name (kv / keyvault / 1key / …).

4) Take the file

Redirect (default):

GET /api/?action=download&token={download_token}&txn={transaction_id}

JSON {"success":true,"redirect":"https://dl.unshared.shop/kv.bin?id=…&dl=true"} or an HTTP redirect to that URL. dl=true is a direct attachment and uses one link credit.

Stream through the API:

GET /api/?action=download&stream=1&token=…&txn=…&extract=1

The response is application/octet-stream. With extract=1 (default) a ZIP is unpacked to a single 16 KB kv.bin. Pass extract=0 to keep the original archive for 2-key / 3-key packs. Headers include X-Unshared-Txn and X-Unshared-Product.

PHP snippet

stream=1 returns the file body (application/octet-stream), not JSON. Save it with curl or your HTTP client’s raw download helper:

curl -H "X-API-Token: YOUR_TOKEN" -OJ \
  "https://api.unshared.shop/api/?action=download&stream=1&token=TOKEN&txn=TXN"

Wrappers: PHP, C#, Python.